@@ -47,11 +47,11 @@ discard block |
||
| 47 | 47 | function modify_entry_value_workflow_step( $output, $entry, $field_settings, $field ) { |
| 48 | 48 | |
| 49 | 49 | // If not set, the entry hasn't started a workflow |
| 50 | - $has_workflow_step = isset( $entry['workflow_step'] ); |
|
| 50 | + $has_workflow_step = isset( $entry[ 'workflow_step' ] ); |
|
| 51 | 51 | |
| 52 | - if( $has_workflow_step ) { |
|
| 52 | + if ( $has_workflow_step ) { |
|
| 53 | 53 | |
| 54 | - $GFlow = new Gravity_Flow_API( $entry['form_id'] ); |
|
| 54 | + $GFlow = new Gravity_Flow_API( $entry[ 'form_id' ] ); |
|
| 55 | 55 | |
| 56 | 56 | if ( $current_step = $GFlow->get_current_step( $entry ) ) { |
| 57 | 57 | $output = esc_html( $current_step->get_name() ); |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | preg_match( '/workflow_step_status_(\d+)/', $key, $matches ); |
| 80 | 80 | |
| 81 | 81 | if ( ! empty( $matches ) ) { |
| 82 | - $workflow_step_id = intval( $matches[1] ); |
|
| 82 | + $workflow_step_id = intval( $matches[ 1 ] ); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | return $workflow_step_id; |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | $return = $label; |
| 100 | 100 | |
| 101 | - if ( '' === $label && $workflow_step_id = $this->get_step_id_from_key( $field['field'] ) ) { |
|
| 101 | + if ( '' === $label && $workflow_step_id = $this->get_step_id_from_key( $field[ 'field' ] ) ) { |
|
| 102 | 102 | |
| 103 | 103 | $step = $this->get_workflow_step( $workflow_step_id ); |
| 104 | 104 | |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | |
| 129 | 129 | $workflow_step = $GFlow->get_step( $workflow_step_id ); |
| 130 | 130 | |
| 131 | - if( ! $GFlow || ! $workflow_step ) { |
|
| 131 | + if ( ! $GFlow || ! $workflow_step ) { |
|
| 132 | 132 | return false; |
| 133 | 133 | } |
| 134 | 134 | |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | |
| 151 | 151 | foreach ( $search_fields as & $search_field ) { |
| 152 | 152 | |
| 153 | - if ( $this->name === $search_field['key'] ) { |
|
| 153 | + if ( $this->name === $search_field[ 'key' ] ) { |
|
| 154 | 154 | |
| 155 | 155 | $form_id = GravityView_View::getInstance()->getFormId(); |
| 156 | 156 | |
@@ -159,21 +159,21 @@ discard block |
||
| 159 | 159 | $choices = array(); |
| 160 | 160 | |
| 161 | 161 | foreach ( $workflow_steps as $step ) { |
| 162 | - $choices[] = array( |
|
| 162 | + $choices[ ] = array( |
|
| 163 | 163 | 'text' => $step->get_name(), |
| 164 | 164 | 'value' => $step->get_id(), |
| 165 | 165 | ); |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | - $search_field['choices'] = $choices; |
|
| 168 | + $search_field[ 'choices' ] = $choices; |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | // Workflow Step Statuses |
| 172 | - else if ( $workflow_step_id = $this->get_step_id_from_key( $search_field['key'] ) ) { |
|
| 172 | + else if ( $workflow_step_id = $this->get_step_id_from_key( $search_field[ 'key' ] ) ) { |
|
| 173 | 173 | |
| 174 | 174 | $status_key = sprintf( 'workflow_step_status_%d', $workflow_step_id ); |
| 175 | 175 | |
| 176 | - $search_field['choices'] = GravityView_Plugin_Hooks_Gravity_Flow::get_status_options( null, $status_key ); |
|
| 176 | + $search_field[ 'choices' ] = GravityView_Plugin_Hooks_Gravity_Flow::get_status_options( null, $status_key ); |
|
| 177 | 177 | } |
| 178 | 178 | } |
| 179 | 179 | |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | function modify_entry_value_workflow_final_status( $output, $entry, $field_settings, $field ) { |
| 43 | 43 | |
| 44 | - if( ! empty( $output ) ) { |
|
| 44 | + if ( ! empty( $output ) ) { |
|
| 45 | 45 | $output = gravity_flow()->translate_status_label( $output ); |
| 46 | 46 | } |
| 47 | 47 | |
@@ -59,8 +59,8 @@ discard block |
||
| 59 | 59 | function modify_search_filters( $search_fields = array(), GravityView_Widget_Search $widget, $widget_args = array() ) { |
| 60 | 60 | |
| 61 | 61 | foreach ( $search_fields as & $search_field ) { |
| 62 | - if ( $this->name === $search_field['key'] ) { |
|
| 63 | - $search_field['choices'] = GravityView_Plugin_Hooks_Gravity_Flow::get_status_options(); |
|
| 62 | + if ( $this->name === $search_field[ 'key' ] ) { |
|
| 63 | + $search_field[ 'choices' ] = GravityView_Plugin_Hooks_Gravity_Flow::get_status_options(); |
|
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | 66 | |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | parent::add_hooks(); |
| 35 | 35 | |
| 36 | - add_filter( 'gravityview/search/searchable_fields', array( $this, 'modify_search_bar_fields_dropdown'), 10, 2 ); |
|
| 36 | + add_filter( 'gravityview/search/searchable_fields', array( $this, 'modify_search_bar_fields_dropdown' ), 10, 2 ); |
|
| 37 | 37 | |
| 38 | 38 | } |
| 39 | 39 | |
@@ -52,13 +52,13 @@ discard block |
||
| 52 | 52 | */ |
| 53 | 53 | public static function get_status_options( $form_id = 0, $status_key = 'workflow_final_status' ) { |
| 54 | 54 | |
| 55 | - if( empty( $form_id ) ) { |
|
| 55 | + if ( empty( $form_id ) ) { |
|
| 56 | 56 | $form_id = GravityView_View::getInstance()->getFormId(); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | $entry_meta = gravity_flow()->get_entry_meta( array(), $form_id ); |
| 60 | 60 | |
| 61 | - return (array) rgars( $entry_meta, $status_key . '/filter/choices' ); |
|
| 61 | + return (array)rgars( $entry_meta, $status_key . '/filter/choices' ); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | $workflow_steps = $GFlow->get_steps(); |
| 82 | 82 | |
| 83 | - if( $workflow_steps ) { |
|
| 83 | + if ( $workflow_steps ) { |
|
| 84 | 84 | |
| 85 | 85 | foreach ( $workflow_steps as $step ) { |
| 86 | 86 | |
@@ -92,12 +92,12 @@ discard block |
||
| 92 | 92 | ); |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - $fields['workflow_step'] = array( |
|
| 95 | + $fields[ 'workflow_step' ] = array( |
|
| 96 | 96 | 'label' => esc_html__( 'Workflow Step', 'gravityview' ), |
| 97 | 97 | 'type' => 'select', |
| 98 | 98 | ); |
| 99 | 99 | |
| 100 | - $fields['workflow_final_status'] = array( |
|
| 100 | + $fields[ 'workflow_final_status' ] = array( |
|
| 101 | 101 | 'label' => esc_html__( 'Workflow Status', 'gravityview' ), |
| 102 | 102 | 'type' => 'select', |
| 103 | 103 | ); |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | $return = $input_type; |
| 47 | 47 | |
| 48 | - if( 'survey' === $field_type ) { |
|
| 48 | + if ( 'survey' === $field_type ) { |
|
| 49 | 49 | $return = 'select'; |
| 50 | 50 | } |
| 51 | 51 | |
@@ -65,8 +65,8 @@ discard block |
||
| 65 | 65 | public function fix_survey_fields( $fields ) { |
| 66 | 66 | |
| 67 | 67 | /** @var GF_Field $field */ |
| 68 | - foreach( $fields as &$field ) { |
|
| 69 | - if( 'survey' === $field->type ) { |
|
| 68 | + foreach ( $fields as &$field ) { |
|
| 69 | + if ( 'survey' === $field->type ) { |
|
| 70 | 70 | $field->allowsPrepopulate = true; |
| 71 | 71 | } |
| 72 | 72 | } |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | * @return void |
| 83 | 83 | */ |
| 84 | 84 | function add_render_hooks() { |
| 85 | - add_filter( 'gform_field_value', array( $this, 'fix_survey_field_value'), 10, 3 ); |
|
| 85 | + add_filter( 'gform_field_value', array( $this, 'fix_survey_field_value' ), 10, 3 ); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | /** |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | * @return void |
| 96 | 96 | */ |
| 97 | 97 | function remove_render_hooks() { |
| 98 | - remove_filter( 'gform_field_value', array( $this, 'fix_survey_field_value'), 10 ); |
|
| 98 | + remove_filter( 'gform_field_value', array( $this, 'fix_survey_field_value' ), 10 ); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
@@ -113,9 +113,9 @@ discard block |
||
| 113 | 113 | */ |
| 114 | 114 | public function fix_survey_field_value( $value, $field, $name ) { |
| 115 | 115 | |
| 116 | - if( 'survey' === $field->type ) { |
|
| 116 | + if ( 'survey' === $field->type ) { |
|
| 117 | 117 | |
| 118 | - $entry = GravityView_Edit_Entry::getInstance()->instances['render']->get_entry(); |
|
| 118 | + $entry = GravityView_Edit_Entry::getInstance()->instances[ 'render' ]->get_entry(); |
|
| 119 | 119 | |
| 120 | 120 | // We need to run through each survey row until we find a match for expected values |
| 121 | 121 | foreach ( $entry as $field_id => $field_value ) { |
@@ -124,11 +124,11 @@ discard block |
||
| 124 | 124 | continue; |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | - if( rgar( $field, 'gsurveyLikertEnableMultipleRows' ) ) { |
|
| 127 | + if ( rgar( $field, 'gsurveyLikertEnableMultipleRows' ) ) { |
|
| 128 | 128 | list( $row_val, $col_val ) = explode( ':', $field_value, 2 ); |
| 129 | 129 | |
| 130 | 130 | // If the $name matches the $row_val, we are processing the correct row |
| 131 | - if( $row_val === $name ) { |
|
| 131 | + if ( $row_val === $name ) { |
|
| 132 | 132 | $value = $field_value; |
| 133 | 133 | break; |
| 134 | 134 | } |
@@ -42,9 +42,9 @@ discard block |
||
| 42 | 42 | function __construct( $title = '', $item_id, $item = array(), $settings = array() ) { |
| 43 | 43 | |
| 44 | 44 | // Backward compat |
| 45 | - if ( ! empty( $item['type'] ) ) { |
|
| 46 | - $item['input_type'] = $item['type']; |
|
| 47 | - unset( $item['type'] ); |
|
| 45 | + if ( ! empty( $item[ 'type' ] ) ) { |
|
| 46 | + $item[ 'input_type' ] = $item[ 'type' ]; |
|
| 47 | + unset( $item[ 'type' ] ); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | // Prevent items from not having index set |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | $this->item = $item; |
| 65 | 65 | $this->id = $item_id; |
| 66 | 66 | $this->settings = $settings; |
| 67 | - $this->label_type = $item['label_type']; |
|
| 67 | + $this->label_type = $item[ 'label_type' ]; |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | /** |
@@ -107,10 +107,10 @@ discard block |
||
| 107 | 107 | if ( $html ) { |
| 108 | 108 | |
| 109 | 109 | foreach ( $field_info_items as $item ) { |
| 110 | - $class = isset( $item['class'] ) ? sanitize_html_class( $item['class'] ) . ' description' : 'description'; |
|
| 110 | + $class = isset( $item[ 'class' ] ) ? sanitize_html_class( $item[ 'class' ] ) . ' description' : 'description'; |
|
| 111 | 111 | // Add the title in case the value's long, in which case, it'll be truncated by CSS. |
| 112 | 112 | $output .= '<span class="' . $class . '">'; |
| 113 | - $output .= esc_html( $item['value'] ); |
|
| 113 | + $output .= esc_html( $item[ 'value' ] ); |
|
| 114 | 114 | $output .= '</span>'; |
| 115 | 115 | } |
| 116 | 116 | |
@@ -138,29 +138,29 @@ discard block |
||
| 138 | 138 | |
| 139 | 139 | // $settings_html will just be hidden inputs if empty. Otherwise, it'll have an <ul>. Ugly hack, I know. |
| 140 | 140 | // TODO: Un-hack this |
| 141 | - $hide_settings_link = ( empty( $this->item['settings_html'] ) || strpos( $this->item['settings_html'], '<!-- No Options -->' ) > 0 ) ? 'hide-if-js' : ''; |
|
| 141 | + $hide_settings_link = ( empty( $this->item[ 'settings_html' ] ) || strpos( $this->item[ 'settings_html' ], '<!-- No Options -->' ) > 0 ) ? 'hide-if-js' : ''; |
|
| 142 | 142 | $settings_link = sprintf( '<a href="#settings" class="dashicons-admin-generic dashicons %s" title="%s"></a>', $hide_settings_link, esc_attr( $settings_title ) ); |
| 143 | 143 | |
| 144 | 144 | // Should we show the icon that the field is being used as a link to single entry? |
| 145 | - $hide_show_as_link_class = empty( $this->settings['show_as_link'] ) ? 'hide-if-js' : ''; |
|
| 145 | + $hide_show_as_link_class = empty( $this->settings[ 'show_as_link' ] ) ? 'hide-if-js' : ''; |
|
| 146 | 146 | $show_as_link = '<span class="dashicons dashicons-admin-links ' . $hide_show_as_link_class . '" title="' . esc_attr( $single_link_title ) . '"></span>'; |
| 147 | 147 | |
| 148 | 148 | // When a field label is empty, use the Field ID |
| 149 | 149 | $label = empty( $this->title ) ? sprintf( _x( 'Field #%s (No Label)', 'Label in field picker for empty label', 'gravityview' ), $this->id ) : $this->title; |
| 150 | 150 | |
| 151 | 151 | // If there's a custom label, and show label is checked, use that as the field heading |
| 152 | - if ( ! empty( $this->settings['custom_label'] ) && ! empty( $this->settings['show_label'] ) ) { |
|
| 153 | - $label = $this->settings['custom_label']; |
|
| 154 | - } else if ( ! empty( $this->item['customLabel'] ) ) { |
|
| 155 | - $label = $this->item['customLabel']; |
|
| 152 | + if ( ! empty( $this->settings[ 'custom_label' ] ) && ! empty( $this->settings[ 'show_label' ] ) ) { |
|
| 153 | + $label = $this->settings[ 'custom_label' ]; |
|
| 154 | + } else if ( ! empty( $this->item[ 'customLabel' ] ) ) { |
|
| 155 | + $label = $this->item[ 'customLabel' ]; |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | $output = '<h5 class="selectable gfield field-id-' . esc_attr( $this->id ) . '">'; |
| 159 | 159 | |
| 160 | 160 | $label = esc_attr( $label ); |
| 161 | 161 | |
| 162 | - if ( ! empty( $this->item['parent'] ) ) { |
|
| 163 | - $label .= ' <small>(' . esc_attr( $this->item['parent']['label'] ) . ')</small>'; |
|
| 162 | + if ( ! empty( $this->item[ 'parent' ] ) ) { |
|
| 163 | + $label .= ' <small>(' . esc_attr( $this->item[ 'parent' ][ 'label' ] ) . ')</small>'; |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | // Name of field / widget |
@@ -176,9 +176,9 @@ discard block |
||
| 176 | 176 | |
| 177 | 177 | $output .= '</h5>'; |
| 178 | 178 | |
| 179 | - $container_class = ! empty( $this->item['parent'] ) ? ' gv-child-field' : ''; |
|
| 179 | + $container_class = ! empty( $this->item[ 'parent' ] ) ? ' gv-child-field' : ''; |
|
| 180 | 180 | |
| 181 | - $output = '<div data-fieldid="' . esc_attr( $this->id ) . '" data-inputtype="' . esc_attr( $this->item['input_type'] ) . '" class="gv-fields' . $container_class . '">' . $output . $this->item['settings_html'] . '</div>'; |
|
| 181 | + $output = '<div data-fieldid="' . esc_attr( $this->id ) . '" data-inputtype="' . esc_attr( $this->item[ 'input_type' ] ) . '" class="gv-fields' . $container_class . '">' . $output . $this->item[ 'settings_html' ] . '</div>'; |
|
| 182 | 182 | |
| 183 | 183 | return $output; |
| 184 | 184 | } |
@@ -10,17 +10,17 @@ discard block |
||
| 10 | 10 | /** |
| 11 | 11 | * @since 1.5.1 |
| 12 | 12 | */ |
| 13 | - add_action('gform_user_registered', array( $this, 'assign_new_user_to_lead'), 10, 4 ); |
|
| 13 | + add_action( 'gform_user_registered', array( $this, 'assign_new_user_to_lead' ), 10, 4 ); |
|
| 14 | 14 | |
| 15 | 15 | // ONLY ADMIN FROM HERE ON. |
| 16 | - if( !is_admin() ) { return; } |
|
| 16 | + if ( ! is_admin() ) { return; } |
|
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * @filter `gravityview_disable_change_entry_creator` Disable the Change Entry Creator functionality |
| 20 | 20 | * @since 1.7.4 |
| 21 | 21 | * @param boolean $disable Disable the Change Entry Creator functionality. Default: false. |
| 22 | 22 | */ |
| 23 | - if( apply_filters('gravityview_disable_change_entry_creator', false ) ) { |
|
| 23 | + if ( apply_filters( 'gravityview_disable_change_entry_creator', false ) ) { |
|
| 24 | 24 | return; |
| 25 | 25 | } |
| 26 | 26 | |
@@ -28,9 +28,9 @@ discard block |
||
| 28 | 28 | * Use `init` to fix bbPress warning |
| 29 | 29 | * @see https://bbpress.trac.wordpress.org/ticket/2309 |
| 30 | 30 | */ |
| 31 | - add_action('init', array( $this, 'load'), 100 ); |
|
| 31 | + add_action( 'init', array( $this, 'load' ), 100 ); |
|
| 32 | 32 | |
| 33 | - add_action('plugins_loaded', array( $this, 'prevent_conflicts') ); |
|
| 33 | + add_action( 'plugins_loaded', array( $this, 'prevent_conflicts' ) ); |
|
| 34 | 34 | |
| 35 | 35 | } |
| 36 | 36 | |
@@ -56,24 +56,24 @@ discard block |
||
| 56 | 56 | $assign_to_lead = apply_filters( 'gravityview_assign_new_user_to_entry', true, $user_id, $config, $entry ); |
| 57 | 57 | |
| 58 | 58 | // If filter returns false, do not process |
| 59 | - if( empty( $assign_to_lead ) ) { |
|
| 59 | + if ( empty( $assign_to_lead ) ) { |
|
| 60 | 60 | return; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | // Update the entry. The `false` prevents checking Akismet; `true` disables the user updated hook from firing |
| 64 | - $result = RGFormsModel::update_lead_property( $entry['id'], 'created_by', $user_id, false, true ); |
|
| 64 | + $result = RGFormsModel::update_lead_property( $entry[ 'id' ], 'created_by', $user_id, false, true ); |
|
| 65 | 65 | |
| 66 | - if( empty( $result ) ) { |
|
| 67 | - $status = __('Error', 'gravityview'); |
|
| 66 | + if ( empty( $result ) ) { |
|
| 67 | + $status = __( 'Error', 'gravityview' ); |
|
| 68 | 68 | } else { |
| 69 | - $status = __('Success', 'gravityview'); |
|
| 69 | + $status = __( 'Success', 'gravityview' ); |
|
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - $note = sprintf( _x('%s: Assigned User ID #%d as the entry creator.', 'First parameter: Success or error of the action. Second: User ID number', 'gravityview'), $status, $user_id ); |
|
| 72 | + $note = sprintf( _x( '%s: Assigned User ID #%d as the entry creator.', 'First parameter: Success or error of the action. Second: User ID number', 'gravityview' ), $status, $user_id ); |
|
| 73 | 73 | |
| 74 | - do_action( 'gravityview_log_debug', 'GravityView_Change_Entry_Creator[assign_new_user_to_lead] - '.$note ); |
|
| 74 | + do_action( 'gravityview_log_debug', 'GravityView_Change_Entry_Creator[assign_new_user_to_lead] - ' . $note ); |
|
| 75 | 75 | |
| 76 | - GravityView_Entry_Notes::add_note( $entry['id'], -1, 'GravityView', $note, 'gravityview' ); |
|
| 76 | + GravityView_Entry_Notes::add_note( $entry[ 'id' ], -1, 'GravityView', $note, 'gravityview' ); |
|
| 77 | 77 | |
| 78 | 78 | } |
| 79 | 79 | |
@@ -85,20 +85,20 @@ discard block |
||
| 85 | 85 | |
| 86 | 86 | // Plugin that was provided here: |
| 87 | 87 | // @link https://gravityview.co/support/documentation/201991205/ |
| 88 | - remove_action("gform_entry_info", 'gravityview_change_entry_creator_form', 10 ); |
|
| 89 | - remove_action("gform_after_update_entry", 'gravityview_update_entry_creator', 10 ); |
|
| 88 | + remove_action( "gform_entry_info", 'gravityview_change_entry_creator_form', 10 ); |
|
| 89 | + remove_action( "gform_after_update_entry", 'gravityview_update_entry_creator', 10 ); |
|
| 90 | 90 | |
| 91 | 91 | // Disable for Gravity Forms Add-ons 3.6.2 and lower |
| 92 | - if( class_exists( 'KWS_GF_Change_Lead_Creator' ) ) { |
|
| 92 | + if ( class_exists( 'KWS_GF_Change_Lead_Creator' ) ) { |
|
| 93 | 93 | |
| 94 | 94 | $Old_Lead_Creator = new KWS_GF_Change_Lead_Creator; |
| 95 | 95 | |
| 96 | 96 | // Now, no validation is required in the methods; let's hook in. |
| 97 | - remove_action('admin_init', array( $Old_Lead_Creator, 'set_screen_mode' ) ); |
|
| 97 | + remove_action( 'admin_init', array( $Old_Lead_Creator, 'set_screen_mode' ) ); |
|
| 98 | 98 | |
| 99 | - remove_action("gform_entry_info", array( $Old_Lead_Creator, 'add_select' ), 10 ); |
|
| 99 | + remove_action( "gform_entry_info", array( $Old_Lead_Creator, 'add_select' ), 10 ); |
|
| 100 | 100 | |
| 101 | - remove_action("gform_after_update_entry", array( $Old_Lead_Creator, 'update_entry_creator' ), 10 ); |
|
| 101 | + remove_action( "gform_after_update_entry", array( $Old_Lead_Creator, 'update_entry_creator' ), 10 ); |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | } |
@@ -110,26 +110,26 @@ discard block |
||
| 110 | 110 | function load() { |
| 111 | 111 | |
| 112 | 112 | // Does GF exist? |
| 113 | - if( !class_exists('GFCommon') ) { |
|
| 113 | + if ( ! class_exists( 'GFCommon' ) ) { |
|
| 114 | 114 | return; |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | // Can the user edit entries? |
| 118 | - if( ! GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_entries' ) ) ) { |
|
| 118 | + if ( ! GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_entries' ) ) ) { |
|
| 119 | 119 | return; |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | // If screen mode isn't set, then we're in the wrong place. |
| 123 | - if( empty( $_REQUEST['screen_mode'] ) ) { |
|
| 123 | + if ( empty( $_REQUEST[ 'screen_mode' ] ) ) { |
|
| 124 | 124 | return; |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | // Now, no validation is required in the methods; let's hook in. |
| 128 | - add_action('admin_init', array( &$this, 'set_screen_mode' ) ); |
|
| 128 | + add_action( 'admin_init', array( &$this, 'set_screen_mode' ) ); |
|
| 129 | 129 | |
| 130 | - add_action("gform_entry_info", array( &$this, 'add_select' ), 10, 2); |
|
| 130 | + add_action( "gform_entry_info", array( &$this, 'add_select' ), 10, 2 ); |
|
| 131 | 131 | |
| 132 | - add_action("gform_after_update_entry", array( &$this, 'update_entry_creator' ), 10, 2); |
|
| 132 | + add_action( "gform_after_update_entry", array( &$this, 'update_entry_creator' ), 10, 2 ); |
|
| 133 | 133 | |
| 134 | 134 | } |
| 135 | 135 | |
@@ -140,8 +140,8 @@ discard block |
||
| 140 | 140 | function set_screen_mode() { |
| 141 | 141 | |
| 142 | 142 | // If $_GET['screen_mode'] is set to edit, set $_POST value |
| 143 | - if( rgget('screen_mode') === 'edit' ) { |
|
| 144 | - $_POST["screen_mode"] = 'edit'; |
|
| 143 | + if ( rgget( 'screen_mode' ) === 'edit' ) { |
|
| 144 | + $_POST[ "screen_mode" ] = 'edit'; |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | } |
@@ -152,42 +152,42 @@ discard block |
||
| 152 | 152 | * @param int $entry_id Entry ID |
| 153 | 153 | * @return void |
| 154 | 154 | */ |
| 155 | - function update_entry_creator($form, $entry_id) { |
|
| 155 | + function update_entry_creator( $form, $entry_id ) { |
|
| 156 | 156 | global $current_user; |
| 157 | 157 | |
| 158 | 158 | // Update the entry |
| 159 | - $created_by = absint( rgpost('created_by') ); |
|
| 159 | + $created_by = absint( rgpost( 'created_by' ) ); |
|
| 160 | 160 | |
| 161 | 161 | RGFormsModel::update_lead_property( $entry_id, 'created_by', $created_by ); |
| 162 | 162 | |
| 163 | 163 | // If the creator has changed, let's add a note about who it used to be. |
| 164 | - $originally_created_by = rgpost('originally_created_by'); |
|
| 164 | + $originally_created_by = rgpost( 'originally_created_by' ); |
|
| 165 | 165 | |
| 166 | 166 | // If there's no owner and there didn't used to be, keep going |
| 167 | - if( empty( $originally_created_by ) && empty( $created_by ) ) { |
|
| 167 | + if ( empty( $originally_created_by ) && empty( $created_by ) ) { |
|
| 168 | 168 | return; |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | // If the values have changed |
| 172 | - if( absint( $originally_created_by ) !== absint( $created_by ) ) { |
|
| 172 | + if ( absint( $originally_created_by ) !== absint( $created_by ) ) { |
|
| 173 | 173 | |
| 174 | - $user_data = get_userdata($current_user->ID); |
|
| 174 | + $user_data = get_userdata( $current_user->ID ); |
|
| 175 | 175 | |
| 176 | - $user_format = _x('%s (ID #%d)', 'The name and the ID of users who initiated changes to entry ownership', 'gravityview'); |
|
| 176 | + $user_format = _x( '%s (ID #%d)', 'The name and the ID of users who initiated changes to entry ownership', 'gravityview' ); |
|
| 177 | 177 | |
| 178 | - $original_name = $created_by_name = esc_attr_x( 'No User', 'To show that the entry was unassigned from an actual user to no user.', 'gravityview'); |
|
| 178 | + $original_name = $created_by_name = esc_attr_x( 'No User', 'To show that the entry was unassigned from an actual user to no user.', 'gravityview' ); |
|
| 179 | 179 | |
| 180 | - if( !empty( $originally_created_by ) ) { |
|
| 181 | - $originally_created_by_user_data = get_userdata($originally_created_by); |
|
| 180 | + if ( ! empty( $originally_created_by ) ) { |
|
| 181 | + $originally_created_by_user_data = get_userdata( $originally_created_by ); |
|
| 182 | 182 | $original_name = sprintf( $user_format, $originally_created_by_user_data->display_name, $originally_created_by_user_data->ID ); |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | - if( !empty( $created_by ) ) { |
|
| 186 | - $created_by_user_data = get_userdata($created_by); |
|
| 185 | + if ( ! empty( $created_by ) ) { |
|
| 186 | + $created_by_user_data = get_userdata( $created_by ); |
|
| 187 | 187 | $created_by_name = sprintf( $user_format, $created_by_user_data->display_name, $created_by_user_data->ID ); |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | - GravityView_Entry_Notes::add_note( $entry_id, $current_user->ID, $user_data->display_name, sprintf( __('Changed entry creator from %s to %s', 'gravityview'), $original_name, $created_by_name ), 'note' ); |
|
| 190 | + GravityView_Entry_Notes::add_note( $entry_id, $current_user->ID, $user_data->display_name, sprintf( __( 'Changed entry creator from %s to %s', 'gravityview' ), $original_name, $created_by_name ), 'note' ); |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | } |
@@ -198,24 +198,24 @@ discard block |
||
| 198 | 198 | * @param array $entry GF entry array |
| 199 | 199 | * @return void |
| 200 | 200 | */ |
| 201 | - function add_select($form_id, $entry ) { |
|
| 201 | + function add_select( $form_id, $entry ) { |
|
| 202 | 202 | |
| 203 | - if( rgpost('screen_mode') !== 'edit' ) { |
|
| 203 | + if ( rgpost( 'screen_mode' ) !== 'edit' ) { |
|
| 204 | 204 | return; |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | $users = GVCommon::get_users( 'change_entry_creator' ); |
| 208 | 208 | |
| 209 | 209 | $output = '<label for="change_created_by">'; |
| 210 | - $output .= esc_html__('Change Entry Creator:', 'gravityview'); |
|
| 210 | + $output .= esc_html__( 'Change Entry Creator:', 'gravityview' ); |
|
| 211 | 211 | $output .= '</label> |
| 212 | 212 | <select name="created_by" id="change_created_by" class="widefat">'; |
| 213 | - $output .= '<option value=""> — '.esc_attr_x( 'No User', 'No user assigned to the entry', 'gravityview').' — </option>'; |
|
| 214 | - foreach($users as $user) { |
|
| 215 | - $output .= '<option value="'. $user->ID .'"'. selected( $entry['created_by'], $user->ID, false ).'>'.esc_attr( $user->display_name.' ('.$user->user_nicename.')' ).'</option>'; |
|
| 213 | + $output .= '<option value=""> — ' . esc_attr_x( 'No User', 'No user assigned to the entry', 'gravityview' ) . ' — </option>'; |
|
| 214 | + foreach ( $users as $user ) { |
|
| 215 | + $output .= '<option value="' . $user->ID . '"' . selected( $entry[ 'created_by' ], $user->ID, false ) . '>' . esc_attr( $user->display_name . ' (' . $user->user_nicename . ')' ) . '</option>'; |
|
| 216 | 216 | } |
| 217 | 217 | $output .= '</select>'; |
| 218 | - $output .= '<input name="originally_created_by" value="'.esc_attr( $entry['created_by'] ).'" type="hidden" />'; |
|
| 218 | + $output .= '<input name="originally_created_by" value="' . esc_attr( $entry[ 'created_by' ] ) . '" type="hidden" />'; |
|
| 219 | 219 | echo $output; |
| 220 | 220 | |
| 221 | 221 | } |
@@ -59,8 +59,8 @@ |
||
| 59 | 59 | |
| 60 | 60 | $notes_table = class_exists( 'GFFormsModel' ) ? GFFormsModel::get_lead_notes_table_name() : $wpdb->prefix . 'rg_lead_notes'; |
| 61 | 61 | |
| 62 | - $disapproved = __('Disapproved the Entry for GravityView', 'gravityview'); |
|
| 63 | - $approved = __('Approved the Entry for GravityView', 'gravityview'); |
|
| 62 | + $disapproved = __( 'Disapproved the Entry for GravityView', 'gravityview' ); |
|
| 63 | + $approved = __( 'Approved the Entry for GravityView', 'gravityview' ); |
|
| 64 | 64 | |
| 65 | 65 | $sql = $wpdb->prepare( " |
| 66 | 66 | DELETE FROM $notes_table |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if( ! class_exists('GFAddOn') ) { |
|
| 3 | +if ( ! class_exists( 'GFAddOn' ) ) { |
|
| 4 | 4 | return; |
| 5 | 5 | } |
| 6 | 6 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | public function __construct( $prevent_multiple_instances = '' ) { |
| 77 | 77 | |
| 78 | - if( $prevent_multiple_instances === 'get_instance' ) { |
|
| 78 | + if ( $prevent_multiple_instances === 'get_instance' ) { |
|
| 79 | 79 | return parent::__construct(); |
| 80 | 80 | } |
| 81 | 81 | |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | public static function get_instance() { |
| 89 | 89 | |
| 90 | - if( empty( self::$instance ) ) { |
|
| 90 | + if ( empty( self::$instance ) ) { |
|
| 91 | 91 | self::$instance = new self( 'get_instance' ); |
| 92 | 92 | } |
| 93 | 93 | |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | public function current_user_can_any( $caps ) { |
| 108 | 108 | |
| 109 | - if( empty( $caps ) ) { |
|
| 109 | + if ( empty( $caps ) ) { |
|
| 110 | 110 | $caps = array( 'gravityview_full_access' ); |
| 111 | 111 | } |
| 112 | 112 | |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | ), |
| 161 | 161 | 'found-other' => array( |
| 162 | 162 | 'label' => esc_html__( 'I found a better plugin', 'gravityview' ), |
| 163 | - 'followup' => esc_attr__('What plugin you are using, and why?', 'gravityview'), |
|
| 163 | + 'followup' => esc_attr__( 'What plugin you are using, and why?', 'gravityview' ), |
|
| 164 | 164 | ), |
| 165 | 165 | 'other' => array( |
| 166 | 166 | 'label' => esc_html__( 'Other', 'gravityview' ), |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | }); |
| 248 | 248 | |
| 249 | 249 | function gv_feedback_append_error_message() { |
| 250 | - $('#gv-uninstall-thanks').append('<div class="notice error"><?php echo esc_js( __('There was an error sharing your feedback. Sorry! Please email us at [email protected]', 'gravityview' ) ) ?></div>'); |
|
| 250 | + $('#gv-uninstall-thanks').append('<div class="notice error"><?php echo esc_js( __( 'There was an error sharing your feedback. Sorry! Please email us at [email protected]', 'gravityview' ) ) ?></div>'); |
|
| 251 | 251 | } |
| 252 | 252 | }); |
| 253 | 253 | </script> |
@@ -264,15 +264,15 @@ discard block |
||
| 264 | 264 | </ul> |
| 265 | 265 | <div class="gv-followup widefat"> |
| 266 | 266 | <p><strong><label for="gv-reason-details"><?php esc_html_e( 'Comments', 'gravityview' ); ?></label></strong></p> |
| 267 | - <textarea id="gv-reason-details" name="reason_details" data-default="<?php esc_attr_e('Please share your thoughts about GravityView', 'gravityview') ?>" placeholder="<?php esc_attr_e('Please share your thoughts about GravityView', 'gravityview'); ?>" class="large-text"></textarea> |
|
| 267 | + <textarea id="gv-reason-details" name="reason_details" data-default="<?php esc_attr_e( 'Please share your thoughts about GravityView', 'gravityview' ) ?>" placeholder="<?php esc_attr_e( 'Please share your thoughts about GravityView', 'gravityview' ); ?>" class="large-text"></textarea> |
|
| 268 | 268 | </div> |
| 269 | 269 | <div class="scale-description"> |
| 270 | - <p><strong><?php esc_html_e('How likely are you to recommend GravityView?', 'gravityview' ); ?></strong></p> |
|
| 270 | + <p><strong><?php esc_html_e( 'How likely are you to recommend GravityView?', 'gravityview' ); ?></strong></p> |
|
| 271 | 271 | <ul class="inline"> |
| 272 | 272 | <?php |
| 273 | 273 | $i = 0; |
| 274 | - while( $i < 11 ) { |
|
| 275 | - echo '<li class="inline number-scale"><label><input name="likely_to_refer" id="likely_to_refer_'.$i.'" value="'.$i.'" type="radio"> '.$i.'</label></li>'; |
|
| 274 | + while ( $i < 11 ) { |
|
| 275 | + echo '<li class="inline number-scale"><label><input name="likely_to_refer" id="likely_to_refer_' . $i . '" value="' . $i . '" type="radio"> ' . $i . '</label></li>'; |
|
| 276 | 276 | $i++; |
| 277 | 277 | } |
| 278 | 278 | ?> |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | </div> |
| 282 | 282 | |
| 283 | 283 | <div class="gv-form-field-wrapper"> |
| 284 | - <label><input type="checkbox" class="checkbox" name="follow_up_with_me" value="1" /> <?php esc_html_e('Please follow up with me about my feedback', 'gravityview'); ?></label> |
|
| 284 | + <label><input type="checkbox" class="checkbox" name="follow_up_with_me" value="1" /> <?php esc_html_e( 'Please follow up with me about my feedback', 'gravityview' ); ?></label> |
|
| 285 | 285 | </div> |
| 286 | 286 | |
| 287 | 287 | <div class="submit"> |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | <div id="gv-uninstall-thanks" class="notice notice-large notice-updated below-h2" style="display:none;"> |
| 296 | 296 | <h3 class="notice-title"><?php esc_html_e( 'Thank you for using GravityView!', 'gravityview' ); ?></h3> |
| 297 | 297 | <p><?php echo gravityview_get_floaty(); ?> |
| 298 | - <?php echo make_clickable( esc_html__('Your feedback helps us improve GravityView. If you have any questions or comments, email us: [email protected]', 'gravityview' ) ); ?> |
|
| 298 | + <?php echo make_clickable( esc_html__( 'Your feedback helps us improve GravityView. If you have any questions or comments, email us: [email protected]', 'gravityview' ) ); ?> |
|
| 299 | 299 | </p> |
| 300 | 300 | <div class="wp-clearfix"></div> |
| 301 | 301 | </div> |
@@ -369,7 +369,7 @@ discard block |
||
| 369 | 369 | add_filter( 'gform_addon_app_settings_menu_gravityview', array( $this, 'modify_app_settings_menu_title' ) ); |
| 370 | 370 | |
| 371 | 371 | /** @since 1.7.6 */ |
| 372 | - add_action('network_admin_menu', array( $this, 'add_network_menu' ) ); |
|
| 372 | + add_action( 'network_admin_menu', array( $this, 'add_network_menu' ) ); |
|
| 373 | 373 | |
| 374 | 374 | parent::init_admin(); |
| 375 | 375 | } |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | */ |
| 384 | 384 | public function modify_app_settings_menu_title( $setting_tabs ) { |
| 385 | 385 | |
| 386 | - $setting_tabs[0]['label'] = __( 'GravityView Settings', 'gravityview'); |
|
| 386 | + $setting_tabs[ 0 ][ 'label' ] = __( 'GravityView Settings', 'gravityview' ); |
|
| 387 | 387 | |
| 388 | 388 | return $setting_tabs; |
| 389 | 389 | } |
@@ -400,11 +400,11 @@ discard block |
||
| 400 | 400 | */ |
| 401 | 401 | private function _load_license_handler() { |
| 402 | 402 | |
| 403 | - if( !empty( $this->License_Handler ) ) { |
|
| 403 | + if ( ! empty( $this->License_Handler ) ) { |
|
| 404 | 404 | return; |
| 405 | 405 | } |
| 406 | 406 | |
| 407 | - require_once( GRAVITYVIEW_DIR . 'includes/class-gv-license-handler.php'); |
|
| 407 | + require_once( GRAVITYVIEW_DIR . 'includes/class-gv-license-handler.php' ); |
|
| 408 | 408 | |
| 409 | 409 | $this->License_Handler = GV_License_Handler::get_instance( $this ); |
| 410 | 410 | } |
@@ -416,42 +416,42 @@ discard block |
||
| 416 | 416 | function license_key_notice() { |
| 417 | 417 | |
| 418 | 418 | // Only show on GravityView pages |
| 419 | - if( ! gravityview_is_admin_page() ) { |
|
| 419 | + if ( ! gravityview_is_admin_page() ) { |
|
| 420 | 420 | return; |
| 421 | 421 | } |
| 422 | 422 | |
| 423 | - $license_status = self::getSetting('license_key_status'); |
|
| 424 | - $license_key = self::getSetting('license_key'); |
|
| 425 | - if( '' === $license_key ) { |
|
| 423 | + $license_status = self::getSetting( 'license_key_status' ); |
|
| 424 | + $license_key = self::getSetting( 'license_key' ); |
|
| 425 | + if ( '' === $license_key ) { |
|
| 426 | 426 | $license_status = 'inactive'; |
| 427 | 427 | } |
| 428 | 428 | $license_id = empty( $license_key ) ? 'license' : $license_key; |
| 429 | 429 | |
| 430 | - $message = esc_html__('Your GravityView license %s. This means you’re missing out on updates and support! %sActivate your license%s or %sget a license here%s.', 'gravityview'); |
|
| 430 | + $message = esc_html__( 'Your GravityView license %s. This means you’re missing out on updates and support! %sActivate your license%s or %sget a license here%s.', 'gravityview' ); |
|
| 431 | 431 | |
| 432 | 432 | /** |
| 433 | 433 | * I wanted to remove the period from after the buttons in the string, |
| 434 | 434 | * but didn't want to mess up the translation strings for the translators. |
| 435 | 435 | */ |
| 436 | 436 | $message = mb_substr( $message, 0, mb_strlen( $message ) - 1 ); |
| 437 | - $title = __('Inactive License', 'gravityview'); |
|
| 437 | + $title = __( 'Inactive License', 'gravityview' ); |
|
| 438 | 438 | $status = ''; |
| 439 | 439 | $update_below = false; |
| 440 | 440 | $primary_button_link = admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ); |
| 441 | 441 | switch ( $license_status ) { |
| 442 | 442 | /** @since 1.17 */ |
| 443 | 443 | case 'expired': |
| 444 | - $title = __('Expired License', 'gravityview'); |
|
| 444 | + $title = __( 'Expired License', 'gravityview' ); |
|
| 445 | 445 | $status = 'expired'; |
| 446 | - $message = $this->get_license_handler()->strings( 'expired', self::getSetting('license_key_response') ); |
|
| 446 | + $message = $this->get_license_handler()->strings( 'expired', self::getSetting( 'license_key_response' ) ); |
|
| 447 | 447 | break; |
| 448 | 448 | case 'invalid': |
| 449 | - $title = __('Invalid License', 'gravityview'); |
|
| 450 | - $status = __('is invalid', 'gravityview'); |
|
| 449 | + $title = __( 'Invalid License', 'gravityview' ); |
|
| 450 | + $status = __( 'is invalid', 'gravityview' ); |
|
| 451 | 451 | break; |
| 452 | 452 | case 'deactivated': |
| 453 | - $status = __('is inactive', 'gravityview'); |
|
| 454 | - $update_below = __('Activate your license key below.', 'gravityview'); |
|
| 453 | + $status = __( 'is inactive', 'gravityview' ); |
|
| 454 | + $update_below = __( 'Activate your license key below.', 'gravityview' ); |
|
| 455 | 455 | break; |
| 456 | 456 | /** @noinspection PhpMissingBreakStatementInspection */ |
| 457 | 457 | case '': |
@@ -459,27 +459,27 @@ discard block |
||
| 459 | 459 | // break intentionally left blank |
| 460 | 460 | case 'inactive': |
| 461 | 461 | case 'site_inactive': |
| 462 | - $status = __('has not been activated', 'gravityview'); |
|
| 463 | - $update_below = __('Activate your license key below.', 'gravityview'); |
|
| 462 | + $status = __( 'has not been activated', 'gravityview' ); |
|
| 463 | + $update_below = __( 'Activate your license key below.', 'gravityview' ); |
|
| 464 | 464 | break; |
| 465 | 465 | } |
| 466 | - $url = 'https://gravityview.co/pricing/?utm_source=admin_notice&utm_medium=admin&utm_content='.$license_status.'&utm_campaign=Admin%20Notice'; |
|
| 466 | + $url = 'https://gravityview.co/pricing/?utm_source=admin_notice&utm_medium=admin&utm_content=' . $license_status . '&utm_campaign=Admin%20Notice'; |
|
| 467 | 467 | |
| 468 | 468 | // Show a different notice on settings page for inactive licenses (hide the buttons) |
| 469 | - if( $update_below && gravityview_is_admin_page( '', 'settings' ) ) { |
|
| 469 | + if ( $update_below && gravityview_is_admin_page( '', 'settings' ) ) { |
|
| 470 | 470 | $message = sprintf( $message, $status, '<div class="hidden">', '', '', '</div><a href="#" onclick="jQuery(\'#license_key\').focus(); return false;">' . $update_below . '</a>' ); |
| 471 | 471 | } else { |
| 472 | 472 | $message = sprintf( $message, $status, "\n\n" . '<a href="' . esc_url( $primary_button_link ) . '" class="button button-primary">', '</a>', '<a href="' . esc_url( $url ) . '" class="button button-secondary">', '</a>' ); |
| 473 | 473 | } |
| 474 | 474 | |
| 475 | - if( !empty( $status ) ) { |
|
| 475 | + if ( ! empty( $status ) ) { |
|
| 476 | 476 | GravityView_Admin_Notices::add_notice( array( |
| 477 | 477 | 'message' => $message, |
| 478 | 478 | 'class' => 'updated', |
| 479 | 479 | 'title' => $title, |
| 480 | 480 | 'cap' => 'gravityview_edit_settings', |
| 481 | - 'dismiss' => sha1( $license_status.'_'.$license_id ), |
|
| 482 | - )); |
|
| 481 | + 'dismiss' => sha1( $license_status . '_' . $license_id ), |
|
| 482 | + ) ); |
|
| 483 | 483 | } |
| 484 | 484 | } |
| 485 | 485 | |
@@ -491,7 +491,7 @@ discard block |
||
| 491 | 491 | |
| 492 | 492 | $styles = parent::styles(); |
| 493 | 493 | |
| 494 | - $styles[] = array( |
|
| 494 | + $styles[ ] = array( |
|
| 495 | 495 | 'handle' => 'gravityview_settings', |
| 496 | 496 | 'src' => plugins_url( 'assets/css/admin-settings.css', GRAVITYVIEW_FILE ), |
| 497 | 497 | 'version' => GravityView_Plugin::version, |
@@ -514,7 +514,7 @@ discard block |
||
| 514 | 514 | * @return void |
| 515 | 515 | */ |
| 516 | 516 | public function add_network_menu() { |
| 517 | - if( GravityView_Plugin::is_network_activated() ) { |
|
| 517 | + if ( GravityView_Plugin::is_network_activated() ) { |
|
| 518 | 518 | add_menu_page( __( 'Settings', 'gravityview' ), __( 'GravityView', 'gravityview' ), $this->_capabilities_app_settings, "{$this->_slug}_settings", array( $this, 'app_tab_page' ), 'none' ); |
| 519 | 519 | } |
| 520 | 520 | } |
@@ -531,7 +531,7 @@ discard block |
||
| 531 | 531 | * If multisite and not network admin, we don't want the settings to show. |
| 532 | 532 | * @since 1.7.6 |
| 533 | 533 | */ |
| 534 | - $show_submenu = !is_multisite() || is_main_site() || !GravityView_Plugin::is_network_activated() || ( is_network_admin() && GravityView_Plugin::is_network_activated() ); |
|
| 534 | + $show_submenu = ! is_multisite() || is_main_site() || ! GravityView_Plugin::is_network_activated() || ( is_network_admin() && GravityView_Plugin::is_network_activated() ); |
|
| 535 | 535 | |
| 536 | 536 | /** |
| 537 | 537 | * Override whether to show the Settings menu on a per-blog basis. |
@@ -540,7 +540,7 @@ discard block |
||
| 540 | 540 | */ |
| 541 | 541 | $show_submenu = apply_filters( 'gravityview/show-settings-menu', $show_submenu ); |
| 542 | 542 | |
| 543 | - if( $show_submenu ) { |
|
| 543 | + if ( $show_submenu ) { |
|
| 544 | 544 | add_submenu_page( 'edit.php?post_type=gravityview', __( 'Settings', 'gravityview' ), __( 'Settings', 'gravityview' ), $this->_capabilities_app_settings, $this->_slug . '_settings', array( $this, 'app_tab_page' ) ); |
| 545 | 545 | } |
| 546 | 546 | } |
@@ -579,7 +579,7 @@ discard block |
||
| 579 | 579 | /** |
| 580 | 580 | * Backward compatibility with Redux |
| 581 | 581 | */ |
| 582 | - if( $setting_name === 'license' ) { |
|
| 582 | + if ( $setting_name === 'license' ) { |
|
| 583 | 583 | return array( |
| 584 | 584 | 'license' => parent::get_app_setting( 'license_key' ), |
| 585 | 585 | 'status' => parent::get_app_setting( 'license_key_status' ), |
@@ -643,7 +643,7 @@ discard block |
||
| 643 | 643 | |
| 644 | 644 | $return = $text . $activation; |
| 645 | 645 | |
| 646 | - if( $echo ) { |
|
| 646 | + if ( $echo ) { |
|
| 647 | 647 | echo $return; |
| 648 | 648 | } |
| 649 | 649 | |
@@ -670,15 +670,15 @@ discard block |
||
| 670 | 670 | */ |
| 671 | 671 | public function settings_submit( $field, $echo = true ) { |
| 672 | 672 | |
| 673 | - $field['type'] = ( isset($field['type']) && in_array( $field['type'], array('submit','reset','button') ) ) ? $field['type'] : 'submit'; |
|
| 673 | + $field[ 'type' ] = ( isset( $field[ 'type' ] ) && in_array( $field[ 'type' ], array( 'submit', 'reset', 'button' ) ) ) ? $field[ 'type' ] : 'submit'; |
|
| 674 | 674 | |
| 675 | 675 | $attributes = $this->get_field_attributes( $field ); |
| 676 | 676 | $default_value = rgar( $field, 'value' ) ? rgar( $field, 'value' ) : rgar( $field, 'default_value' ); |
| 677 | - $value = $this->get_setting( $field['name'], $default_value ); |
|
| 677 | + $value = $this->get_setting( $field[ 'name' ], $default_value ); |
|
| 678 | 678 | |
| 679 | 679 | |
| 680 | - $attributes['class'] = isset( $attributes['class'] ) ? esc_attr( $attributes['class'] ) : 'button-primary gfbutton'; |
|
| 681 | - $name = ( $field['name'] === 'gform-settings-save' ) ? $field['name'] : '_gaddon_setting_'.$field['name']; |
|
| 680 | + $attributes[ 'class' ] = isset( $attributes[ 'class' ] ) ? esc_attr( $attributes[ 'class' ] ) : 'button-primary gfbutton'; |
|
| 681 | + $name = ( $field[ 'name' ] === 'gform-settings-save' ) ? $field[ 'name' ] : '_gaddon_setting_' . $field[ 'name' ]; |
|
| 682 | 682 | |
| 683 | 683 | if ( empty( $value ) ) { |
| 684 | 684 | $value = __( 'Update Settings', 'gravityview' ); |
@@ -687,7 +687,7 @@ discard block |
||
| 687 | 687 | $attributes = $this->get_field_attributes( $field ); |
| 688 | 688 | |
| 689 | 689 | $html = '<input |
| 690 | - type="' . $field['type'] . '" |
|
| 690 | + type="' . $field[ 'type' ] . '" |
|
| 691 | 691 | name="' . esc_attr( $name ) . '" |
| 692 | 692 | value="' . $value . '" ' . |
| 693 | 693 | implode( ' ', $attributes ) . |
@@ -709,12 +709,12 @@ discard block |
||
| 709 | 709 | * @return string |
| 710 | 710 | */ |
| 711 | 711 | public function settings_save( $field, $echo = true ) { |
| 712 | - $field['type'] = 'submit'; |
|
| 713 | - $field['name'] = 'gform-settings-save'; |
|
| 714 | - $field['class'] = isset( $field['class'] ) ? $field['class'] : 'button-primary gfbutton'; |
|
| 712 | + $field[ 'type' ] = 'submit'; |
|
| 713 | + $field[ 'name' ] = 'gform-settings-save'; |
|
| 714 | + $field[ 'class' ] = isset( $field[ 'class' ] ) ? $field[ 'class' ] : 'button-primary gfbutton'; |
|
| 715 | 715 | |
| 716 | 716 | if ( ! rgar( $field, 'value' ) ) { |
| 717 | - $field['value'] = __( 'Update Settings', 'gravityview' ); |
|
| 717 | + $field[ 'value' ] = __( 'Update Settings', 'gravityview' ); |
|
| 718 | 718 | } |
| 719 | 719 | |
| 720 | 720 | $output = $this->settings_submit( $field, false ); |
@@ -723,7 +723,7 @@ discard block |
||
| 723 | 723 | $this->app_settings_uninstall_tab(); |
| 724 | 724 | $output .= ob_get_clean(); |
| 725 | 725 | |
| 726 | - if( $echo ) { |
|
| 726 | + if ( $echo ) { |
|
| 727 | 727 | echo $output; |
| 728 | 728 | } |
| 729 | 729 | |
@@ -741,8 +741,8 @@ discard block |
||
| 741 | 741 | parent::single_setting_label( $field ); |
| 742 | 742 | |
| 743 | 743 | // Added by GravityView |
| 744 | - if ( isset( $field['description'] ) ) { |
|
| 745 | - echo '<span class="description">'. $field['description'] .'</span>'; |
|
| 744 | + if ( isset( $field[ 'description' ] ) ) { |
|
| 745 | + echo '<span class="description">' . $field[ 'description' ] . '</span>'; |
|
| 746 | 746 | } |
| 747 | 747 | |
| 748 | 748 | } |
@@ -804,11 +804,11 @@ discard block |
||
| 804 | 804 | |
| 805 | 805 | // If the posted key doesn't match the activated/deactivated key (set using the Activate License button, AJAX response), |
| 806 | 806 | // then we assume it's changed. If it's changed, unset the status and the previous response. |
| 807 | - if( $local_key !== $response_key ) { |
|
| 807 | + if ( $local_key !== $response_key ) { |
|
| 808 | 808 | |
| 809 | - unset( $posted_settings['license_key_response'] ); |
|
| 810 | - unset( $posted_settings['license_key_status'] ); |
|
| 811 | - GFCommon::add_error_message( __('The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) ); |
|
| 809 | + unset( $posted_settings[ 'license_key_response' ] ); |
|
| 810 | + unset( $posted_settings[ 'license_key_status' ] ); |
|
| 811 | + GFCommon::add_error_message( __( 'The license key you entered has been saved, but not activated. Please activate the license.', 'gravityview' ) ); |
|
| 812 | 812 | } |
| 813 | 813 | |
| 814 | 814 | return $posted_settings; |
@@ -843,25 +843,25 @@ discard block |
||
| 843 | 843 | 'label' => __( 'License Key', 'gravityview' ), |
| 844 | 844 | 'description' => __( 'Enter the license key that was sent to you on purchase. This enables plugin updates & support.', 'gravityview' ) . $this->get_license_handler()->license_details( $this->get_app_setting( 'license_key_response' ) ), |
| 845 | 845 | 'type' => 'edd_license', |
| 846 | - 'data-pending-text' => __('Verifying license…', 'gravityview'), |
|
| 847 | - 'default_value' => $default_settings['license_key'], |
|
| 846 | + 'data-pending-text' => __( 'Verifying license…', 'gravityview' ), |
|
| 847 | + 'default_value' => $default_settings[ 'license_key' ], |
|
| 848 | 848 | 'class' => ( '' == $this->get_app_setting( 'license_key' ) ) ? 'activate code regular-text edd-license-key' : 'deactivate code regular-text edd-license-key', |
| 849 | 849 | ), |
| 850 | 850 | array( |
| 851 | 851 | 'name' => 'license_key_response', |
| 852 | - 'default_value' => $default_settings['license_key_response'], |
|
| 852 | + 'default_value' => $default_settings[ 'license_key_response' ], |
|
| 853 | 853 | 'type' => 'hidden', |
| 854 | 854 | ), |
| 855 | 855 | array( |
| 856 | 856 | 'name' => 'license_key_status', |
| 857 | - 'default_value' => $default_settings['license_key_status'], |
|
| 857 | + 'default_value' => $default_settings[ 'license_key_status' ], |
|
| 858 | 858 | 'type' => 'hidden', |
| 859 | 859 | ), |
| 860 | 860 | array( |
| 861 | 861 | 'name' => 'support-email', |
| 862 | 862 | 'type' => 'text', |
| 863 | 863 | 'validate' => 'email', |
| 864 | - 'default_value' => $default_settings['support-email'], |
|
| 864 | + 'default_value' => $default_settings[ 'support-email' ], |
|
| 865 | 865 | 'label' => __( 'Support Email', 'gravityview' ), |
| 866 | 866 | 'description' => __( 'In order to provide responses to your support requests, please provide your email address.', 'gravityview' ), |
| 867 | 867 | 'class' => 'code regular-text', |
@@ -873,38 +873,38 @@ discard block |
||
| 873 | 873 | 'name' => 'support_port', |
| 874 | 874 | 'type' => 'radio', |
| 875 | 875 | 'label' => __( 'Show Support Port?', 'gravityview' ), |
| 876 | - 'default_value' => $default_settings['support_port'], |
|
| 876 | + 'default_value' => $default_settings[ 'support_port' ], |
|
| 877 | 877 | 'horizontal' => 1, |
| 878 | 878 | 'choices' => array( |
| 879 | 879 | array( |
| 880 | - 'label' => _x('Show', 'Setting: Show or Hide', 'gravityview'), |
|
| 880 | + 'label' => _x( 'Show', 'Setting: Show or Hide', 'gravityview' ), |
|
| 881 | 881 | 'value' => '1', |
| 882 | 882 | ), |
| 883 | 883 | array( |
| 884 | - 'label' => _x('Hide', 'Setting: Show or Hide', 'gravityview'), |
|
| 884 | + 'label' => _x( 'Hide', 'Setting: Show or Hide', 'gravityview' ), |
|
| 885 | 885 | 'value' => '0', |
| 886 | 886 | ), |
| 887 | 887 | ), |
| 888 | - 'tooltip' => '<p><img src="' . esc_url_raw( plugins_url('assets/images/screenshots/beacon.png', GRAVITYVIEW_FILE ) ) . '" alt="' . esc_attr__( 'The Support Port looks like this.', 'gravityview' ) . '" class="alignright" style="max-width:40px; margin:.5em;" />' . esc_html__('The Support Port provides quick access to how-to articles and tutorials. For administrators, it also makes it easy to contact support.', 'gravityview') . '</p>', |
|
| 888 | + 'tooltip' => '<p><img src="' . esc_url_raw( plugins_url( 'assets/images/screenshots/beacon.png', GRAVITYVIEW_FILE ) ) . '" alt="' . esc_attr__( 'The Support Port looks like this.', 'gravityview' ) . '" class="alignright" style="max-width:40px; margin:.5em;" />' . esc_html__( 'The Support Port provides quick access to how-to articles and tutorials. For administrators, it also makes it easy to contact support.', 'gravityview' ) . '</p>', |
|
| 889 | 889 | 'description' => __( 'Show the Support Port on GravityView pages?', 'gravityview' ), |
| 890 | 890 | ), |
| 891 | 891 | array( |
| 892 | 892 | 'name' => 'no-conflict-mode', |
| 893 | 893 | 'type' => 'radio', |
| 894 | 894 | 'label' => __( 'No-Conflict Mode', 'gravityview' ), |
| 895 | - 'default_value' => $default_settings['no-conflict-mode'], |
|
| 895 | + 'default_value' => $default_settings[ 'no-conflict-mode' ], |
|
| 896 | 896 | 'horizontal' => 1, |
| 897 | 897 | 'choices' => array( |
| 898 | 898 | array( |
| 899 | - 'label' => _x('On', 'Setting: On or off', 'gravityview'), |
|
| 899 | + 'label' => _x( 'On', 'Setting: On or off', 'gravityview' ), |
|
| 900 | 900 | 'value' => '1', |
| 901 | 901 | ), |
| 902 | 902 | array( |
| 903 | - 'label' => _x('Off', 'Setting: On or off', 'gravityview'), |
|
| 903 | + 'label' => _x( 'Off', 'Setting: On or off', 'gravityview' ), |
|
| 904 | 904 | 'value' => '0', |
| 905 | 905 | ), |
| 906 | 906 | ), |
| 907 | - 'description' => __( 'Set this to ON to prevent extraneous scripts and styles from being printed on GravityView admin pages, reducing conflicts with other plugins and themes.', 'gravityview' ) . ' ' . __('If your Edit View tabs are ugly, enable this setting.', 'gravityview'), |
|
| 907 | + 'description' => __( 'Set this to ON to prevent extraneous scripts and styles from being printed on GravityView admin pages, reducing conflicts with other plugins and themes.', 'gravityview' ) . ' ' . __( 'If your Edit View tabs are ugly, enable this setting.', 'gravityview' ), |
|
| 908 | 908 | ), |
| 909 | 909 | ) ); |
| 910 | 910 | |
@@ -915,20 +915,20 @@ discard block |
||
| 915 | 915 | * @since 1.7.4 |
| 916 | 916 | */ |
| 917 | 917 | foreach ( $fields as &$field ) { |
| 918 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : rgget('id', $field ); |
|
| 919 | - $field['label'] = isset( $field['label'] ) ? $field['label'] : rgget('title', $field ); |
|
| 920 | - $field['default_value'] = isset( $field['default_value'] ) ? $field['default_value'] : rgget('default', $field ); |
|
| 921 | - $field['description'] = isset( $field['description'] ) ? $field['description'] : rgget('subtitle', $field ); |
|
| 918 | + $field[ 'name' ] = isset( $field[ 'name' ] ) ? $field[ 'name' ] : rgget( 'id', $field ); |
|
| 919 | + $field[ 'label' ] = isset( $field[ 'label' ] ) ? $field[ 'label' ] : rgget( 'title', $field ); |
|
| 920 | + $field[ 'default_value' ] = isset( $field[ 'default_value' ] ) ? $field[ 'default_value' ] : rgget( 'default', $field ); |
|
| 921 | + $field[ 'description' ] = isset( $field[ 'description' ] ) ? $field[ 'description' ] : rgget( 'subtitle', $field ); |
|
| 922 | 922 | |
| 923 | - if( $disabled_attribute ) { |
|
| 924 | - $field['disabled'] = $disabled_attribute; |
|
| 923 | + if ( $disabled_attribute ) { |
|
| 924 | + $field[ 'disabled' ] = $disabled_attribute; |
|
| 925 | 925 | } |
| 926 | 926 | } |
| 927 | 927 | |
| 928 | 928 | |
| 929 | 929 | $sections = array( |
| 930 | 930 | array( |
| 931 | - 'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __('You are running GravityView version %s', 'gravityview'), GravityView_Plugin::version ) ), |
|
| 931 | + 'description' => sprintf( '<span class="version-info description">%s</span>', sprintf( __( 'You are running GravityView version %s', 'gravityview' ), GravityView_Plugin::version ) ), |
|
| 932 | 932 | 'fields' => $fields, |
| 933 | 933 | ) |
| 934 | 934 | ); |
@@ -939,8 +939,8 @@ discard block |
||
| 939 | 939 | 'type' => 'save', |
| 940 | 940 | ); |
| 941 | 941 | |
| 942 | - if( $disabled_attribute ) { |
|
| 943 | - $button['disabled'] = $disabled_attribute; |
|
| 942 | + if ( $disabled_attribute ) { |
|
| 943 | + $button[ 'disabled' ] = $disabled_attribute; |
|
| 944 | 944 | } |
| 945 | 945 | |
| 946 | 946 | |
@@ -960,20 +960,20 @@ discard block |
||
| 960 | 960 | // If there are extensions, add a section for them |
| 961 | 961 | if ( ! empty( $extension_sections ) ) { |
| 962 | 962 | |
| 963 | - if( $disabled_attribute ) { |
|
| 963 | + if ( $disabled_attribute ) { |
|
| 964 | 964 | foreach ( $extension_sections as &$section ) { |
| 965 | - foreach ( $section['fields'] as &$field ) { |
|
| 966 | - $field['disabled'] = $disabled_attribute; |
|
| 965 | + foreach ( $section[ 'fields' ] as &$field ) { |
|
| 966 | + $field[ 'disabled' ] = $disabled_attribute; |
|
| 967 | 967 | } |
| 968 | 968 | } |
| 969 | 969 | } |
| 970 | 970 | |
| 971 | - $k = count( $extension_sections ) - 1 ; |
|
| 972 | - $extension_sections[ $k ]['fields'][] = $button; |
|
| 971 | + $k = count( $extension_sections ) - 1; |
|
| 972 | + $extension_sections[ $k ][ 'fields' ][ ] = $button; |
|
| 973 | 973 | $sections = array_merge( $sections, $extension_sections ); |
| 974 | 974 | } else { |
| 975 | 975 | // add the 'update settings' button to the general section |
| 976 | - $sections[0]['fields'][] = $button; |
|
| 976 | + $sections[ 0 ][ 'fields' ][ ] = $button; |
|
| 977 | 977 | } |
| 978 | 978 | |
| 979 | 979 | return $sections; |
@@ -20,16 +20,16 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
| 22 | 22 | |
| 23 | - unset( $field_options['search_filter'] ); |
|
| 23 | + unset( $field_options[ 'search_filter' ] ); |
|
| 24 | 24 | |
| 25 | - if( 'edit' === $context ) { |
|
| 25 | + if ( 'edit' === $context ) { |
|
| 26 | 26 | return $field_options; |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - $add_options['link_to_file'] = array( |
|
| 29 | + $add_options[ 'link_to_file' ] = array( |
|
| 30 | 30 | 'type' => 'checkbox', |
| 31 | 31 | 'label' => __( 'Display as a Link:', 'gravityview' ), |
| 32 | - 'desc' => __('Display the uploaded files as links, rather than embedded content.', 'gravityview'), |
|
| 32 | + 'desc' => __( 'Display the uploaded files as links, rather than embedded content.', 'gravityview' ), |
|
| 33 | 33 | 'value' => false, |
| 34 | 34 | 'merge_tags' => false, |
| 35 | 35 | ); |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | $output_arr = array(); |
| 66 | 66 | |
| 67 | 67 | // Get an array of file paths for the field. |
| 68 | - $file_paths = rgar( $field , 'multipleFiles' ) ? json_decode( $value ) : array( $value ); |
|
| 68 | + $file_paths = rgar( $field, 'multipleFiles' ) ? json_decode( $value ) : array( $value ); |
|
| 69 | 69 | |
| 70 | 70 | // The $value JSON was probably truncated; let's check lead_detail_long. |
| 71 | 71 | if ( ! is_array( $file_paths ) ) { |
@@ -79,19 +79,19 @@ discard block |
||
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | // Process each file path |
| 82 | - foreach( $file_paths as $file_path ) { |
|
| 82 | + foreach ( $file_paths as $file_path ) { |
|
| 83 | 83 | |
| 84 | 84 | // If the site is HTTPS, use HTTPS |
| 85 | - if(function_exists('set_url_scheme')) { $file_path = set_url_scheme($file_path); } |
|
| 85 | + if ( function_exists( 'set_url_scheme' ) ) { $file_path = set_url_scheme( $file_path ); } |
|
| 86 | 86 | |
| 87 | 87 | // This is from Gravity Forms's code |
| 88 | - $file_path = esc_attr(str_replace(" ", "%20", $file_path)); |
|
| 88 | + $file_path = esc_attr( str_replace( " ", "%20", $file_path ) ); |
|
| 89 | 89 | |
| 90 | 90 | // If the field is set to link to the single entry, link to it. |
| 91 | - $link = !empty( $field_settings['show_as_link'] ) ? GravityView_API::entry_link( $entry, $field ) : $file_path; |
|
| 91 | + $link = ! empty( $field_settings[ 'show_as_link' ] ) ? GravityView_API::entry_link( $entry, $field ) : $file_path; |
|
| 92 | 92 | |
| 93 | 93 | // Get file path information |
| 94 | - $file_path_info = pathinfo($file_path); |
|
| 94 | + $file_path_info = pathinfo( $file_path ); |
|
| 95 | 95 | |
| 96 | 96 | $html_format = NULL; |
| 97 | 97 | |
@@ -100,30 +100,30 @@ discard block |
||
| 100 | 100 | $disable_wrapped_link = false; |
| 101 | 101 | |
| 102 | 102 | // Is this an image? |
| 103 | - $image = new GravityView_Image(array( |
|
| 103 | + $image = new GravityView_Image( array( |
|
| 104 | 104 | 'src' => $file_path, |
| 105 | - 'class' => 'gv-image gv-field-id-'.$field_settings['id'], |
|
| 106 | - 'alt' => $field_settings['label'], |
|
| 107 | - 'width' => (gravityview_get_context() === 'single' ? NULL : 250) |
|
| 108 | - )); |
|
| 105 | + 'class' => 'gv-image gv-field-id-' . $field_settings[ 'id' ], |
|
| 106 | + 'alt' => $field_settings[ 'label' ], |
|
| 107 | + 'width' => ( gravityview_get_context() === 'single' ? NULL : 250 ) |
|
| 108 | + ) ); |
|
| 109 | 109 | |
| 110 | 110 | $content = $image->html(); |
| 111 | 111 | |
| 112 | 112 | // The new default content is the image, if it exists. If not, use the file name as the content. |
| 113 | - $content = !empty( $content ) ? $content : $file_path_info['basename']; |
|
| 113 | + $content = ! empty( $content ) ? $content : $file_path_info[ 'basename' ]; |
|
| 114 | 114 | |
| 115 | 115 | // If pathinfo() gave us the extension of the file, run the switch statement using that. |
| 116 | - $extension = empty( $file_path_info['extension'] ) ? NULL : strtolower( $file_path_info['extension'] ); |
|
| 116 | + $extension = empty( $file_path_info[ 'extension' ] ) ? NULL : strtolower( $file_path_info[ 'extension' ] ); |
|
| 117 | 117 | |
| 118 | 118 | |
| 119 | - switch( true ) { |
|
| 119 | + switch ( true ) { |
|
| 120 | 120 | |
| 121 | 121 | // Audio file |
| 122 | 122 | case in_array( $extension, wp_get_audio_extensions() ): |
| 123 | 123 | |
| 124 | 124 | $disable_lightbox = true; |
| 125 | 125 | |
| 126 | - if( shortcode_exists( 'audio' ) ) { |
|
| 126 | + if ( shortcode_exists( 'audio' ) ) { |
|
| 127 | 127 | |
| 128 | 128 | $disable_wrapped_link = true; |
| 129 | 129 | |
@@ -134,8 +134,8 @@ discard block |
||
| 134 | 134 | */ |
| 135 | 135 | $audio_settings = apply_filters( 'gravityview_audio_settings', array( |
| 136 | 136 | 'src' => $file_path, |
| 137 | - 'class' => 'wp-audio-shortcode gv-audio gv-field-id-'.$field_settings['id'] |
|
| 138 | - )); |
|
| 137 | + 'class' => 'wp-audio-shortcode gv-audio gv-field-id-' . $field_settings[ 'id' ] |
|
| 138 | + ) ); |
|
| 139 | 139 | |
| 140 | 140 | /** |
| 141 | 141 | * Generate the audio shortcode |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | |
| 154 | 154 | $disable_lightbox = true; |
| 155 | 155 | |
| 156 | - if( shortcode_exists( 'video' ) ) { |
|
| 156 | + if ( shortcode_exists( 'video' ) ) { |
|
| 157 | 157 | |
| 158 | 158 | $disable_wrapped_link = true; |
| 159 | 159 | |
@@ -164,8 +164,8 @@ discard block |
||
| 164 | 164 | */ |
| 165 | 165 | $video_settings = apply_filters( 'gravityview_video_settings', array( |
| 166 | 166 | 'src' => $file_path, |
| 167 | - 'class' => 'wp-video-shortcode gv-video gv-field-id-'.$field_settings['id'] |
|
| 168 | - )); |
|
| 167 | + 'class' => 'wp-video-shortcode gv-video gv-field-id-' . $field_settings[ 'id' ] |
|
| 168 | + ) ); |
|
| 169 | 169 | |
| 170 | 170 | /** |
| 171 | 171 | * Generate the video shortcode |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | break; |
| 188 | 188 | |
| 189 | 189 | // if not image, do not set the lightbox (@since 1.5.3) |
| 190 | - case !in_array( $extension, array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' ) ): |
|
| 190 | + case ! in_array( $extension, array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' ) ): |
|
| 191 | 191 | |
| 192 | 192 | $disable_lightbox = true; |
| 193 | 193 | |
@@ -197,10 +197,10 @@ discard block |
||
| 197 | 197 | |
| 198 | 198 | // If using Link to File, override the content. |
| 199 | 199 | // (We do this here so that the $disable_lightbox can be set. Yes, there's a little more processing time, but oh well.) |
| 200 | - if( !empty( $field_settings['link_to_file'] ) ) { |
|
| 200 | + if ( ! empty( $field_settings[ 'link_to_file' ] ) ) { |
|
| 201 | 201 | |
| 202 | 202 | // Force the content to be the file name |
| 203 | - $content = $file_path_info["basename"]; |
|
| 203 | + $content = $file_path_info[ "basename" ]; |
|
| 204 | 204 | |
| 205 | 205 | // Restore the wrapped link |
| 206 | 206 | $disable_wrapped_link = false; |
@@ -208,13 +208,13 @@ discard block |
||
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | // Whether to use lightbox or not |
| 211 | - if( $disable_lightbox || empty( $gravityview_view->atts['lightbox'] ) || !empty( $field_settings['show_as_link'] ) ) { |
|
| 211 | + if ( $disable_lightbox || empty( $gravityview_view->atts[ 'lightbox' ] ) || ! empty( $field_settings[ 'show_as_link' ] ) ) { |
|
| 212 | 212 | |
| 213 | - $link_atts = empty( $field_settings['show_as_link'] ) ? array( 'target' => '_blank' ) : array(); |
|
| 213 | + $link_atts = empty( $field_settings[ 'show_as_link' ] ) ? array( 'target' => '_blank' ) : array(); |
|
| 214 | 214 | |
| 215 | 215 | } else { |
| 216 | 216 | |
| 217 | - $entry_slug = GravityView_API::get_entry_slug( $entry['id'], $entry ); |
|
| 217 | + $entry_slug = GravityView_API::get_entry_slug( $entry[ 'id' ], $entry ); |
|
| 218 | 218 | |
| 219 | 219 | $link_atts = array( |
| 220 | 220 | 'rel' => sprintf( "%s-%s", $gv_class, $entry_slug ), |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | $disable_wrapped_link = apply_filters( 'gravityview/fields/fileupload/disable_link', $disable_wrapped_link, $gravityview_view->getCurrentField() ); |
| 241 | 241 | |
| 242 | 242 | // If the HTML output hasn't been overridden by the switch statement above, use the default format |
| 243 | - if( !empty( $content ) && empty( $disable_wrapped_link ) ) { |
|
| 243 | + if ( ! empty( $content ) && empty( $disable_wrapped_link ) ) { |
|
| 244 | 244 | |
| 245 | 245 | /** |
| 246 | 246 | * Modify the link text (defaults to the file name) |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | $content = gravityview_get_link( $link, $content, $link_atts ); |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | - $output_arr[] = array( |
|
| 258 | + $output_arr[ ] = array( |
|
| 259 | 259 | 'file_path' => $file_path, |
| 260 | 260 | 'content' => $content |
| 261 | 261 | ); |