@@ -62,28 +62,28 @@ discard block |
||
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | /** |
| 65 | - * When on the Add/Edit View screen, suggest most popular articles related to that |
|
| 66 | - * |
|
| 65 | + * When on the Add/Edit View screen, suggest most popular articles related to that |
|
| 66 | + * |
|
| 67 | 67 | * @param array $localization_data Data to be passed to the Support Port JS |
| 68 | 68 | * |
| 69 | 69 | * @return array |
| 70 | 70 | */ |
| 71 | 71 | function suggest_support_articles( $localization_data = array() ) { |
| 72 | 72 | |
| 73 | - if( ! gravityview()->request->is_view() ) { |
|
| 74 | - return $localization_data; |
|
| 75 | - } |
|
| 73 | + if( ! gravityview()->request->is_view() ) { |
|
| 74 | + return $localization_data; |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | 77 | $localization_data['suggest'] = array( |
| 78 | - '57ef23539033602e61d4a560', |
|
| 79 | - '54c67bb9e4b0512429885513', |
|
| 80 | - '54c67bb9e4b0512429885512', |
|
| 81 | - '54c67bbbe4b07997ea3f3f6b', |
|
| 82 | - '54d1a33ae4b086c0c0964ce9', |
|
| 83 | - '57ef253c9033602e61d4a563', |
|
| 84 | - '552355bfe4b0221aadf2572b', |
|
| 85 | - '54c67bcde4b051242988553e', |
|
| 86 | - ); |
|
| 78 | + '57ef23539033602e61d4a560', |
|
| 79 | + '54c67bb9e4b0512429885513', |
|
| 80 | + '54c67bb9e4b0512429885512', |
|
| 81 | + '54c67bbbe4b07997ea3f3f6b', |
|
| 82 | + '54d1a33ae4b086c0c0964ce9', |
|
| 83 | + '57ef253c9033602e61d4a563', |
|
| 84 | + '552355bfe4b0221aadf2572b', |
|
| 85 | + '54c67bcde4b051242988553e', |
|
| 86 | + ); |
|
| 87 | 87 | |
| 88 | 88 | return $localization_data; |
| 89 | 89 | } |
@@ -229,11 +229,11 @@ discard block |
||
| 229 | 229 | |
| 230 | 230 | if( 'form_list' === GFForms::get_page() ) { |
| 231 | 231 | $priority = 790; |
| 232 | - } |
|
| 232 | + } |
|
| 233 | 233 | |
| 234 | 234 | if( empty( $connected_views ) ) { |
| 235 | 235 | |
| 236 | - $menu_items['gravityview'] = array( |
|
| 236 | + $menu_items['gravityview'] = array( |
|
| 237 | 237 | 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
| 238 | 238 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', |
| 239 | 239 | 'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ), |
@@ -264,14 +264,14 @@ discard block |
||
| 264 | 264 | // If there were no items added, then let's create the parent menu |
| 265 | 265 | if( $sub_menu_items ) { |
| 266 | 266 | |
| 267 | - $sub_menu_items[] = array( |
|
| 268 | - 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
|
| 269 | - 'link_class' => 'gv-create-view', |
|
| 270 | - 'icon' => '<i> + </i>', |
|
| 271 | - 'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ), |
|
| 272 | - 'url' => admin_url( 'post-new.php?post_type=gravityview&form_id=' . $id ), |
|
| 273 | - 'capabilities' => array( 'edit_gravityviews' ), |
|
| 274 | - ); |
|
| 267 | + $sub_menu_items[] = array( |
|
| 268 | + 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
|
| 269 | + 'link_class' => 'gv-create-view', |
|
| 270 | + 'icon' => '<i> + </i>', |
|
| 271 | + 'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ), |
|
| 272 | + 'url' => admin_url( 'post-new.php?post_type=gravityview&form_id=' . $id ), |
|
| 273 | + 'capabilities' => array( 'edit_gravityviews' ), |
|
| 274 | + ); |
|
| 275 | 275 | |
| 276 | 276 | |
| 277 | 277 | /** |
@@ -681,16 +681,16 @@ discard block |
||
| 681 | 681 | /** |
| 682 | 682 | * Render html for displaying available fields based on a Form ID |
| 683 | 683 | * |
| 684 | - * @see GravityView_Ajax::get_available_fields_html() Triggers `gravityview_render_available_fields` action |
|
| 684 | + * @see GravityView_Ajax::get_available_fields_html() Triggers `gravityview_render_available_fields` action |
|
| 685 | 685 | * |
| 686 | 686 | * @param int $form Gravity Forms Form ID (default: '') |
| 687 | 687 | * @param string $context (default: 'single') |
| 688 | - * |
|
| 688 | + * |
|
| 689 | 689 | * @return void |
| 690 | 690 | */ |
| 691 | 691 | function render_available_fields( $form = 0, $context = 'single' ) { |
| 692 | 692 | |
| 693 | - // Determine if form is a preset and convert it to an array with fields |
|
| 693 | + // Determine if form is a preset and convert it to an array with fields |
|
| 694 | 694 | $form = ( is_string( $form ) && preg_match( '/^preset_/', $form ) ) ? GravityView_Ajax::pre_get_form_fields( $form ) : $form; |
| 695 | 695 | |
| 696 | 696 | /** |
@@ -702,7 +702,7 @@ discard block |
||
| 702 | 702 | |
| 703 | 703 | if ( ! is_array( $blacklist_field_types ) ) { |
| 704 | 704 | |
| 705 | - gravityview()->log->error( '$blacklist_field_types is not an array', array( 'data' => print_r( $blacklist_field_types, true ) ) ); |
|
| 705 | + gravityview()->log->error( '$blacklist_field_types is not an array', array( 'data' => print_r( $blacklist_field_types, true ) ) ); |
|
| 706 | 706 | |
| 707 | 707 | $blacklist_field_types = array(); |
| 708 | 708 | } |
@@ -840,12 +840,12 @@ discard block |
||
| 840 | 840 | /** |
| 841 | 841 | * @since 1.7.2 |
| 842 | 842 | */ |
| 843 | - 'other_entries' => array( |
|
| 844 | - 'label' => __('Other Entries', 'gravityview'), |
|
| 845 | - 'type' => 'other_entries', |
|
| 846 | - 'desc' => __('Display other entries created by the entry creator.', 'gravityview'), |
|
| 847 | - ), |
|
| 848 | - ); |
|
| 843 | + 'other_entries' => array( |
|
| 844 | + 'label' => __('Other Entries', 'gravityview'), |
|
| 845 | + 'type' => 'other_entries', |
|
| 846 | + 'desc' => __('Display other entries created by the entry creator.', 'gravityview'), |
|
| 847 | + ), |
|
| 848 | + ); |
|
| 849 | 849 | |
| 850 | 850 | if( 'single' !== $zone) { |
| 851 | 851 | |
@@ -1017,9 +1017,9 @@ discard block |
||
| 1017 | 1017 | |
| 1018 | 1018 | $joined_forms = gravityview_get_joined_forms( $post->ID ); |
| 1019 | 1019 | |
| 1020 | - foreach ( $joined_forms as $form ) { |
|
| 1021 | - $available_items[ $form->ID ] = $this->get_available_fields( $form->ID, $zone ); |
|
| 1022 | - } |
|
| 1020 | + foreach ( $joined_forms as $form ) { |
|
| 1021 | + $available_items[ $form->ID ] = $this->get_available_fields( $form->ID, $zone ); |
|
| 1022 | + } |
|
| 1023 | 1023 | } else { |
| 1024 | 1024 | $available_items[ $form ] = \GV\Widget::registered(); |
| 1025 | 1025 | } |
@@ -1047,9 +1047,9 @@ discard block |
||
| 1047 | 1047 | |
| 1048 | 1048 | if ( $form_id ) { |
| 1049 | 1049 | $original_item = isset( $available_items[ $form_id ] [ $field['id'] ] ) ? $available_items[ $form_id ] [ $field['id'] ] : false ; |
| 1050 | - } else { |
|
| 1050 | + } else { |
|
| 1051 | 1051 | $original_item = isset( $available_items[ $field['id'] ] ) ? $available_items[ $field['id'] ] : false ; |
| 1052 | - } |
|
| 1052 | + } |
|
| 1053 | 1053 | |
| 1054 | 1054 | if ( !$original_item ) { |
| 1055 | 1055 | 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 ) ) ); |
@@ -1101,7 +1101,7 @@ discard block |
||
| 1101 | 1101 | |
| 1102 | 1102 | /** |
| 1103 | 1103 | * Render the widget active areas |
| 1104 | - * @param string $template_id The current slug of the selected View template |
|
| 1104 | + * @param string $template_id The current slug of the selected View template |
|
| 1105 | 1105 | * @param string $zone Either 'header' or 'footer' |
| 1106 | 1106 | * @param string $post_id Current Post ID (view) |
| 1107 | 1107 | * @return string html |
@@ -1292,7 +1292,7 @@ discard block |
||
| 1292 | 1292 | } |
| 1293 | 1293 | |
| 1294 | 1294 | // Add the GV font (with the Astronaut) |
| 1295 | - wp_enqueue_style( 'gravityview_global', plugins_url('assets/css/admin-global.css', GRAVITYVIEW_FILE), array(), \GV\Plugin::$version ); |
|
| 1295 | + wp_enqueue_style( 'gravityview_global', plugins_url('assets/css/admin-global.css', GRAVITYVIEW_FILE), array(), \GV\Plugin::$version ); |
|
| 1296 | 1296 | wp_register_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array( 'dashicons', 'wp-jquery-ui-dialog' ), \GV\Plugin::$version ); |
| 1297 | 1297 | |
| 1298 | 1298 | wp_register_script( 'gravityview-jquery-cookie', plugins_url('assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE), array( 'jquery' ), \GV\Plugin::$version, true ); |
@@ -1300,42 +1300,42 @@ discard block |
||
| 1300 | 1300 | if( GFForms::get_page() === 'form_list' ) { |
| 1301 | 1301 | wp_enqueue_style( 'gravityview_views_styles' ); |
| 1302 | 1302 | return; |
| 1303 | - } |
|
| 1303 | + } |
|
| 1304 | 1304 | |
| 1305 | 1305 | // Don't process any scripts below here if it's not a GravityView page. |
| 1306 | 1306 | if( ! gravityview()->request->is_admin( $hook, 'single' ) && ! $is_widgets_page ) { |
| 1307 | - return; |
|
| 1307 | + return; |
|
| 1308 | 1308 | } |
| 1309 | 1309 | |
| 1310 | - wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
| 1311 | - wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), \GV\Plugin::$version ); |
|
| 1312 | - |
|
| 1313 | - // Enqueue scripts |
|
| 1314 | - 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 ); |
|
| 1315 | - |
|
| 1316 | - wp_localize_script('gravityview_views_scripts', 'gvGlobals', array( |
|
| 1317 | - 'cookiepath' => COOKIEPATH, |
|
| 1318 | - 'passed_form_id' => (bool) \GV\Utils::_GET( 'form_id' ), |
|
| 1319 | - 'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ), |
|
| 1320 | - 'label_viewname' => __( 'Enter View name here', 'gravityview' ), |
|
| 1321 | - 'label_reorder_search_fields' => __( 'Reorder Search Fields', 'gravityview' ), |
|
| 1322 | - 'label_add_search_field' => __( 'Add Search Field', 'gravityview' ), |
|
| 1323 | - 'label_remove_search_field' => __( 'Remove Search Field', 'gravityview' ), |
|
| 1324 | - 'label_close' => __( 'Close', 'gravityview' ), |
|
| 1325 | - 'label_cancel' => __( 'Cancel', 'gravityview' ), |
|
| 1326 | - 'label_continue' => __( 'Continue', 'gravityview' ), |
|
| 1327 | - 'label_ok' => __( 'Ok', 'gravityview' ), |
|
| 1328 | - 'label_publisherror' => __( 'Error while creating the View for you. Check the settings or contact GravityView support.', 'gravityview' ), |
|
| 1329 | - 'loading_text' => esc_html__( 'Loading…', 'gravityview' ), |
|
| 1330 | - 'loading_error' => esc_html__( 'There was an error loading dynamic content.', 'gravityview' ), |
|
| 1331 | - 'field_loaderror' => __( 'Error while adding the field. Please try again or contact GravityView support.', 'gravityview' ), |
|
| 1332 | - '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' ), |
|
| 1333 | - )); |
|
| 1310 | + wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
| 1311 | + wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), \GV\Plugin::$version ); |
|
| 1312 | + |
|
| 1313 | + // Enqueue scripts |
|
| 1314 | + 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 ); |
|
| 1315 | + |
|
| 1316 | + wp_localize_script('gravityview_views_scripts', 'gvGlobals', array( |
|
| 1317 | + 'cookiepath' => COOKIEPATH, |
|
| 1318 | + 'passed_form_id' => (bool) \GV\Utils::_GET( 'form_id' ), |
|
| 1319 | + 'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ), |
|
| 1320 | + 'label_viewname' => __( 'Enter View name here', 'gravityview' ), |
|
| 1321 | + 'label_reorder_search_fields' => __( 'Reorder Search Fields', 'gravityview' ), |
|
| 1322 | + 'label_add_search_field' => __( 'Add Search Field', 'gravityview' ), |
|
| 1323 | + 'label_remove_search_field' => __( 'Remove Search Field', 'gravityview' ), |
|
| 1324 | + 'label_close' => __( 'Close', 'gravityview' ), |
|
| 1325 | + 'label_cancel' => __( 'Cancel', 'gravityview' ), |
|
| 1326 | + 'label_continue' => __( 'Continue', 'gravityview' ), |
|
| 1327 | + 'label_ok' => __( 'Ok', 'gravityview' ), |
|
| 1328 | + 'label_publisherror' => __( 'Error while creating the View for you. Check the settings or contact GravityView support.', 'gravityview' ), |
|
| 1329 | + 'loading_text' => esc_html__( 'Loading…', 'gravityview' ), |
|
| 1330 | + 'loading_error' => esc_html__( 'There was an error loading dynamic content.', 'gravityview' ), |
|
| 1331 | + 'field_loaderror' => __( 'Error while adding the field. Please try again or contact GravityView support.', 'gravityview' ), |
|
| 1332 | + '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' ), |
|
| 1333 | + )); |
|
| 1334 | 1334 | |
| 1335 | 1335 | wp_enqueue_style( 'gravityview_views_styles' ); |
| 1336 | 1336 | |
| 1337 | - // Enqueue scripts needed for merge tags |
|
| 1338 | - self::enqueue_gravity_forms_scripts(); |
|
| 1337 | + // Enqueue scripts needed for merge tags |
|
| 1338 | + self::enqueue_gravity_forms_scripts(); |
|
| 1339 | 1339 | |
| 1340 | 1340 | // 2.5 changed how Merge Tags are enqueued |
| 1341 | 1341 | if ( is_callable( array( 'GFCommon', 'output_hooks_javascript') ) ) { |
@@ -1345,24 +1345,24 @@ discard block |
||
| 1345 | 1345 | |
| 1346 | 1346 | /** |
| 1347 | 1347 | * Enqueue Gravity Forms scripts, needed for Merge Tags |
| 1348 | - * |
|
| 1349 | - * @since 1.0.5-beta |
|
| 1350 | - * |
|
| 1351 | - * @return void |
|
| 1348 | + * |
|
| 1349 | + * @since 1.0.5-beta |
|
| 1350 | + * |
|
| 1351 | + * @return void |
|
| 1352 | 1352 | */ |
| 1353 | 1353 | static function enqueue_gravity_forms_scripts() { |
| 1354 | 1354 | GFForms::register_scripts(); |
| 1355 | 1355 | |
| 1356 | 1356 | $scripts = array( |
| 1357 | - 'sack', |
|
| 1358 | - 'gform_gravityforms', |
|
| 1359 | - 'gform_forms', |
|
| 1360 | - 'gform_form_admin', |
|
| 1361 | - 'jquery-ui-autocomplete' |
|
| 1357 | + 'sack', |
|
| 1358 | + 'gform_gravityforms', |
|
| 1359 | + 'gform_forms', |
|
| 1360 | + 'gform_form_admin', |
|
| 1361 | + 'jquery-ui-autocomplete' |
|
| 1362 | 1362 | ); |
| 1363 | 1363 | |
| 1364 | 1364 | if ( wp_is_mobile() ) { |
| 1365 | - $scripts[] = 'jquery-touch-punch'; |
|
| 1365 | + $scripts[] = 'jquery-touch-punch'; |
|
| 1366 | 1366 | } |
| 1367 | 1367 | |
| 1368 | 1368 | 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'), 10, 2 ); |
|
| 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' ), 10, 2 ); |
|
| 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 | |
@@ -70,11 +70,11 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | function suggest_support_articles( $localization_data = array() ) { |
| 72 | 72 | |
| 73 | - if( ! gravityview()->request->is_view() ) { |
|
| 73 | + if ( ! gravityview()->request->is_view() ) { |
|
| 74 | 74 | return $localization_data; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - $localization_data['suggest'] = array( |
|
| 77 | + $localization_data[ 'suggest' ] = array( |
|
| 78 | 78 | '57ef23539033602e61d4a560', |
| 79 | 79 | '54c67bb9e4b0512429885513', |
| 80 | 80 | '54c67bb9e4b0512429885512', |
@@ -103,20 +103,20 @@ discard block |
||
| 103 | 103 | return; |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - if ( ! isset( $query->query_vars['post_type'] ) ) { |
|
| 106 | + if ( ! isset( $query->query_vars[ 'post_type' ] ) ) { |
|
| 107 | 107 | return; |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - if ( 'gravityview' !== $query->query_vars['post_type'] ) { |
|
| 110 | + if ( 'gravityview' !== $query->query_vars[ 'post_type' ] ) { |
|
| 111 | 111 | return; |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - $form_id = (int) \GV\Utils::_GET( 'gravityview_form_id' ); |
|
| 114 | + $form_id = (int)\GV\Utils::_GET( 'gravityview_form_id' ); |
|
| 115 | 115 | |
| 116 | 116 | $meta_query = array(); |
| 117 | 117 | |
| 118 | 118 | if ( $form_id ) { |
| 119 | - $meta_query[] = array( |
|
| 119 | + $meta_query[ ] = array( |
|
| 120 | 120 | 'key' => '_gravityview_form_id', |
| 121 | 121 | 'value' => $form_id, |
| 122 | 122 | ); |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | $layout_id = \GV\Utils::_GET( 'gravityview_layout' ); |
| 126 | 126 | |
| 127 | 127 | if ( $layout_id ) { |
| 128 | - $meta_query[] = array( |
|
| 128 | + $meta_query[ ] = array( |
|
| 129 | 129 | 'key' => '_gravityview_directory_template', |
| 130 | 130 | 'value' => esc_attr( $layout_id ), |
| 131 | 131 | ); |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | public function add_view_dropdown() { |
| 143 | 143 | $current_screen = get_current_screen(); |
| 144 | 144 | |
| 145 | - if( 'gravityview' !== $current_screen->post_type ) { |
|
| 145 | + if ( 'gravityview' !== $current_screen->post_type ) { |
|
| 146 | 146 | return; |
| 147 | 147 | } |
| 148 | 148 | |
@@ -150,12 +150,12 @@ discard block |
||
| 150 | 150 | $current_form = \GV\Utils::_GET( 'gravityview_form_id' ); |
| 151 | 151 | |
| 152 | 152 | // If there are no forms to select, show no forms. |
| 153 | - if( ! empty( $forms ) ) { ?> |
|
| 153 | + if ( ! empty( $forms ) ) { ?> |
|
| 154 | 154 | <label for="gravityview_form_id" class="screen-reader-text"><?php esc_html_e( 'Filter Views by form', 'gravityview' ); ?></label> |
| 155 | 155 | <select name="gravityview_form_id" id="gravityview_form_id"> |
| 156 | 156 | <option value="" <?php selected( '', $current_form, true ); ?>><?php esc_html_e( 'All forms', 'gravityview' ); ?></option> |
| 157 | - <?php foreach( $forms as $form ) { ?> |
|
| 158 | - <option value="<?php echo esc_attr( $form['id'] ); ?>" <?php selected( $form['id'], $current_form, true ); ?>><?php echo esc_html( $form['title'] ); ?></option> |
|
| 157 | + <?php foreach ( $forms as $form ) { ?> |
|
| 158 | + <option value="<?php echo esc_attr( $form[ 'id' ] ); ?>" <?php selected( $form[ 'id' ], $current_form, true ); ?>><?php echo esc_html( $form[ 'title' ] ); ?></option> |
|
| 159 | 159 | <?php } ?> |
| 160 | 160 | </select> |
| 161 | 161 | <?php } |
@@ -164,26 +164,26 @@ discard block |
||
| 164 | 164 | $current_layout = \GV\Utils::_GET( 'gravityview_layout' ); |
| 165 | 165 | |
| 166 | 166 | // If there are no forms to select, show no forms. |
| 167 | - if( ! empty( $layouts ) ) { ?> |
|
| 167 | + if ( ! empty( $layouts ) ) { ?> |
|
| 168 | 168 | <label for="gravityview_layout_name" class="screen-reader-text"><?php esc_html_e( 'Filter Views by layout', 'gravityview' ); ?></label> |
| 169 | 169 | <select name="gravityview_layout" id="gravityview_layout_name"> |
| 170 | 170 | <option value="" <?php selected( '', $current_layout, true ); ?>><?php esc_html_e( 'All layouts', 'gravityview' ); ?></option> |
| 171 | 171 | <optgroup label="<?php esc_html_e( 'Layouts', 'gravityview' ); ?>"> |
| 172 | - <?php foreach( $layouts as $layout_id => $layout ) { |
|
| 173 | - if ( in_array( $layout['type'], array( 'preset', 'internal' ), true ) ) { |
|
| 172 | + <?php foreach ( $layouts as $layout_id => $layout ) { |
|
| 173 | + if ( in_array( $layout[ 'type' ], array( 'preset', 'internal' ), true ) ) { |
|
| 174 | 174 | continue; |
| 175 | 175 | } |
| 176 | 176 | ?> |
| 177 | - <option value="<?php echo esc_attr( $layout_id ); ?>" <?php selected( $layout_id, $current_layout, true ); ?>><?php echo esc_html( $layout['label'] ); ?></option> |
|
| 177 | + <option value="<?php echo esc_attr( $layout_id ); ?>" <?php selected( $layout_id, $current_layout, true ); ?>><?php echo esc_html( $layout[ 'label' ] ); ?></option> |
|
| 178 | 178 | <?php } ?> |
| 179 | 179 | </optgroup> |
| 180 | 180 | <optgroup label="<?php esc_html_e( 'Form Presets', 'gravityview' ); ?>"> |
| 181 | - <?php foreach( $layouts as $layout_id => $layout ) { |
|
| 182 | - if ( ! in_array( $layout['type'], array( 'preset' ), true ) ) { |
|
| 181 | + <?php foreach ( $layouts as $layout_id => $layout ) { |
|
| 182 | + if ( ! in_array( $layout[ 'type' ], array( 'preset' ), true ) ) { |
|
| 183 | 183 | continue; |
| 184 | 184 | } |
| 185 | 185 | ?> |
| 186 | - <option value="<?php echo esc_attr( $layout_id ); ?>" <?php selected( $layout_id, $current_layout, true ); ?>><?php echo esc_html( $layout['label'] ); ?></option> |
|
| 186 | + <option value="<?php echo esc_attr( $layout_id ); ?>" <?php selected( $layout_id, $current_layout, true ); ?>><?php echo esc_html( $layout[ 'label' ] ); ?></option> |
|
| 187 | 187 | <?php } ?> |
| 188 | 188 | </optgroup> |
| 189 | 189 | </select> |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | */ |
| 198 | 198 | public static function render_setting_row( $key = '', $current_settings = array(), $override_input = null, $name = 'template_settings[%s]', $id = 'gravityview_se_%s' ) { |
| 199 | 199 | _deprecated_function( 'GravityView_Admin_Views::render_setting_row', '1.1.7', 'GravityView_Render_Settings::render_setting_row' ); |
| 200 | - GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name , $id ); |
|
| 200 | + GravityView_Render_Settings::render_setting_row( $key, $current_settings, $override_input, $name, $id ); |
|
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | /** |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | public static function gform_toolbar_menu( $menu_items = array(), $id = NULL ) { |
| 220 | 220 | |
| 221 | 221 | // Don't show on Trashed forms |
| 222 | - if( 'trash' === rgget( 'filter') ) { |
|
| 222 | + if ( 'trash' === rgget( 'filter' ) ) { |
|
| 223 | 223 | return $menu_items; |
| 224 | 224 | } |
| 225 | 225 | |
@@ -227,13 +227,13 @@ discard block |
||
| 227 | 227 | |
| 228 | 228 | $priority = 0; |
| 229 | 229 | |
| 230 | - if( 'form_list' === GFForms::get_page() ) { |
|
| 230 | + if ( 'form_list' === GFForms::get_page() ) { |
|
| 231 | 231 | $priority = 790; |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | - if( empty( $connected_views ) ) { |
|
| 234 | + if ( empty( $connected_views ) ) { |
|
| 235 | 235 | |
| 236 | - $menu_items['gravityview'] = array( |
|
| 236 | + $menu_items[ 'gravityview' ] = array( |
|
| 237 | 237 | 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
| 238 | 238 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', |
| 239 | 239 | 'title' => esc_attr__( 'Create a View using this form as a data source', 'gravityview' ), |
@@ -249,22 +249,22 @@ discard block |
||
| 249 | 249 | $sub_menu_items = array(); |
| 250 | 250 | foreach ( (array)$connected_views as $view ) { |
| 251 | 251 | |
| 252 | - if( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) { |
|
| 252 | + if ( ! GVCommon::has_cap( 'edit_gravityview', $view->ID ) ) { |
|
| 253 | 253 | continue; |
| 254 | 254 | } |
| 255 | 255 | |
| 256 | - $label = empty( $view->post_title ) ? sprintf( __('No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title; |
|
| 256 | + $label = empty( $view->post_title ) ? sprintf( __( 'No Title (View #%d)', 'gravityview' ), $view->ID ) : $view->post_title; |
|
| 257 | 257 | |
| 258 | - $sub_menu_items[] = array( |
|
| 258 | + $sub_menu_items[ ] = array( |
|
| 259 | 259 | 'label' => esc_attr( $label ), |
| 260 | - 'url' => admin_url( 'post.php?action=edit&post='.$view->ID ), |
|
| 260 | + 'url' => admin_url( 'post.php?action=edit&post=' . $view->ID ), |
|
| 261 | 261 | ); |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | // If there were no items added, then let's create the parent menu |
| 265 | - if( $sub_menu_items ) { |
|
| 265 | + if ( $sub_menu_items ) { |
|
| 266 | 266 | |
| 267 | - $sub_menu_items[] = array( |
|
| 267 | + $sub_menu_items[ ] = array( |
|
| 268 | 268 | 'label' => esc_attr__( 'Create a View', 'gravityview' ), |
| 269 | 269 | 'link_class' => 'gv-create-view', |
| 270 | 270 | 'icon' => '<i> + </i>', |
@@ -280,14 +280,14 @@ discard block |
||
| 280 | 280 | if ( ! ( 'gf_edit_forms' === rgget( 'page' ) && '' === rgget( 'view' ) ) || version_compare( '2.5-beta', GFForms::$version, '>' ) ) { |
| 281 | 281 | |
| 282 | 282 | // Make sure Gravity Forms uses the submenu; if there's only one item, it uses a link instead of a dropdown |
| 283 | - $sub_menu_items[] = array( |
|
| 283 | + $sub_menu_items[ ] = array( |
|
| 284 | 284 | 'url' => '#', |
| 285 | 285 | 'label' => '', |
| 286 | 286 | 'menu_class' => 'hidden', |
| 287 | 287 | 'capabilities' => '', |
| 288 | 288 | ); |
| 289 | 289 | |
| 290 | - $menu_items['gravityview'] = array( |
|
| 290 | + $menu_items[ 'gravityview' ] = array( |
|
| 291 | 291 | 'label' => __( 'Connected Views', 'gravityview' ), |
| 292 | 292 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', |
| 293 | 293 | 'title' => __( 'GravityView Views using this form as a data source', 'gravityview' ), |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | |
| 302 | 302 | } else { |
| 303 | 303 | |
| 304 | - $menu_items[ 'gravityview'] = array( |
|
| 304 | + $menu_items[ 'gravityview' ] = array( |
|
| 305 | 305 | 'label' => __( 'Connected Views', 'gravityview' ), |
| 306 | 306 | 'url' => '#gravityview-group-heading', |
| 307 | 307 | 'icon' => '<i class="fa fa-lg gv-icon-astronaut-head gv-icon"></i>', |
@@ -337,8 +337,8 @@ discard block |
||
| 337 | 337 | $add = array( 'captcha', 'page' ); |
| 338 | 338 | |
| 339 | 339 | // Don't allowing editing the following values: |
| 340 | - if( $context === 'edit' ) { |
|
| 341 | - $add[] = 'post_id'; |
|
| 340 | + if ( $context === 'edit' ) { |
|
| 341 | + $add[ ] = 'post_id'; |
|
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | $return = array_merge( $array, $add ); |
@@ -361,27 +361,27 @@ discard block |
||
| 361 | 361 | foreach ( $default_args as $key => $arg ) { |
| 362 | 362 | |
| 363 | 363 | // If an arg has `tooltip` defined, but it's false, don't display a tooltip |
| 364 | - if( isset( $arg['tooltip'] ) && empty( $arg['tooltip'] ) ) { continue; } |
|
| 364 | + if ( isset( $arg[ 'tooltip' ] ) && empty( $arg[ 'tooltip' ] ) ) { continue; } |
|
| 365 | 365 | |
| 366 | 366 | // By default, use `tooltip` if defined. |
| 367 | - $tooltip = empty( $arg['tooltip'] ) ? NULL : $arg['tooltip']; |
|
| 367 | + $tooltip = empty( $arg[ 'tooltip' ] ) ? NULL : $arg[ 'tooltip' ]; |
|
| 368 | 368 | |
| 369 | 369 | // If there's no tooltip set, continue |
| 370 | - if( empty( $tooltip ) ) { |
|
| 370 | + if ( empty( $tooltip ) ) { |
|
| 371 | 371 | continue; |
| 372 | 372 | } |
| 373 | 373 | |
| 374 | 374 | // Add the tooltip |
| 375 | - $gv_tooltips[ 'gv_'.$key ] = array( |
|
| 376 | - 'title' => $arg['label'], |
|
| 375 | + $gv_tooltips[ 'gv_' . $key ] = array( |
|
| 376 | + 'title' => $arg[ 'label' ], |
|
| 377 | 377 | 'value' => $tooltip, |
| 378 | 378 | ); |
| 379 | 379 | |
| 380 | 380 | } |
| 381 | 381 | |
| 382 | - $gv_tooltips['gv_css_merge_tags'] = array( |
|
| 383 | - 'title' => __('CSS Merge Tags', 'gravityview'), |
|
| 384 | - 'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview'), '<code>', '</code>' ) |
|
| 382 | + $gv_tooltips[ 'gv_css_merge_tags' ] = array( |
|
| 383 | + 'title' => __( 'CSS Merge Tags', 'gravityview' ), |
|
| 384 | + 'value' => sprintf( __( 'Developers: The CSS classes will be sanitized using the %ssanitize_title_with_dashes()%s function.', 'gravityview' ), '<code>', '</code>' ) |
|
| 385 | 385 | ); |
| 386 | 386 | |
| 387 | 387 | /** |
@@ -399,9 +399,9 @@ discard block |
||
| 399 | 399 | |
| 400 | 400 | foreach ( $gv_tooltips as $key => $tooltip ) { |
| 401 | 401 | |
| 402 | - $title = empty( $tooltip['title'] ) ? '' : '<h6>'.esc_html( $tooltip['title'] ) .'</h6>'; |
|
| 402 | + $title = empty( $tooltip[ 'title' ] ) ? '' : '<h6>' . esc_html( $tooltip[ 'title' ] ) . '</h6>'; |
|
| 403 | 403 | |
| 404 | - $tooltips[ $key ] = $title . wpautop( esc_html( $tooltip['value'] ) ); |
|
| 404 | + $tooltips[ $key ] = $title . wpautop( esc_html( $tooltip[ 'value' ] ) ); |
|
| 405 | 405 | } |
| 406 | 406 | |
| 407 | 407 | return $tooltips; |
@@ -415,7 +415,7 @@ discard block |
||
| 415 | 415 | * |
| 416 | 416 | * @return void |
| 417 | 417 | */ |
| 418 | - public function add_custom_column_content( $column_name = NULL, $post_id ) { |
|
| 418 | + public function add_custom_column_content( $column_name = NULL, $post_id ) { |
|
| 419 | 419 | |
| 420 | 420 | $output = ''; |
| 421 | 421 | |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | // Generate backup if label doesn't exist: `example_name` => `Example Name` |
| 438 | 438 | $template_id_pretty = ucwords( implode( ' ', explode( '_', $template_id ) ) ); |
| 439 | 439 | |
| 440 | - $output = $template ? $template['label'] : $template_id_pretty; |
|
| 440 | + $output = $template ? $template[ 'label' ] : $template_id_pretty; |
|
| 441 | 441 | |
| 442 | 442 | break; |
| 443 | 443 | |
@@ -478,44 +478,44 @@ discard block |
||
| 478 | 478 | static public function get_connected_form_links( $form, $include_form_link = true ) { |
| 479 | 479 | |
| 480 | 480 | // Either the form is empty or the form ID is 0, not yet set. |
| 481 | - if( empty( $form ) ) { |
|
| 481 | + if ( empty( $form ) ) { |
|
| 482 | 482 | return ''; |
| 483 | 483 | } |
| 484 | 484 | |
| 485 | 485 | // The $form is passed as the form ID |
| 486 | - if( !is_array( $form ) ) { |
|
| 486 | + if ( ! is_array( $form ) ) { |
|
| 487 | 487 | $form = gravityview_get_form( $form ); |
| 488 | 488 | } |
| 489 | 489 | |
| 490 | - $form_id = $form['id']; |
|
| 490 | + $form_id = $form[ 'id' ]; |
|
| 491 | 491 | $links = array(); |
| 492 | 492 | |
| 493 | - if( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) { |
|
| 493 | + if ( GVCommon::has_cap( 'gravityforms_edit_forms' ) ) { |
|
| 494 | 494 | $form_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&id=%d', $form_id ) ); |
| 495 | - $form_link = '<strong class="gv-form-title">'.gravityview_get_link( $form_url, $form['title'], 'class=row-title' ).'</strong>'; |
|
| 496 | - $links[] = '<span>'.gravityview_get_link( $form_url, __('Edit Form', 'gravityview') ).'</span>'; |
|
| 495 | + $form_link = '<strong class="gv-form-title">' . gravityview_get_link( $form_url, $form[ 'title' ], 'class=row-title' ) . '</strong>'; |
|
| 496 | + $links[ ] = '<span>' . gravityview_get_link( $form_url, __( 'Edit Form', 'gravityview' ) ) . '</span>'; |
|
| 497 | 497 | } else { |
| 498 | - $form_link = '<strong class="gv-form-title">'. esc_html( $form['title'] ). '</strong>'; |
|
| 498 | + $form_link = '<strong class="gv-form-title">' . esc_html( $form[ 'title' ] ) . '</strong>'; |
|
| 499 | 499 | } |
| 500 | 500 | |
| 501 | - if( GVCommon::has_cap( 'gravityforms_view_entries' ) ) { |
|
| 501 | + if ( GVCommon::has_cap( 'gravityforms_view_entries' ) ) { |
|
| 502 | 502 | $entries_url = admin_url( sprintf( 'admin.php?page=gf_entries&id=%d', $form_id ) ); |
| 503 | - $links[] = '<span>'.gravityview_get_link( $entries_url, __('Entries', 'gravityview') ).'</span>'; |
|
| 503 | + $links[ ] = '<span>' . gravityview_get_link( $entries_url, __( 'Entries', 'gravityview' ) ) . '</span>'; |
|
| 504 | 504 | } |
| 505 | 505 | |
| 506 | - if( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) { |
|
| 506 | + if ( GVCommon::has_cap( array( 'gravityforms_edit_settings', 'gravityview_view_settings' ) ) ) { |
|
| 507 | 507 | $settings_url = admin_url( sprintf( 'admin.php?page=gf_edit_forms&view=settings&id=%d', $form_id ) ); |
| 508 | - $links[] = '<span>'.gravityview_get_link( $settings_url, __('Settings', 'gravityview'), 'title='.__('Edit settings for this form', 'gravityview') ).'</span>'; |
|
| 508 | + $links[ ] = '<span>' . gravityview_get_link( $settings_url, __( 'Settings', 'gravityview' ), 'title=' . __( 'Edit settings for this form', 'gravityview' ) ) . '</span>'; |
|
| 509 | 509 | } |
| 510 | 510 | |
| 511 | - if( GVCommon::has_cap( array("gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms") ) ) { |
|
| 511 | + if ( GVCommon::has_cap( array( "gravityforms_edit_forms", "gravityforms_create_form", "gravityforms_preview_forms" ) ) ) { |
|
| 512 | 512 | $preview_url = site_url( sprintf( '?gf_page=preview&id=%d', $form_id ) ); |
| 513 | - $links[] = '<span>'.gravityview_get_link( $preview_url, __('Preview Form', 'gravityview'), 'title='.__('Preview this form', 'gravityview') ).'</span>'; |
|
| 513 | + $links[ ] = '<span>' . gravityview_get_link( $preview_url, __( 'Preview Form', 'gravityview' ), 'title=' . __( 'Preview this form', 'gravityview' ) ) . '</span>'; |
|
| 514 | 514 | } |
| 515 | 515 | |
| 516 | 516 | $output = ''; |
| 517 | 517 | |
| 518 | - if( !empty( $include_form_link ) ) { |
|
| 518 | + if ( ! empty( $include_form_link ) ) { |
|
| 519 | 519 | $output .= $form_link; |
| 520 | 520 | } |
| 521 | 521 | |
@@ -530,11 +530,11 @@ discard block |
||
| 530 | 530 | $css_class = 'row-actions'; |
| 531 | 531 | |
| 532 | 532 | // Is Screen Options > View mode set to "Extended view"? If so, keep actions visible. |
| 533 | - if( 'excerpt' === get_user_setting( 'posts_list_mode', 'list' ) ) { |
|
| 533 | + if ( 'excerpt' === get_user_setting( 'posts_list_mode', 'list' ) ) { |
|
| 534 | 534 | $css_class = 'row-actions visible'; |
| 535 | 535 | } |
| 536 | 536 | |
| 537 | - $output .= '<div class="' . $css_class . '">'. implode( ' | ', $links ) .'</div>'; |
|
| 537 | + $output .= '<div class="' . $css_class . '">' . implode( ' | ', $links ) . '</div>'; |
|
| 538 | 538 | |
| 539 | 539 | return $output; |
| 540 | 540 | } |
@@ -548,8 +548,8 @@ discard block |
||
| 548 | 548 | // Get the date column and save it for later to add back in. |
| 549 | 549 | // This adds it after the Data Source column. |
| 550 | 550 | // This way, we don't need to do array_slice, array_merge, etc. |
| 551 | - $date = $columns['date']; |
|
| 552 | - unset( $columns['date'] ); |
|
| 551 | + $date = $columns[ 'date' ]; |
|
| 552 | + unset( $columns[ 'date' ] ); |
|
| 553 | 553 | |
| 554 | 554 | $data_source_required_caps = array( |
| 555 | 555 | 'gravityforms_edit_forms', |
@@ -560,14 +560,14 @@ discard block |
||
| 560 | 560 | 'gravityforms_preview_forms', |
| 561 | 561 | ); |
| 562 | 562 | |
| 563 | - if( GVCommon::has_cap( $data_source_required_caps ) ) { |
|
| 564 | - $columns['gv_connected_form'] = __( 'Data Source', 'gravityview' ); |
|
| 563 | + if ( GVCommon::has_cap( $data_source_required_caps ) ) { |
|
| 564 | + $columns[ 'gv_connected_form' ] = __( 'Data Source', 'gravityview' ); |
|
| 565 | 565 | } |
| 566 | 566 | |
| 567 | - $columns['gv_template'] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' ); |
|
| 567 | + $columns[ 'gv_template' ] = _x( 'Template', 'Column title that shows what template is being used for Views', 'gravityview' ); |
|
| 568 | 568 | |
| 569 | 569 | // Add the date back in. |
| 570 | - $columns['date'] = $date; |
|
| 570 | + $columns[ 'date' ] = $date; |
|
| 571 | 571 | |
| 572 | 572 | return $columns; |
| 573 | 573 | } |
@@ -580,12 +580,12 @@ discard block |
||
| 580 | 580 | */ |
| 581 | 581 | function save_postdata( $post_id ) { |
| 582 | 582 | |
| 583 | - if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ){ |
|
| 583 | + if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
| 584 | 584 | return; |
| 585 | 585 | } |
| 586 | 586 | |
| 587 | 587 | // validate post_type |
| 588 | - if ( ! isset( $_POST['post_type'] ) || 'gravityview' != $_POST['post_type'] ) { |
|
| 588 | + if ( ! isset( $_POST[ 'post_type' ] ) || 'gravityview' != $_POST[ 'post_type' ] ) { |
|
| 589 | 589 | return; |
| 590 | 590 | } |
| 591 | 591 | |
@@ -600,63 +600,63 @@ discard block |
||
| 600 | 600 | $statii = array(); |
| 601 | 601 | |
| 602 | 602 | // check if this is a start fresh View |
| 603 | - if ( isset( $_POST['gravityview_select_form_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_form_nonce'], 'gravityview_select_form' ) ) { |
|
| 603 | + if ( isset( $_POST[ 'gravityview_select_form_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_form_nonce' ], 'gravityview_select_form' ) ) { |
|
| 604 | 604 | |
| 605 | - $form_id = !empty( $_POST['gravityview_form_id'] ) ? $_POST['gravityview_form_id'] : ''; |
|
| 605 | + $form_id = ! empty( $_POST[ 'gravityview_form_id' ] ) ? $_POST[ 'gravityview_form_id' ] : ''; |
|
| 606 | 606 | // save form id |
| 607 | - $statii['form_id'] = update_post_meta( $post_id, '_gravityview_form_id', $form_id ); |
|
| 607 | + $statii[ 'form_id' ] = update_post_meta( $post_id, '_gravityview_form_id', $form_id ); |
|
| 608 | 608 | |
| 609 | 609 | } |
| 610 | 610 | |
| 611 | - if( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii['form_id'] ) ) { |
|
| 611 | + if ( false === GVCommon::has_cap( 'gravityforms_create_form' ) && empty( $statii[ 'form_id' ] ) ) { |
|
| 612 | 612 | gravityview()->log->error( 'Current user does not have the capability to create a new Form.', array( 'data' => wp_get_current_user() ) ); |
| 613 | 613 | return; |
| 614 | 614 | } |
| 615 | 615 | |
| 616 | 616 | // Was this a start fresh? |
| 617 | - if ( ! empty( $_POST['gravityview_form_id_start_fresh'] ) ) { |
|
| 618 | - $statii['start_fresh'] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 ); |
|
| 617 | + if ( ! empty( $_POST[ 'gravityview_form_id_start_fresh' ] ) ) { |
|
| 618 | + $statii[ 'start_fresh' ] = add_post_meta( $post_id, '_gravityview_start_fresh', 1 ); |
|
| 619 | 619 | } else { |
| 620 | - $statii['start_fresh'] = delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
|
| 620 | + $statii[ 'start_fresh' ] = delete_post_meta( $post_id, '_gravityview_start_fresh' ); |
|
| 621 | 621 | } |
| 622 | 622 | |
| 623 | 623 | // Check if we have a template id |
| 624 | - if ( isset( $_POST['gravityview_select_template_nonce'] ) && wp_verify_nonce( $_POST['gravityview_select_template_nonce'], 'gravityview_select_template' ) ) { |
|
| 624 | + if ( isset( $_POST[ 'gravityview_select_template_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_select_template_nonce' ], 'gravityview_select_template' ) ) { |
|
| 625 | 625 | |
| 626 | - $template_id = !empty( $_POST['gravityview_directory_template'] ) ? $_POST['gravityview_directory_template'] : ''; |
|
| 626 | + $template_id = ! empty( $_POST[ 'gravityview_directory_template' ] ) ? $_POST[ 'gravityview_directory_template' ] : ''; |
|
| 627 | 627 | |
| 628 | 628 | // now save template id |
| 629 | - $statii['directory_template'] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id ); |
|
| 629 | + $statii[ 'directory_template' ] = update_post_meta( $post_id, '_gravityview_directory_template', $template_id ); |
|
| 630 | 630 | } |
| 631 | 631 | |
| 632 | 632 | |
| 633 | 633 | // save View Configuration metabox |
| 634 | - if ( isset( $_POST['gravityview_view_configuration_nonce'] ) && wp_verify_nonce( $_POST['gravityview_view_configuration_nonce'], 'gravityview_view_configuration' ) ) { |
|
| 634 | + if ( isset( $_POST[ 'gravityview_view_configuration_nonce' ] ) && wp_verify_nonce( $_POST[ 'gravityview_view_configuration_nonce' ], 'gravityview_view_configuration' ) ) { |
|
| 635 | 635 | |
| 636 | 636 | // template settings |
| 637 | - if( empty( $_POST['template_settings'] ) ) { |
|
| 638 | - $_POST['template_settings'] = array(); |
|
| 637 | + if ( empty( $_POST[ 'template_settings' ] ) ) { |
|
| 638 | + $_POST[ 'template_settings' ] = array(); |
|
| 639 | 639 | } |
| 640 | - $statii['template_settings'] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST['template_settings'] ); |
|
| 640 | + $statii[ 'template_settings' ] = update_post_meta( $post_id, '_gravityview_template_settings', $_POST[ 'template_settings' ] ); |
|
| 641 | 641 | |
| 642 | 642 | // guard against unloaded View configuration page |
| 643 | - if ( isset( $_POST['gv_fields'] ) && isset( $_POST['gv_fields_done'] ) ) { |
|
| 643 | + if ( isset( $_POST[ 'gv_fields' ] ) && isset( $_POST[ 'gv_fields_done' ] ) ) { |
|
| 644 | 644 | $fields = array(); |
| 645 | 645 | |
| 646 | - if ( ! empty( $_POST['gv_fields'] ) ) { |
|
| 646 | + if ( ! empty( $_POST[ 'gv_fields' ] ) ) { |
|
| 647 | 647 | $fields = _gravityview_process_posted_fields(); |
| 648 | 648 | } |
| 649 | 649 | |
| 650 | 650 | $fields = wp_slash( $fields ); |
| 651 | 651 | |
| 652 | - $statii['directory_fields'] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields ); |
|
| 652 | + $statii[ 'directory_fields' ] = update_post_meta( $post_id, '_gravityview_directory_fields', $fields ); |
|
| 653 | 653 | } |
| 654 | 654 | |
| 655 | 655 | // Directory Visible Widgets |
| 656 | - if( empty( $_POST['widgets'] ) ) { |
|
| 657 | - $_POST['widgets'] = array(); |
|
| 656 | + if ( empty( $_POST[ 'widgets' ] ) ) { |
|
| 657 | + $_POST[ 'widgets' ] = array(); |
|
| 658 | 658 | } |
| 659 | - $statii['directory_widgets'] = gravityview_set_directory_widgets( $post_id, $_POST['widgets'] ); |
|
| 659 | + $statii[ 'directory_widgets' ] = gravityview_set_directory_widgets( $post_id, $_POST[ 'widgets' ] ); |
|
| 660 | 660 | |
| 661 | 661 | } // end save view configuration |
| 662 | 662 | |
@@ -666,7 +666,7 @@ discard block |
||
| 666 | 666 | * @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. |
| 667 | 667 | * @since 1.17.2 |
| 668 | 668 | */ |
| 669 | - do_action('gravityview_view_saved', $post_id, $statii ); |
|
| 669 | + do_action( 'gravityview_view_saved', $post_id, $statii ); |
|
| 670 | 670 | |
| 671 | 671 | gravityview()->log->debug( '[save_postdata] Update Post Meta Statuses (also returns false if nothing changed)', array( 'data' => array_map( 'intval', $statii ) ) ); |
| 672 | 672 | } |
@@ -711,20 +711,20 @@ discard block |
||
| 711 | 711 | |
| 712 | 712 | $output = ''; |
| 713 | 713 | |
| 714 | - if( !empty( $fields ) ) { |
|
| 714 | + if ( ! empty( $fields ) ) { |
|
| 715 | 715 | |
| 716 | - foreach( $fields as $id => $details ) { |
|
| 716 | + foreach ( $fields as $id => $details ) { |
|
| 717 | 717 | |
| 718 | - if( in_array( $details['type'], (array) $blacklist_field_types ) ) { |
|
| 718 | + if ( in_array( $details[ 'type' ], (array)$blacklist_field_types ) ) { |
|
| 719 | 719 | continue; |
| 720 | 720 | } |
| 721 | 721 | |
| 722 | 722 | // Edit mode only allows editing the parent fields, not single inputs. |
| 723 | - if( $context === 'edit' && ! empty( $details['parent'] ) ) { |
|
| 723 | + if ( $context === 'edit' && ! empty( $details[ 'parent' ] ) ) { |
|
| 724 | 724 | continue; |
| 725 | 725 | } |
| 726 | 726 | |
| 727 | - $output .= new GravityView_Admin_View_Field( $details['label'], $id, $details, array(), $form ); |
|
| 727 | + $output .= new GravityView_Admin_View_Field( $details[ 'label' ], $id, $details, array(), $form ); |
|
| 728 | 728 | |
| 729 | 729 | } // End foreach |
| 730 | 730 | } |
@@ -732,7 +732,7 @@ discard block |
||
| 732 | 732 | echo $output; |
| 733 | 733 | |
| 734 | 734 | // For the EDIT view we only want to allow the form fields. |
| 735 | - if( $context === 'edit' ) { |
|
| 735 | + if ( $context === 'edit' ) { |
|
| 736 | 736 | return; |
| 737 | 737 | } |
| 738 | 738 | |
@@ -751,7 +751,7 @@ discard block |
||
| 751 | 751 | $additional_fields = array( |
| 752 | 752 | array( |
| 753 | 753 | 'label_text' => '+ ' . __( 'Add All Form Fields', 'gravityview' ), |
| 754 | - 'desc' => __('Insert all the form fields at once.', 'gravityview'), |
|
| 754 | + 'desc' => __( 'Insert all the form fields at once.', 'gravityview' ), |
|
| 755 | 755 | 'field_id' => 'all-fields', |
| 756 | 756 | 'label_type' => 'field', |
| 757 | 757 | 'input_type' => null, |
@@ -767,7 +767,7 @@ discard block |
||
| 767 | 767 | */ |
| 768 | 768 | $additional_fields = apply_filters( 'gravityview_additional_fields', $additional_fields ); |
| 769 | 769 | |
| 770 | - foreach ( (array) $additional_fields as $item ) { |
|
| 770 | + foreach ( (array)$additional_fields as $item ) { |
|
| 771 | 771 | |
| 772 | 772 | // Prevent items from not having index set |
| 773 | 773 | $item = wp_parse_args( $item, array( |
@@ -778,16 +778,16 @@ discard block |
||
| 778 | 778 | 'field_options' => null, |
| 779 | 779 | 'settings_html' => null, |
| 780 | 780 | 'icon' => null, |
| 781 | - )); |
|
| 781 | + ) ); |
|
| 782 | 782 | |
| 783 | 783 | // Backward compat. |
| 784 | - if( !empty( $item['field_options'] ) ) { |
|
| 784 | + if ( ! empty( $item[ 'field_options' ] ) ) { |
|
| 785 | 785 | // Use settings_html from now on. |
| 786 | - $item['settings_html'] = $item['field_options']; |
|
| 786 | + $item[ 'settings_html' ] = $item[ 'field_options' ]; |
|
| 787 | 787 | } |
| 788 | 788 | |
| 789 | 789 | // Render a label for each of them |
| 790 | - echo new GravityView_Admin_View_Field( $item['label_text'], $item['field_id'], $item, $settings = array(), $form ); |
|
| 790 | + echo new GravityView_Admin_View_Field( $item[ 'label_text' ], $item[ 'field_id' ], $item, $settings = array(), $form ); |
|
| 791 | 791 | |
| 792 | 792 | } |
| 793 | 793 | |
@@ -799,59 +799,59 @@ discard block |
||
| 799 | 799 | * @param string $zone Either 'single', 'directory', 'header', 'footer' |
| 800 | 800 | * @return array |
| 801 | 801 | */ |
| 802 | - function get_entry_default_fields($form, $zone) { |
|
| 802 | + function get_entry_default_fields( $form, $zone ) { |
|
| 803 | 803 | |
| 804 | 804 | $entry_default_fields = array(); |
| 805 | 805 | |
| 806 | - if( in_array( $zone, array( 'directory', 'single' ) ) ) { |
|
| 806 | + if ( in_array( $zone, array( 'directory', 'single' ) ) ) { |
|
| 807 | 807 | |
| 808 | 808 | $entry_default_fields = array( |
| 809 | 809 | 'id' => array( |
| 810 | - 'label' => __('Entry ID', 'gravityview'), |
|
| 810 | + 'label' => __( 'Entry ID', 'gravityview' ), |
|
| 811 | 811 | 'type' => 'id', |
| 812 | - 'desc' => __('The unique ID of the entry.', 'gravityview'), |
|
| 812 | + 'desc' => __( 'The unique ID of the entry.', 'gravityview' ), |
|
| 813 | 813 | ), |
| 814 | 814 | 'date_created' => array( |
| 815 | - 'label' => __('Entry Date', 'gravityview'), |
|
| 816 | - 'desc' => __('The date the entry was created.', 'gravityview'), |
|
| 815 | + 'label' => __( 'Entry Date', 'gravityview' ), |
|
| 816 | + 'desc' => __( 'The date the entry was created.', 'gravityview' ), |
|
| 817 | 817 | 'type' => 'date_created', |
| 818 | 818 | ), |
| 819 | 819 | 'date_updated' => array( |
| 820 | - 'label' => __( 'Date Updated', 'gravityview'), |
|
| 821 | - 'desc' => __('The date the entry was last updated.', 'gravityview'), |
|
| 820 | + 'label' => __( 'Date Updated', 'gravityview' ), |
|
| 821 | + 'desc' => __( 'The date the entry was last updated.', 'gravityview' ), |
|
| 822 | 822 | 'type' => 'date_updated', |
| 823 | 823 | ), |
| 824 | 824 | 'source_url' => array( |
| 825 | - 'label' => __('Source URL', 'gravityview'), |
|
| 825 | + 'label' => __( 'Source URL', 'gravityview' ), |
|
| 826 | 826 | 'type' => 'source_url', |
| 827 | - 'desc' => __('The URL of the page where the form was submitted.', 'gravityview'), |
|
| 827 | + 'desc' => __( 'The URL of the page where the form was submitted.', 'gravityview' ), |
|
| 828 | 828 | ), |
| 829 | 829 | 'ip' => array( |
| 830 | - 'label' => __('User IP', 'gravityview'), |
|
| 830 | + 'label' => __( 'User IP', 'gravityview' ), |
|
| 831 | 831 | 'type' => 'ip', |
| 832 | - 'desc' => __('The IP Address of the user who created the entry.', 'gravityview'), |
|
| 832 | + 'desc' => __( 'The IP Address of the user who created the entry.', 'gravityview' ), |
|
| 833 | 833 | ), |
| 834 | 834 | 'created_by' => array( |
| 835 | - 'label' => __('User', 'gravityview'), |
|
| 835 | + 'label' => __( 'User', 'gravityview' ), |
|
| 836 | 836 | 'type' => 'created_by', |
| 837 | - 'desc' => __('Details of the logged-in user who created the entry (if any).', 'gravityview'), |
|
| 837 | + 'desc' => __( 'Details of the logged-in user who created the entry (if any).', 'gravityview' ), |
|
| 838 | 838 | ), |
| 839 | 839 | |
| 840 | 840 | /** |
| 841 | 841 | * @since 1.7.2 |
| 842 | 842 | */ |
| 843 | 843 | 'other_entries' => array( |
| 844 | - 'label' => __('Other Entries', 'gravityview'), |
|
| 844 | + 'label' => __( 'Other Entries', 'gravityview' ), |
|
| 845 | 845 | 'type' => 'other_entries', |
| 846 | - 'desc' => __('Display other entries created by the entry creator.', 'gravityview'), |
|
| 846 | + 'desc' => __( 'Display other entries created by the entry creator.', 'gravityview' ), |
|
| 847 | 847 | ), |
| 848 | 848 | ); |
| 849 | 849 | |
| 850 | - if( 'single' !== $zone) { |
|
| 850 | + if ( 'single' !== $zone ) { |
|
| 851 | 851 | |
| 852 | - $entry_default_fields['entry_link'] = array( |
|
| 853 | - 'label' => __('Link to Entry', 'gravityview'), |
|
| 854 | - 'desc' => __('A dedicated link to the single entry with customizable text.', 'gravityview'), |
|
| 852 | + $entry_default_fields[ 'entry_link' ] = array( |
|
| 853 | + 'label' => __( 'Link to Entry', 'gravityview' ), |
|
| 854 | + 'desc' => __( 'A dedicated link to the single entry with customizable text.', 'gravityview' ), |
|
| 855 | 855 | 'type' => 'entry_link', |
| 856 | 856 | ); |
| 857 | 857 | } |
@@ -861,19 +861,19 @@ discard block |
||
| 861 | 861 | /** |
| 862 | 862 | * @since 1.2 |
| 863 | 863 | */ |
| 864 | - $entry_default_fields['custom'] = array( |
|
| 865 | - 'label' => __('Custom Content', 'gravityview'), |
|
| 864 | + $entry_default_fields[ 'custom' ] = array( |
|
| 865 | + 'label' => __( 'Custom Content', 'gravityview' ), |
|
| 866 | 866 | 'type' => 'custom', |
| 867 | - 'desc' => __('Insert custom text or HTML.', 'gravityview'), |
|
| 867 | + 'desc' => __( 'Insert custom text or HTML.', 'gravityview' ), |
|
| 868 | 868 | ); |
| 869 | 869 | |
| 870 | 870 | /** |
| 871 | 871 | * @since develop |
| 872 | 872 | */ |
| 873 | - $entry_default_fields['sequence'] = array( |
|
| 874 | - 'label' => __('Result Number', 'gravityview'), |
|
| 873 | + $entry_default_fields[ 'sequence' ] = array( |
|
| 874 | + 'label' => __( 'Result Number', 'gravityview' ), |
|
| 875 | 875 | 'type' => 'sequence', |
| 876 | - 'desc' => __('Display a sequential result number for each entry.', 'gravityview'), |
|
| 876 | + 'desc' => __( 'Display a sequential result number for each entry.', 'gravityview' ), |
|
| 877 | 877 | ); |
| 878 | 878 | |
| 879 | 879 | /** |
@@ -882,7 +882,7 @@ discard block |
||
| 882 | 882 | * @param string|array $form form_ID or form object |
| 883 | 883 | * @param string $zone Either 'single', 'directory', 'header', 'footer' |
| 884 | 884 | */ |
| 885 | - return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone); |
|
| 885 | + return apply_filters( 'gravityview_entry_default_fields', $entry_default_fields, $form, $zone ); |
|
| 886 | 886 | } |
| 887 | 887 | |
| 888 | 888 | /** |
@@ -893,7 +893,7 @@ discard block |
||
| 893 | 893 | */ |
| 894 | 894 | function get_available_fields( $form = '', $zone = NULL ) { |
| 895 | 895 | |
| 896 | - if( empty( $form ) ) { |
|
| 896 | + if ( empty( $form ) ) { |
|
| 897 | 897 | gravityview()->log->error( '$form is empty' ); |
| 898 | 898 | return array(); |
| 899 | 899 | } |
@@ -902,7 +902,7 @@ discard block |
||
| 902 | 902 | $fields = gravityview_get_form_fields( $form, true ); |
| 903 | 903 | |
| 904 | 904 | // get meta fields ( only if form was already created ) |
| 905 | - if( !is_array( $form ) ) { |
|
| 905 | + if ( ! is_array( $form ) ) { |
|
| 906 | 906 | $meta_fields = gravityview_get_entry_meta( $form ); |
| 907 | 907 | } else { |
| 908 | 908 | $meta_fields = array(); |
@@ -915,14 +915,14 @@ discard block |
||
| 915 | 915 | $fields = $fields + $meta_fields + $default_fields; |
| 916 | 916 | |
| 917 | 917 | // Move Custom Content to top |
| 918 | - $fields = array( 'custom' => $fields['custom'] ) + $fields; |
|
| 918 | + $fields = array( 'custom' => $fields[ 'custom' ] ) + $fields; |
|
| 919 | 919 | |
| 920 | 920 | $gv_fields = GravityView_Fields::get_all(); |
| 921 | 921 | |
| 922 | 922 | foreach ( $fields as &$field ) { |
| 923 | 923 | foreach ( $gv_fields as $gv_field ) { |
| 924 | - if ( $field['type'] === $gv_field->name ) { |
|
| 925 | - $field['icon'] = $gv_field->icon; |
|
| 924 | + if ( $field[ 'type' ] === $gv_field->name ) { |
|
| 925 | + $field[ 'icon' ] = $gv_field->icon; |
|
| 926 | 926 | } |
| 927 | 927 | } |
| 928 | 928 | } |
@@ -945,11 +945,11 @@ discard block |
||
| 945 | 945 | |
| 946 | 946 | $widgets = $this->get_registered_widgets(); |
| 947 | 947 | |
| 948 | - if( !empty( $widgets ) ) { |
|
| 948 | + if ( ! empty( $widgets ) ) { |
|
| 949 | 949 | |
| 950 | - foreach( $widgets as $id => $details ) { |
|
| 950 | + foreach ( $widgets as $id => $details ) { |
|
| 951 | 951 | |
| 952 | - echo new GravityView_Admin_View_Widget( $details['label'], $id, $details ); |
|
| 952 | + echo new GravityView_Admin_View_Widget( $details[ 'label' ], $id, $details ); |
|
| 953 | 953 | |
| 954 | 954 | } |
| 955 | 955 | } |
@@ -978,7 +978,7 @@ discard block |
||
| 978 | 978 | function render_active_areas( $template_id, $type, $zone, $rows, $values ) { |
| 979 | 979 | global $post; |
| 980 | 980 | |
| 981 | - if( $type === 'widget' ) { |
|
| 981 | + if ( $type === 'widget' ) { |
|
| 982 | 982 | $button_label = __( 'Add Widget', 'gravityview' ); |
| 983 | 983 | } else { |
| 984 | 984 | $button_label = __( 'Add Field', 'gravityview' ); |
@@ -1004,10 +1004,10 @@ discard block |
||
| 1004 | 1004 | $form_id = null; |
| 1005 | 1005 | |
| 1006 | 1006 | // if saved values, get available fields to label everyone |
| 1007 | - if( !empty( $values ) && ( !empty( $post->ID ) || !empty( $_POST['template_id'] ) ) ) { |
|
| 1007 | + if ( ! empty( $values ) && ( ! empty( $post->ID ) || ! empty( $_POST[ 'template_id' ] ) ) ) { |
|
| 1008 | 1008 | |
| 1009 | - if( !empty( $_POST['template_id'] ) ) { |
|
| 1010 | - $form = GravityView_Ajax::pre_get_form_fields( $_POST['template_id'] ); |
|
| 1009 | + if ( ! empty( $_POST[ 'template_id' ] ) ) { |
|
| 1010 | + $form = GravityView_Ajax::pre_get_form_fields( $_POST[ 'template_id' ] ); |
|
| 1011 | 1011 | } else { |
| 1012 | 1012 | $form_id = $form = gravityview_get_form_id( $post->ID ); |
| 1013 | 1013 | } |
@@ -1025,42 +1025,42 @@ discard block |
||
| 1025 | 1025 | } |
| 1026 | 1026 | } |
| 1027 | 1027 | |
| 1028 | - foreach( $rows as $row ) : |
|
| 1029 | - foreach( $row as $col => $areas ) : |
|
| 1030 | - $column = ($col == '2-2') ? '1-2' : $col; ?> |
|
| 1028 | + foreach ( $rows as $row ) : |
|
| 1029 | + foreach ( $row as $col => $areas ) : |
|
| 1030 | + $column = ( $col == '2-2' ) ? '1-2' : $col; ?> |
|
| 1031 | 1031 | |
| 1032 | 1032 | <div class="gv-grid-col-<?php echo esc_attr( $column ); ?>"> |
| 1033 | 1033 | |
| 1034 | - <?php foreach( $areas as $area ) : ?> |
|
| 1034 | + <?php foreach ( $areas as $area ) : ?> |
|
| 1035 | 1035 | |
| 1036 | - <div class="gv-droppable-area" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>"> |
|
| 1037 | - <div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone .'_'. $area['areaid'] ); ?>"> |
|
| 1036 | + <div class="gv-droppable-area" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>" data-context="<?php echo esc_attr( $zone ); ?>"> |
|
| 1037 | + <div class="active-drop active-drop-<?php echo esc_attr( $type ); ?>" data-areaid="<?php echo esc_attr( $zone . '_' . $area[ 'areaid' ] ); ?>"> |
|
| 1038 | 1038 | <?php // render saved fields |
| 1039 | - if( ! empty( $values[ $zone .'_'. $area['areaid'] ] ) ) { |
|
| 1039 | + if ( ! empty( $values[ $zone . '_' . $area[ 'areaid' ] ] ) ) { |
|
| 1040 | 1040 | |
| 1041 | - foreach( $values[ $zone .'_'. $area['areaid'] ] as $uniqid => $field ) { |
|
| 1041 | + foreach ( $values[ $zone . '_' . $area[ 'areaid' ] ] as $uniqid => $field ) { |
|
| 1042 | 1042 | |
| 1043 | 1043 | // Maybe has a form ID |
| 1044 | - $form_id = empty( $field['form_id'] ) ? $form_id : $field['form_id']; |
|
| 1044 | + $form_id = empty( $field[ 'form_id' ] ) ? $form_id : $field[ 'form_id' ]; |
|
| 1045 | 1045 | |
| 1046 | 1046 | $input_type = NULL; |
| 1047 | 1047 | |
| 1048 | 1048 | if ( $form_id ) { |
| 1049 | - $original_item = isset( $available_items[ $form_id ] [ $field['id'] ] ) ? $available_items[ $form_id ] [ $field['id'] ] : false ; |
|
| 1049 | + $original_item = isset( $available_items[ $form_id ] [ $field[ 'id' ] ] ) ? $available_items[ $form_id ] [ $field[ 'id' ] ] : false; |
|
| 1050 | 1050 | } else { |
| 1051 | - $original_item = isset( $available_items[ $field['id'] ] ) ? $available_items[ $field['id'] ] : false ; |
|
| 1051 | + $original_item = isset( $available_items[ $field[ 'id' ] ] ) ? $available_items[ $field[ 'id' ] ] : false; |
|
| 1052 | 1052 | } |
| 1053 | 1053 | |
| 1054 | - if ( !$original_item ) { |
|
| 1055 | - 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 ) ) ); |
|
| 1054 | + if ( ! $original_item ) { |
|
| 1055 | + 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 ) ) ); |
|
| 1056 | 1056 | |
| 1057 | 1057 | $original_item = $field; |
| 1058 | 1058 | } else { |
| 1059 | - $input_type = isset( $original_item['type'] ) ? $original_item['type'] : NULL; |
|
| 1059 | + $input_type = isset( $original_item[ 'type' ] ) ? $original_item[ 'type' ] : NULL; |
|
| 1060 | 1060 | } |
| 1061 | 1061 | |
| 1062 | 1062 | // Field options dialog box |
| 1063 | - $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 ); |
|
| 1063 | + $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 ); |
|
| 1064 | 1064 | |
| 1065 | 1065 | $item = array( |
| 1066 | 1066 | 'input_type' => $input_type, |
@@ -1073,22 +1073,22 @@ discard block |
||
| 1073 | 1073 | $item = wp_parse_args( $item, $original_item ); |
| 1074 | 1074 | } |
| 1075 | 1075 | |
| 1076 | - switch( $type ) { |
|
| 1076 | + switch ( $type ) { |
|
| 1077 | 1077 | case 'widget': |
| 1078 | - echo new GravityView_Admin_View_Widget( $item['label'], $field['id'], $item, $field ); |
|
| 1078 | + echo new GravityView_Admin_View_Widget( $item[ 'label' ], $field[ 'id' ], $item, $field ); |
|
| 1079 | 1079 | break; |
| 1080 | 1080 | default: |
| 1081 | - echo new GravityView_Admin_View_Field( $field['label'], $field['id'], $item, $field, $form_id ); |
|
| 1081 | + echo new GravityView_Admin_View_Field( $field[ 'label' ], $field[ 'id' ], $item, $field, $form_id ); |
|
| 1082 | 1082 | } |
| 1083 | 1083 | } |
| 1084 | 1084 | |
| 1085 | 1085 | } // End if zone is not empty ?> |
| 1086 | 1086 | |
| 1087 | - <span class="drop-message"><?php echo sprintf( esc_html__('"+ %s" or drag existing %ss here.', 'gravityview'), esc_html( $button_label ), esc_html( $type ) ); ?></span> |
|
| 1087 | + <span class="drop-message"><?php echo sprintf( esc_html__( '"+ %s" or drag existing %ss here.', 'gravityview' ), esc_html( $button_label ), esc_html( $type ) ); ?></span> |
|
| 1088 | 1088 | </div> |
| 1089 | 1089 | <div class="gv-droppable-area-action"> |
| 1090 | - <button 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 ); ?></button> |
|
| 1091 | - <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> |
|
| 1090 | + <button 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 ); ?></button> |
|
| 1091 | + <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> |
|
| 1092 | 1092 | </div> |
| 1093 | 1093 | </div> |
| 1094 | 1094 | |
@@ -1116,7 +1116,7 @@ discard block |
||
| 1116 | 1116 | // This is a new View, prefill the widgets |
| 1117 | 1117 | $widgets = array( |
| 1118 | 1118 | 'header_top' => array( |
| 1119 | - substr( md5( microtime( true ) ), 0, 13 ) => array ( |
|
| 1119 | + substr( md5( microtime( true ) ), 0, 13 ) => array( |
|
| 1120 | 1120 | 'id' => 'search_bar', |
| 1121 | 1121 | 'label' => __( 'Search Bar', 'gravityview' ), |
| 1122 | 1122 | 'search_layout' => 'horizontal', |
@@ -1191,12 +1191,12 @@ discard block |
||
| 1191 | 1191 | if ( $post ) { |
| 1192 | 1192 | $source_form_id = gravityview_get_form_id( $post->ID ); |
| 1193 | 1193 | if ( $source_form_id ) { |
| 1194 | - $form_ids[] = $source_form_id; |
|
| 1194 | + $form_ids[ ] = $source_form_id; |
|
| 1195 | 1195 | } |
| 1196 | 1196 | |
| 1197 | 1197 | $joined_forms = \GV\View::get_joined_forms( $post->ID ); |
| 1198 | 1198 | foreach ( $joined_forms as $joined_form ) { |
| 1199 | - $form_ids[] = $joined_form->ID; |
|
| 1199 | + $form_ids[ ] = $joined_form->ID; |
|
| 1200 | 1200 | } |
| 1201 | 1201 | } |
| 1202 | 1202 | foreach ( array_unique( $form_ids ) as $form_id ) { |
@@ -1230,7 +1230,7 @@ discard block |
||
| 1230 | 1230 | * @return string HTML of the active areas |
| 1231 | 1231 | */ |
| 1232 | 1232 | function render_directory_active_areas( $template_id = '', $context = 'single', $post_id = '', $echo = false ) { |
| 1233 | - if( empty( $template_id ) ) { |
|
| 1233 | + if ( empty( $template_id ) ) { |
|
| 1234 | 1234 | gravityview()->log->debug( '[render_directory_active_areas] {template_id} is empty', array( 'template_id' => $template_id ) ); |
| 1235 | 1235 | return ''; |
| 1236 | 1236 | } |
@@ -1244,12 +1244,12 @@ discard block |
||
| 1244 | 1244 | */ |
| 1245 | 1245 | $template_areas = apply_filters( 'gravityview_template_active_areas', array(), $template_id, $context ); |
| 1246 | 1246 | |
| 1247 | - if( empty( $template_areas ) ) { |
|
| 1247 | + if ( empty( $template_areas ) ) { |
|
| 1248 | 1248 | |
| 1249 | 1249 | gravityview()->log->debug( '[render_directory_active_areas] No areas defined. Maybe template {template_id} is disabled.', array( 'data' => $template_id ) ); |
| 1250 | 1250 | $output = '<div>'; |
| 1251 | - $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>'; |
|
| 1252 | - $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>'; |
|
| 1251 | + $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>'; |
|
| 1252 | + $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>'; |
|
| 1253 | 1253 | $output .= '</div>'; |
| 1254 | 1254 | } else { |
| 1255 | 1255 | |
@@ -1264,7 +1264,7 @@ discard block |
||
| 1264 | 1264 | |
| 1265 | 1265 | } |
| 1266 | 1266 | |
| 1267 | - if( $echo ) { |
|
| 1267 | + if ( $echo ) { |
|
| 1268 | 1268 | echo $output; |
| 1269 | 1269 | } |
| 1270 | 1270 | |
@@ -1292,30 +1292,30 @@ discard block |
||
| 1292 | 1292 | } |
| 1293 | 1293 | |
| 1294 | 1294 | // Add the GV font (with the Astronaut) |
| 1295 | - wp_enqueue_style( 'gravityview_global', plugins_url('assets/css/admin-global.css', GRAVITYVIEW_FILE), array(), \GV\Plugin::$version ); |
|
| 1295 | + wp_enqueue_style( 'gravityview_global', plugins_url( 'assets/css/admin-global.css', GRAVITYVIEW_FILE ), array(), \GV\Plugin::$version ); |
|
| 1296 | 1296 | wp_register_style( 'gravityview_views_styles', plugins_url( 'assets/css/admin-views.css', GRAVITYVIEW_FILE ), array( 'dashicons', 'wp-jquery-ui-dialog' ), \GV\Plugin::$version ); |
| 1297 | 1297 | |
| 1298 | - wp_register_script( 'gravityview-jquery-cookie', plugins_url('assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE), array( 'jquery' ), \GV\Plugin::$version, true ); |
|
| 1298 | + wp_register_script( 'gravityview-jquery-cookie', plugins_url( 'assets/lib/jquery.cookie/jquery.cookie.min.js', GRAVITYVIEW_FILE ), array( 'jquery' ), \GV\Plugin::$version, true ); |
|
| 1299 | 1299 | |
| 1300 | - if( GFForms::get_page() === 'form_list' ) { |
|
| 1300 | + if ( GFForms::get_page() === 'form_list' ) { |
|
| 1301 | 1301 | wp_enqueue_style( 'gravityview_views_styles' ); |
| 1302 | 1302 | return; |
| 1303 | 1303 | } |
| 1304 | 1304 | |
| 1305 | 1305 | // Don't process any scripts below here if it's not a GravityView page. |
| 1306 | - if( ! gravityview()->request->is_admin( $hook, 'single' ) && ! $is_widgets_page ) { |
|
| 1306 | + if ( ! gravityview()->request->is_admin( $hook, 'single' ) && ! $is_widgets_page ) { |
|
| 1307 | 1307 | return; |
| 1308 | 1308 | } |
| 1309 | 1309 | |
| 1310 | 1310 | wp_enqueue_script( 'jquery-ui-datepicker' ); |
| 1311 | - wp_enqueue_style( 'gravityview_views_datepicker', plugins_url('assets/css/admin-datepicker.css', GRAVITYVIEW_FILE), \GV\Plugin::$version ); |
|
| 1311 | + wp_enqueue_style( 'gravityview_views_datepicker', plugins_url( 'assets/css/admin-datepicker.css', GRAVITYVIEW_FILE ), \GV\Plugin::$version ); |
|
| 1312 | 1312 | |
| 1313 | 1313 | // Enqueue scripts |
| 1314 | 1314 | 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 ); |
| 1315 | 1315 | |
| 1316 | - wp_localize_script('gravityview_views_scripts', 'gvGlobals', array( |
|
| 1316 | + wp_localize_script( 'gravityview_views_scripts', 'gvGlobals', array( |
|
| 1317 | 1317 | 'cookiepath' => COOKIEPATH, |
| 1318 | - 'passed_form_id' => (bool) \GV\Utils::_GET( 'form_id' ), |
|
| 1318 | + 'passed_form_id' => (bool)\GV\Utils::_GET( 'form_id' ), |
|
| 1319 | 1319 | 'nonce' => wp_create_nonce( 'gravityview_ajaxviews' ), |
| 1320 | 1320 | 'label_viewname' => __( 'Enter View name here', 'gravityview' ), |
| 1321 | 1321 | 'label_reorder_search_fields' => __( 'Reorder Search Fields', 'gravityview' ), |
@@ -1330,7 +1330,7 @@ discard block |
||
| 1330 | 1330 | 'loading_error' => esc_html__( 'There was an error loading dynamic content.', 'gravityview' ), |
| 1331 | 1331 | 'field_loaderror' => __( 'Error while adding the field. Please try again or contact GravityView support.', 'gravityview' ), |
| 1332 | 1332 | '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' ), |
| 1333 | - )); |
|
| 1333 | + ) ); |
|
| 1334 | 1334 | |
| 1335 | 1335 | wp_enqueue_style( 'gravityview_views_styles' ); |
| 1336 | 1336 | |
@@ -1338,7 +1338,7 @@ discard block |
||
| 1338 | 1338 | self::enqueue_gravity_forms_scripts(); |
| 1339 | 1339 | |
| 1340 | 1340 | // 2.5 changed how Merge Tags are enqueued |
| 1341 | - if ( is_callable( array( 'GFCommon', 'output_hooks_javascript') ) ) { |
|
| 1341 | + if ( is_callable( array( 'GFCommon', 'output_hooks_javascript' ) ) ) { |
|
| 1342 | 1342 | GFCommon::output_hooks_javascript(); |
| 1343 | 1343 | } |
| 1344 | 1344 | } |
@@ -1362,7 +1362,7 @@ discard block |
||
| 1362 | 1362 | ); |
| 1363 | 1363 | |
| 1364 | 1364 | if ( wp_is_mobile() ) { |
| 1365 | - $scripts[] = 'jquery-touch-punch'; |
|
| 1365 | + $scripts[ ] = 'jquery-touch-punch'; |
|
| 1366 | 1366 | } |
| 1367 | 1367 | |
| 1368 | 1368 | wp_enqueue_script( $scripts ); |