@@ -40,8 +40,7 @@ discard block |
||
| 40 | 40 | $tab = __( 'Edit Entry', 'gravityview' ); |
| 41 | 41 | $context = 'edit'; |
| 42 | 42 | break; |
| 43 | - case ( $gravityview->request->is_entry( $gravityview->view->form ? $gravityview->view->form->ID : 0 ) ): |
|
| 44 | - $tab = __( 'Single Entry', 'gravityview' ); |
|
| 43 | + case ( $gravityview->request->is_entry( $gravityview->view->form ? $gravityview->view->form->ID : 0 ) ) : $tab = __( 'Single Entry', 'gravityview' ); |
|
| 45 | 44 | $context = 'single'; |
| 46 | 45 | break; |
| 47 | 46 | default: |
@@ -61,7 +60,7 @@ discard block |
||
| 61 | 60 | $action_text = sprintf( esc_html__( 'Add fields to %s', 'gravityview' ), $tab ); |
| 62 | 61 | $message = esc_html__( 'You can only see this message because you are able to edit this View.', 'gravityview' ); |
| 63 | 62 | |
| 64 | - $image = sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', $tab, esc_url( plugins_url( sprintf( 'assets/images/tab-%s.png', $context ), GRAVITYVIEW_FILE ) ) ); |
|
| 63 | + $image = sprintf( '<img alt="%s" src="%s" style="margin-top: 10px;" />', $tab, esc_url( plugins_url( sprintf( 'assets/images/tab-%s.png', $context ), GRAVITYVIEW_FILE ) ) ); |
|
| 65 | 64 | $output = sprintf( '<h3>%s <strong><a href="%s">%s</a></strong></h3><p>%s</p>', $title, esc_url( $edit_link ), $action_text, $message ); |
| 66 | 65 | |
| 67 | 66 | echo \GVCommon::generate_notice( $output . $image, 'gv-error error', 'edit_gravityview', $gravityview->view->ID ); |
@@ -41,8 +41,8 @@ discard block |
||
| 41 | 41 | 'detail' => null, |
| 42 | 42 | ) ); |
| 43 | 43 | |
| 44 | - if ( ! $view_id = $atts['id'] ? : $atts['view_id'] ) { |
|
| 45 | - if ( $atts['detail'] && $view = $request->is_view() ) { |
|
| 44 | + if ( ! $view_id = $atts[ 'id' ] ?: $atts[ 'view_id' ] ) { |
|
| 45 | + if ( $atts[ 'detail' ] && $view = $request->is_view() ) { |
|
| 46 | 46 | $view_id = $view->ID; |
| 47 | 47 | } |
| 48 | 48 | } |
@@ -111,12 +111,12 @@ discard block |
||
| 111 | 111 | } |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - $is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap('gravityview_moderate_entries', $view->ID ); |
|
| 114 | + $is_admin_and_can_view = $view->settings->get( 'admin_show_all_statuses' ) && \GVCommon::has_cap( 'gravityview_moderate_entries', $view->ID ); |
|
| 115 | 115 | |
| 116 | 116 | /** |
| 117 | 117 | * View details. |
| 118 | 118 | */ |
| 119 | - if ( $atts['detail'] ) { |
|
| 119 | + if ( $atts[ 'detail' ] ) { |
|
| 120 | 120 | $entries = $view->get_entries( $request ); |
| 121 | 121 | return self::_return( $this->detail( $view, $entries, $atts ) ); |
| 122 | 122 | |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | return self::_return( '' ); |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | - if ( $entry['status'] != 'active' ) { |
|
| 136 | + if ( $entry[ 'status' ] != 'active' ) { |
|
| 137 | 137 | gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) ); |
| 138 | 138 | return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) ); |
| 139 | 139 | } |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) { |
| 147 | - if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
| 147 | + if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
| 148 | 148 | gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) ); |
| 149 | 149 | return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) ); |
| 150 | 150 | } |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | return self::_return( '' ); |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | - if ( $entry['status'] != 'active' ) { |
|
| 167 | + if ( $entry[ 'status' ] != 'active' ) { |
|
| 168 | 168 | gravityview()->log->notice( 'Entry ID #{entry_id} is not active', array( 'entry_id' => $entry->ID ) ); |
| 169 | 169 | return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) ); |
| 170 | 170 | } |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | if ( $view->settings->get( 'show_only_approved' ) && ! $is_admin_and_can_view ) { |
| 178 | - if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
| 178 | + if ( ! \GravityView_Entry_Approval_Status::is_approved( gform_get_meta( $entry->ID, \GravityView_Entry_Approval::meta_key ) ) ) { |
|
| 179 | 179 | gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing', array( 'entry_id' => $entry->ID ) ); |
| 180 | 180 | return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) ); |
| 181 | 181 | } |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | |
| 184 | 184 | $error = \GVCommon::check_entry_display( $entry->as_entry(), $view ); |
| 185 | 185 | |
| 186 | - if( is_wp_error( $error ) ) { |
|
| 186 | + if ( is_wp_error( $error ) ) { |
|
| 187 | 187 | gravityview()->log->error( 'Entry ID #{entry_id} is not approved for viewing: {message}', array( 'entry_id' => $entry->ID, 'message' => $error->get_error_message() ) ); |
| 188 | 188 | return self::_return( __( 'You are not allowed to view this content.', 'gravityview' ) ); |
| 189 | 189 | } |
@@ -199,10 +199,10 @@ discard block |
||
| 199 | 199 | |
| 200 | 200 | // Mock the request with the actual View, not the global one |
| 201 | 201 | $mock_request = new \GV\Mock_Request(); |
| 202 | - $mock_request->returns['is_view'] = $view; |
|
| 203 | - $mock_request->returns['is_entry'] = $request->is_entry( $view->form ? $view->form->ID : 0 ); |
|
| 204 | - $mock_request->returns['is_edit_entry'] = $request->is_edit_entry( $view->form ? $view->form->ID : 0 ); |
|
| 205 | - $mock_request->returns['is_search'] = $request->is_search(); |
|
| 202 | + $mock_request->returns[ 'is_view' ] = $view; |
|
| 203 | + $mock_request->returns[ 'is_entry' ] = $request->is_entry( $view->form ? $view->form->ID : 0 ); |
|
| 204 | + $mock_request->returns[ 'is_edit_entry' ] = $request->is_edit_entry( $view->form ? $view->form->ID : 0 ); |
|
| 205 | + $mock_request->returns[ 'is_search' ] = $request->is_search(); |
|
| 206 | 206 | |
| 207 | 207 | $request = $mock_request; |
| 208 | 208 | } |
@@ -238,16 +238,16 @@ discard block |
||
| 238 | 238 | $filtered_atts = shortcode_atts( $supported_atts, $passed_atts, 'gravityview' ); |
| 239 | 239 | |
| 240 | 240 | // Only keep the passed attributes after making sure that they're valid pairs |
| 241 | - $filtered_atts = array_intersect_key( (array) $passed_atts, $filtered_atts ); |
|
| 241 | + $filtered_atts = array_intersect_key( (array)$passed_atts, $filtered_atts ); |
|
| 242 | 242 | |
| 243 | 243 | $atts = array(); |
| 244 | 244 | |
| 245 | - foreach( $filtered_atts as $key => $passed_value ) { |
|
| 245 | + foreach ( $filtered_atts as $key => $passed_value ) { |
|
| 246 | 246 | |
| 247 | 247 | // Allow using GravityView merge tags in shortcode attributes, like {get} and {created_by} |
| 248 | 248 | $passed_value = \GravityView_Merge_Tags::replace_variables( $passed_value ); |
| 249 | 249 | |
| 250 | - switch( $defaults[ $key ]['type'] ) { |
|
| 250 | + switch ( $defaults[ $key ][ 'type' ] ) { |
|
| 251 | 251 | |
| 252 | 252 | /** |
| 253 | 253 | * Make sure number fields are numeric. |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | * @see http://php.net/manual/en/function.is-numeric.php#107326 |
| 256 | 256 | */ |
| 257 | 257 | case 'number': |
| 258 | - if( is_numeric( $passed_value ) ) { |
|
| 258 | + if ( is_numeric( $passed_value ) ) { |
|
| 259 | 259 | $atts[ $key ] = ( $passed_value + 0 ); |
| 260 | 260 | } |
| 261 | 261 | break; |
@@ -270,8 +270,8 @@ discard block |
||
| 270 | 270 | */ |
| 271 | 271 | case 'select': |
| 272 | 272 | case 'radio': |
| 273 | - $options = isset( $defaults[ $key ]['choices'] ) ? $defaults[ $key ]['choices'] : $defaults[ $key ]['options']; |
|
| 274 | - if( in_array( $passed_value, array_keys( $options ) ) ) { |
|
| 273 | + $options = isset( $defaults[ $key ][ 'choices' ] ) ? $defaults[ $key ][ 'choices' ] : $defaults[ $key ][ 'options' ]; |
|
| 274 | + if ( in_array( $passed_value, array_keys( $options ) ) ) { |
|
| 275 | 275 | $atts[ $key ] = $passed_value; |
| 276 | 276 | } |
| 277 | 277 | break; |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | } |
| 284 | 284 | } |
| 285 | 285 | |
| 286 | - $atts['detail'] = \GV\Utils::get( $passed_atts, 'detail', null ); |
|
| 286 | + $atts[ 'detail' ] = \GV\Utils::get( $passed_atts, 'detail', null ); |
|
| 287 | 287 | |
| 288 | 288 | return $atts; |
| 289 | 289 | } |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | private function detail( $view, $entries, $atts ) { |
| 301 | 301 | $output = ''; |
| 302 | 302 | |
| 303 | - switch ( $key = $atts['detail'] ): |
|
| 303 | + switch ( $key = $atts[ 'detail' ] ): |
|
| 304 | 304 | case 'total_entries': |
| 305 | 305 | $output = number_format_i18n( $entries->total() ); |
| 306 | 306 | break; |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | 'type' => 'radio', |
| 65 | 65 | 'full_width' => true, |
| 66 | 66 | 'label' => esc_html__( 'Search Mode', 'gravityview' ), |
| 67 | - 'desc' => __('Should search results match all search fields, or any?', 'gravityview'), |
|
| 67 | + 'desc' => __( 'Should search results match all search fields, or any?', 'gravityview' ), |
|
| 68 | 68 | 'value' => 'any', |
| 69 | 69 | 'class' => 'hide-if-js', |
| 70 | 70 | 'options' => array( |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | // admin - add scripts - run at 1100 to make sure GravityView_Admin_Views::add_scripts_and_styles() runs first at 999 |
| 88 | 88 | add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ), 1100 ); |
| 89 | - add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts') ); |
|
| 89 | + add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) ); |
|
| 90 | 90 | add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
| 91 | 91 | |
| 92 | 92 | // ajax - get the searchable fields |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | $script_min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
| 225 | 225 | $script_source = empty( $script_min ) ? '/source' : ''; |
| 226 | 226 | |
| 227 | - wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js'.$script_source.'/admin-search-widget'.$script_min.'.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), \GV\Plugin::$version ); |
|
| 227 | + wp_enqueue_script( 'gravityview_searchwidget_admin', plugins_url( 'assets/js' . $script_source . '/admin-search-widget' . $script_min . '.js', __FILE__ ), array( 'jquery', 'gravityview_views_scripts' ), \GV\Plugin::$version ); |
|
| 228 | 228 | |
| 229 | 229 | wp_localize_script( 'gravityview_searchwidget_admin', 'gvSearchVar', array( |
| 230 | 230 | 'nonce' => wp_create_nonce( 'gravityview_ajaxsearchwidget' ), |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | * @return array Scripts allowed in no-conflict mode, plus the search widget script |
| 247 | 247 | */ |
| 248 | 248 | public function register_no_conflict( $allowed ) { |
| 249 | - $allowed[] = 'gravityview_searchwidget_admin'; |
|
| 249 | + $allowed[ ] = 'gravityview_searchwidget_admin'; |
|
| 250 | 250 | return $allowed; |
| 251 | 251 | } |
| 252 | 252 | |
@@ -259,24 +259,24 @@ discard block |
||
| 259 | 259 | */ |
| 260 | 260 | public static function get_searchable_fields() { |
| 261 | 261 | |
| 262 | - if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxsearchwidget' ) ) { |
|
| 262 | + if ( ! isset( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxsearchwidget' ) ) { |
|
| 263 | 263 | exit( '0' ); |
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | $form = ''; |
| 267 | 267 | |
| 268 | 268 | // Fetch the form for the current View |
| 269 | - if ( ! empty( $_POST['view_id'] ) ) { |
|
| 269 | + if ( ! empty( $_POST[ 'view_id' ] ) ) { |
|
| 270 | 270 | |
| 271 | - $form = gravityview_get_form_id( $_POST['view_id'] ); |
|
| 271 | + $form = gravityview_get_form_id( $_POST[ 'view_id' ] ); |
|
| 272 | 272 | |
| 273 | - } elseif ( ! empty( $_POST['formid'] ) ) { |
|
| 273 | + } elseif ( ! empty( $_POST[ 'formid' ] ) ) { |
|
| 274 | 274 | |
| 275 | - $form = (int) $_POST['formid']; |
|
| 275 | + $form = (int)$_POST[ 'formid' ]; |
|
| 276 | 276 | |
| 277 | - } elseif ( ! empty( $_POST['template_id'] ) && class_exists( 'GravityView_Ajax' ) ) { |
|
| 277 | + } elseif ( ! empty( $_POST[ 'template_id' ] ) && class_exists( 'GravityView_Ajax' ) ) { |
|
| 278 | 278 | |
| 279 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
| 279 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
| 280 | 280 | |
| 281 | 281 | } |
| 282 | 282 | |
@@ -325,8 +325,8 @@ discard block |
||
| 325 | 325 | ), |
| 326 | 326 | ); |
| 327 | 327 | |
| 328 | - foreach( $custom_fields as $custom_field_key => $custom_field ) { |
|
| 329 | - $output .= sprintf( '<option value="%s" %s data-inputtypes="%s" data-placeholder="%s">%s</option>', $custom_field_key, selected( $custom_field_key, $current, false ), $custom_field['type'], self::get_field_label( array('field' => $custom_field_key ) ), $custom_field['text'] ); |
|
| 328 | + foreach ( $custom_fields as $custom_field_key => $custom_field ) { |
|
| 329 | + $output .= sprintf( '<option value="%s" %s data-inputtypes="%s" data-placeholder="%s">%s</option>', $custom_field_key, selected( $custom_field_key, $current, false ), $custom_field[ 'type' ], self::get_field_label( array( 'field' => $custom_field_key ) ), $custom_field[ 'text' ] ); |
|
| 330 | 330 | } |
| 331 | 331 | |
| 332 | 332 | // Get fields with sub-inputs and no parent |
@@ -348,13 +348,13 @@ discard block |
||
| 348 | 348 | |
| 349 | 349 | foreach ( $fields as $id => $field ) { |
| 350 | 350 | |
| 351 | - if ( in_array( $field['type'], $blacklist_field_types ) ) { |
|
| 351 | + if ( in_array( $field[ 'type' ], $blacklist_field_types ) ) { |
|
| 352 | 352 | continue; |
| 353 | 353 | } |
| 354 | 354 | |
| 355 | - $types = self::get_search_input_types( $id, $field['type'] ); |
|
| 355 | + $types = self::get_search_input_types( $id, $field[ 'type' ] ); |
|
| 356 | 356 | |
| 357 | - $output .= '<option value="'. $id .'" '. selected( $id, $current, false ).'data-inputtypes="'. esc_attr( $types ) .'">'. esc_html( $field['label'] ) .'</option>'; |
|
| 357 | + $output .= '<option value="' . $id . '" ' . selected( $id, $current, false ) . 'data-inputtypes="' . esc_attr( $types ) . '">' . esc_html( $field[ 'label' ] ) . '</option>'; |
|
| 358 | 358 | } |
| 359 | 359 | } |
| 360 | 360 | |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | public static function get_search_input_types( $field_id = '', $field_type = null ) { |
| 378 | 378 | |
| 379 | 379 | // @todo - This needs to be improved - many fields have . including products and addresses |
| 380 | - if ( false !== strpos( (string) $field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) { |
|
| 380 | + if ( false !== strpos( (string)$field_id, '.' ) && in_array( $field_type, array( 'checkbox' ) ) || in_array( $field_id, array( 'is_fulfilled' ) ) ) { |
|
| 381 | 381 | $input_type = 'boolean'; // on/off checkbox |
| 382 | 382 | } elseif ( in_array( $field_type, array( 'checkbox', 'post_category', 'multiselect' ) ) ) { |
| 383 | 383 | $input_type = 'multi'; //multiselect |
@@ -421,19 +421,19 @@ discard block |
||
| 421 | 421 | $post_id = 0; |
| 422 | 422 | |
| 423 | 423 | // We're in the WordPress Widget context, and an overriding post ID has been set. |
| 424 | - if ( ! empty( $widget_args['post_id'] ) ) { |
|
| 425 | - $post_id = absint( $widget_args['post_id'] ); |
|
| 424 | + if ( ! empty( $widget_args[ 'post_id' ] ) ) { |
|
| 425 | + $post_id = absint( $widget_args[ 'post_id' ] ); |
|
| 426 | 426 | } |
| 427 | 427 | // We're in the WordPress Widget context, and the base View ID should be used |
| 428 | - else if ( ! empty( $widget_args['view_id'] ) ) { |
|
| 429 | - $post_id = absint( $widget_args['view_id'] ); |
|
| 428 | + else if ( ! empty( $widget_args[ 'view_id' ] ) ) { |
|
| 429 | + $post_id = absint( $widget_args[ 'view_id' ] ); |
|
| 430 | 430 | } |
| 431 | 431 | |
| 432 | 432 | $args = gravityview_get_permalink_query_args( $post_id ); |
| 433 | 433 | |
| 434 | 434 | // Add hidden fields to the search form |
| 435 | 435 | foreach ( $args as $key => $value ) { |
| 436 | - $search_fields[] = array( |
|
| 436 | + $search_fields[ ] = array( |
|
| 437 | 437 | 'name' => $key, |
| 438 | 438 | 'input' => 'hidden', |
| 439 | 439 | 'value' => $value, |
@@ -472,22 +472,22 @@ discard block |
||
| 472 | 472 | /** |
| 473 | 473 | * Include the sidebar Widgets. |
| 474 | 474 | */ |
| 475 | - $widgets = (array) get_option( 'widget_gravityview_search', array() ); |
|
| 475 | + $widgets = (array)get_option( 'widget_gravityview_search', array() ); |
|
| 476 | 476 | |
| 477 | 477 | foreach ( $widgets as $widget ) { |
| 478 | - if ( ! empty( $widget['view_id'] ) && $widget['view_id'] == $view->ID ) { |
|
| 479 | - if( $_fields = json_decode( $widget['search_fields'], true ) ) { |
|
| 478 | + if ( ! empty( $widget[ 'view_id' ] ) && $widget[ 'view_id' ] == $view->ID ) { |
|
| 479 | + if ( $_fields = json_decode( $widget[ 'search_fields' ], true ) ) { |
|
| 480 | 480 | foreach ( $_fields as $field ) { |
| 481 | - $searchable_fields [] = $with_full_field ? $field : $field['field']; |
|
| 481 | + $searchable_fields [ ] = $with_full_field ? $field : $field[ 'field' ]; |
|
| 482 | 482 | } |
| 483 | 483 | } |
| 484 | 484 | } |
| 485 | 485 | } |
| 486 | 486 | |
| 487 | 487 | foreach ( $view->widgets->by_id( $this->get_widget_id() )->all() as $widget ) { |
| 488 | - if( $_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ) ) { |
|
| 488 | + if ( $_fields = json_decode( $widget->configuration->get( 'search_fields' ), true ) ) { |
|
| 489 | 489 | foreach ( $_fields as $field ) { |
| 490 | - $searchable_fields [] = $with_full_field ? $field : $field['field']; |
|
| 490 | + $searchable_fields [ ] = $with_full_field ? $field : $field[ 'field' ]; |
|
| 491 | 491 | } |
| 492 | 492 | } |
| 493 | 493 | } |
@@ -504,7 +504,7 @@ discard block |
||
| 504 | 504 | */ |
| 505 | 505 | public function filter_entries( $search_criteria, $form_id = null, $args = array() ) { |
| 506 | 506 | |
| 507 | - if( 'post' === $this->search_method ) { |
|
| 507 | + if ( 'post' === $this->search_method ) { |
|
| 508 | 508 | $get = $_POST; |
| 509 | 509 | } else { |
| 510 | 510 | $get = $_GET; |
@@ -523,14 +523,14 @@ discard block |
||
| 523 | 523 | $get = gv_map_deep( $get, 'rawurldecode' ); |
| 524 | 524 | |
| 525 | 525 | // Make sure array key is set up |
| 526 | - $search_criteria['field_filters'] = \GV\Utils::get( $search_criteria, 'field_filters', array() ); |
|
| 526 | + $search_criteria[ 'field_filters' ] = \GV\Utils::get( $search_criteria, 'field_filters', array() ); |
|
| 527 | 527 | |
| 528 | 528 | $searchable_fields = $this->get_view_searchable_fields( $view ); |
| 529 | 529 | |
| 530 | 530 | // add free search |
| 531 | - if ( isset( $get['gv_search'] ) && '' !== $get['gv_search'] && in_array( 'search_all', $searchable_fields ) ) { |
|
| 531 | + if ( isset( $get[ 'gv_search' ] ) && '' !== $get[ 'gv_search' ] && in_array( 'search_all', $searchable_fields ) ) { |
|
| 532 | 532 | |
| 533 | - $search_all_value = trim( $get['gv_search'] ); |
|
| 533 | + $search_all_value = trim( $get[ 'gv_search' ] ); |
|
| 534 | 534 | |
| 535 | 535 | /** |
| 536 | 536 | * @filter `gravityview/search-all-split-words` Search for each word separately or the whole phrase? |
@@ -555,7 +555,7 @@ discard block |
||
| 555 | 555 | } |
| 556 | 556 | |
| 557 | 557 | foreach ( $words as $word ) { |
| 558 | - $search_criteria['field_filters'][] = array( |
|
| 558 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 559 | 559 | 'key' => null, // The field ID to search |
| 560 | 560 | 'value' => $word, // The value to search |
| 561 | 561 | 'operator' => 'contains', // What to search in. Options: `is` or `contains` |
@@ -568,14 +568,14 @@ discard block |
||
| 568 | 568 | /** |
| 569 | 569 | * Get and normalize the dates according to the input format. |
| 570 | 570 | */ |
| 571 | - if ( $curr_start = ! empty( $get['gv_start'] ) ? $get['gv_start'] : '' ) { |
|
| 572 | - if( $curr_start_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_start ) ) { |
|
| 571 | + if ( $curr_start = ! empty( $get[ 'gv_start' ] ) ? $get[ 'gv_start' ] : '' ) { |
|
| 572 | + if ( $curr_start_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_start ) ) { |
|
| 573 | 573 | $curr_start = $curr_start_date->format( 'Y-m-d' ); |
| 574 | 574 | } |
| 575 | 575 | } |
| 576 | 576 | |
| 577 | - if ( $curr_end = ! empty( $get['gv_start'] ) ? ( ! empty( $get['gv_end'] ) ? $get['gv_end'] : '' ) : '' ) { |
|
| 578 | - if( $curr_end_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_end ) ) { |
|
| 577 | + if ( $curr_end = ! empty( $get[ 'gv_start' ] ) ? ( ! empty( $get[ 'gv_end' ] ) ? $get[ 'gv_end' ] : '' ) : '' ) { |
|
| 578 | + if ( $curr_end_date = date_create_from_format( $this->get_datepicker_format( true ), $curr_end ) ) { |
|
| 579 | 579 | $curr_end = $curr_end_date->format( 'Y-m-d' ); |
| 580 | 580 | } |
| 581 | 581 | } |
@@ -610,22 +610,22 @@ discard block |
||
| 610 | 610 | */ |
| 611 | 611 | if ( ! empty( $curr_start ) ) { |
| 612 | 612 | $curr_start = date( 'Y-m-d H:i:s', strtotime( $curr_start ) ); |
| 613 | - $search_criteria['start_date'] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start; |
|
| 613 | + $search_criteria[ 'start_date' ] = $adjust_tz ? get_gmt_from_date( $curr_start ) : $curr_start; |
|
| 614 | 614 | } |
| 615 | 615 | |
| 616 | 616 | if ( ! empty( $curr_end ) ) { |
| 617 | 617 | // Fast-forward 24 hour on the end time |
| 618 | 618 | $curr_end = date( 'Y-m-d H:i:s', strtotime( $curr_end ) + DAY_IN_SECONDS ); |
| 619 | - $search_criteria['end_date'] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end; |
|
| 620 | - if ( strpos( $search_criteria['end_date'], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056 |
|
| 621 | - $search_criteria['end_date'] = date( 'Y-m-d H:i:s', strtotime( $search_criteria['end_date'] ) - 1 ); |
|
| 619 | + $search_criteria[ 'end_date' ] = $adjust_tz ? get_gmt_from_date( $curr_end ) : $curr_end; |
|
| 620 | + if ( strpos( $search_criteria[ 'end_date' ], '00:00:00' ) ) { // See https://github.com/gravityview/GravityView/issues/1056 |
|
| 621 | + $search_criteria[ 'end_date' ] = date( 'Y-m-d H:i:s', strtotime( $search_criteria[ 'end_date' ] ) - 1 ); |
|
| 622 | 622 | } |
| 623 | 623 | } |
| 624 | 624 | } |
| 625 | 625 | |
| 626 | 626 | // search for a specific entry ID |
| 627 | 627 | if ( ! empty( $get[ 'gv_id' ] ) && in_array( 'entry_id', $searchable_fields ) ) { |
| 628 | - $search_criteria['field_filters'][] = array( |
|
| 628 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 629 | 629 | 'key' => 'id', |
| 630 | 630 | 'value' => absint( $get[ 'gv_id' ] ), |
| 631 | 631 | 'operator' => '=', |
@@ -634,42 +634,42 @@ discard block |
||
| 634 | 634 | |
| 635 | 635 | // search for a specific Created_by ID |
| 636 | 636 | if ( ! empty( $get[ 'gv_by' ] ) && in_array( 'created_by', $searchable_fields ) ) { |
| 637 | - $search_criteria['field_filters'][] = array( |
|
| 637 | + $search_criteria[ 'field_filters' ][ ] = array( |
|
| 638 | 638 | 'key' => 'created_by', |
| 639 | - 'value' => absint( $get['gv_by'] ), |
|
| 639 | + 'value' => absint( $get[ 'gv_by' ] ), |
|
| 640 | 640 | 'operator' => '=', |
| 641 | 641 | ); |
| 642 | 642 | } |
| 643 | 643 | |
| 644 | 644 | |
| 645 | 645 | // Get search mode passed in URL |
| 646 | - $mode = isset( $get['mode'] ) && in_array( $get['mode'], array( 'any', 'all' ) ) ? $get['mode'] : 'any'; |
|
| 646 | + $mode = isset( $get[ 'mode' ] ) && in_array( $get[ 'mode' ], array( 'any', 'all' ) ) ? $get[ 'mode' ] : 'any'; |
|
| 647 | 647 | |
| 648 | 648 | // get the other search filters |
| 649 | 649 | foreach ( $get as $key => $value ) { |
| 650 | 650 | |
| 651 | - if ( 0 !== strpos( $key, 'filter_' ) || gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[0], false, false ) ) ) { |
|
| 651 | + if ( 0 !== strpos( $key, 'filter_' ) || gv_empty( $value, false, false ) || ( is_array( $value ) && count( $value ) === 1 && gv_empty( $value[ 0 ], false, false ) ) ) { |
|
| 652 | 652 | continue; |
| 653 | 653 | } |
| 654 | 654 | |
| 655 | 655 | $filter_key = $this->convert_request_key_to_filter_key( $key ); |
| 656 | 656 | |
| 657 | 657 | // could return simple filter or multiple filters |
| 658 | - if ( ! in_array( 'search_all', $searchable_fields ) && ! in_array( $filter_key , $searchable_fields ) ) { |
|
| 658 | + if ( ! in_array( 'search_all', $searchable_fields ) && ! in_array( $filter_key, $searchable_fields ) ) { |
|
| 659 | 659 | continue; |
| 660 | 660 | } |
| 661 | 661 | |
| 662 | 662 | $filter = $this->prepare_field_filter( $filter_key, $value, $view ); |
| 663 | 663 | |
| 664 | - if ( isset( $filter[0]['value'] ) ) { |
|
| 665 | - $search_criteria['field_filters'] = array_merge( $search_criteria['field_filters'], $filter ); |
|
| 664 | + if ( isset( $filter[ 0 ][ 'value' ] ) ) { |
|
| 665 | + $search_criteria[ 'field_filters' ] = array_merge( $search_criteria[ 'field_filters' ], $filter ); |
|
| 666 | 666 | |
| 667 | 667 | // if date range type, set search mode to ALL |
| 668 | - if ( ! empty( $filter[0]['operator'] ) && in_array( $filter[0]['operator'], array( '>=', '<=', '>', '<' ) ) ) { |
|
| 668 | + if ( ! empty( $filter[ 0 ][ 'operator' ] ) && in_array( $filter[ 0 ][ 'operator' ], array( '>=', '<=', '>', '<' ) ) ) { |
|
| 669 | 669 | $mode = 'all'; |
| 670 | 670 | } |
| 671 | - } elseif( !empty( $filter ) ) { |
|
| 672 | - $search_criteria['field_filters'][] = $filter; |
|
| 671 | + } elseif ( ! empty( $filter ) ) { |
|
| 672 | + $search_criteria[ 'field_filters' ][ ] = $filter; |
|
| 673 | 673 | } |
| 674 | 674 | } |
| 675 | 675 | |
@@ -678,7 +678,7 @@ discard block |
||
| 678 | 678 | * @since 1.5.1 |
| 679 | 679 | * @param[out,in] string $mode Search mode (`any` vs `all`) |
| 680 | 680 | */ |
| 681 | - $search_criteria['field_filters']['mode'] = apply_filters( 'gravityview/search/mode', $mode ); |
|
| 681 | + $search_criteria[ 'field_filters' ][ 'mode' ] = apply_filters( 'gravityview/search/mode', $mode ); |
|
| 682 | 682 | |
| 683 | 683 | gravityview()->log->debug( 'Returned Search Criteria: ', array( 'data' => $search_criteria ) ); |
| 684 | 684 | |
@@ -706,7 +706,7 @@ discard block |
||
| 706 | 706 | $field_id = str_replace( 'filter_', '', $key ); |
| 707 | 707 | |
| 708 | 708 | // calculates field_id, removing 'filter_' and for '_' for advanced fields ( like name or checkbox ) |
| 709 | - if ( preg_match('/^[0-9_]+$/ism', $field_id ) ) { |
|
| 709 | + if ( preg_match( '/^[0-9_]+$/ism', $field_id ) ) { |
|
| 710 | 710 | $field_id = str_replace( '_', '.', $field_id ); |
| 711 | 711 | } |
| 712 | 712 | |
@@ -741,7 +741,7 @@ discard block |
||
| 741 | 741 | |
| 742 | 742 | case 'select': |
| 743 | 743 | case 'radio': |
| 744 | - $filter['operator'] = 'is'; |
|
| 744 | + $filter[ 'operator' ] = 'is'; |
|
| 745 | 745 | break; |
| 746 | 746 | |
| 747 | 747 | case 'post_category': |
@@ -755,7 +755,7 @@ discard block |
||
| 755 | 755 | |
| 756 | 756 | foreach ( $value as $val ) { |
| 757 | 757 | $cat = get_term( $val, 'category' ); |
| 758 | - $filter[] = array( |
|
| 758 | + $filter[ ] = array( |
|
| 759 | 759 | 'key' => $filter_key, |
| 760 | 760 | 'value' => esc_attr( $cat->name ) . ':' . $val, |
| 761 | 761 | 'operator' => 'is', |
@@ -774,7 +774,7 @@ discard block |
||
| 774 | 774 | $filter = array(); |
| 775 | 775 | |
| 776 | 776 | foreach ( $value as $val ) { |
| 777 | - $filter[] = array( 'key' => $filter_key, 'value' => $val ); |
|
| 777 | + $filter[ ] = array( 'key' => $filter_key, 'value' => $val ); |
|
| 778 | 778 | } |
| 779 | 779 | |
| 780 | 780 | break; |
@@ -783,9 +783,9 @@ discard block |
||
| 783 | 783 | // convert checkbox on/off into the correct search filter |
| 784 | 784 | if ( false !== strpos( $filter_key, '.' ) && ! empty( $form_field->inputs ) && ! empty( $form_field->choices ) ) { |
| 785 | 785 | foreach ( $form_field->inputs as $k => $input ) { |
| 786 | - if ( $input['id'] == $filter_key ) { |
|
| 787 | - $filter['value'] = $form_field->choices[ $k ]['value']; |
|
| 788 | - $filter['operator'] = 'is'; |
|
| 786 | + if ( $input[ 'id' ] == $filter_key ) { |
|
| 787 | + $filter[ 'value' ] = $form_field->choices[ $k ][ 'value' ]; |
|
| 788 | + $filter[ 'operator' ] = 'is'; |
|
| 789 | 789 | break; |
| 790 | 790 | } |
| 791 | 791 | } |
@@ -795,7 +795,7 @@ discard block |
||
| 795 | 795 | $filter = array(); |
| 796 | 796 | |
| 797 | 797 | foreach ( $value as $val ) { |
| 798 | - $filter[] = array( |
|
| 798 | + $filter[ ] = array( |
|
| 799 | 799 | 'key' => $filter_key, |
| 800 | 800 | 'value' => $val, |
| 801 | 801 | 'operator' => 'is', |
@@ -816,9 +816,9 @@ discard block |
||
| 816 | 816 | foreach ( $words as $word ) { |
| 817 | 817 | if ( ! empty( $word ) && strlen( $word ) > 1 ) { |
| 818 | 818 | // Keep the same key for each filter |
| 819 | - $filter['value'] = $word; |
|
| 819 | + $filter[ 'value' ] = $word; |
|
| 820 | 820 | // Add a search for the value |
| 821 | - $filters[] = $filter; |
|
| 821 | + $filters[ ] = $filter; |
|
| 822 | 822 | } |
| 823 | 823 | } |
| 824 | 824 | |
@@ -832,19 +832,19 @@ discard block |
||
| 832 | 832 | |
| 833 | 833 | foreach ( $searchable_fields as $searchable_field ) { |
| 834 | 834 | |
| 835 | - if( $form_field->ID !== $searchable_field['field'] ) { |
|
| 835 | + if ( $form_field->ID !== $searchable_field[ 'field' ] ) { |
|
| 836 | 836 | continue; |
| 837 | 837 | } |
| 838 | 838 | |
| 839 | 839 | // Only exact-match dropdowns, not text search |
| 840 | - if( in_array( $searchable_field['input'], array( 'text', 'search' ), true ) ) { |
|
| 840 | + if ( in_array( $searchable_field[ 'input' ], array( 'text', 'search' ), true ) ) { |
|
| 841 | 841 | continue; |
| 842 | 842 | } |
| 843 | 843 | |
| 844 | 844 | $input_id = gravityview_get_input_id_from_id( $form_field->ID ); |
| 845 | 845 | |
| 846 | 846 | if ( 4 === $input_id ) { |
| 847 | - $filter['operator'] = 'is'; |
|
| 847 | + $filter[ 'operator' ] = 'is'; |
|
| 848 | 848 | }; |
| 849 | 849 | } |
| 850 | 850 | } |
@@ -869,19 +869,19 @@ discard block |
||
| 869 | 869 | * @since 1.16.3 |
| 870 | 870 | * Safeguard until GF implements '<=' operator |
| 871 | 871 | */ |
| 872 | - if( !GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) { |
|
| 872 | + if ( ! GFFormsModel::is_valid_operator( $operator ) && $operator === '<=' ) { |
|
| 873 | 873 | $operator = '<'; |
| 874 | 874 | $date = date( 'Y-m-d', strtotime( $date . ' +1 day' ) ); |
| 875 | 875 | } |
| 876 | 876 | |
| 877 | - $filter[] = array( |
|
| 877 | + $filter[ ] = array( |
|
| 878 | 878 | 'key' => $filter_key, |
| 879 | 879 | 'value' => self::get_formatted_date( $date, 'Y-m-d' ), |
| 880 | 880 | 'operator' => $operator, |
| 881 | 881 | ); |
| 882 | 882 | } |
| 883 | 883 | } else { |
| 884 | - $filter['value'] = self::get_formatted_date( $value, 'Y-m-d' ); |
|
| 884 | + $filter[ 'value' ] = self::get_formatted_date( $value, 'Y-m-d' ); |
|
| 885 | 885 | } |
| 886 | 886 | |
| 887 | 887 | break; |
@@ -912,7 +912,7 @@ discard block |
||
| 912 | 912 | 'ymd_dot' => 'Y.m.d', |
| 913 | 913 | ); |
| 914 | 914 | |
| 915 | - if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ){ |
|
| 915 | + if ( ! empty( $field->dateFormat ) && isset( $datepicker[ $field->dateFormat ] ) ) { |
|
| 916 | 916 | $format = $datepicker[ $field->dateFormat ]; |
| 917 | 917 | } |
| 918 | 918 | |
@@ -945,7 +945,7 @@ discard block |
||
| 945 | 945 | public function add_template_path( $file_paths ) { |
| 946 | 946 | |
| 947 | 947 | // Index 100 is the default GravityView template path. |
| 948 | - $file_paths[102] = self::$file . 'templates/'; |
|
| 948 | + $file_paths[ 102 ] = self::$file . 'templates/'; |
|
| 949 | 949 | |
| 950 | 950 | return $file_paths; |
| 951 | 951 | } |
@@ -964,7 +964,7 @@ discard block |
||
| 964 | 964 | $has_date = false; |
| 965 | 965 | |
| 966 | 966 | foreach ( $search_fields as $k => $field ) { |
| 967 | - if ( in_array( $field['input'], array( 'date', 'date_range', 'entry_date' ) ) ) { |
|
| 967 | + if ( in_array( $field[ 'input' ], array( 'date', 'date_range', 'entry_date' ) ) ) { |
|
| 968 | 968 | $has_date = true; |
| 969 | 969 | break; |
| 970 | 970 | } |
@@ -991,7 +991,7 @@ discard block |
||
| 991 | 991 | } |
| 992 | 992 | |
| 993 | 993 | // get configured search fields |
| 994 | - $search_fields = ! empty( $widget_args['search_fields'] ) ? json_decode( $widget_args['search_fields'], true ) : ''; |
|
| 994 | + $search_fields = ! empty( $widget_args[ 'search_fields' ] ) ? json_decode( $widget_args[ 'search_fields' ], true ) : ''; |
|
| 995 | 995 | |
| 996 | 996 | if ( empty( $search_fields ) || ! is_array( $search_fields ) ) { |
| 997 | 997 | gravityview()->log->debug( 'No search fields configured for widget:', array( 'data' => $widget_args ) ); |
@@ -1006,34 +1006,34 @@ discard block |
||
| 1006 | 1006 | |
| 1007 | 1007 | $updated_field = $this->get_search_filter_details( $updated_field ); |
| 1008 | 1008 | |
| 1009 | - switch ( $field['field'] ) { |
|
| 1009 | + switch ( $field[ 'field' ] ) { |
|
| 1010 | 1010 | |
| 1011 | 1011 | case 'search_all': |
| 1012 | - $updated_field['key'] = 'search_all'; |
|
| 1013 | - $updated_field['input'] = 'search_all'; |
|
| 1014 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_search' ); |
|
| 1012 | + $updated_field[ 'key' ] = 'search_all'; |
|
| 1013 | + $updated_field[ 'input' ] = 'search_all'; |
|
| 1014 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_search' ); |
|
| 1015 | 1015 | break; |
| 1016 | 1016 | |
| 1017 | 1017 | case 'entry_date': |
| 1018 | - $updated_field['key'] = 'entry_date'; |
|
| 1019 | - $updated_field['input'] = 'entry_date'; |
|
| 1020 | - $updated_field['value'] = array( |
|
| 1018 | + $updated_field[ 'key' ] = 'entry_date'; |
|
| 1019 | + $updated_field[ 'input' ] = 'entry_date'; |
|
| 1020 | + $updated_field[ 'value' ] = array( |
|
| 1021 | 1021 | 'start' => $this->rgget_or_rgpost( 'gv_start' ), |
| 1022 | 1022 | 'end' => $this->rgget_or_rgpost( 'gv_end' ), |
| 1023 | 1023 | ); |
| 1024 | 1024 | break; |
| 1025 | 1025 | |
| 1026 | 1026 | case 'entry_id': |
| 1027 | - $updated_field['key'] = 'entry_id'; |
|
| 1028 | - $updated_field['input'] = 'entry_id'; |
|
| 1029 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_id' ); |
|
| 1027 | + $updated_field[ 'key' ] = 'entry_id'; |
|
| 1028 | + $updated_field[ 'input' ] = 'entry_id'; |
|
| 1029 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_id' ); |
|
| 1030 | 1030 | break; |
| 1031 | 1031 | |
| 1032 | 1032 | case 'created_by': |
| 1033 | - $updated_field['key'] = 'created_by'; |
|
| 1034 | - $updated_field['name'] = 'gv_by'; |
|
| 1035 | - $updated_field['value'] = $this->rgget_or_rgpost( 'gv_by' ); |
|
| 1036 | - $updated_field['choices'] = self::get_created_by_choices(); |
|
| 1033 | + $updated_field[ 'key' ] = 'created_by'; |
|
| 1034 | + $updated_field[ 'name' ] = 'gv_by'; |
|
| 1035 | + $updated_field[ 'value' ] = $this->rgget_or_rgpost( 'gv_by' ); |
|
| 1036 | + $updated_field[ 'choices' ] = self::get_created_by_choices(); |
|
| 1037 | 1037 | break; |
| 1038 | 1038 | } |
| 1039 | 1039 | |
@@ -1052,16 +1052,16 @@ discard block |
||
| 1052 | 1052 | */ |
| 1053 | 1053 | $gravityview_view->search_fields = apply_filters( 'gravityview_widget_search_filters', $search_fields, $this, $widget_args, $context ); |
| 1054 | 1054 | |
| 1055 | - $gravityview_view->search_layout = ! empty( $widget_args['search_layout'] ) ? $widget_args['search_layout'] : 'horizontal'; |
|
| 1055 | + $gravityview_view->search_layout = ! empty( $widget_args[ 'search_layout' ] ) ? $widget_args[ 'search_layout' ] : 'horizontal'; |
|
| 1056 | 1056 | |
| 1057 | 1057 | /** @since 1.14 */ |
| 1058 | - $gravityview_view->search_mode = ! empty( $widget_args['search_mode'] ) ? $widget_args['search_mode'] : 'any'; |
|
| 1058 | + $gravityview_view->search_mode = ! empty( $widget_args[ 'search_mode' ] ) ? $widget_args[ 'search_mode' ] : 'any'; |
|
| 1059 | 1059 | |
| 1060 | - $custom_class = ! empty( $widget_args['custom_class'] ) ? $widget_args['custom_class'] : ''; |
|
| 1060 | + $custom_class = ! empty( $widget_args[ 'custom_class' ] ) ? $widget_args[ 'custom_class' ] : ''; |
|
| 1061 | 1061 | |
| 1062 | 1062 | $gravityview_view->search_class = self::get_search_class( $custom_class ); |
| 1063 | 1063 | |
| 1064 | - $gravityview_view->search_clear = ! empty( $widget_args['search_clear'] ) ? $widget_args['search_clear'] : false; |
|
| 1064 | + $gravityview_view->search_clear = ! empty( $widget_args[ 'search_clear' ] ) ? $widget_args[ 'search_clear' ] : false; |
|
| 1065 | 1065 | |
| 1066 | 1066 | if ( $this->has_date_field( $search_fields ) ) { |
| 1067 | 1067 | // enqueue datepicker stuff only if needed! |
@@ -1083,10 +1083,10 @@ discard block |
||
| 1083 | 1083 | public static function get_search_class( $custom_class = '' ) { |
| 1084 | 1084 | $gravityview_view = GravityView_View::getInstance(); |
| 1085 | 1085 | |
| 1086 | - $search_class = 'gv-search-'.$gravityview_view->search_layout; |
|
| 1086 | + $search_class = 'gv-search-' . $gravityview_view->search_layout; |
|
| 1087 | 1087 | |
| 1088 | - if ( ! empty( $custom_class ) ) { |
|
| 1089 | - $search_class .= ' '.$custom_class; |
|
| 1088 | + if ( ! empty( $custom_class ) ) { |
|
| 1089 | + $search_class .= ' ' . $custom_class; |
|
| 1090 | 1090 | } |
| 1091 | 1091 | |
| 1092 | 1092 | /** |
@@ -1130,9 +1130,9 @@ discard block |
||
| 1130 | 1130 | |
| 1131 | 1131 | if ( ! $label ) { |
| 1132 | 1132 | |
| 1133 | - $label = isset( $form_field['label'] ) ? $form_field['label'] : ''; |
|
| 1133 | + $label = isset( $form_field[ 'label' ] ) ? $form_field[ 'label' ] : ''; |
|
| 1134 | 1134 | |
| 1135 | - switch( $field['field'] ) { |
|
| 1135 | + switch ( $field[ 'field' ] ) { |
|
| 1136 | 1136 | case 'search_all': |
| 1137 | 1137 | $label = __( 'Search Entries:', 'gravityview' ); |
| 1138 | 1138 | break; |
@@ -1144,10 +1144,10 @@ discard block |
||
| 1144 | 1144 | break; |
| 1145 | 1145 | default: |
| 1146 | 1146 | // If this is a field input, not a field |
| 1147 | - if ( strpos( $field['field'], '.' ) > 0 && ! empty( $form_field['inputs'] ) ) { |
|
| 1147 | + if ( strpos( $field[ 'field' ], '.' ) > 0 && ! empty( $form_field[ 'inputs' ] ) ) { |
|
| 1148 | 1148 | |
| 1149 | 1149 | // Get the label for the field in question, which returns an array |
| 1150 | - $items = wp_list_filter( $form_field['inputs'], array( 'id' => $field['field'] ) ); |
|
| 1150 | + $items = wp_list_filter( $form_field[ 'inputs' ], array( 'id' => $field[ 'field' ] ) ); |
|
| 1151 | 1151 | |
| 1152 | 1152 | // Get the item with the `label` key |
| 1153 | 1153 | $values = wp_list_pluck( $items, 'label' ); |
@@ -1186,32 +1186,32 @@ discard block |
||
| 1186 | 1186 | $form = $gravityview_view->getForm(); |
| 1187 | 1187 | |
| 1188 | 1188 | // for advanced field ids (eg, first name / last name ) |
| 1189 | - $name = 'filter_' . str_replace( '.', '_', $field['field'] ); |
|
| 1189 | + $name = 'filter_' . str_replace( '.', '_', $field[ 'field' ] ); |
|
| 1190 | 1190 | |
| 1191 | 1191 | // get searched value from $_GET/$_POST (string or array) |
| 1192 | 1192 | $value = $this->rgget_or_rgpost( $name ); |
| 1193 | 1193 | |
| 1194 | 1194 | // get form field details |
| 1195 | - $form_field = gravityview_get_field( $form, $field['field'] ); |
|
| 1195 | + $form_field = gravityview_get_field( $form, $field[ 'field' ] ); |
|
| 1196 | 1196 | |
| 1197 | 1197 | $filter = array( |
| 1198 | - 'key' => $field['field'], |
|
| 1198 | + 'key' => $field[ 'field' ], |
|
| 1199 | 1199 | 'name' => $name, |
| 1200 | 1200 | 'label' => self::get_field_label( $field, $form_field ), |
| 1201 | - 'input' => $field['input'], |
|
| 1201 | + 'input' => $field[ 'input' ], |
|
| 1202 | 1202 | 'value' => $value, |
| 1203 | - 'type' => $form_field['type'], |
|
| 1203 | + 'type' => $form_field[ 'type' ], |
|
| 1204 | 1204 | ); |
| 1205 | 1205 | |
| 1206 | 1206 | // collect choices |
| 1207 | - if ( 'post_category' === $form_field['type'] && ! empty( $form_field['displayAllCategories'] ) && empty( $form_field['choices'] ) ) { |
|
| 1208 | - $filter['choices'] = gravityview_get_terms_choices(); |
|
| 1209 | - } elseif ( ! empty( $form_field['choices'] ) ) { |
|
| 1210 | - $filter['choices'] = $form_field['choices']; |
|
| 1207 | + if ( 'post_category' === $form_field[ 'type' ] && ! empty( $form_field[ 'displayAllCategories' ] ) && empty( $form_field[ 'choices' ] ) ) { |
|
| 1208 | + $filter[ 'choices' ] = gravityview_get_terms_choices(); |
|
| 1209 | + } elseif ( ! empty( $form_field[ 'choices' ] ) ) { |
|
| 1210 | + $filter[ 'choices' ] = $form_field[ 'choices' ]; |
|
| 1211 | 1211 | } |
| 1212 | 1212 | |
| 1213 | - if ( 'date_range' === $field['input'] && empty( $value ) ) { |
|
| 1214 | - $filter['value'] = array( 'start' => '', 'end' => '' ); |
|
| 1213 | + if ( 'date_range' === $field[ 'input' ] && empty( $value ) ) { |
|
| 1214 | + $filter[ 'value' ] = array( 'start' => '', 'end' => '' ); |
|
| 1215 | 1215 | } |
| 1216 | 1216 | |
| 1217 | 1217 | return $filter; |
@@ -1235,7 +1235,7 @@ discard block |
||
| 1235 | 1235 | |
| 1236 | 1236 | $choices = array(); |
| 1237 | 1237 | foreach ( $users as $user ) { |
| 1238 | - $choices[] = array( |
|
| 1238 | + $choices[ ] = array( |
|
| 1239 | 1239 | 'value' => $user->ID, |
| 1240 | 1240 | 'text' => $user->display_name, |
| 1241 | 1241 | ); |
@@ -1290,7 +1290,7 @@ discard block |
||
| 1290 | 1290 | */ |
| 1291 | 1291 | public function add_datepicker_js_dependency( $js_dependencies ) { |
| 1292 | 1292 | |
| 1293 | - $js_dependencies[] = 'jquery-ui-datepicker'; |
|
| 1293 | + $js_dependencies[ ] = 'jquery-ui-datepicker'; |
|
| 1294 | 1294 | |
| 1295 | 1295 | return $js_dependencies; |
| 1296 | 1296 | } |
@@ -1334,7 +1334,7 @@ discard block |
||
| 1334 | 1334 | 'isRTL' => is_rtl(), |
| 1335 | 1335 | ), $view_data ); |
| 1336 | 1336 | |
| 1337 | - $localizations['datepicker'] = $datepicker_settings; |
|
| 1337 | + $localizations[ 'datepicker' ] = $datepicker_settings; |
|
| 1338 | 1338 | |
| 1339 | 1339 | return $localizations; |
| 1340 | 1340 | |
@@ -1361,7 +1361,7 @@ discard block |
||
| 1361 | 1361 | * @return void |
| 1362 | 1362 | */ |
| 1363 | 1363 | private function maybe_enqueue_flexibility() { |
| 1364 | - if ( isset( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( '/MSIE [8-9]/', $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
| 1364 | + if ( isset( $_SERVER[ 'HTTP_USER_AGENT' ] ) && preg_match( '/MSIE [8-9]/', $_SERVER[ 'HTTP_USER_AGENT' ] ) ) { |
|
| 1365 | 1365 | wp_enqueue_script( 'gv-flexibility' ); |
| 1366 | 1366 | } |
| 1367 | 1367 | } |
@@ -1383,7 +1383,7 @@ discard block |
||
| 1383 | 1383 | add_filter( 'gravityview_js_localization', array( $this, 'add_datepicker_localization' ), 10, 2 ); |
| 1384 | 1384 | |
| 1385 | 1385 | $scheme = is_ssl() ? 'https://' : 'http://'; |
| 1386 | - wp_enqueue_style( 'jquery-ui-datepicker', $scheme.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' ); |
|
| 1386 | + wp_enqueue_style( 'jquery-ui-datepicker', $scheme . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css' ); |
|
| 1387 | 1387 | |
| 1388 | 1388 | /** |
| 1389 | 1389 | * @filter `gravityview_search_datepicker_class` |
@@ -63,28 +63,28 @@ discard block |
||
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | /** |
| 66 | - * When on the Add/Edit View screen, suggest most popular articles related to that |
|
| 67 | - * |
|
| 66 | + * When on the Add/Edit View screen, suggest most popular articles related to that |
|
| 67 | + * |
|
| 68 | 68 | * @param array $localization_data Data to be passed to the Support Port JS |
| 69 | 69 | * |
| 70 | 70 | * @return array |
| 71 | 71 | */ |
| 72 | 72 | function suggest_support_articles( $localization_data = array() ) { |
| 73 | 73 | |
| 74 | - if( ! gravityview()->request->is_view() ) { |
|
| 75 | - return $localization_data; |
|
| 76 | - } |
|
| 74 | + if( ! gravityview()->request->is_view() ) { |
|
| 75 | + return $localization_data; |
|
| 76 | + } |
|
| 77 | 77 | |
| 78 | 78 | $localization_data['suggest'] = array( |
| 79 | - '57ef23539033602e61d4a560', |
|
| 80 | - '54c67bb9e4b0512429885513', |
|
| 81 | - '54c67bb9e4b0512429885512', |
|
| 82 | - '54c67bbbe4b07997ea3f3f6b', |
|
| 83 | - '54d1a33ae4b086c0c0964ce9', |
|
| 84 | - '57ef253c9033602e61d4a563', |
|
| 85 | - '552355bfe4b0221aadf2572b', |
|
| 86 | - '54c67bcde4b051242988553e', |
|
| 87 | - ); |
|
| 79 | + '57ef23539033602e61d4a560', |
|
| 80 | + '54c67bb9e4b0512429885513', |
|
| 81 | + '54c67bb9e4b0512429885512', |
|
| 82 | + '54c67bbbe4b07997ea3f3f6b', |
|
| 83 | + '54d1a33ae4b086c0c0964ce9', |
|
| 84 | + '57ef253c9033602e61d4a563', |
|
| 85 | + '552355bfe4b0221aadf2572b', |
|
| 86 | + '54c67bcde4b051242988553e', |
|
| 87 | + ); |
|
| 88 | 88 | |
| 89 | 89 | return $localization_data; |
| 90 | 90 | } |
@@ -170,11 +170,11 @@ discard block |
||
| 170 | 170 | |
| 171 | 171 | if( 'form_list' === GFForms::get_page() ) { |
| 172 | 172 | $priority = 790; |
| 173 | - } |
|
| 173 | + } |
|
| 174 | 174 | |
| 175 | 175 | if( empty( $connected_views ) ) { |
| 176 | 176 | |
| 177 | - $menu_items['gravityview'] = array( |
|
| 177 | + $menu_items['gravityview'] = array( |
|
| 178 | 178 | 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
| 179 | 179 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', |
| 180 | 180 | 'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ), |
@@ -205,13 +205,13 @@ discard block |
||
| 205 | 205 | // If there were no items added, then let's create the parent menu |
| 206 | 206 | if( $sub_menu_items ) { |
| 207 | 207 | |
| 208 | - $sub_menu_items[] = array( |
|
| 209 | - 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
|
| 210 | - 'link_class' => 'gv-create-view', |
|
| 211 | - 'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ), |
|
| 212 | - 'url' => admin_url( 'post-new.php?post_type=gravityview&form_id=' . $id ), |
|
| 213 | - 'capabilities' => array( 'edit_gravityviews' ), |
|
| 214 | - ); |
|
| 208 | + $sub_menu_items[] = array( |
|
| 209 | + 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
|
| 210 | + 'link_class' => 'gv-create-view', |
|
| 211 | + 'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ), |
|
| 212 | + 'url' => admin_url( 'post-new.php?post_type=gravityview&form_id=' . $id ), |
|
| 213 | + 'capabilities' => array( 'edit_gravityviews' ), |
|
| 214 | + ); |
|
| 215 | 215 | |
| 216 | 216 | // Make sure Gravity Forms uses the submenu; if there's only one item, it uses a link instead of a dropdown |
| 217 | 217 | $sub_menu_items[] = array( |
@@ -596,12 +596,12 @@ discard block |
||
| 596 | 596 | * Render html for displaying available fields based on a Form ID |
| 597 | 597 | * $blacklist_field_types - contains the field types which are not proper to be shown in a directory. |
| 598 | 598 | * |
| 599 | - * @see GravityView_Ajax::get_available_fields_html() Triggers `gravityview_render_available_fields` action |
|
| 599 | + * @see GravityView_Ajax::get_available_fields_html() Triggers `gravityview_render_available_fields` action |
|
| 600 | 600 | * @access public |
| 601 | - * |
|
| 601 | + * |
|
| 602 | 602 | * @param int $form Gravity Forms Form ID (default: '') |
| 603 | 603 | * @param string $context (default: 'single') |
| 604 | - * |
|
| 604 | + * |
|
| 605 | 605 | * @return void |
| 606 | 606 | */ |
| 607 | 607 | function render_available_fields( $form = 0, $context = 'single' ) { |
@@ -615,7 +615,7 @@ discard block |
||
| 615 | 615 | |
| 616 | 616 | if ( ! is_array( $blacklist_field_types ) ) { |
| 617 | 617 | |
| 618 | - gravityview()->log->error( '$blacklist_field_types is not an array', array( 'data' => print_r( $blacklist_field_types, true ) ) ); |
|
| 618 | + gravityview()->log->error( '$blacklist_field_types is not an array', array( 'data' => print_r( $blacklist_field_types, true ) ) ); |
|
| 619 | 619 | |
| 620 | 620 | $blacklist_field_types = array(); |
| 621 | 621 | } |
@@ -747,12 +747,12 @@ discard block |
||
| 747 | 747 | /** |
| 748 | 748 | * @since 1.7.2 |
| 749 | 749 | */ |
| 750 | - 'other_entries' => array( |
|
| 751 | - 'label' => __('Other Entries', 'gravityview'), |
|
| 752 | - 'type' => 'other_entries', |
|
| 753 | - 'desc' => __('Display other entries created by the entry creator.', 'gravityview'), |
|
| 754 | - ), |
|
| 755 | - ); |
|
| 750 | + 'other_entries' => array( |
|
| 751 | + 'label' => __('Other Entries', 'gravityview'), |
|
| 752 | + 'type' => 'other_entries', |
|
| 753 | + 'desc' => __('Display other entries created by the entry creator.', 'gravityview'), |
|
| 754 | + ), |
|
| 755 | + ); |
|
| 756 | 756 | |
| 757 | 757 | if( 'single' !== $zone) { |
| 758 | 758 | |
@@ -885,9 +885,9 @@ discard block |
||
| 885 | 885 | |
| 886 | 886 | $joined_forms = gravityview_get_joined_forms( $post->ID ); |
| 887 | 887 | |
| 888 | - foreach ( $joined_forms as $form ) { |
|
| 889 | - $available_items[ $form->ID ] = $this->get_available_fields( $form->ID, $zone ); |
|
| 890 | - } |
|
| 888 | + foreach ( $joined_forms as $form ) { |
|
| 889 | + $available_items[ $form->ID ] = $this->get_available_fields( $form->ID, $zone ); |
|
| 890 | + } |
|
| 891 | 891 | } else { |
| 892 | 892 | $available_items[ $form ] = $this->get_registered_widgets(); |
| 893 | 893 | } |
@@ -917,9 +917,9 @@ discard block |
||
| 917 | 917 | |
| 918 | 918 | if ( $form_id ) { |
| 919 | 919 | $original_item = isset( $available_items[ $form_id ] [ $field['id'] ] ) ? $available_items[ $form_id ] [ $field['id'] ] : false ; |
| 920 | - } else { |
|
| 920 | + } else { |
|
| 921 | 921 | $original_item = isset( $available_items[ $field['id'] ] ) ? $available_items[ $field['id'] ] : false ; |
| 922 | - } |
|
| 922 | + } |
|
| 923 | 923 | |
| 924 | 924 | if ( !$original_item ) { |
| 925 | 925 | gravityview()->log->error( 'An item was not available when rendering the output; maybe it was added by a plugin that is now de-activated.', array(' data' => array('available_items' => $available_items, 'field' => $field ) ) ); |
@@ -1001,13 +1001,13 @@ discard block |
||
| 1001 | 1001 | } |
| 1002 | 1002 | |
| 1003 | 1003 | /** |
| 1004 | - * Renders "Add Field" tooltips |
|
| 1005 | - * |
|
| 1006 | - * @since 2.0.11 |
|
| 1007 | - * |
|
| 1004 | + * Renders "Add Field" tooltips |
|
| 1005 | + * |
|
| 1006 | + * @since 2.0.11 |
|
| 1007 | + * |
|
| 1008 | 1008 | * @param string $context "directory", "single", or "edit" |
| 1009 | - * |
|
| 1010 | - * @return void |
|
| 1009 | + * |
|
| 1010 | + * @return void |
|
| 1011 | 1011 | */ |
| 1012 | 1012 | function render_field_pickers( $context = 'directory' ) { |
| 1013 | 1013 | |
@@ -1034,7 +1034,7 @@ discard block |
||
| 1034 | 1034 | </div> |
| 1035 | 1035 | <?php |
| 1036 | 1036 | } |
| 1037 | - } |
|
| 1037 | + } |
|
| 1038 | 1038 | |
| 1039 | 1039 | /** |
| 1040 | 1040 | * Render the Template Active Areas and configured active fields for a given template id and post id |
@@ -1100,7 +1100,7 @@ discard block |
||
| 1100 | 1100 | $is_widgets_page = ( $pagenow === 'widgets.php' ); |
| 1101 | 1101 | |
| 1102 | 1102 | // Add the GV font (with the Astronaut) |
| 1103 | - wp_enqueue_style( 'gravityview_global', plugins_url('assets/css/admin-global.css', GRAVITYVIEW_FILE), array(), \GV\Plugin::$version ); |
|
| 1103 | + wp_enqueue_style( 'gravityview_global', plugins_url('assets/css/admin-global.css', GRAVITYVIEW_FILE), array(), \GV\Plugin::$version ); |
|
| 1104 | 1104 | wp_register_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array( 'dashicons', 'wp-jquery-ui-dialog' ), \GV\Plugin::$version ); |
| 1105 | 1105 | |
| 1106 | 1106 | wp_register_script( 'gravityview-jquery-cookie', plugins_url('assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE), array( 'jquery' ), \GV\Plugin::$version, true ); |
@@ -1108,63 +1108,63 @@ discard block |
||
| 1108 | 1108 | if( GFForms::get_page() === 'form_list' ) { |
| 1109 | 1109 | wp_enqueue_style( 'gravityview_views_styles' ); |
| 1110 | 1110 | return; |
| 1111 | - } |
|
| 1111 | + } |
|
| 1112 | 1112 | |
| 1113 | 1113 | // Don't process any scripts below here if it's not a GravityView page. |
| 1114 | 1114 | if( ! gravityview()->request->is_admin( $hook, 'single' ) && ! $is_widgets_page ) { |
| 1115 | - return; |
|
| 1115 | + return; |
|
| 1116 | 1116 | } |
| 1117 | 1117 | |
| 1118 | - wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
| 1119 | - wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), \GV\Plugin::$version ); |
|
| 1120 | - |
|
| 1121 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
| 1122 | - |
|
| 1123 | - //enqueue scripts |
|
| 1124 | - wp_enqueue_script( 'gravityview_views_scripts', plugins_url( 'assets/js/admin-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'jquery-ui-dialog', 'gravityview-jquery-cookie', 'jquery-ui-datepicker', 'underscore' ), \GV\Plugin::$version ); |
|
| 1125 | - |
|
| 1126 | - wp_localize_script('gravityview_views_scripts', 'gvGlobals', array( |
|
| 1127 | - 'cookiepath' => COOKIEPATH, |
|
| 1128 | - 'passed_form_id' => (bool) \GV\Utils::_GET( 'form_id' ), |
|
| 1129 | - 'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ), |
|
| 1130 | - 'label_viewname' => __( 'Enter View name here', 'gravityview' ), |
|
| 1131 | - 'label_close' => __( 'Close', 'gravityview' ), |
|
| 1132 | - 'label_cancel' => __( 'Cancel', 'gravityview' ), |
|
| 1133 | - 'label_continue' => __( 'Continue', 'gravityview' ), |
|
| 1134 | - 'label_ok' => __( 'Ok', 'gravityview' ), |
|
| 1135 | - 'label_publisherror' => __( 'Error while creating the View for you. Check the settings or contact GravityView support.', 'gravityview' ), |
|
| 1136 | - 'loading_text' => esc_html__( 'Loading…', 'gravityview' ), |
|
| 1137 | - 'loading_error' => esc_html__( 'There was an error loading dynamic content.', 'gravityview' ), |
|
| 1138 | - 'field_loaderror' => __( 'Error while adding the field. Please try again or contact GravityView support.', 'gravityview' ), |
|
| 1139 | - 'remove_all_fields' => __( 'Would you like to remove all fields in this zone? (You are seeing this message because you were holding down the ALT key)', 'gravityview' ), |
|
| 1140 | - )); |
|
| 1118 | + wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
| 1119 | + wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), \GV\Plugin::$version ); |
|
| 1120 | + |
|
| 1121 | + $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
| 1122 | + |
|
| 1123 | + //enqueue scripts |
|
| 1124 | + wp_enqueue_script( 'gravityview_views_scripts', plugins_url( 'assets/js/admin-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'jquery-ui-dialog', 'gravityview-jquery-cookie', 'jquery-ui-datepicker', 'underscore' ), \GV\Plugin::$version ); |
|
| 1125 | + |
|
| 1126 | + wp_localize_script('gravityview_views_scripts', 'gvGlobals', array( |
|
| 1127 | + 'cookiepath' => COOKIEPATH, |
|
| 1128 | + 'passed_form_id' => (bool) \GV\Utils::_GET( 'form_id' ), |
|
| 1129 | + 'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ), |
|
| 1130 | + 'label_viewname' => __( 'Enter View name here', 'gravityview' ), |
|
| 1131 | + 'label_close' => __( 'Close', 'gravityview' ), |
|
| 1132 | + 'label_cancel' => __( 'Cancel', 'gravityview' ), |
|
| 1133 | + 'label_continue' => __( 'Continue', 'gravityview' ), |
|
| 1134 | + 'label_ok' => __( 'Ok', 'gravityview' ), |
|
| 1135 | + 'label_publisherror' => __( 'Error while creating the View for you. Check the settings or contact GravityView support.', 'gravityview' ), |
|
| 1136 | + 'loading_text' => esc_html__( 'Loading…', 'gravityview' ), |
|
| 1137 | + 'loading_error' => esc_html__( 'There was an error loading dynamic content.', 'gravityview' ), |
|
| 1138 | + 'field_loaderror' => __( 'Error while adding the field. Please try again or contact GravityView support.', 'gravityview' ), |
|
| 1139 | + 'remove_all_fields' => __( 'Would you like to remove all fields in this zone? (You are seeing this message because you were holding down the ALT key)', 'gravityview' ), |
|
| 1140 | + )); |
|
| 1141 | 1141 | |
| 1142 | 1142 | wp_enqueue_style( 'gravityview_views_styles' ); |
| 1143 | 1143 | |
| 1144 | - // Enqueue scripts needed for merge tags |
|
| 1145 | - self::enqueue_gravity_forms_scripts(); |
|
| 1144 | + // Enqueue scripts needed for merge tags |
|
| 1145 | + self::enqueue_gravity_forms_scripts(); |
|
| 1146 | 1146 | } |
| 1147 | 1147 | |
| 1148 | 1148 | /** |
| 1149 | 1149 | * Enqueue Gravity Forms scripts, needed for Merge Tags |
| 1150 | - * |
|
| 1151 | - * @since 1.0.5-beta |
|
| 1152 | - * |
|
| 1153 | - * @return void |
|
| 1150 | + * |
|
| 1151 | + * @since 1.0.5-beta |
|
| 1152 | + * |
|
| 1153 | + * @return void |
|
| 1154 | 1154 | */ |
| 1155 | 1155 | static function enqueue_gravity_forms_scripts() { |
| 1156 | 1156 | GFForms::register_scripts(); |
| 1157 | 1157 | |
| 1158 | 1158 | $scripts = array( |
| 1159 | - 'sack', |
|
| 1160 | - 'gform_gravityforms', |
|
| 1161 | - 'gform_forms', |
|
| 1162 | - 'gform_form_admin', |
|
| 1163 | - 'jquery-ui-autocomplete' |
|
| 1159 | + 'sack', |
|
| 1160 | + 'gform_gravityforms', |
|
| 1161 | + 'gform_forms', |
|
| 1162 | + 'gform_form_admin', |
|
| 1163 | + 'jquery-ui-autocomplete' |
|
| 1164 | 1164 | ); |
| 1165 | 1165 | |
| 1166 | 1166 | if ( wp_is_mobile() ) { |
| 1167 | - $scripts[] = 'jquery-touch-punch'; |
|
| 1167 | + $scripts[] = 'jquery-touch-punch'; |
|
| 1168 | 1168 | } |
| 1169 | 1169 | |
| 1170 | 1170 | wp_enqueue_script( $scripts ); |
@@ -27,32 +27,32 @@ discard block |
||
| 27 | 27 | add_filter( 'gravityview_blacklist_field_types', array( $this, 'default_field_blacklist' ), 10, 2 ); |
| 28 | 28 | |
| 29 | 29 | // Tooltips |
| 30 | - add_filter( 'gform_tooltips', array( $this, 'tooltips') ); |
|
| 30 | + add_filter( 'gform_tooltips', array( $this, 'tooltips' ) ); |
|
| 31 | 31 | |
| 32 | 32 | // adding styles and scripts |
| 33 | - add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles'), 999 ); |
|
| 34 | - add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict') ); |
|
| 35 | - add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict') ); |
|
| 36 | - add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict') ); |
|
| 37 | - add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict') ); |
|
| 38 | - |
|
| 39 | - add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas'), 10, 4 ); |
|
| 40 | - add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas'), 10, 3 ); |
|
| 41 | - add_action( 'gravityview_render_field_pickers', array( $this, 'render_field_pickers') ); |
|
| 42 | - add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields'), 10, 2 ); |
|
| 43 | - add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets') ); |
|
| 44 | - add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas'), 10, 5 ); |
|
| 33 | + add_action( 'admin_enqueue_scripts', array( 'GravityView_Admin_Views', 'add_scripts_and_styles' ), 999 ); |
|
| 34 | + add_filter( 'gform_noconflict_styles', array( $this, 'register_no_conflict' ) ); |
|
| 35 | + add_filter( 'gform_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
|
| 36 | + add_filter( 'gravityview_noconflict_styles', array( $this, 'register_no_conflict' ) ); |
|
| 37 | + add_filter( 'gravityview_noconflict_scripts', array( $this, 'register_no_conflict' ) ); |
|
| 38 | + |
|
| 39 | + add_action( 'gravityview_render_directory_active_areas', array( $this, 'render_directory_active_areas' ), 10, 4 ); |
|
| 40 | + add_action( 'gravityview_render_widgets_active_areas', array( $this, 'render_widgets_active_areas' ), 10, 3 ); |
|
| 41 | + add_action( 'gravityview_render_field_pickers', array( $this, 'render_field_pickers' ) ); |
|
| 42 | + add_action( 'gravityview_render_available_fields', array( $this, 'render_available_fields' ), 10, 2 ); |
|
| 43 | + add_action( 'gravityview_render_available_widgets', array( $this, 'render_available_widgets' ) ); |
|
| 44 | + add_action( 'gravityview_render_active_areas', array( $this, 'render_active_areas' ), 10, 5 ); |
|
| 45 | 45 | |
| 46 | 46 | // @todo check if this hook is needed.. |
| 47 | 47 | //add_action( 'gravityview_render_field_options', array( $this, 'render_field_options'), 10, 9 ); |
| 48 | 48 | |
| 49 | 49 | // Add Connected Form column |
| 50 | - add_filter('manage_gravityview_posts_columns' , array( $this, 'add_post_type_columns' ) ); |
|
| 50 | + add_filter( 'manage_gravityview_posts_columns', array( $this, 'add_post_type_columns' ) ); |
|
| 51 | 51 | |
| 52 | 52 | add_filter( 'gform_toolbar_menu', array( 'GravityView_Admin_Views', 'gform_toolbar_menu' ), 10, 2 ); |
| 53 | 53 | add_action( 'gform_form_actions', array( 'GravityView_Admin_Views', 'gform_toolbar_menu' ), 10, 2 ); |
| 54 | 54 | |
| 55 | - add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content'), 10, 2 ); |
|
| 55 | + add_action( 'manage_gravityview_posts_custom_column', array( $this, 'add_custom_column_content' ), 10, 2 ); |
|
| 56 | 56 | |
| 57 | 57 | add_action( 'restrict_manage_posts', array( $this, 'add_view_dropdown' ) ); |
| 58 | 58 | |
@@ -71,11 +71,11 @@ discard block |
||
| 71 | 71 | */ |
| 72 | 72 | function suggest_support_articles( $localization_data = array() ) { |
| 73 | 73 | |
| 74 | - if( ! gravityview()->request->is_view() ) { |
|
| 74 | + if ( ! gravityview()->request->is_view() ) { |
|
| 75 | 75 | return $localization_data; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - $localization_data['suggest'] = array( |
|
| 78 | + $localization_data[ 'suggest' ] = array( |
|
| 79 | 79 | '57ef23539033602e61d4a560', |
| 80 | 80 | '54c67bb9e4b0512429885513', |
| 81 | 81 | '54c67bb9e4b0512429885512', |
@@ -96,13 +96,13 @@ discard block |
||
| 96 | 96 | public function filter_pre_get_posts_by_gravityview_form_id( &$query ) { |
| 97 | 97 | global $pagenow; |
| 98 | 98 | |
| 99 | - if ( !is_admin() ) { |
|
| 99 | + if ( ! is_admin() ) { |
|
| 100 | 100 | return; |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - $form_id = isset( $_GET['gravityview_form_id'] ) ? (int) $_GET['gravityview_form_id'] : false; |
|
| 103 | + $form_id = isset( $_GET[ 'gravityview_form_id' ] ) ? (int)$_GET[ 'gravityview_form_id' ] : false; |
|
| 104 | 104 | |
| 105 | - if( 'edit.php' !== $pagenow || ! $form_id || ! isset( $query->query_vars[ 'post_type' ] ) ) { |
|
| 105 | + if ( 'edit.php' !== $pagenow || ! $form_id || ! isset( $query->query_vars[ 'post_type' ] ) ) { |
|
| 106 | 106 | return; |
| 107 | 107 | } |
| 108 | 108 | |
@@ -119,18 +119,18 @@ discard block |
||
| 119 | 119 | function add_view_dropdown() { |
| 120 | 120 | $current_screen = get_current_screen(); |
| 121 | 121 | |
| 122 | - if( 'gravityview' !== $current_screen->post_type ) { |
|
| 122 | + if ( 'gravityview' !== $current_screen->post_type ) { |
|
| 123 | 123 | return; |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | $forms = gravityview_get_forms(); |
| 127 | 127 | $current_form = \GV\Utils::_GET( 'gravityview_form_id' ); |
| 128 | 128 | // If there are no forms to select, show no forms. |
| 129 | - if( !empty( $forms ) ) { ?> |
|
| 129 | + if ( ! empty( $forms ) ) { ?> |
|
| 130 | 130 | <select name="gravityview_form_id" id="gravityview_form_id"> |
| 131 | 131 | <option value="" <?php selected( '', $current_form, true ); ?>><?php esc_html_e( 'All forms', 'gravityview' ); ?></option> |
| 132 | - <?php foreach( $forms as $form ) { ?> |
|
| 133 | - <option value="<?php echo $form['id']; ?>" <?php selected( $form['id'], $current_form, true ); ?>><?php echo esc_html( $form['title'] ); ?></option> |
|
| 132 | + <?php foreach ( $forms as $form ) { ?> |
|
| 133 | + <option value="<?php echo $form[ 'id' ]; ?>" <?php selected( $form[ 'id' ], $current_form, true ); ?>><?php echo esc_html( $form[ 'title' ] ); ?></option> |
|
| 134 | 134 | <?php } ?> |
| 135 | 135 | </select> |
| 136 | 136 | <?php } |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | */ |
| 144 | 144 | public static function render_setting_row( $key = '', $current_settings = array(), $override_input = null, $name = 'template_settings[%s]', $id = 'gravityview_se_%s' ) { |
| 145 | 145 | _deprecated_function( 'GravityView_Admin_Views::render_setting_row', '1.1.7', 'GravityView_Render_Settings::render_setting_row' ); |
| 146 | - GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name , $id ); |
|
| 146 | + GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name, $id ); |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | /** |
@@ -168,13 +168,13 @@ discard block |
||
| 168 | 168 | |
| 169 | 169 | $priority = 0; |
| 170 | 170 | |
| 171 | - if( 'form_list' === GFForms::get_page() ) { |
|
| 171 | + if ( 'form_list' === GFForms::get_page() ) { |
|
| 172 | 172 | $priority = 790; |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | - if( empty( $connected_views ) ) { |
|
| 175 | + if ( empty( $connected_views ) ) { |
|
| 176 | 176 | |
| 177 | - $menu_items['gravityview'] = array( |
|
| 177 | + $menu_items[ 'gravityview' ] = array( |
|
| 178 | 178 | 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
| 179 | 179 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', |
| 180 | 180 | 'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ), |
@@ -190,22 +190,22 @@ discard block |
||
| 190 | 190 | $sub_menu_items = array(); |
| 191 | 191 | foreach ( (array)$connected_views as $view ) { |
| 192 | 192 | |
| 193 | - if( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) { |
|
| 193 | + if ( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) { |
|
| 194 | 194 | continue; |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | - $label = empty( $view->post_title ) ? sprintf( __('No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title; |
|
| 197 | + $label = empty( $view->post_title ) ? sprintf( __( 'No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title; |
|
| 198 | 198 | |
| 199 | - $sub_menu_items[] = array( |
|
| 199 | + $sub_menu_items[ ] = array( |
|
| 200 | 200 | 'label' => esc_attr( $label ), |
| 201 | - 'url' => admin_url( 'post.php?action=edit&post='.$view->ID ), |
|
| 201 | + 'url' => admin_url( 'post.php?action=edit&post=' . $view->ID ), |
|
| 202 | 202 | ); |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | // If there were no items added, then let's create the parent menu |
| 206 | - if( $sub_menu_items ) { |
|
| 206 | + if ( $sub_menu_items ) { |
|
| 207 | 207 | |
| 208 | - $sub_menu_items[] = array( |
|
| 208 | + $sub_menu_items[ ] = array( |
|
| 209 | 209 | 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
| 210 | 210 | 'link_class' => 'gv-create-view', |
| 211 | 211 | 'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ), |
@@ -214,14 +214,14 @@ discard block |
||
| 214 | 214 | ); |
| 215 | 215 | |
| 216 | 216 | // Make sure Gravity Forms uses the submenu; if there's only one item, it uses a link instead of a dropdown |
| 217 | - $sub_menu_items[] = array( |
|
| 217 | + $sub_menu_items[ ] = array( |
|
| 218 | 218 | 'url' => '#', |
| 219 | 219 | 'label' => '', |
| 220 | 220 | 'menu_class' => 'hidden', |
| 221 | 221 | 'capabilities' => '', |
| 222 | 222 | ); |
| 223 | 223 | |
| 224 | - $menu_items['gravityview'] = array( |
|
| 224 | + $menu_items[ 'gravityview' ] = array( |
|
| 225 | 225 | 'label' => __( 'Connected Views', 'gravityview' ), |
| 226 | 226 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', |
| 227 | 227 | 'title' => __( 'GravityView Views using this form as a data source', 'gravityview' ), |
@@ -250,8 +250,8 @@ discard block |
||
| 250 | 250 | $add = array( 'captcha', 'page' ); |
| 251 | 251 | |
| 252 | 252 | // Don't allowing editing the following values: |
| 253 | - if( $context === 'edit' ) { |
|
| 254 | - $add[] = 'post_id'; |
|
| 253 | + if ( $context === 'edit' ) { |
|
| 254 | + $add[ ] = 'post_id'; |
|
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | $return = array_merge( $array, $add ); |
@@ -274,32 +274,32 @@ discard block |
||
| 274 | 274 | foreach ( $default_args as $key => $arg ) { |
| 275 | 275 | |
| 276 | 276 | // If an arg has `tooltip` defined, but it's false, don't display a tooltip |
| 277 | - if( isset( $arg['tooltip'] ) && empty( $arg['tooltip'] ) ) { continue; } |
|
| 277 | + if ( isset( $arg[ 'tooltip' ] ) && empty( $arg[ 'tooltip' ] ) ) { continue; } |
|
| 278 | 278 | |
| 279 | 279 | // By default, use `tooltip` if defined. |
| 280 | - $tooltip = empty( $arg['tooltip'] ) ? NULL : $arg['tooltip']; |
|
| 280 | + $tooltip = empty( $arg[ 'tooltip' ] ) ? NULL : $arg[ 'tooltip' ]; |
|
| 281 | 281 | |
| 282 | 282 | // Otherwise, use the description as a tooltip. |
| 283 | - if( empty( $tooltip ) && !empty( $arg['desc'] ) ) { |
|
| 284 | - $tooltip = $arg['desc']; |
|
| 283 | + if ( empty( $tooltip ) && ! empty( $arg[ 'desc' ] ) ) { |
|
| 284 | + $tooltip = $arg[ 'desc' ]; |
|
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | // If there's no tooltip set, continue |
| 288 | - if( empty( $tooltip ) ) { |
|
| 288 | + if ( empty( $tooltip ) ) { |
|
| 289 | 289 | continue; |
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | // Add the tooltip |
| 293 | - $gv_tooltips[ 'gv_'.$key ] = array( |
|
| 294 | - 'title' => $arg['label'], |
|
| 293 | + $gv_tooltips[ 'gv_' . $key ] = array( |
|
| 294 | + 'title' => $arg[ 'label' ], |
|
| 295 | 295 | 'value' => $tooltip, |
| 296 | 296 | ); |
| 297 | 297 | |
| 298 | 298 | } |
| 299 | 299 | |
| 300 | - $gv_tooltips['gv_css_merge_tags'] = array( |
|
| 301 | - 'title' => __('CSS Merge Tags', 'gravityview'), |
|
| 302 | - 'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview'), '<code>', '</code>' ) |
|
| 300 | + $gv_tooltips[ 'gv_css_merge_tags' ] = array( |
|
| 301 | + 'title' => __( 'CSS Merge Tags', 'gravityview' ), |
|
| 302 | + 'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview' ), '<code>', '</code>' ) |
|
| 303 | 303 | ); |
| 304 | 304 | |
| 305 | 305 | /** |
@@ -317,9 +317,9 @@ discard block |
||
| 317 | 317 | |
| 318 | 318 | foreach ( $gv_tooltips as $key => $tooltip ) { |
| 319 | 319 | |
| 320 | - $title = empty( $tooltip['title'] ) ? '' : '<h6>'.esc_html( $tooltip['title'] ) .'</h6>'; |
|
| 320 | + $title = empty( $tooltip[ 'title' ] ) ? '' : '<h6>' . esc_html( $tooltip[ 'title' ] ) . '</h6>'; |
|
| 321 | 321 | |
| 322 | - $tooltips[ $key ] = $title . wpautop( esc_html( $tooltip['value'] ) ); |
|
| 322 | + $tooltips[ $key ] = $title . wpautop( esc_html( $tooltip[ 'value' ] ) ); |
|
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | return $tooltips; |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | * |
| 334 | 334 | * @return void |
| 335 | 335 | */ |
| 336 | - public function add_custom_column_content( $column_name = NULL, $post_id ) { |
|
| 336 | + public function add_custom_column_content( $column_name = NULL, $post_id ) { |
|
| 337 | 337 | |
| 338 | 338 | $output = ''; |
| 339 | 339 | |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | // Generate backup if label doesn't exist: `example_name` => `Example Name` |
| 356 | 356 | $template_id_pretty = ucwords( implode( ' ', explode( '_', $template_id ) ) ); |
| 357 | 357 | |
| 358 | - $output = $template ? $template['label'] : $template_id_pretty; |
|
| 358 | + $output = $template ? $template[ 'label' ] : $template_id_pretty; |
|
| 359 | 359 | |
| 360 | 360 | break; |
| 361 | 361 | |
@@ -396,44 +396,44 @@ discard block |
||
| 396 | 396 | static public function get_connected_form_links( $form, $include_form_link = true ) { |
| 397 | 397 | |
| 398 | 398 | // Either the form is empty or the form ID is 0, not yet set. |
| 399 | - if( empty( $form ) ) { |
|
| 399 | + if ( empty( $form ) ) { |
|
| 400 | 400 | return ''; |
| 401 | 401 | } |
| 402 | 402 | |
| 403 | 403 | // The $form is passed as the form ID |
| 404 | - if( !is_array( $form ) ) { |
|
| 404 | + if ( ! is_array( $form ) ) { |
|
| 405 | 405 | $form = gravityview_get_form( $form ); |
| 406 | 406 | } |
| 407 | 407 | |
| 408 | - $form_id = $form['id']; |
|
| 408 | + $form_id = $form[ 'id' ]; |
|
| 409 | 409 | $links = array(); |
| 410 | 410 | |
| 411 | - if( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) { |
|
| 411 | + if ( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) { |
|
| 412 | 412 | $form_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&id=%d', $form_id ) ); |
| 413 | - $form_link = '<strong class="gv-form-title">'.gravityview_get_link( $form_url, $form['title'], 'class=row-title' ).'</strong>'; |
|
| 414 | - $links[] = '<span>'.gravityview_get_link( $form_url, __('Edit Form', 'gravityview') ).'</span>'; |
|
| 413 | + $form_link = '<strong class="gv-form-title">' . gravityview_get_link( $form_url, $form[ 'title' ], 'class=row-title' ) . '</strong>'; |
|
| 414 | + $links[ ] = '<span>' . gravityview_get_link( $form_url, __( 'Edit Form', 'gravityview' ) ) . '</span>'; |
|
| 415 | 415 | } else { |
| 416 | - $form_link = '<strong class="gv-form-title">'. esc_html( $form['title'] ). '</strong>'; |
|
| 416 | + $form_link = '<strong class="gv-form-title">' . esc_html( $form[ 'title' ] ) . '</strong>'; |
|
| 417 | 417 | } |
| 418 | 418 | |
| 419 | - if( GVCommon::has_cap( 'gravityforms_view_entries' ) ) { |
|
| 419 | + if ( GVCommon::has_cap( 'gravityforms_view_entries' ) ) { |
|
| 420 | 420 | $entries_url = admin_url( sprintf( 'admin.php?page=gf_entries&id=%d', $form_id ) ); |
| 421 | - $links[] = '<span>'.gravityview_get_link( $entries_url, __('Entries', 'gravityview') ).'</span>'; |
|
| 421 | + $links[ ] = '<span>' . gravityview_get_link( $entries_url, __( 'Entries', 'gravityview' ) ) . '</span>'; |
|
| 422 | 422 | } |
| 423 | 423 | |
| 424 | - if( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) { |
|
| 424 | + if ( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) { |
|
| 425 | 425 | $settings_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&view=settings&id=%d', $form_id ) ); |
| 426 | - $links[] = '<span>'.gravityview_get_link( $settings_url, __('Settings', 'gravityview'), 'title='.__('Edit settings for this form', 'gravityview') ).'</span>'; |
|
| 426 | + $links[ ] = '<span>' . gravityview_get_link( $settings_url, __( 'Settings', 'gravityview' ), 'title=' . __( 'Edit settings for this form', 'gravityview' ) ) . '</span>'; |
|
| 427 | 427 | } |
| 428 | 428 | |
| 429 | - if( GVCommon::has_cap( array("gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms") ) ) { |
|
| 429 | + if ( GVCommon::has_cap( array( "gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms" ) ) ) { |
|
| 430 | 430 | $preview_url = site_url( sprintf( '?gf_page=preview&id=%d', $form_id ) ); |
| 431 | - $links[] = '<span>'.gravityview_get_link( $preview_url, __('Preview Form', 'gravityview'), 'title='.__('Preview this form', 'gravityview') ).'</span>'; |
|
| 431 | + $links[ ] = '<span>' . gravityview_get_link( $preview_url, __( 'Preview Form', 'gravityview' ), 'title=' . __( 'Preview this form', 'gravityview' ) ) . '</span>'; |
|
| 432 | 432 | } |
| 433 | 433 | |
| 434 | 434 | $output = ''; |
| 435 | 435 | |
| 436 | - if( !empty( $include_form_link ) ) { |
|
| 436 | + if ( ! empty( $include_form_link ) ) { |
|
| 437 | 437 | $output .= $form_link; |
| 438 | 438 | } |
| 439 | 439 | |
@@ -445,7 +445,7 @@ discard block |
||
| 445 | 445 | */ |
| 446 | 446 | $links = apply_filters( 'gravityview_connected_form_links', $links, $form ); |
| 447 | 447 | |
| 448 | - $output .= '<div class="row-actions">'. implode( ' | ', $links ) .'</div>'; |
|
| 448 | + $output .= '<div class="row-actions">' . implode( ' | ', $links ) . '</div>'; |
|
| 449 | 449 | |
| 450 | 450 | return $output; |
| 451 | 451 | } |
@@ -459,8 +459,8 @@ discard block |
||
| 459 | 459 | // Get the date column and save it for later to add back in. |
| 460 | 460 | // This adds it after the Data Source column. |
| 461 | 461 | // This way, we don't need to do array_slice, array_merge, etc. |
| 462 | - $date = $columns['date']; |
|
| 463 | - unset( $columns['date'] ); |
|
| 462 | + $date = $columns[ 'date' ]; |
|
| 463 | + unset( $columns[ 'date' ] ); |
|
| 464 | 464 | |
| 465 | 465 | $data_source_required_caps = array( |
| 466 | 466 | 'gravityforms_edit_forms', |
@@ -471,14 +471,14 @@ discard block |
||
| 471 | 471 | 'gravityforms_preview_forms', |
| 472 | 472 | ); |
| 473 | 473 | |
| 474 | - if( GVCommon::has_cap( $data_source_required_caps ) ) { |
|
| 475 | - $columns['gv_connected_form'] = __( 'Data Source', 'gravityview' ); |
|
| 474 | + if ( GVCommon::has_cap( $data_source_required_caps ) ) { |
|
| 475 | + $columns[ 'gv_connected_form' ] = __( 'Data Source', 'gravityview' ); |
|
| 476 | 476 | } |
| 477 | 477 | |
| 478 | - $columns['gv_template'] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' ); |
|
| 478 | + $columns[ 'gv_template' ] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' ); |
|
| 479 | 479 | |
| 480 | 480 | // Add the date back in. |
| 481 | - $columns['date'] = $date; |
|
| 481 | + $columns[ 'date' ] = $date; |
|
| 482 | 482 | |
| 483 | 483 | return $columns; |
| 484 | 484 | } |
@@ -492,12 +492,12 @@ discard block |
||
| 492 | 492 | */ |
| 493 | 493 | function save_postdata( $post_id ) { |
| 494 | 494 | |
| 495 | - if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ){ |
|
| 495 | + if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
| 496 | 496 | return; |
| 497 | 497 | } |
| 498 | 498 | |
| 499 | 499 | // validate post_type |
| 500 | - if ( ! isset( $_POST['post_type'] ) || 'gravityview' != $_POST['post_type'] ) { |
|
| 500 | + if ( ! isset( $_POST[ 'post_type' ] ) || 'gravityview' != $_POST[ 'post_type' ] ) { |
|
| 501 | 501 | return; |
| 502 | 502 | } |
| 503 | 503 | |
@@ -512,65 +512,65 @@ discard block |
||
| 512 | 512 | $statii = array(); |
| 513 | 513 | |
| 514 | 514 | // check if this is a start fresh View |
| 515 | - if ( isset( $_POST['gravityview_select_form_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_form_nonce'], 'gravityview_select_form' ) ) { |
|
| 515 | + if ( isset( $_POST[ 'gravityview_select_form_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_form_nonce' ], 'gravityview_select_form' ) ) { |
|
| 516 | 516 | |
| 517 | - $form_id = !empty( $_POST['gravityview_form_id'] ) ? $_POST['gravityview_form_id'] : ''; |
|
| 517 | + $form_id = ! empty( $_POST[ 'gravityview_form_id' ] ) ? $_POST[ 'gravityview_form_id' ] : ''; |
|
| 518 | 518 | // save form id |
| 519 | - $statii['form_id'] = update_post_meta( $post_id, '_gravityview_form_id', $form_id ); |
|
| 519 | + $statii[ 'form_id' ] = update_post_meta( $post_id, '_gravityview_form_id', $form_id ); |
|
| 520 | 520 | |
| 521 | 521 | } |
| 522 | 522 | |
| 523 | - if( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii['form_id'] ) ) { |
|
| 523 | + if ( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii[ 'form_id' ] ) ) { |
|
| 524 | 524 | gravityview()->log->error( 'Current user does not have the capability to create a new Form.', array( 'data' => wp_get_current_user() ) ); |
| 525 | 525 | return; |
| 526 | 526 | } |
| 527 | 527 | |
| 528 | 528 | // Was this a start fresh? |
| 529 | - if ( ! empty( $_POST['gravityview_form_id_start_fresh'] ) ) { |
|
| 530 | - $statii['start_fresh'] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 ); |
|
| 529 | + if ( ! empty( $_POST[ 'gravityview_form_id_start_fresh' ] ) ) { |
|
| 530 | + $statii[ 'start_fresh' ] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 ); |
|
| 531 | 531 | } else { |
| 532 | - $statii['start_fresh'] = delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
|
| 532 | + $statii[ 'start_fresh' ] = delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
|
| 533 | 533 | } |
| 534 | 534 | |
| 535 | 535 | // Check if we have a template id |
| 536 | - if ( isset( $_POST['gravityview_select_template_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_template_nonce'], 'gravityview_select_template' ) ) { |
|
| 536 | + if ( isset( $_POST[ 'gravityview_select_template_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_template_nonce' ], 'gravityview_select_template' ) ) { |
|
| 537 | 537 | |
| 538 | - $template_id = !empty( $_POST['gravityview_directory_template'] ) ? $_POST['gravityview_directory_template'] : ''; |
|
| 538 | + $template_id = ! empty( $_POST[ 'gravityview_directory_template' ] ) ? $_POST[ 'gravityview_directory_template' ] : ''; |
|
| 539 | 539 | |
| 540 | 540 | // now save template id |
| 541 | - $statii['directory_template'] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id ); |
|
| 541 | + $statii[ 'directory_template' ] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id ); |
|
| 542 | 542 | } |
| 543 | 543 | |
| 544 | 544 | |
| 545 | 545 | // save View Configuration metabox |
| 546 | - if ( isset( $_POST['gravityview_view_configuration_nonce'] ) && wp_verify_nonce( $_POST['gravityview_view_configuration_nonce'], 'gravityview_view_configuration' ) ) { |
|
| 546 | + if ( isset( $_POST[ 'gravityview_view_configuration_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_view_configuration_nonce' ], 'gravityview_view_configuration' ) ) { |
|
| 547 | 547 | |
| 548 | 548 | // template settings |
| 549 | - if( empty( $_POST['template_settings'] ) ) { |
|
| 550 | - $_POST['template_settings'] = array(); |
|
| 549 | + if ( empty( $_POST[ 'template_settings' ] ) ) { |
|
| 550 | + $_POST[ 'template_settings' ] = array(); |
|
| 551 | 551 | } |
| 552 | - $statii['template_settings'] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST['template_settings'] ); |
|
| 552 | + $statii[ 'template_settings' ] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST[ 'template_settings' ] ); |
|
| 553 | 553 | |
| 554 | 554 | $fields = array(); |
| 555 | 555 | |
| 556 | 556 | // Directory&single Visible Fields |
| 557 | - if( !empty( $preset_fields ) ) { |
|
| 557 | + if ( ! empty( $preset_fields ) ) { |
|
| 558 | 558 | |
| 559 | 559 | $fields = $preset_fields; |
| 560 | 560 | |
| 561 | - } elseif( !empty( $_POST['gv_fields'] ) ) { |
|
| 561 | + } elseif ( ! empty( $_POST[ 'gv_fields' ] ) ) { |
|
| 562 | 562 | $fields = _gravityview_process_posted_fields(); |
| 563 | 563 | } |
| 564 | 564 | |
| 565 | 565 | $fields = wp_slash( $fields ); |
| 566 | 566 | |
| 567 | - $statii['directory_fields'] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields ); |
|
| 567 | + $statii[ 'directory_fields' ] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields ); |
|
| 568 | 568 | |
| 569 | 569 | // Directory Visible Widgets |
| 570 | - if( empty( $_POST['widgets'] ) ) { |
|
| 571 | - $_POST['widgets'] = array(); |
|
| 570 | + if ( empty( $_POST[ 'widgets' ] ) ) { |
|
| 571 | + $_POST[ 'widgets' ] = array(); |
|
| 572 | 572 | } |
| 573 | - $statii['directory_widgets'] = gravityview_set_directory_widgets( $post_id, $_POST['widgets'] ); |
|
| 573 | + $statii[ 'directory_widgets' ] = gravityview_set_directory_widgets( $post_id, $_POST[ 'widgets' ] ); |
|
| 574 | 574 | |
| 575 | 575 | } // end save view configuration |
| 576 | 576 | |
@@ -580,7 +580,7 @@ discard block |
||
| 580 | 580 | * @param array $statii Array of statuses of the post meta saving processes. If saving worked, each key should be mapped to a value of the post ID (`directory_widgets` => `124`). If failed (or didn't change), the value will be false. |
| 581 | 581 | * @since 1.17.2 |
| 582 | 582 | */ |
| 583 | - do_action('gravityview_view_saved', $post_id, $statii ); |
|
| 583 | + do_action( 'gravityview_view_saved', $post_id, $statii ); |
|
| 584 | 584 | |
| 585 | 585 | gravityview()->log->debug( '[save_postdata] Update Post Meta Statuses (also returns false if nothing changed)', array( 'data' => array_map( 'intval', $statii ) ) ); |
| 586 | 586 | } |
@@ -624,20 +624,20 @@ discard block |
||
| 624 | 624 | |
| 625 | 625 | $output = ''; |
| 626 | 626 | |
| 627 | - if( !empty( $fields ) ) { |
|
| 627 | + if ( ! empty( $fields ) ) { |
|
| 628 | 628 | |
| 629 | - foreach( $fields as $id => $details ) { |
|
| 629 | + foreach ( $fields as $id => $details ) { |
|
| 630 | 630 | |
| 631 | - if( in_array( $details['type'], (array) $blacklist_field_types ) ) { |
|
| 631 | + if ( in_array( $details[ 'type' ], (array)$blacklist_field_types ) ) { |
|
| 632 | 632 | continue; |
| 633 | 633 | } |
| 634 | 634 | |
| 635 | 635 | // Edit mode only allows editing the parent fields, not single inputs. |
| 636 | - if( $context === 'edit' && !empty( $details['parent'] ) ) { |
|
| 636 | + if ( $context === 'edit' && ! empty( $details[ 'parent' ] ) ) { |
|
| 637 | 637 | continue; |
| 638 | 638 | } |
| 639 | 639 | |
| 640 | - $output .= new GravityView_Admin_View_Field( $details['label'], $id, $details, $settings = array(), $form ); |
|
| 640 | + $output .= new GravityView_Admin_View_Field( $details[ 'label' ], $id, $details, $settings = array(), $form ); |
|
| 641 | 641 | |
| 642 | 642 | } // End foreach |
| 643 | 643 | } |
@@ -645,7 +645,7 @@ discard block |
||
| 645 | 645 | echo $output; |
| 646 | 646 | |
| 647 | 647 | // For the EDIT view we only want to allow the form fields. |
| 648 | - if( $context === 'edit' ) { |
|
| 648 | + if ( $context === 'edit' ) { |
|
| 649 | 649 | return; |
| 650 | 650 | } |
| 651 | 651 | |
@@ -669,16 +669,16 @@ discard block |
||
| 669 | 669 | $additional_fields = apply_filters( 'gravityview_additional_fields', array( |
| 670 | 670 | array( |
| 671 | 671 | 'label_text' => __( '+ Add All Fields', 'gravityview' ), |
| 672 | - 'desc' => __('Add all the available fields at once.', 'gravityview'), |
|
| 672 | + 'desc' => __( 'Add all the available fields at once.', 'gravityview' ), |
|
| 673 | 673 | 'field_id' => 'all-fields', |
| 674 | 674 | 'label_type' => 'field', |
| 675 | 675 | 'input_type' => NULL, |
| 676 | 676 | 'field_options' => NULL, |
| 677 | 677 | 'settings_html' => NULL, |
| 678 | 678 | ) |
| 679 | - )); |
|
| 679 | + ) ); |
|
| 680 | 680 | |
| 681 | - if( !empty( $additional_fields )) { |
|
| 681 | + if ( ! empty( $additional_fields ) ) { |
|
| 682 | 682 | foreach ( (array)$additional_fields as $item ) { |
| 683 | 683 | |
| 684 | 684 | // Prevent items from not having index set |
@@ -689,16 +689,16 @@ discard block |
||
| 689 | 689 | 'input_type' => NULL, |
| 690 | 690 | 'field_options' => NULL, |
| 691 | 691 | 'settings_html' => NULL, |
| 692 | - )); |
|
| 692 | + ) ); |
|
| 693 | 693 | |
| 694 | 694 | // Backward compat. |
| 695 | - if( !empty( $item['field_options'] ) ) { |
|
| 695 | + if ( ! empty( $item[ 'field_options' ] ) ) { |
|
| 696 | 696 | // Use settings_html from now on. |
| 697 | - $item['settings_html'] = $item['field_options']; |
|
| 697 | + $item[ 'settings_html' ] = $item[ 'field_options' ]; |
|
| 698 | 698 | } |
| 699 | 699 | |
| 700 | 700 | // Render a label for each of them |
| 701 | - echo new GravityView_Admin_View_Field( $item['label_text'], $item['field_id'], $item, $settings = array(), $form ); |
|
| 701 | + echo new GravityView_Admin_View_Field( $item[ 'label_text' ], $item[ 'field_id' ], $item, $settings = array(), $form ); |
|
| 702 | 702 | |
| 703 | 703 | } |
| 704 | 704 | } |
@@ -711,54 +711,54 @@ discard block |
||
| 711 | 711 | * @param string $zone Either 'single', 'directory', 'header', 'footer' |
| 712 | 712 | * @return array |
| 713 | 713 | */ |
| 714 | - function get_entry_default_fields($form, $zone) { |
|
| 714 | + function get_entry_default_fields( $form, $zone ) { |
|
| 715 | 715 | |
| 716 | 716 | $entry_default_fields = array(); |
| 717 | 717 | |
| 718 | - if( in_array( $zone, array( 'directory', 'single' ) ) ) { |
|
| 718 | + if ( in_array( $zone, array( 'directory', 'single' ) ) ) { |
|
| 719 | 719 | |
| 720 | 720 | $entry_default_fields = array( |
| 721 | 721 | 'id' => array( |
| 722 | - 'label' => __('Entry ID', 'gravityview'), |
|
| 722 | + 'label' => __( 'Entry ID', 'gravityview' ), |
|
| 723 | 723 | 'type' => 'id', |
| 724 | - 'desc' => __('The unique ID of the entry.', 'gravityview'), |
|
| 724 | + 'desc' => __( 'The unique ID of the entry.', 'gravityview' ), |
|
| 725 | 725 | ), |
| 726 | 726 | 'date_created' => array( |
| 727 | - 'label' => __('Entry Date', 'gravityview'), |
|
| 728 | - 'desc' => __('The date the entry was created.', 'gravityview'), |
|
| 727 | + 'label' => __( 'Entry Date', 'gravityview' ), |
|
| 728 | + 'desc' => __( 'The date the entry was created.', 'gravityview' ), |
|
| 729 | 729 | 'type' => 'date_created', |
| 730 | 730 | ), |
| 731 | 731 | 'source_url' => array( |
| 732 | - 'label' => __('Source URL', 'gravityview'), |
|
| 732 | + 'label' => __( 'Source URL', 'gravityview' ), |
|
| 733 | 733 | 'type' => 'source_url', |
| 734 | - 'desc' => __('The URL of the page where the form was submitted.', 'gravityview'), |
|
| 734 | + 'desc' => __( 'The URL of the page where the form was submitted.', 'gravityview' ), |
|
| 735 | 735 | ), |
| 736 | 736 | 'ip' => array( |
| 737 | - 'label' => __('User IP', 'gravityview'), |
|
| 737 | + 'label' => __( 'User IP', 'gravityview' ), |
|
| 738 | 738 | 'type' => 'ip', |
| 739 | - 'desc' => __('The IP Address of the user who created the entry.', 'gravityview'), |
|
| 739 | + 'desc' => __( 'The IP Address of the user who created the entry.', 'gravityview' ), |
|
| 740 | 740 | ), |
| 741 | 741 | 'created_by' => array( |
| 742 | - 'label' => __('User', 'gravityview'), |
|
| 742 | + 'label' => __( 'User', 'gravityview' ), |
|
| 743 | 743 | 'type' => 'created_by', |
| 744 | - 'desc' => __('Details of the logged-in user who created the entry (if any).', 'gravityview'), |
|
| 744 | + 'desc' => __( 'Details of the logged-in user who created the entry (if any).', 'gravityview' ), |
|
| 745 | 745 | ), |
| 746 | 746 | |
| 747 | 747 | /** |
| 748 | 748 | * @since 1.7.2 |
| 749 | 749 | */ |
| 750 | 750 | 'other_entries' => array( |
| 751 | - 'label' => __('Other Entries', 'gravityview'), |
|
| 751 | + 'label' => __( 'Other Entries', 'gravityview' ), |
|
| 752 | 752 | 'type' => 'other_entries', |
| 753 | - 'desc' => __('Display other entries created by the entry creator.', 'gravityview'), |
|
| 753 | + 'desc' => __( 'Display other entries created by the entry creator.', 'gravityview' ), |
|
| 754 | 754 | ), |
| 755 | 755 | ); |
| 756 | 756 | |
| 757 | - if( 'single' !== $zone) { |
|
| 757 | + if ( 'single' !== $zone ) { |
|
| 758 | 758 | |
| 759 | - $entry_default_fields['entry_link'] = array( |
|
| 760 | - 'label' => __('Link to Entry', 'gravityview'), |
|
| 761 | - 'desc' => __('A dedicated link to the single entry with customizable text.', 'gravityview'), |
|
| 759 | + $entry_default_fields[ 'entry_link' ] = array( |
|
| 760 | + 'label' => __( 'Link to Entry', 'gravityview' ), |
|
| 761 | + 'desc' => __( 'A dedicated link to the single entry with customizable text.', 'gravityview' ), |
|
| 762 | 762 | 'type' => 'entry_link', |
| 763 | 763 | ); |
| 764 | 764 | } |
@@ -768,10 +768,10 @@ discard block |
||
| 768 | 768 | /** |
| 769 | 769 | * @since 1.2 |
| 770 | 770 | */ |
| 771 | - $entry_default_fields['custom'] = array( |
|
| 772 | - 'label' => __('Custom Content', 'gravityview'), |
|
| 771 | + $entry_default_fields[ 'custom' ] = array( |
|
| 772 | + 'label' => __( 'Custom Content', 'gravityview' ), |
|
| 773 | 773 | 'type' => 'custom', |
| 774 | - 'desc' => __('Insert custom text or HTML.', 'gravityview'), |
|
| 774 | + 'desc' => __( 'Insert custom text or HTML.', 'gravityview' ), |
|
| 775 | 775 | ); |
| 776 | 776 | |
| 777 | 777 | /** |
@@ -780,7 +780,7 @@ discard block |
||
| 780 | 780 | * @param string|array $form form_ID or form object |
| 781 | 781 | * @param string $zone Either 'single', 'directory', 'header', 'footer' |
| 782 | 782 | */ |
| 783 | - return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone); |
|
| 783 | + return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone ); |
|
| 784 | 784 | } |
| 785 | 785 | |
| 786 | 786 | /** |
@@ -791,7 +791,7 @@ discard block |
||
| 791 | 791 | */ |
| 792 | 792 | function get_available_fields( $form = '', $zone = NULL ) { |
| 793 | 793 | |
| 794 | - if( empty( $form ) ) { |
|
| 794 | + if ( empty( $form ) ) { |
|
| 795 | 795 | gravityview()->log->error( '$form is empty' ); |
| 796 | 796 | return array(); |
| 797 | 797 | } |
@@ -800,7 +800,7 @@ discard block |
||
| 800 | 800 | $fields = gravityview_get_form_fields( $form, true ); |
| 801 | 801 | |
| 802 | 802 | // get meta fields ( only if form was already created ) |
| 803 | - if( !is_array( $form ) ) { |
|
| 803 | + if ( ! is_array( $form ) ) { |
|
| 804 | 804 | $meta_fields = gravityview_get_entry_meta( $form ); |
| 805 | 805 | } else { |
| 806 | 806 | $meta_fields = array(); |
@@ -813,7 +813,7 @@ discard block |
||
| 813 | 813 | $fields = $fields + $meta_fields + $default_fields; |
| 814 | 814 | |
| 815 | 815 | // Move Custom Content to top |
| 816 | - $fields = array( 'custom' => $fields['custom'] ) + $fields; |
|
| 816 | + $fields = array( 'custom' => $fields[ 'custom' ] ) + $fields; |
|
| 817 | 817 | |
| 818 | 818 | return $fields; |
| 819 | 819 | } |
@@ -827,11 +827,11 @@ discard block |
||
| 827 | 827 | |
| 828 | 828 | $widgets = $this->get_registered_widgets(); |
| 829 | 829 | |
| 830 | - if( !empty( $widgets ) ) { |
|
| 830 | + if ( ! empty( $widgets ) ) { |
|
| 831 | 831 | |
| 832 | - foreach( $widgets as $id => $details ) { |
|
| 832 | + foreach ( $widgets as $id => $details ) { |
|
| 833 | 833 | |
| 834 | - echo new GravityView_Admin_View_Widget( $details['label'], $id, $details ); |
|
| 834 | + echo new GravityView_Admin_View_Widget( $details[ 'label' ], $id, $details ); |
|
| 835 | 835 | |
| 836 | 836 | } |
| 837 | 837 | } |
@@ -860,7 +860,7 @@ discard block |
||
| 860 | 860 | function render_active_areas( $template_id, $type, $zone, $rows, $values ) { |
| 861 | 861 | global $post; |
| 862 | 862 | |
| 863 | - if( $type === 'widget' ) { |
|
| 863 | + if ( $type === 'widget' ) { |
|
| 864 | 864 | $button_label = __( 'Add Widget', 'gravityview' ); |
| 865 | 865 | } else { |
| 866 | 866 | $button_label = __( 'Add Field', 'gravityview' ); |
@@ -872,10 +872,10 @@ discard block |
||
| 872 | 872 | $form_id = null; |
| 873 | 873 | |
| 874 | 874 | // if saved values, get available fields to label everyone |
| 875 | - if( !empty( $values ) && ( !empty( $post->ID ) || !empty( $_POST['template_id'] ) ) ) { |
|
| 875 | + if ( ! empty( $values ) && ( ! empty( $post->ID ) || ! empty( $_POST[ 'template_id' ] ) ) ) { |
|
| 876 | 876 | |
| 877 | - if( !empty( $_POST['template_id'] ) ) { |
|
| 878 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
| 877 | + if ( ! empty( $_POST[ 'template_id' ] ) ) { |
|
| 878 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
| 879 | 879 | } else { |
| 880 | 880 | $form_id = $form = gravityview_get_form_id( $post->ID ); |
| 881 | 881 | } |
@@ -893,44 +893,44 @@ discard block |
||
| 893 | 893 | } |
| 894 | 894 | } |
| 895 | 895 | |
| 896 | - foreach( $rows as $row ) : |
|
| 897 | - foreach( $row as $col => $areas ) : |
|
| 898 | - $column = ($col == '2-2') ? '1-2' : $col; ?> |
|
| 896 | + foreach ( $rows as $row ) : |
|
| 897 | + foreach ( $row as $col => $areas ) : |
|
| 898 | + $column = ( $col == '2-2' ) ? '1-2' : $col; ?> |
|
| 899 | 899 | |
| 900 | 900 | <div class="gv-grid-col-<?php echo esc_attr( $column ); ?>"> |
| 901 | 901 | |
| 902 | - <?php foreach( $areas as $area ) : ?> |
|
| 902 | + <?php foreach ( $areas as $area ) : ?> |
|
| 903 | 903 | |
| 904 | - <div class="gv-droppable-area" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>"> |
|
| 905 | - <div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>"> |
|
| 904 | + <div class="gv-droppable-area" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>"> |
|
| 905 | + <div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>"> |
|
| 906 | 906 | |
| 907 | 907 | <?php // render saved fields |
| 908 | 908 | |
| 909 | - if( ! empty( $values[ $zone .'_'. $area['areaid'] ] ) ) { |
|
| 909 | + if ( ! empty( $values[ $zone . '_' . $area[ 'areaid' ] ] ) ) { |
|
| 910 | 910 | |
| 911 | - foreach( $values[ $zone .'_'. $area['areaid'] ] as $uniqid => $field ) { |
|
| 911 | + foreach ( $values[ $zone . '_' . $area[ 'areaid' ] ] as $uniqid => $field ) { |
|
| 912 | 912 | |
| 913 | 913 | // Maybe has a form ID |
| 914 | - $form_id = empty( $field['form_id'] ) ? $form_id : $field['form_id']; |
|
| 914 | + $form_id = empty( $field[ 'form_id' ] ) ? $form_id : $field[ 'form_id' ]; |
|
| 915 | 915 | |
| 916 | 916 | $input_type = NULL; |
| 917 | 917 | |
| 918 | 918 | if ( $form_id ) { |
| 919 | - $original_item = isset( $available_items[ $form_id ] [ $field['id'] ] ) ? $available_items[ $form_id ] [ $field['id'] ] : false ; |
|
| 919 | + $original_item = isset( $available_items[ $form_id ] [ $field[ 'id' ] ] ) ? $available_items[ $form_id ] [ $field[ 'id' ] ] : false; |
|
| 920 | 920 | } else { |
| 921 | - $original_item = isset( $available_items[ $field['id'] ] ) ? $available_items[ $field['id'] ] : false ; |
|
| 921 | + $original_item = isset( $available_items[ $field[ 'id' ] ] ) ? $available_items[ $field[ 'id' ] ] : false; |
|
| 922 | 922 | } |
| 923 | 923 | |
| 924 | - if ( !$original_item ) { |
|
| 925 | - gravityview()->log->error( 'An item was not available when rendering the output; maybe it was added by a plugin that is now de-activated.', array(' data' => array('available_items' => $available_items, 'field' => $field ) ) ); |
|
| 924 | + if ( ! $original_item ) { |
|
| 925 | + gravityview()->log->error( 'An item was not available when rendering the output; maybe it was added by a plugin that is now de-activated.', array( ' data' => array( 'available_items' => $available_items, 'field' => $field ) ) ); |
|
| 926 | 926 | |
| 927 | 927 | $original_item = $field; |
| 928 | 928 | } else { |
| 929 | - $input_type = isset( $original_item['type'] ) ? $original_item['type'] : NULL; |
|
| 929 | + $input_type = isset( $original_item[ 'type' ] ) ? $original_item[ 'type' ] : NULL; |
|
| 930 | 930 | } |
| 931 | 931 | |
| 932 | 932 | // Field options dialog box |
| 933 | - $field_options = GravityView_Render_Settings::render_field_options( $form_id, $type, $template_id, $field['id'], $original_item['label'], $zone .'_'. $area['areaid'], $input_type, $uniqid, $field, $zone, $original_item ); |
|
| 933 | + $field_options = GravityView_Render_Settings::render_field_options( $form_id, $type, $template_id, $field[ 'id' ], $original_item[ 'label' ], $zone . '_' . $area[ 'areaid' ], $input_type, $uniqid, $field, $zone, $original_item ); |
|
| 934 | 934 | |
| 935 | 935 | $item = array( |
| 936 | 936 | 'input_type' => $input_type, |
@@ -943,23 +943,23 @@ discard block |
||
| 943 | 943 | $item = wp_parse_args( $item, $original_item ); |
| 944 | 944 | } |
| 945 | 945 | |
| 946 | - switch( $type ) { |
|
| 946 | + switch ( $type ) { |
|
| 947 | 947 | case 'widget': |
| 948 | - echo new GravityView_Admin_View_Widget( $item['label'], $field['id'], $item, $field ); |
|
| 948 | + echo new GravityView_Admin_View_Widget( $item[ 'label' ], $field[ 'id' ], $item, $field ); |
|
| 949 | 949 | break; |
| 950 | 950 | default: |
| 951 | - echo new GravityView_Admin_View_Field( $field['label'], $field['id'], $item, $field, $form_id ); |
|
| 951 | + echo new GravityView_Admin_View_Field( $field[ 'label' ], $field[ 'id' ], $item, $field, $form_id ); |
|
| 952 | 952 | } |
| 953 | 953 | } |
| 954 | 954 | |
| 955 | 955 | } // End if zone is not empty ?> |
| 956 | 956 | |
| 957 | - <span class="drop-message"><?php echo sprintf(esc_attr__('"+ %s" or drag existing %ss here.', 'gravityview'), $button_label, $type ); ?></span> |
|
| 957 | + <span class="drop-message"><?php echo sprintf( esc_attr__( '"+ %s" or drag existing %ss here.', 'gravityview' ), $button_label, $type ); ?></span> |
|
| 958 | 958 | </div> |
| 959 | 959 | <div class="gv-droppable-area-action"> |
| 960 | - <a href="#" class="gv-add-field button-secondary" title="" data-objecttype="<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>" data-formid="<?php echo $view ? esc_attr( $view->form ? $view->form->ID : '' ) : ''; ?>"><?php echo '+ '.esc_html( $button_label ); ?></a> |
|
| 960 | + <a href="#" class="gv-add-field button-secondary" title="" data-objecttype="<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>" data-formid="<?php echo $view ? esc_attr( $view->form ? $view->form->ID : '' ) : ''; ?>"><?php echo '+ ' . esc_html( $button_label ); ?></a> |
|
| 961 | 961 | |
| 962 | - <p class="gv-droppable-area-title"><strong><?php echo esc_html( $area['title'] ); ?></strong><?php if( !empty( $area['subtitle'] ) ) { ?><span class="gv-droppable-area-subtitle"> – <?php echo esc_html( $area['subtitle'] ); ?></span><?php } ?></p> |
|
| 962 | + <p class="gv-droppable-area-title"><strong><?php echo esc_html( $area[ 'title' ] ); ?></strong><?php if ( ! empty( $area[ 'subtitle' ] ) ) { ?><span class="gv-droppable-area-subtitle"> – <?php echo esc_html( $area[ 'subtitle' ] ); ?></span><?php } ?></p> |
|
| 963 | 963 | </div> |
| 964 | 964 | </div> |
| 965 | 965 | |
@@ -981,7 +981,7 @@ discard block |
||
| 981 | 981 | $default_widget_areas = GravityView_Widget::get_default_widget_areas(); |
| 982 | 982 | |
| 983 | 983 | $widgets = array(); |
| 984 | - if( !empty( $post_id ) ) { |
|
| 984 | + if ( ! empty( $post_id ) ) { |
|
| 985 | 985 | $widgets = gravityview_get_directory_widgets( $post_id ); |
| 986 | 986 | } |
| 987 | 987 | |
@@ -1014,7 +1014,7 @@ discard block |
||
| 1014 | 1014 | // list of available fields to be shown in the popup |
| 1015 | 1015 | $forms = gravityview_get_forms( 'any' ); |
| 1016 | 1016 | |
| 1017 | - $form_ids = array_map( function ($form) { return $form['id']; }, $forms); |
|
| 1017 | + $form_ids = array_map( function( $form ) { return $form[ 'id' ]; }, $forms ); |
|
| 1018 | 1018 | |
| 1019 | 1019 | foreach ( $form_ids as $form_id ) { |
| 1020 | 1020 | $filter_field_id = sprintf( 'gv-field-filter-%s-%d', $context, $form_id ); |
@@ -1027,7 +1027,7 @@ discard block |
||
| 1027 | 1027 | </div> |
| 1028 | 1028 | |
| 1029 | 1029 | <div id="available-fields-<?php echo $filter_field_id; ?>" aria-live="polite" role="listbox"> |
| 1030 | - <?php do_action('gravityview_render_available_fields', $form_id, $context ); ?> |
|
| 1030 | + <?php do_action( 'gravityview_render_available_fields', $form_id, $context ); ?> |
|
| 1031 | 1031 | </div> |
| 1032 | 1032 | |
| 1033 | 1033 | <div class="gv-no-results hidden description"><?php esc_html_e( 'No fields were found matching the search.', 'gravityview' ); ?></div> |
@@ -1046,7 +1046,7 @@ discard block |
||
| 1046 | 1046 | * @return string HTML of the active areas |
| 1047 | 1047 | */ |
| 1048 | 1048 | function render_directory_active_areas( $template_id = '', $context = 'single', $post_id = '', $echo = false ) { |
| 1049 | - if( empty( $template_id ) ) { |
|
| 1049 | + if ( empty( $template_id ) ) { |
|
| 1050 | 1050 | gravityview()->log->debug( '[render_directory_active_areas] {template_id} is empty', array( 'template_id' => $template_id ) ); |
| 1051 | 1051 | return ''; |
| 1052 | 1052 | } |
@@ -1060,12 +1060,12 @@ discard block |
||
| 1060 | 1060 | */ |
| 1061 | 1061 | $template_areas = apply_filters( 'gravityview_template_active_areas', array(), $template_id, $context ); |
| 1062 | 1062 | |
| 1063 | - if( empty( $template_areas ) ) { |
|
| 1063 | + if ( empty( $template_areas ) ) { |
|
| 1064 | 1064 | |
| 1065 | 1065 | gravityview()->log->debug( '[render_directory_active_areas] No areas defined. Maybe template {template_id} is disabled.', array( 'data' => $template_id ) ); |
| 1066 | 1066 | $output = '<div>'; |
| 1067 | - $output .= '<h2 class="description" style="font-size: 16px; margin:0">'. sprintf( esc_html__( 'This View is configured using the %s View type, which is disabled.', 'gravityview' ), '<em>'.$template_id.'</em>' ) .'</h2>'; |
|
| 1068 | - $output .= '<p class="description" style="font-size: 14px; margin:0 0 1em 0;padding:0">'.esc_html__('The data is not lost; re-activate the associated plugin and the configuration will re-appear.', 'gravityview').'</p>'; |
|
| 1067 | + $output .= '<h2 class="description" style="font-size: 16px; margin:0">' . sprintf( esc_html__( 'This View is configured using the %s View type, which is disabled.', 'gravityview' ), '<em>' . $template_id . '</em>' ) . '</h2>'; |
|
| 1068 | + $output .= '<p class="description" style="font-size: 14px; margin:0 0 1em 0;padding:0">' . esc_html__( 'The data is not lost; re-activate the associated plugin and the configuration will re-appear.', 'gravityview' ) . '</p>'; |
|
| 1069 | 1069 | $output .= '</div>'; |
| 1070 | 1070 | } else { |
| 1071 | 1071 | |
@@ -1080,7 +1080,7 @@ discard block |
||
| 1080 | 1080 | |
| 1081 | 1081 | } |
| 1082 | 1082 | |
| 1083 | - if( $echo ) { |
|
| 1083 | + if ( $echo ) { |
|
| 1084 | 1084 | echo $output; |
| 1085 | 1085 | } |
| 1086 | 1086 | |
@@ -1100,32 +1100,32 @@ discard block |
||
| 1100 | 1100 | $is_widgets_page = ( $pagenow === 'widgets.php' ); |
| 1101 | 1101 | |
| 1102 | 1102 | // Add the GV font (with the Astronaut) |
| 1103 | - wp_enqueue_style( 'gravityview_global', plugins_url('assets/css/admin-global.css', GRAVITYVIEW_FILE), array(), \GV\Plugin::$version ); |
|
| 1103 | + wp_enqueue_style( 'gravityview_global', plugins_url( 'assets/css/admin-global.css', GRAVITYVIEW_FILE ), array(), \GV\Plugin::$version ); |
|
| 1104 | 1104 | wp_register_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array( 'dashicons', 'wp-jquery-ui-dialog' ), \GV\Plugin::$version ); |
| 1105 | 1105 | |
| 1106 | - wp_register_script( 'gravityview-jquery-cookie', plugins_url('assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE), array( 'jquery' ), \GV\Plugin::$version, true ); |
|
| 1106 | + wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), \GV\Plugin::$version, true ); |
|
| 1107 | 1107 | |
| 1108 | - if( GFForms::get_page() === 'form_list' ) { |
|
| 1108 | + if ( GFForms::get_page() === 'form_list' ) { |
|
| 1109 | 1109 | wp_enqueue_style( 'gravityview_views_styles' ); |
| 1110 | 1110 | return; |
| 1111 | 1111 | } |
| 1112 | 1112 | |
| 1113 | 1113 | // Don't process any scripts below here if it's not a GravityView page. |
| 1114 | - if( ! gravityview()->request->is_admin( $hook, 'single' ) && ! $is_widgets_page ) { |
|
| 1114 | + if ( ! gravityview()->request->is_admin( $hook, 'single' ) && ! $is_widgets_page ) { |
|
| 1115 | 1115 | return; |
| 1116 | 1116 | } |
| 1117 | 1117 | |
| 1118 | 1118 | wp_enqueue_script( 'jquery-ui-datepicker' ); |
| 1119 | - wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), \GV\Plugin::$version ); |
|
| 1119 | + wp_enqueue_style( 'gravityview_views_datepicker', plugins_url( 'assets/css/admin-datepicker.css', GRAVITYVIEW_FILE ), \GV\Plugin::$version ); |
|
| 1120 | 1120 | |
| 1121 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
| 1121 | + $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
| 1122 | 1122 | |
| 1123 | 1123 | //enqueue scripts |
| 1124 | 1124 | wp_enqueue_script( 'gravityview_views_scripts', plugins_url( 'assets/js/admin-views' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery-ui-tabs', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-sortable', 'jquery-ui-tooltip', 'jquery-ui-dialog', 'gravityview-jquery-cookie', 'jquery-ui-datepicker', 'underscore' ), \GV\Plugin::$version ); |
| 1125 | 1125 | |
| 1126 | - wp_localize_script('gravityview_views_scripts', 'gvGlobals', array( |
|
| 1126 | + wp_localize_script( 'gravityview_views_scripts', 'gvGlobals', array( |
|
| 1127 | 1127 | 'cookiepath' => COOKIEPATH, |
| 1128 | - 'passed_form_id' => (bool) \GV\Utils::_GET( 'form_id' ), |
|
| 1128 | + 'passed_form_id' => (bool)\GV\Utils::_GET( 'form_id' ), |
|
| 1129 | 1129 | 'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ), |
| 1130 | 1130 | 'label_viewname' => __( 'Enter View name here', 'gravityview' ), |
| 1131 | 1131 | 'label_close' => __( 'Close', 'gravityview' ), |
@@ -1137,7 +1137,7 @@ discard block |
||
| 1137 | 1137 | 'loading_error' => esc_html__( 'There was an error loading dynamic content.', 'gravityview' ), |
| 1138 | 1138 | 'field_loaderror' => __( 'Error while adding the field. Please try again or contact GravityView support.', 'gravityview' ), |
| 1139 | 1139 | 'remove_all_fields' => __( 'Would you like to remove all fields in this zone? (You are seeing this message because you were holding down the ALT key)', 'gravityview' ), |
| 1140 | - )); |
|
| 1140 | + ) ); |
|
| 1141 | 1141 | |
| 1142 | 1142 | wp_enqueue_style( 'gravityview_views_styles' ); |
| 1143 | 1143 | |
@@ -1164,7 +1164,7 @@ discard block |
||
| 1164 | 1164 | ); |
| 1165 | 1165 | |
| 1166 | 1166 | if ( wp_is_mobile() ) { |
| 1167 | - $scripts[] = 'jquery-touch-punch'; |
|
| 1167 | + $scripts[ ] = 'jquery-touch-punch'; |
|
| 1168 | 1168 | } |
| 1169 | 1169 | |
| 1170 | 1170 | wp_enqueue_script( $scripts ); |
@@ -24,16 +24,16 @@ discard block |
||
| 24 | 24 | |
| 25 | 25 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
| 26 | 26 | |
| 27 | - unset( $field_options['search_filter'] ); |
|
| 27 | + unset( $field_options[ 'search_filter' ] ); |
|
| 28 | 28 | |
| 29 | - if( 'edit' === $context ) { |
|
| 29 | + if ( 'edit' === $context ) { |
|
| 30 | 30 | return $field_options; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - $add_options['link_to_file'] = array( |
|
| 33 | + $add_options[ 'link_to_file' ] = array( |
|
| 34 | 34 | 'type' => 'checkbox', |
| 35 | 35 | 'label' => __( 'Display as a Link:', 'gravityview' ), |
| 36 | - 'desc' => __('Display the uploaded files as links, rather than embedded content.', 'gravityview'), |
|
| 36 | + 'desc' => __( 'Display the uploaded files as links, rather than embedded content.', 'gravityview' ), |
|
| 37 | 37 | 'value' => false, |
| 38 | 38 | 'merge_tags' => false, |
| 39 | 39 | ); |
@@ -119,14 +119,14 @@ discard block |
||
| 119 | 119 | $base_id = null; |
| 120 | 120 | |
| 121 | 121 | $is_single = gravityview_get_context() === 'single'; |
| 122 | - $lightbox = ! empty( $gravityview_view->atts['lightbox'] ); |
|
| 122 | + $lightbox = ! empty( $gravityview_view->atts[ 'lightbox' ] ); |
|
| 123 | 123 | $field_compat = $gravityview_view->getCurrentField(); |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | $output_arr = array(); |
| 127 | 127 | |
| 128 | 128 | // Get an array of file paths for the field. |
| 129 | - $file_paths = \GV\Utils::get( $field , 'multipleFiles' ) ? json_decode( $value ) : array( $value ); |
|
| 129 | + $file_paths = \GV\Utils::get( $field, 'multipleFiles' ) ? json_decode( $value ) : array( $value ); |
|
| 130 | 130 | |
| 131 | 131 | // The $value JSON was probably truncated; let's check lead_detail_long. |
| 132 | 132 | if ( ! is_array( $file_paths ) ) { |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | $rendered = null; |
| 146 | 146 | |
| 147 | 147 | // If the site is HTTPS, use HTTPS |
| 148 | - if ( function_exists('set_url_scheme') ) { |
|
| 148 | + if ( function_exists( 'set_url_scheme' ) ) { |
|
| 149 | 149 | $file_path = set_url_scheme( $file_path ); |
| 150 | 150 | } |
| 151 | 151 | |
@@ -156,8 +156,8 @@ discard block |
||
| 156 | 156 | $file_path_info = pathinfo( $file_path ); |
| 157 | 157 | |
| 158 | 158 | // If pathinfo() gave us the extension of the file, run the switch statement using that. |
| 159 | - $extension = empty( $file_path_info['extension'] ) ? NULL : strtolower( $file_path_info['extension'] ); |
|
| 160 | - $basename = $file_path_info['basename']; |
|
| 159 | + $extension = empty( $file_path_info[ 'extension' ] ) ? NULL : strtolower( $file_path_info[ 'extension' ] ); |
|
| 160 | + $basename = $file_path_info[ 'basename' ]; |
|
| 161 | 161 | |
| 162 | 162 | // Get the secure download URL |
| 163 | 163 | $is_secure = false; |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | */ |
| 195 | 195 | $audio_settings = apply_filters( 'gravityview_audio_settings', array( |
| 196 | 196 | 'src' => $insecure_file_path, // Needs to be insecure path so WP can parse extension |
| 197 | - 'class' => 'wp-audio-shortcode gv-audio gv-field-id-'.$field_settings['id'] |
|
| 197 | + 'class' => 'wp-audio-shortcode gv-audio gv-field-id-' . $field_settings[ 'id' ] |
|
| 198 | 198 | ), $context ); |
| 199 | 199 | |
| 200 | 200 | /** |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | */ |
| 235 | 235 | $video_settings = apply_filters( 'gravityview_video_settings', array( |
| 236 | 236 | 'src' => $insecure_file_path, // Needs to be insecure path so WP can parse extension |
| 237 | - 'class' => 'wp-video-shortcode gv-video gv-field-id-'.$field_settings['id'] |
|
| 237 | + 'class' => 'wp-video-shortcode gv-video gv-field-id-' . $field_settings[ 'id' ] |
|
| 238 | 238 | ), $context ); |
| 239 | 239 | |
| 240 | 240 | /** |
@@ -269,17 +269,17 @@ discard block |
||
| 269 | 269 | // Images |
| 270 | 270 | } else if ( in_array( $extension, array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' ) ) ) { |
| 271 | 271 | |
| 272 | - if ( empty( $field_settings['link_to_file'] ) ) { |
|
| 272 | + if ( empty( $field_settings[ 'link_to_file' ] ) ) { |
|
| 273 | 273 | |
| 274 | 274 | $image_atts = array( |
| 275 | 275 | 'src' => $insecure_file_path, |
| 276 | - 'class' => 'gv-image gv-field-id-' . $field_settings['id'], |
|
| 277 | - 'alt' => $field_settings['label'], |
|
| 276 | + 'class' => 'gv-image gv-field-id-' . $field_settings[ 'id' ], |
|
| 277 | + 'alt' => $field_settings[ 'label' ], |
|
| 278 | 278 | 'width' => ( $is_single ? null : 250 ) |
| 279 | 279 | ); |
| 280 | 280 | |
| 281 | 281 | if ( $is_secure ) { |
| 282 | - $image_atts['validate_src'] = false; |
|
| 282 | + $image_atts[ 'validate_src' ] = false; |
|
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | /** |
@@ -294,9 +294,9 @@ discard block |
||
| 294 | 294 | |
| 295 | 295 | $image = new GravityView_Image( $image_atts ); |
| 296 | 296 | |
| 297 | - $entry_slug = GravityView_API::get_entry_slug( $entry['id'], $entry ); |
|
| 297 | + $entry_slug = GravityView_API::get_entry_slug( $entry[ 'id' ], $entry ); |
|
| 298 | 298 | |
| 299 | - if ( $lightbox && empty( $field_settings['show_as_link'] ) ) { |
|
| 299 | + if ( $lightbox && empty( $field_settings[ 'show_as_link' ] ) ) { |
|
| 300 | 300 | $lightbox_link_atts = array( |
| 301 | 301 | 'rel' => sprintf( "%s-%s", $gv_class, $entry_slug ), |
| 302 | 302 | 'class' => 'thickbox', |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | $disable_wrapped_link = apply_filters( 'gravityview/fields/fileupload/disable_link', false, $field_compat, $context ); |
| 322 | 322 | |
| 323 | 323 | // Output textualized content where |
| 324 | - if ( ! $disable_wrapped_link && ( ! empty( $field_settings['link_to_file'] ) && empty( $field_settings['show_as_link'] ) ) ) { |
|
| 324 | + if ( ! $disable_wrapped_link && ( ! empty( $field_settings[ 'link_to_file' ] ) && empty( $field_settings[ 'show_as_link' ] ) ) ) { |
|
| 325 | 325 | $content = empty( $text ) ? $basename : $text; |
| 326 | 326 | |
| 327 | 327 | /** |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | $content = empty( $rendered ) ? ( empty( $text ) ? $basename : $text ) : $rendered; |
| 351 | 351 | } |
| 352 | 352 | |
| 353 | - $output_arr[] = array( |
|
| 353 | + $output_arr[ ] = array( |
|
| 354 | 354 | 'file_path' => $file_path, |
| 355 | 355 | 'content' => $content |
| 356 | 356 | ); |