@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | * |
| 57 | 57 | * @see GVCommon::get_form_fields() |
| 58 | 58 | * @access public |
| 59 | - * @param string|array $form_id (default: '') or $form object |
|
| 59 | + * @param string|array $form (default: '') or $form object |
|
| 60 | 60 | * @return array |
| 61 | 61 | */ |
| 62 | 62 | function gravityview_get_form_fields( $form = '', $add_default_properties = false, $include_parent_field = true ) { |
@@ -94,6 +94,7 @@ discard block |
||
| 94 | 94 | * @param int|array $form_ids The ID of the form or an array IDs of the Forms. Zero for all forms. |
| 95 | 95 | * @param mixed $passed_criteria (default: null) |
| 96 | 96 | * @param mixed &$total (default: null) |
| 97 | + * @param integer $total |
|
| 97 | 98 | * @return mixed False: Error fetching entries. Array: Multi-dimensional array of Gravity Forms entry arrays |
| 98 | 99 | */ |
| 99 | 100 | function gravityview_get_entries( $form_ids = null, $passed_criteria = null, &$total = null ) { |
@@ -106,7 +107,6 @@ discard block |
||
| 106 | 107 | * Since 1.4, supports custom entry slugs. The way that GravityView fetches an entry based on the custom slug is by searching `gravityview_unique_id` meta. The `$entry_slug` is fetched by getting the current query var set by `is_single_entry()` |
| 107 | 108 | * |
| 108 | 109 | * @access public |
| 109 | - * @param mixed $entry_id |
|
| 110 | 110 | * @param boolean $force_allow_ids Force the get_entry() method to allow passed entry IDs, even if the `gravityview_custom_entry_slug_allow_id` filter returns false. |
| 111 | 111 | * @param boolean $check_entry_display Check whether the entry is visible for the current View configuration. Default: true {@since 1.14} |
| 112 | 112 | * @return array|boolean |
@@ -193,7 +193,6 @@ discard block |
||
| 193 | 193 | * |
| 194 | 194 | * @see GravityView_Template::template_id |
| 195 | 195 | * |
| 196 | - * @param int $view_id The ID of the View to get the layout of |
|
| 197 | 196 | * |
| 198 | 197 | * @return string GravityView_Template::template_id value. Empty string if not. |
| 199 | 198 | */ |
@@ -328,8 +328,8 @@ discard block |
||
| 328 | 328 | * @param mixed $field_id Field ID or Field array |
| 329 | 329 | * @return string field type |
| 330 | 330 | */ |
| 331 | -function gravityview_get_field_type( $form = null , $field_id = '' ) { |
|
| 332 | - return GVCommon::get_field_type( $form, $field_id ); |
|
| 331 | +function gravityview_get_field_type( $form = null, $field_id = '' ) { |
|
| 332 | + return GVCommon::get_field_type( $form, $field_id ); |
|
| 333 | 333 | } |
| 334 | 334 | |
| 335 | 335 | |
@@ -342,8 +342,8 @@ discard block |
||
| 342 | 342 | * @return string HTML of the output. Empty string if $view_id is empty. |
| 343 | 343 | */ |
| 344 | 344 | function get_gravityview( $view_id = '', $atts = array() ) { |
| 345 | - if( !empty( $view_id ) ) { |
|
| 346 | - $atts['id'] = $view_id; |
|
| 345 | + if ( ! empty( $view_id ) ) { |
|
| 346 | + $atts[ 'id' ] = $view_id; |
|
| 347 | 347 | $args = wp_parse_args( $atts, defined( 'GRAVITYVIEW_FUTURE_CORE_LOADED' ) ? \GV\View_Settings::defaults() : GravityView_View_Data::get_default_args() ); |
| 348 | 348 | $GravityView_frontend = GravityView_frontend::getInstance(); |
| 349 | 349 | $GravityView_frontend->setGvOutputData( GravityView_View_Data::getInstance( $view_id ) ); |
@@ -386,19 +386,19 @@ discard block |
||
| 386 | 386 | */ |
| 387 | 387 | function gravityview_view_has_single_checkbox_or_radio( $form, $view_fields ) { |
| 388 | 388 | |
| 389 | - if( $form_fields = GFFormsModel::get_fields_by_type( $form, array( 'checkbox', 'radio' ) ) ) { |
|
| 389 | + if ( $form_fields = GFFormsModel::get_fields_by_type( $form, array( 'checkbox', 'radio' ) ) ) { |
|
| 390 | 390 | |
| 391 | 391 | /** @var GF_Field_Radio|GF_Field_Checkbox $form_field */ |
| 392 | - foreach( $form_fields as $form_field ) { |
|
| 392 | + foreach ( $form_fields as $form_field ) { |
|
| 393 | 393 | $field_id = $form_field->id; |
| 394 | - foreach( $view_fields as $zone ) { |
|
| 394 | + foreach ( $view_fields as $zone ) { |
|
| 395 | 395 | |
| 396 | 396 | // ACF compatibility; ACF-added fields aren't arrays |
| 397 | 397 | if ( ! is_array( $zone ) ) { continue; } |
| 398 | 398 | |
| 399 | - foreach( $zone as $field ) { |
|
| 399 | + foreach ( $zone as $field ) { |
|
| 400 | 400 | // If it's an input, not the parent and the parent ID matches a checkbox or radio |
| 401 | - if( ( strpos( $field['id'], '.' ) > 0 ) && floor( $field['id'] ) === floor( $field_id ) ) { |
|
| 401 | + if ( ( strpos( $field[ 'id' ], '.' ) > 0 ) && floor( $field[ 'id' ] ) === floor( $field_id ) ) { |
|
| 402 | 402 | return true; |
| 403 | 403 | } |
| 404 | 404 | } |
@@ -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 | ); |
@@ -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 | } |
@@ -5,220 +5,220 @@ |
||
| 5 | 5 | */ |
| 6 | 6 | class GravityView_Change_Entry_Creator { |
| 7 | 7 | |
| 8 | - function __construct() { |
|
| 9 | - |
|
| 10 | - /** |
|
| 11 | - * @since 1.5.1 |
|
| 12 | - */ |
|
| 13 | - add_action('gform_user_registered', array( $this, 'assign_new_user_to_lead'), 10, 4 ); |
|
| 14 | - |
|
| 15 | - // ONLY ADMIN FROM HERE ON. |
|
| 16 | - if( !is_admin() ) { return; } |
|
| 17 | - |
|
| 18 | - /** |
|
| 19 | - * @filter `gravityview_disable_change_entry_creator` Disable the Change Entry Creator functionality |
|
| 20 | - * @since 1.7.4 |
|
| 21 | - * @param boolean $disable Disable the Change Entry Creator functionality. Default: false. |
|
| 22 | - */ |
|
| 23 | - if( apply_filters('gravityview_disable_change_entry_creator', false ) ) { |
|
| 24 | - return; |
|
| 25 | - } |
|
| 26 | - |
|
| 27 | - /** |
|
| 28 | - * Use `init` to fix bbPress warning |
|
| 29 | - * @see https://bbpress.trac.wordpress.org/ticket/2309 |
|
| 30 | - */ |
|
| 31 | - add_action('init', array( $this, 'load'), 100 ); |
|
| 32 | - |
|
| 33 | - add_action('plugins_loaded', array( $this, 'prevent_conflicts') ); |
|
| 8 | + function __construct() { |
|
| 9 | + |
|
| 10 | + /** |
|
| 11 | + * @since 1.5.1 |
|
| 12 | + */ |
|
| 13 | + add_action('gform_user_registered', array( $this, 'assign_new_user_to_lead'), 10, 4 ); |
|
| 14 | + |
|
| 15 | + // ONLY ADMIN FROM HERE ON. |
|
| 16 | + if( !is_admin() ) { return; } |
|
| 17 | + |
|
| 18 | + /** |
|
| 19 | + * @filter `gravityview_disable_change_entry_creator` Disable the Change Entry Creator functionality |
|
| 20 | + * @since 1.7.4 |
|
| 21 | + * @param boolean $disable Disable the Change Entry Creator functionality. Default: false. |
|
| 22 | + */ |
|
| 23 | + if( apply_filters('gravityview_disable_change_entry_creator', false ) ) { |
|
| 24 | + return; |
|
| 25 | + } |
|
| 26 | + |
|
| 27 | + /** |
|
| 28 | + * Use `init` to fix bbPress warning |
|
| 29 | + * @see https://bbpress.trac.wordpress.org/ticket/2309 |
|
| 30 | + */ |
|
| 31 | + add_action('init', array( $this, 'load'), 100 ); |
|
| 32 | + |
|
| 33 | + add_action('plugins_loaded', array( $this, 'prevent_conflicts') ); |
|
| 34 | 34 | |
| 35 | - } |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * When an user is created using the User Registration add-on, assign the entry to them |
|
| 39 | - * |
|
| 40 | - * @since 1.5.1 |
|
| 41 | - * @uses RGFormsModel::update_lead_property() Modify the entry `created_by` field |
|
| 42 | - * @param int $user_id WordPress User ID |
|
| 43 | - * @param array $config User registration feed configuration |
|
| 44 | - * @param array $entry GF Entry array |
|
| 45 | - * @param string $password User password |
|
| 46 | - * @return void |
|
| 47 | - */ |
|
| 48 | - function assign_new_user_to_lead( $user_id, $config, $entry = array(), $password = '' ) { |
|
| 37 | + /** |
|
| 38 | + * When an user is created using the User Registration add-on, assign the entry to them |
|
| 39 | + * |
|
| 40 | + * @since 1.5.1 |
|
| 41 | + * @uses RGFormsModel::update_lead_property() Modify the entry `created_by` field |
|
| 42 | + * @param int $user_id WordPress User ID |
|
| 43 | + * @param array $config User registration feed configuration |
|
| 44 | + * @param array $entry GF Entry array |
|
| 45 | + * @param string $password User password |
|
| 46 | + * @return void |
|
| 47 | + */ |
|
| 48 | + function assign_new_user_to_lead( $user_id, $config, $entry = array(), $password = '' ) { |
|
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * Disable assigning the new user to the entry by returning false. |
|
| 52 | - * @param int $user_id WordPress User ID |
|
| 53 | - * @param array $config User registration feed configuration |
|
| 54 | - * @param array $entry GF Entry array |
|
| 55 | - */ |
|
| 56 | - $assign_to_lead = apply_filters( 'gravityview_assign_new_user_to_entry', true, $user_id, $config, $entry ); |
|
| 57 | - |
|
| 58 | - // If filter returns false, do not process |
|
| 59 | - if( empty( $assign_to_lead ) ) { |
|
| 60 | - return; |
|
| 61 | - } |
|
| 50 | + /** |
|
| 51 | + * Disable assigning the new user to the entry by returning false. |
|
| 52 | + * @param int $user_id WordPress User ID |
|
| 53 | + * @param array $config User registration feed configuration |
|
| 54 | + * @param array $entry GF Entry array |
|
| 55 | + */ |
|
| 56 | + $assign_to_lead = apply_filters( 'gravityview_assign_new_user_to_entry', true, $user_id, $config, $entry ); |
|
| 57 | + |
|
| 58 | + // If filter returns false, do not process |
|
| 59 | + if( empty( $assign_to_lead ) ) { |
|
| 60 | + return; |
|
| 61 | + } |
|
| 62 | 62 | |
| 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 ); |
|
| 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 ); |
|
| 65 | 65 | |
| 66 | - if( empty( $result ) ) { |
|
| 67 | - $status = __('Error', 'gravityview'); |
|
| 68 | - } else { |
|
| 69 | - $status = __('Success', 'gravityview'); |
|
| 70 | - } |
|
| 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 ); |
|
| 66 | + if( empty( $result ) ) { |
|
| 67 | + $status = __('Error', 'gravityview'); |
|
| 68 | + } else { |
|
| 69 | + $status = __('Success', 'gravityview'); |
|
| 70 | + } |
|
| 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 ); |
|
| 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 | |
| 80 | - /** |
|
| 81 | - * Disable previous functionality; use this one as the canonical. |
|
| 82 | - * @return void |
|
| 83 | - */ |
|
| 84 | - function prevent_conflicts() { |
|
| 80 | + /** |
|
| 81 | + * Disable previous functionality; use this one as the canonical. |
|
| 82 | + * @return void |
|
| 83 | + */ |
|
| 84 | + function prevent_conflicts() { |
|
| 85 | 85 | |
| 86 | - // Plugin that was provided here: |
|
| 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 ); |
|
| 86 | + // Plugin that was provided here: |
|
| 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 ); |
|
| 90 | 90 | |
| 91 | - // Disable for Gravity Forms Add-ons 3.6.2 and lower |
|
| 92 | - if( class_exists( 'KWS_GF_Change_Lead_Creator' ) ) { |
|
| 91 | + // Disable for Gravity Forms Add-ons 3.6.2 and lower |
|
| 92 | + if( class_exists( 'KWS_GF_Change_Lead_Creator' ) ) { |
|
| 93 | 93 | |
| 94 | - $Old_Lead_Creator = new KWS_GF_Change_Lead_Creator; |
|
| 94 | + $Old_Lead_Creator = new KWS_GF_Change_Lead_Creator; |
|
| 95 | 95 | |
| 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' ) ); |
|
| 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' ) ); |
|
| 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 ); |
|
| 102 | - } |
|
| 101 | + remove_action("gform_after_update_entry", array( $Old_Lead_Creator, 'update_entry_creator' ), 10 ); |
|
| 102 | + } |
|
| 103 | 103 | |
| 104 | - } |
|
| 104 | + } |
|
| 105 | 105 | |
| 106 | - /** |
|
| 107 | - * @since 3.6.3 |
|
| 108 | - * @return void |
|
| 109 | - */ |
|
| 110 | - function load() { |
|
| 106 | + /** |
|
| 107 | + * @since 3.6.3 |
|
| 108 | + * @return void |
|
| 109 | + */ |
|
| 110 | + function load() { |
|
| 111 | 111 | |
| 112 | - // Does GF exist? |
|
| 113 | - if( !class_exists('GFCommon') ) { |
|
| 114 | - return; |
|
| 115 | - } |
|
| 112 | + // Does GF exist? |
|
| 113 | + if( !class_exists('GFCommon') ) { |
|
| 114 | + return; |
|
| 115 | + } |
|
| 116 | 116 | |
| 117 | - // Can the user edit entries? |
|
| 118 | - if( ! GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_entries' ) ) ) { |
|
| 119 | - return; |
|
| 120 | - } |
|
| 117 | + // Can the user edit entries? |
|
| 118 | + if( ! GVCommon::has_cap( array( 'gravityforms_edit_entries', 'gravityview_edit_entries' ) ) ) { |
|
| 119 | + return; |
|
| 120 | + } |
|
| 121 | 121 | |
| 122 | - // If screen mode isn't set, then we're in the wrong place. |
|
| 123 | - if( empty( $_REQUEST['screen_mode'] ) ) { |
|
| 124 | - return; |
|
| 125 | - } |
|
| 122 | + // If screen mode isn't set, then we're in the wrong place. |
|
| 123 | + if( empty( $_REQUEST['screen_mode'] ) ) { |
|
| 124 | + return; |
|
| 125 | + } |
|
| 126 | 126 | |
| 127 | - // Now, no validation is required in the methods; let's hook in. |
|
| 128 | - add_action('admin_init', array( &$this, 'set_screen_mode' ) ); |
|
| 127 | + // Now, no validation is required in the methods; let's hook in. |
|
| 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 | |
| 136 | - /** |
|
| 137 | - * Allows for edit links to work with a link instead of a form (GET instead of POST) |
|
| 138 | - * @return void |
|
| 139 | - */ |
|
| 140 | - function set_screen_mode() { |
|
| 136 | + /** |
|
| 137 | + * Allows for edit links to work with a link instead of a form (GET instead of POST) |
|
| 138 | + * @return void |
|
| 139 | + */ |
|
| 140 | + function set_screen_mode() { |
|
| 141 | 141 | |
| 142 | - // If $_GET['screen_mode'] is set to edit, set $_POST value |
|
| 143 | - if( rgget('screen_mode') === 'edit' ) { |
|
| 144 | - $_POST["screen_mode"] = 'edit'; |
|
| 145 | - } |
|
| 142 | + // If $_GET['screen_mode'] is set to edit, set $_POST value |
|
| 143 | + if( rgget('screen_mode') === 'edit' ) { |
|
| 144 | + $_POST["screen_mode"] = 'edit'; |
|
| 145 | + } |
|
| 146 | 146 | |
| 147 | - } |
|
| 147 | + } |
|
| 148 | 148 | |
| 149 | - /** |
|
| 150 | - * When the entry creator is changed, add a note to the entry |
|
| 151 | - * @param array $form GF entry array |
|
| 152 | - * @param int $entry_id Entry ID |
|
| 153 | - * @return void |
|
| 154 | - */ |
|
| 155 | - function update_entry_creator($form, $entry_id) { |
|
| 156 | - global $current_user; |
|
| 149 | + /** |
|
| 150 | + * When the entry creator is changed, add a note to the entry |
|
| 151 | + * @param array $form GF entry array |
|
| 152 | + * @param int $entry_id Entry ID |
|
| 153 | + * @return void |
|
| 154 | + */ |
|
| 155 | + function update_entry_creator($form, $entry_id) { |
|
| 156 | + global $current_user; |
|
| 157 | 157 | |
| 158 | - // Update the entry |
|
| 159 | - $created_by = absint( rgpost('created_by') ); |
|
| 158 | + // Update the entry |
|
| 159 | + $created_by = absint( rgpost('created_by') ); |
|
| 160 | 160 | |
| 161 | - RGFormsModel::update_lead_property( $entry_id, 'created_by', $created_by ); |
|
| 161 | + RGFormsModel::update_lead_property( $entry_id, 'created_by', $created_by ); |
|
| 162 | 162 | |
| 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'); |
|
| 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'); |
|
| 165 | 165 | |
| 166 | - // If there's no owner and there didn't used to be, keep going |
|
| 167 | - if( empty( $originally_created_by ) && empty( $created_by ) ) { |
|
| 168 | - return; |
|
| 169 | - } |
|
| 166 | + // If there's no owner and there didn't used to be, keep going |
|
| 167 | + if( empty( $originally_created_by ) && empty( $created_by ) ) { |
|
| 168 | + return; |
|
| 169 | + } |
|
| 170 | 170 | |
| 171 | - // If the values have changed |
|
| 172 | - if( absint( $originally_created_by ) !== absint( $created_by ) ) { |
|
| 171 | + // If the values have changed |
|
| 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); |
|
| 182 | - $original_name = sprintf( $user_format, $originally_created_by_user_data->display_name, $originally_created_by_user_data->ID ); |
|
| 183 | - } |
|
| 180 | + if( !empty( $originally_created_by ) ) { |
|
| 181 | + $originally_created_by_user_data = get_userdata($originally_created_by); |
|
| 182 | + $original_name = sprintf( $user_format, $originally_created_by_user_data->display_name, $originally_created_by_user_data->ID ); |
|
| 183 | + } |
|
| 184 | 184 | |
| 185 | - if( !empty( $created_by ) ) { |
|
| 186 | - $created_by_user_data = get_userdata($created_by); |
|
| 187 | - $created_by_name = sprintf( $user_format, $created_by_user_data->display_name, $created_by_user_data->ID ); |
|
| 188 | - } |
|
| 185 | + if( !empty( $created_by ) ) { |
|
| 186 | + $created_by_user_data = get_userdata($created_by); |
|
| 187 | + $created_by_name = sprintf( $user_format, $created_by_user_data->display_name, $created_by_user_data->ID ); |
|
| 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' ); |
|
| 191 | - } |
|
| 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 | + } |
|
| 192 | 192 | |
| 193 | - } |
|
| 193 | + } |
|
| 194 | 194 | |
| 195 | - /** |
|
| 196 | - * Output the select to change the entry creator |
|
| 197 | - * @param int $form_id GF Form ID |
|
| 198 | - * @param array $entry GF entry array |
|
| 199 | - * @return void |
|
| 200 | - */ |
|
| 201 | - function add_select($form_id, $entry ) { |
|
| 195 | + /** |
|
| 196 | + * Output the select to change the entry creator |
|
| 197 | + * @param int $form_id GF Form ID |
|
| 198 | + * @param array $entry GF entry array |
|
| 199 | + * @return void |
|
| 200 | + */ |
|
| 201 | + function add_select($form_id, $entry ) { |
|
| 202 | 202 | |
| 203 | - if( rgpost('screen_mode') !== 'edit' ) { |
|
| 204 | - return; |
|
| 205 | - } |
|
| 203 | + if( rgpost('screen_mode') !== 'edit' ) { |
|
| 204 | + return; |
|
| 205 | + } |
|
| 206 | 206 | |
| 207 | - $users = GVCommon::get_users( 'change_entry_creator' ); |
|
| 207 | + $users = GVCommon::get_users( 'change_entry_creator' ); |
|
| 208 | 208 | |
| 209 | - $output = '<label for="change_created_by">'; |
|
| 210 | - $output .= esc_html__('Change Entry Creator:', 'gravityview'); |
|
| 211 | - $output .= '</label> |
|
| 209 | + $output = '<label for="change_created_by">'; |
|
| 210 | + $output .= esc_html__('Change Entry Creator:', 'gravityview'); |
|
| 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>'; |
|
| 216 | - } |
|
| 217 | - $output .= '</select>'; |
|
| 218 | - $output .= '<input name="originally_created_by" value="'.esc_attr( $entry['created_by'] ).'" type="hidden" />'; |
|
| 219 | - echo $output; |
|
| 220 | - |
|
| 221 | - } |
|
| 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 | + } |
|
| 217 | + $output .= '</select>'; |
|
| 218 | + $output .= '<input name="originally_created_by" value="'.esc_attr( $entry['created_by'] ).'" type="hidden" />'; |
|
| 219 | + echo $output; |
|
| 220 | + |
|
| 221 | + } |
|
| 222 | 222 | |
| 223 | 223 | } |
| 224 | 224 | |
@@ -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 |
@@ -221,11 +221,11 @@ discard block |
||
| 221 | 221 | * |
| 222 | 222 | * If the user doesn't have the `gravityview_support_port` capability, returns false; then |
| 223 | 223 | * If global setting is "hide", returns false; then |
| 224 | - * If user preference is not set, return global setting; then |
|
| 225 | - * If user preference is set, return that setting. |
|
| 224 | + * If user preference is not set, return global setting; then |
|
| 225 | + * If user preference is set, return that setting. |
|
| 226 | 226 | * |
| 227 | 227 | * @since 1.15 |
| 228 | - * @since 1.17.5 Changed behavior to respect global setting |
|
| 228 | + * @since 1.17.5 Changed behavior to respect global setting |
|
| 229 | 229 | * |
| 230 | 230 | * @param int $user Optional. ID of the user to check, defaults to 0 for current user. |
| 231 | 231 | * |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | $global_setting = GravityView_Settings::getSetting( 'support_port' ); |
| 241 | 241 | |
| 242 | 242 | if ( empty( $global_setting ) ) { |
| 243 | - return false; |
|
| 243 | + return false; |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | // Get the per-user Support Port setting |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | * Modifies the output of profile.php to add GravityView Support preference |
| 277 | 277 | * |
| 278 | 278 | * @since 1.15 |
| 279 | - * @since 1.17.5 Only show if global setting is active |
|
| 279 | + * @since 1.17.5 Only show if global setting is active |
|
| 280 | 280 | * |
| 281 | 281 | * @param WP_User $user Current user info |
| 282 | 282 | * |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | $global_setting = GravityView_Settings::getSetting( 'support_port' ); |
| 288 | 288 | |
| 289 | 289 | if ( empty( $global_setting ) ) { |
| 290 | - return; |
|
| 290 | + return; |
|
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | /** |
@@ -107,9 +107,9 @@ discard block |
||
| 107 | 107 | ) ); |
| 108 | 108 | |
| 109 | 109 | // This is just HTML we don't need. |
| 110 | - unset( $response['message'] ); |
|
| 110 | + unset( $response[ 'message' ] ); |
|
| 111 | 111 | |
| 112 | - switch ( intval( $response['license_limit'] ) ) { |
|
| 112 | + switch ( intval( $response[ 'license_limit' ] ) ) { |
|
| 113 | 113 | case 1: |
| 114 | 114 | $package = 'Sol'; |
| 115 | 115 | break; |
@@ -120,24 +120,24 @@ discard block |
||
| 120 | 120 | $package = 'Interstellar'; |
| 121 | 121 | break; |
| 122 | 122 | default: |
| 123 | - $package = sprintf( '%d-Site License', $response['license_limit'] ); |
|
| 123 | + $package = sprintf( '%d-Site License', $response[ 'license_limit' ] ); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | $data = array( |
| 127 | 127 | 'email' => GravityView_Settings::getSetting( 'support-email' ), |
| 128 | - 'name' => $response['customer_name'], |
|
| 129 | - 'Valid License?' => ucwords( $response['license'] ), |
|
| 130 | - 'License Key' => $response['license_key'], |
|
| 128 | + 'name' => $response[ 'customer_name' ], |
|
| 129 | + 'Valid License?' => ucwords( $response[ 'license' ] ), |
|
| 130 | + 'License Key' => $response[ 'license_key' ], |
|
| 131 | 131 | 'License Level' => $package, |
| 132 | 132 | 'Site Admin Email' => get_bloginfo( 'admin_email' ), |
| 133 | 133 | 'Support Email' => GravityView_Settings::getSetting( 'support-email' ), |
| 134 | - 'License Limit' => $response['license_limit'], |
|
| 135 | - 'Site Count' => $response['site_count'], |
|
| 136 | - 'License Expires' => $response['expires'], |
|
| 137 | - 'Activations Left' => $response['activations_left'], |
|
| 138 | - 'Payment ID' => $response['payment_id'], |
|
| 139 | - 'Payment Name' => $response['customer_name'], |
|
| 140 | - 'Payment Email' => $response['customer_email'], |
|
| 134 | + 'License Limit' => $response[ 'license_limit' ], |
|
| 135 | + 'Site Count' => $response[ 'site_count' ], |
|
| 136 | + 'License Expires' => $response[ 'expires' ], |
|
| 137 | + 'Activations Left' => $response[ 'activations_left' ], |
|
| 138 | + 'Payment ID' => $response[ 'payment_id' ], |
|
| 139 | + 'Payment Name' => $response[ 'customer_name' ], |
|
| 140 | + 'Payment Email' => $response[ 'customer_email' ], |
|
| 141 | 141 | 'WordPress Version' => get_bloginfo( 'version', 'display' ), |
| 142 | 142 | 'PHP Version' => phpversion(), |
| 143 | 143 | 'GravityView Version' => GravityView_Plugin::version, |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | * |
| 266 | 266 | * @uses GravityView_frontend::get_search_criteria() Convert the $_POST search request into a properly formatted request. |
| 267 | 267 | * @access public |
| 268 | - * @return void|boolean |
|
| 268 | + * @return false|null |
|
| 269 | 269 | */ |
| 270 | 270 | public function process_bulk_action() { |
| 271 | 271 | |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | * @since 1.18 Moved to GravityView_Entry_Approval::get_approved_column |
| 363 | 363 | * @see GravityView_Entry_Approval::get_approved_column |
| 364 | 364 | * |
| 365 | - * @param mixed $form GF Form or Form ID |
|
| 365 | + * @param integer $form GF Form or Form ID |
|
| 366 | 366 | * @return false|null|string Returns the input ID of the approved field. Returns NULL if no approved fields were found. Returns false if $form_id wasn't set. |
| 367 | 367 | */ |
| 368 | 368 | static public function get_approved_column( $form ) { |
@@ -346,14 +346,14 @@ discard block |
||
| 346 | 346 | /** |
| 347 | 347 | * update_approved function. |
| 348 | 348 | * |
| 349 | - * @since 1.18 Moved to GravityView_Entry_Approval::update_approved |
|
| 349 | + * @since 1.18 Moved to GravityView_Entry_Approval::update_approved |
|
| 350 | 350 | * @see GravityView_Entry_Approval::update_approved |
| 351 | - * |
|
| 351 | + * |
|
| 352 | 352 | * @param int $entry_id (default: 0) |
| 353 | 353 | * @param int $approved (default: 0) |
| 354 | 354 | * @param int $form_id (default: 0) |
| 355 | 355 | * @param int $approvedcolumn (default: 0) |
| 356 | - * |
|
| 356 | + * |
|
| 357 | 357 | * @return boolean True: It worked; False: it failed |
| 358 | 358 | */ |
| 359 | 359 | public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0) { |
@@ -363,9 +363,9 @@ discard block |
||
| 363 | 363 | /** |
| 364 | 364 | * Calculate the approve field.input id |
| 365 | 365 | * |
| 366 | - * @since 1.18 Moved to GravityView_Entry_Approval::get_approved_column |
|
| 367 | - * @see GravityView_Entry_Approval::get_approved_column |
|
| 368 | - * |
|
| 366 | + * @since 1.18 Moved to GravityView_Entry_Approval::get_approved_column |
|
| 367 | + * @see GravityView_Entry_Approval::get_approved_column |
|
| 368 | + * |
|
| 369 | 369 | * @param mixed $form GF Form or Form ID |
| 370 | 370 | * @return false|null|string Returns the input ID of the approved field. Returns NULL if no approved fields were found. Returns false if $form_id wasn't set. |
| 371 | 371 | */ |
@@ -487,7 +487,7 @@ discard block |
||
| 487 | 487 | 'bulk_actions' => $this->get_bulk_actions( $form_id ), |
| 488 | 488 | 'bulk_message' => $this->bulk_update_message, |
| 489 | 489 | 'unapprove_title' => GravityView_Entry_Approval_Status::get_title_attr('unapproved'), |
| 490 | - 'approve_title' => GravityView_Entry_Approval_Status::get_title_attr('disapproved'), |
|
| 490 | + 'approve_title' => GravityView_Entry_Approval_Status::get_title_attr('disapproved'), |
|
| 491 | 491 | 'disapprove_title' => GravityView_Entry_Approval_Status::get_title_attr('approved'), |
| 492 | 492 | 'column_title' => __( 'Show entry in directory view?', 'gravityview'), |
| 493 | 493 | 'column_link' => esc_url( $this->get_sort_link( $form_id ) ), |
@@ -496,11 +496,11 @@ discard block |
||
| 496 | 496 | } |
| 497 | 497 | |
| 498 | 498 | /** |
| 499 | - * Generate a link to sort by approval status (if there is an Approve/Disapprove field) |
|
| 500 | - * |
|
| 501 | - * Note: Sorting by approval will never be great because it's not possible currently to declare the sorting as |
|
| 502 | - * numeric, but it does group the approved entries together. |
|
| 503 | - * |
|
| 499 | + * Generate a link to sort by approval status (if there is an Approve/Disapprove field) |
|
| 500 | + * |
|
| 501 | + * Note: Sorting by approval will never be great because it's not possible currently to declare the sorting as |
|
| 502 | + * numeric, but it does group the approved entries together. |
|
| 503 | + * |
|
| 504 | 504 | * @param int $form_id |
| 505 | 505 | * |
| 506 | 506 | * @return string Sorting link |
@@ -510,20 +510,20 @@ discard block |
||
| 510 | 510 | $approved_column_id = self::get_approved_column( $form_id ); |
| 511 | 511 | |
| 512 | 512 | if( ! $approved_column_id ) { |
| 513 | - return ''; |
|
| 514 | - } |
|
| 513 | + return ''; |
|
| 514 | + } |
|
| 515 | 515 | |
| 516 | - $order = ( 'desc' === rgget('order') ) ? 'asc' : 'desc'; |
|
| 516 | + $order = ( 'desc' === rgget('order') ) ? 'asc' : 'desc'; |
|
| 517 | 517 | |
| 518 | - $args = array( |
|
| 519 | - 'orderby' => $approved_column_id, |
|
| 520 | - 'order' => $order, |
|
| 521 | - ); |
|
| 518 | + $args = array( |
|
| 519 | + 'orderby' => $approved_column_id, |
|
| 520 | + 'order' => $order, |
|
| 521 | + ); |
|
| 522 | 522 | |
| 523 | - $link = add_query_arg( $args ); |
|
| 523 | + $link = add_query_arg( $args ); |
|
| 524 | 524 | |
| 525 | 525 | return $link; |
| 526 | - } |
|
| 526 | + } |
|
| 527 | 527 | |
| 528 | 528 | /** |
| 529 | 529 | * Get an array of options to be added to the Gravity Forms "Bulk action" dropdown in a "GravityView" option group |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | /** gf_entries page - entries table screen */ |
| 45 | 45 | |
| 46 | 46 | // capture bulk actions |
| 47 | - add_action( 'gform_loaded', array( $this, 'process_bulk_action') ); |
|
| 47 | + add_action( 'gform_loaded', array( $this, 'process_bulk_action' ) ); |
|
| 48 | 48 | |
| 49 | 49 | // add hidden field with approve status |
| 50 | 50 | add_action( 'gform_entries_first_column_actions', array( $this, 'add_entry_approved_hidden_input' ), 1, 5 ); |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | add_filter( 'gravityview_tooltips', array( $this, 'tooltips' ) ); |
| 53 | 53 | |
| 54 | 54 | // adding styles and scripts |
| 55 | - add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles') ); |
|
| 55 | + add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ) ); |
|
| 56 | 56 | // bypass Gravity Forms no-conflict mode |
| 57 | 57 | add_filter( 'gform_noconflict_scripts', array( $this, 'register_gform_noconflict_script' ) ); |
| 58 | 58 | add_filter( 'gform_noconflict_styles', array( $this, 'register_gform_noconflict_style' ) ); |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | * @param bool $show_filter_links True: show the "approved"/"disapproved" filter links. False: hide them. |
| 82 | 82 | * @param array $form GF Form object of current form |
| 83 | 83 | */ |
| 84 | - if( false === apply_filters( 'gravityview/approve_entries/show_filter_links_entry_list', true, $form ) ) { |
|
| 84 | + if ( false === apply_filters( 'gravityview/approve_entries/show_filter_links_entry_list', true, $form ) ) { |
|
| 85 | 85 | return $filter_links; |
| 86 | 86 | } |
| 87 | 87 | |
@@ -102,19 +102,19 @@ discard block |
||
| 102 | 102 | $approved_count = $disapproved_count = 0; |
| 103 | 103 | |
| 104 | 104 | // Only count if necessary |
| 105 | - if( $include_counts ) { |
|
| 106 | - $approved_count = count( gravityview_get_entry_ids( $form['id'], array( 'status' => 'active', 'field_filters' => $field_filters_approved ) ) ); |
|
| 107 | - $disapproved_count = count( gravityview_get_entry_ids( $form['id'], array( 'status' => 'active', 'field_filters' => $field_filters_disapproved ) ) ); |
|
| 105 | + if ( $include_counts ) { |
|
| 106 | + $approved_count = count( gravityview_get_entry_ids( $form[ 'id' ], array( 'status' => 'active', 'field_filters' => $field_filters_approved ) ) ); |
|
| 107 | + $disapproved_count = count( gravityview_get_entry_ids( $form[ 'id' ], array( 'status' => 'active', 'field_filters' => $field_filters_disapproved ) ) ); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | - $filter_links[] = array( |
|
| 110 | + $filter_links[ ] = array( |
|
| 111 | 111 | 'id' => 'gv_approved', |
| 112 | 112 | 'field_filters' => $field_filters_approved, |
| 113 | 113 | 'count' => $approved_count, |
| 114 | 114 | 'label' => GravityView_Entry_Approval_Status::get_label( GravityView_Entry_Approval_Status::APPROVED ), |
| 115 | 115 | ); |
| 116 | 116 | |
| 117 | - $filter_links[] = array( |
|
| 117 | + $filter_links[ ] = array( |
|
| 118 | 118 | 'id' => 'gv_disapproved', |
| 119 | 119 | 'field_filters' => $field_filters_disapproved, |
| 120 | 120 | 'count' => $disapproved_count, |
@@ -133,9 +133,9 @@ discard block |
||
| 133 | 133 | */ |
| 134 | 134 | function tooltips( $tooltips ) { |
| 135 | 135 | |
| 136 | - $tooltips['form_gravityview_fields'] = array( |
|
| 137 | - 'title' => __('GravityView Fields', 'gravityview'), |
|
| 138 | - 'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview'), |
|
| 136 | + $tooltips[ 'form_gravityview_fields' ] = array( |
|
| 137 | + 'title' => __( 'GravityView Fields', 'gravityview' ), |
|
| 138 | + 'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview' ), |
|
| 139 | 139 | ); |
| 140 | 140 | |
| 141 | 141 | return $tooltips; |
@@ -246,15 +246,15 @@ discard block |
||
| 246 | 246 | |
| 247 | 247 | $gv_bulk_action = false; |
| 248 | 248 | |
| 249 | - if( version_compare( GFForms::$version, '2.0', '>=' ) ) { |
|
| 250 | - $bulk_action = ( '-1' !== rgpost('action') ) ? rgpost('action') : rgpost('action2'); |
|
| 249 | + if ( version_compare( GFForms::$version, '2.0', '>=' ) ) { |
|
| 250 | + $bulk_action = ( '-1' !== rgpost( 'action' ) ) ? rgpost( 'action' ) : rgpost( 'action2' ); |
|
| 251 | 251 | } else { |
| 252 | 252 | // GF 1.9.x - Bulk action 2 is the bottom bulk action select form. |
| 253 | - $bulk_action = rgpost('bulk_action') ? rgpost('bulk_action') : rgpost('bulk_action2'); |
|
| 253 | + $bulk_action = rgpost( 'bulk_action' ) ? rgpost( 'bulk_action' ) : rgpost( 'bulk_action2' ); |
|
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | // Check the $bulk_action value against GV actions, see if they're the same. I hate strpos(). |
| 257 | - if( ! empty( $bulk_action ) && preg_match( '/^('. implode( '|', $this->bulk_action_prefixes ) .')/ism', $bulk_action ) ) { |
|
| 257 | + if ( ! empty( $bulk_action ) && preg_match( '/^(' . implode( '|', $this->bulk_action_prefixes ) . ')/ism', $bulk_action ) ) { |
|
| 258 | 258 | $gv_bulk_action = $bulk_action; |
| 259 | 259 | } |
| 260 | 260 | |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | |
| 280 | 280 | // gforms_entry_list is the nonce that confirms we're on the right page |
| 281 | 281 | // gforms_update_note is sent when bulk editing entry notes. We don't want to process then. |
| 282 | - if ( $bulk_action && rgpost('gforms_entry_list') && empty( $_POST['gforms_update_note'] ) ) { |
|
| 282 | + if ( $bulk_action && rgpost( 'gforms_entry_list' ) && empty( $_POST[ 'gforms_update_note' ] ) ) { |
|
| 283 | 283 | |
| 284 | 284 | check_admin_referer( 'gforms_entry_list', 'gforms_entry_list' ); |
| 285 | 285 | |
@@ -297,13 +297,13 @@ discard block |
||
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | // All entries are set to be updated, not just the visible ones |
| 300 | - if ( ! empty( $_POST['all_entries'] ) ) { |
|
| 300 | + if ( ! empty( $_POST[ 'all_entries' ] ) ) { |
|
| 301 | 301 | |
| 302 | 302 | // Convert the current entry search into GF-formatted search criteria |
| 303 | 303 | $search = array( |
| 304 | - 'search_field' => isset( $_POST['f'] ) ? $_POST['f'][0] : 0, |
|
| 305 | - 'search_value' => isset( $_POST['v'][0] ) ? $_POST['v'][0] : '', |
|
| 306 | - 'search_operator' => isset( $_POST['o'][0] ) ? $_POST['o'][0] : 'contains', |
|
| 304 | + 'search_field' => isset( $_POST[ 'f' ] ) ? $_POST[ 'f' ][ 0 ] : 0, |
|
| 305 | + 'search_value' => isset( $_POST[ 'v' ][ 0 ] ) ? $_POST[ 'v' ][ 0 ] : '', |
|
| 306 | + 'search_operator' => isset( $_POST[ 'o' ][ 0 ] ) ? $_POST[ 'o' ][ 0 ] : 'contains', |
|
| 307 | 307 | ); |
| 308 | 308 | |
| 309 | 309 | $search_criteria = GravityView_frontend::get_search_criteria( $search, $form_id ); |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | } else { |
| 315 | 315 | |
| 316 | 316 | // Changed from 'lead' to 'entry' in 2.0 |
| 317 | - $entries = isset( $_POST['lead'] ) ? $_POST['lead'] : $_POST['entry']; |
|
| 317 | + $entries = isset( $_POST[ 'lead' ] ) ? $_POST[ 'lead' ] : $_POST[ 'entry' ]; |
|
| 318 | 318 | |
| 319 | 319 | } |
| 320 | 320 | |
@@ -326,15 +326,15 @@ discard block |
||
| 326 | 326 | $entry_count = count( $entries ) > 1 ? sprintf( __( '%d entries', 'gravityview' ), count( $entries ) ) : __( '1 entry', 'gravityview' ); |
| 327 | 327 | |
| 328 | 328 | switch ( $approved_status ) { |
| 329 | - case $this->bulk_action_prefixes['approve']: |
|
| 329 | + case $this->bulk_action_prefixes[ 'approve' ]: |
|
| 330 | 330 | GravityView_Entry_Approval::update_bulk( $entries, GravityView_Entry_Approval_Status::APPROVED, $form_id ); |
| 331 | 331 | $this->bulk_update_message = sprintf( __( '%s approved.', 'gravityview' ), $entry_count ); |
| 332 | 332 | break; |
| 333 | - case $this->bulk_action_prefixes['unapprove']: |
|
| 333 | + case $this->bulk_action_prefixes[ 'unapprove' ]: |
|
| 334 | 334 | GravityView_Entry_Approval::update_bulk( $entries, GravityView_Entry_Approval_Status::UNAPPROVED, $form_id ); |
| 335 | 335 | $this->bulk_update_message = sprintf( __( '%s unapproved.', 'gravityview' ), $entry_count ); |
| 336 | 336 | break; |
| 337 | - case $this->bulk_action_prefixes['disapprove']: |
|
| 337 | + case $this->bulk_action_prefixes[ 'disapprove' ]: |
|
| 338 | 338 | GravityView_Entry_Approval::update_bulk( $entries, GravityView_Entry_Approval_Status::DISAPPROVED, $form_id ); |
| 339 | 339 | $this->bulk_update_message = sprintf( __( '%s disapproved.', 'gravityview' ), $entry_count ); |
| 340 | 340 | break; |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | * |
| 357 | 357 | * @return boolean True: It worked; False: it failed |
| 358 | 358 | */ |
| 359 | - public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0) { |
|
| 359 | + public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0 ) { |
|
| 360 | 360 | return GravityView_Entry_Approval::update_approved( $entry_id, $approved, $form_id, $approvedcolumn ); |
| 361 | 361 | } |
| 362 | 362 | |
@@ -386,20 +386,20 @@ discard block |
||
| 386 | 386 | * |
| 387 | 387 | * @return void |
| 388 | 388 | */ |
| 389 | - static public function add_entry_approved_hidden_input( $form_id, $field_id, $value, $entry, $query_string ) { |
|
| 389 | + static public function add_entry_approved_hidden_input( $form_id, $field_id, $value, $entry, $query_string ) { |
|
| 390 | 390 | |
| 391 | - if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry['id'] ) ) { |
|
| 391 | + if ( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry[ 'id' ] ) ) { |
|
| 392 | 392 | return; |
| 393 | 393 | } |
| 394 | 394 | |
| 395 | - if( empty( $entry['id'] ) ) { |
|
| 395 | + if ( empty( $entry[ 'id' ] ) ) { |
|
| 396 | 396 | return; |
| 397 | 397 | } |
| 398 | 398 | |
| 399 | 399 | $status_value = GravityView_Entry_Approval::get_entry_status( $entry, 'value' ); |
| 400 | 400 | |
| 401 | - if( $status_value ) { |
|
| 402 | - echo '<input type="hidden" class="entry_approval" id="entry_approved_'. $entry['id'] .'" value="' . esc_attr( $status_value ) . '" />'; |
|
| 401 | + if ( $status_value ) { |
|
| 402 | + echo '<input type="hidden" class="entry_approval" id="entry_approved_' . $entry[ 'id' ] . '" value="' . esc_attr( $status_value ) . '" />'; |
|
| 403 | 403 | } |
| 404 | 404 | } |
| 405 | 405 | |
@@ -412,10 +412,10 @@ discard block |
||
| 412 | 412 | */ |
| 413 | 413 | private function get_form_id() { |
| 414 | 414 | |
| 415 | - $form_id = GFForms::get('id'); |
|
| 415 | + $form_id = GFForms::get( 'id' ); |
|
| 416 | 416 | |
| 417 | 417 | // If there are no forms identified, use the first form. That's how GF does it. |
| 418 | - if( empty( $form_id ) && class_exists('RGFormsModel') ) { |
|
| 418 | + if ( empty( $form_id ) && class_exists( 'RGFormsModel' ) ) { |
|
| 419 | 419 | $form_id = $this->get_first_form_id(); |
| 420 | 420 | } |
| 421 | 421 | |
@@ -435,14 +435,14 @@ discard block |
||
| 435 | 435 | |
| 436 | 436 | $forms = RGFormsModel::get_forms( null, 'title' ); |
| 437 | 437 | |
| 438 | - if( ! isset( $forms[0] ) ) { |
|
| 438 | + if ( ! isset( $forms[ 0 ] ) ) { |
|
| 439 | 439 | do_action( 'gravityview_log_error', __METHOD__ . ': No forms were found' ); |
| 440 | 440 | return 0; |
| 441 | 441 | } |
| 442 | 442 | |
| 443 | - $first_form = $forms[0]; |
|
| 443 | + $first_form = $forms[ 0 ]; |
|
| 444 | 444 | |
| 445 | - $form_id = is_object( $forms[0] ) ? $first_form->id : $first_form['id']; |
|
| 445 | + $form_id = is_object( $forms[ 0 ] ) ? $first_form->id : $first_form[ 'id' ]; |
|
| 446 | 446 | |
| 447 | 447 | return intval( $form_id ); |
| 448 | 448 | } |
@@ -450,7 +450,7 @@ discard block |
||
| 450 | 450 | |
| 451 | 451 | function add_scripts_and_styles( $hook ) { |
| 452 | 452 | |
| 453 | - if( ! class_exists( 'GFForms' ) ) { |
|
| 453 | + if ( ! class_exists( 'GFForms' ) ) { |
|
| 454 | 454 | |
| 455 | 455 | do_action( 'gravityview_log_error', 'GravityView_Admin_ApproveEntries[add_scripts_and_styles] GFForms does not exist.' ); |
| 456 | 456 | |
@@ -459,26 +459,26 @@ discard block |
||
| 459 | 459 | |
| 460 | 460 | // enqueue styles & scripts gf_entries |
| 461 | 461 | // But only if we're on the main Entries page, not on reports pages |
| 462 | - if( GFForms::get_page() !== 'entry_list' ) { |
|
| 462 | + if ( GFForms::get_page() !== 'entry_list' ) { |
|
| 463 | 463 | return; |
| 464 | 464 | } |
| 465 | 465 | |
| 466 | 466 | $form_id = $this->get_form_id(); |
| 467 | 467 | |
| 468 | 468 | // Things are broken; no forms were found |
| 469 | - if( empty( $form_id ) ) { |
|
| 469 | + if ( empty( $form_id ) ) { |
|
| 470 | 470 | return; |
| 471 | 471 | } |
| 472 | 472 | |
| 473 | - wp_enqueue_style( 'gravityview_entries_list', plugins_url('assets/css/admin-entries-list.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version ); |
|
| 473 | + wp_enqueue_style( 'gravityview_entries_list', plugins_url( 'assets/css/admin-entries-list.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version ); |
|
| 474 | 474 | |
| 475 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
| 475 | + $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
| 476 | 476 | |
| 477 | - wp_enqueue_script( 'gravityview_gf_entries_scripts', plugins_url('assets/js/admin-entries-list'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery' ), GravityView_Plugin::version ); |
|
| 477 | + wp_enqueue_script( 'gravityview_gf_entries_scripts', plugins_url( 'assets/js/admin-entries-list' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery' ), GravityView_Plugin::version ); |
|
| 478 | 478 | |
| 479 | 479 | wp_localize_script( 'gravityview_gf_entries_scripts', 'gvGlobals', array( |
| 480 | - 'nonce' => wp_create_nonce( 'gravityview_entry_approval'), |
|
| 481 | - 'admin_nonce' => wp_create_nonce( 'gravityview_admin_entry_approval'), |
|
| 480 | + 'nonce' => wp_create_nonce( 'gravityview_entry_approval' ), |
|
| 481 | + 'admin_nonce' => wp_create_nonce( 'gravityview_admin_entry_approval' ), |
|
| 482 | 482 | 'form_id' => $form_id, |
| 483 | 483 | 'show_column' => (int)$this->show_approve_entry_column( $form_id ), |
| 484 | 484 | 'add_bulk_action' => (int)GVCommon::has_cap( 'gravityview_moderate_entries' ), |
@@ -487,10 +487,10 @@ discard block |
||
| 487 | 487 | 'status_unapproved' => GravityView_Entry_Approval_Status::UNAPPROVED, |
| 488 | 488 | 'bulk_actions' => $this->get_bulk_actions( $form_id ), |
| 489 | 489 | 'bulk_message' => $this->bulk_update_message, |
| 490 | - 'unapprove_title' => GravityView_Entry_Approval_Status::get_title_attr('unapproved'), |
|
| 491 | - 'approve_title' => GravityView_Entry_Approval_Status::get_title_attr('disapproved'), |
|
| 492 | - 'disapprove_title' => GravityView_Entry_Approval_Status::get_title_attr('approved'), |
|
| 493 | - 'column_title' => __( 'Show entry in directory view?', 'gravityview'), |
|
| 490 | + 'unapprove_title' => GravityView_Entry_Approval_Status::get_title_attr( 'unapproved' ), |
|
| 491 | + 'approve_title' => GravityView_Entry_Approval_Status::get_title_attr( 'disapproved' ), |
|
| 492 | + 'disapprove_title' => GravityView_Entry_Approval_Status::get_title_attr( 'approved' ), |
|
| 493 | + 'column_title' => __( 'Show entry in directory view?', 'gravityview' ), |
|
| 494 | 494 | 'column_link' => esc_url( $this->get_sort_link( $form_id ) ), |
| 495 | 495 | ) ); |
| 496 | 496 | |
@@ -510,11 +510,11 @@ discard block |
||
| 510 | 510 | |
| 511 | 511 | $approved_column_id = self::get_approved_column( $form_id ); |
| 512 | 512 | |
| 513 | - if( ! $approved_column_id ) { |
|
| 513 | + if ( ! $approved_column_id ) { |
|
| 514 | 514 | return ''; |
| 515 | 515 | } |
| 516 | 516 | |
| 517 | - $order = ( 'desc' === rgget('order') ) ? 'asc' : 'desc'; |
|
| 517 | + $order = ( 'desc' === rgget( 'order' ) ) ? 'asc' : 'desc'; |
|
| 518 | 518 | |
| 519 | 519 | $args = array( |
| 520 | 520 | 'orderby' => $approved_column_id, |
@@ -540,16 +540,16 @@ discard block |
||
| 540 | 540 | $bulk_actions = array( |
| 541 | 541 | 'GravityView' => array( |
| 542 | 542 | array( |
| 543 | - 'label' => GravityView_Entry_Approval_Status::get_string('approved', 'action'), |
|
| 544 | - 'value' => sprintf( '%s-%d', $this->bulk_action_prefixes['approve'], $form_id ), |
|
| 543 | + 'label' => GravityView_Entry_Approval_Status::get_string( 'approved', 'action' ), |
|
| 544 | + 'value' => sprintf( '%s-%d', $this->bulk_action_prefixes[ 'approve' ], $form_id ), |
|
| 545 | 545 | ), |
| 546 | 546 | array( |
| 547 | - 'label' => GravityView_Entry_Approval_Status::get_string('disapproved', 'action'), |
|
| 548 | - 'value' => sprintf( '%s-%d', $this->bulk_action_prefixes['disapprove'], $form_id ), |
|
| 547 | + 'label' => GravityView_Entry_Approval_Status::get_string( 'disapproved', 'action' ), |
|
| 548 | + 'value' => sprintf( '%s-%d', $this->bulk_action_prefixes[ 'disapprove' ], $form_id ), |
|
| 549 | 549 | ), |
| 550 | 550 | array( |
| 551 | - 'label' => GravityView_Entry_Approval_Status::get_string('unapproved', 'action'), |
|
| 552 | - 'value' => sprintf( '%s-%d', $this->bulk_action_prefixes['unapprove'], $form_id ), |
|
| 551 | + 'label' => GravityView_Entry_Approval_Status::get_string( 'unapproved', 'action' ), |
|
| 552 | + 'value' => sprintf( '%s-%d', $this->bulk_action_prefixes[ 'unapprove' ], $form_id ), |
|
| 553 | 553 | ), |
| 554 | 554 | ), |
| 555 | 555 | ); |
@@ -566,8 +566,8 @@ discard block |
||
| 566 | 566 | // Sanitize the values, just to be sure. |
| 567 | 567 | foreach ( $bulk_actions as $key => $group ) { |
| 568 | 568 | foreach ( $group as $i => $action ) { |
| 569 | - $bulk_actions[ $key ][ $i ]['label'] = esc_html( $bulk_actions[ $key ][ $i ]['label'] ); |
|
| 570 | - $bulk_actions[ $key ][ $i ]['value'] = esc_attr( $bulk_actions[ $key ][ $i ]['value'] ); |
|
| 569 | + $bulk_actions[ $key ][ $i ][ 'label' ] = esc_html( $bulk_actions[ $key ][ $i ][ 'label' ] ); |
|
| 570 | + $bulk_actions[ $key ][ $i ][ 'value' ] = esc_attr( $bulk_actions[ $key ][ $i ][ 'value' ] ); |
|
| 571 | 571 | } |
| 572 | 572 | } |
| 573 | 573 | |
@@ -592,13 +592,13 @@ discard block |
||
| 592 | 592 | * @since 1.7.2 |
| 593 | 593 | * @param boolean $hide_if_no_connections |
| 594 | 594 | */ |
| 595 | - $hide_if_no_connections = apply_filters('gravityview/approve_entries/hide-if-no-connections', false ); |
|
| 595 | + $hide_if_no_connections = apply_filters( 'gravityview/approve_entries/hide-if-no-connections', false ); |
|
| 596 | 596 | |
| 597 | - if( $hide_if_no_connections ) { |
|
| 597 | + if ( $hide_if_no_connections ) { |
|
| 598 | 598 | |
| 599 | 599 | $connected_views = gravityview_get_connected_views( $form_id ); |
| 600 | 600 | |
| 601 | - if( empty( $connected_views ) ) { |
|
| 601 | + if ( empty( $connected_views ) ) { |
|
| 602 | 602 | $show_approve_column = false; |
| 603 | 603 | } |
| 604 | 604 | } |
@@ -608,18 +608,18 @@ discard block |
||
| 608 | 608 | * @param boolean $show_approve_column Whether the column will be shown |
| 609 | 609 | * @param int $form_id The ID of the Gravity Forms form for which entries are being shown |
| 610 | 610 | */ |
| 611 | - $show_approve_column = apply_filters('gravityview/approve_entries/show-column', $show_approve_column, $form_id ); |
|
| 611 | + $show_approve_column = apply_filters( 'gravityview/approve_entries/show-column', $show_approve_column, $form_id ); |
|
| 612 | 612 | |
| 613 | 613 | return $show_approve_column; |
| 614 | 614 | } |
| 615 | 615 | |
| 616 | 616 | function register_gform_noconflict_script( $scripts ) { |
| 617 | - $scripts[] = 'gravityview_gf_entries_scripts'; |
|
| 617 | + $scripts[ ] = 'gravityview_gf_entries_scripts'; |
|
| 618 | 618 | return $scripts; |
| 619 | 619 | } |
| 620 | 620 | |
| 621 | 621 | function register_gform_noconflict_style( $styles ) { |
| 622 | - $styles[] = 'gravityview_entries_list'; |
|
| 622 | + $styles[ ] = 'gravityview_entries_list'; |
|
| 623 | 623 | return $styles; |
| 624 | 624 | } |
| 625 | 625 | |