@@ -15,29 +15,29 @@ |
||
| 15 | 15 | $field_info_items = array(); |
| 16 | 16 | |
| 17 | 17 | // Fields with IDs, not like Source URL or Entry ID |
| 18 | - if( is_numeric( $this->id ) ) { |
|
| 18 | + if ( is_numeric( $this->id ) ) { |
|
| 19 | 19 | |
| 20 | - $field_type_title = GFCommon::get_field_type_title( $this->item['input_type'] ); |
|
| 20 | + $field_type_title = GFCommon::get_field_type_title( $this->item[ 'input_type' ] ); |
|
| 21 | 21 | |
| 22 | - $field_info_items[] = array( |
|
| 23 | - 'value' => sprintf( __('Type: %s', 'gravityview'), $field_type_title ) |
|
| 22 | + $field_info_items[ ] = array( |
|
| 23 | + 'value' => sprintf( __( 'Type: %s', 'gravityview' ), $field_type_title ) |
|
| 24 | 24 | ); |
| 25 | 25 | |
| 26 | - $field_info_items[] = array( |
|
| 27 | - 'value' => sprintf( __('Field ID: %s', 'gravityview'), $this->id ), |
|
| 26 | + $field_info_items[ ] = array( |
|
| 27 | + 'value' => sprintf( __( 'Field ID: %s', 'gravityview' ), $this->id ), |
|
| 28 | 28 | ); |
| 29 | 29 | |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - if( !empty( $this->item['desc'] ) ) { |
|
| 33 | - $field_info_items[] = array( |
|
| 34 | - 'value' => $this->item['desc'] |
|
| 32 | + if ( ! empty( $this->item[ 'desc' ] ) ) { |
|
| 33 | + $field_info_items[ ] = array( |
|
| 34 | + 'value' => $this->item[ 'desc' ] |
|
| 35 | 35 | ); |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - if( !empty( $this->item['adminLabel'] ) ) { |
|
| 39 | - $field_info_items[] = array( |
|
| 40 | - 'value' => sprintf( __('Admin Label: %s', 'gravityview' ), $this->item['adminLabel'] ), |
|
| 38 | + if ( ! empty( $this->item[ 'adminLabel' ] ) ) { |
|
| 39 | + $field_info_items[ ] = array( |
|
| 40 | + 'value' => sprintf( __( 'Admin Label: %s', 'gravityview' ), $this->item[ 'adminLabel' ] ), |
|
| 41 | 41 | 'class' => 'gv-sublabel' |
| 42 | 42 | ); |
| 43 | 43 | } |
@@ -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, |