@@ -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 | } |
@@ -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 | |
@@ -20,12 +20,12 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | function __construct() { |
| 22 | 22 | |
| 23 | - add_action( 'media_buttons', array( $this, 'add_shortcode_button'), 30); |
|
| 23 | + add_action( 'media_buttons', array( $this, 'add_shortcode_button' ), 30 ); |
|
| 24 | 24 | |
| 25 | - add_action( 'admin_footer', array( $this, 'add_shortcode_popup') ); |
|
| 25 | + add_action( 'admin_footer', array( $this, 'add_shortcode_popup' ) ); |
|
| 26 | 26 | |
| 27 | 27 | // adding styles and scripts |
| 28 | - add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles') ); |
|
| 28 | + add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles' ) ); |
|
| 29 | 29 | |
| 30 | 30 | // ajax - populate sort fields based on the selected view |
| 31 | 31 | add_action( 'wp_ajax_gv_sortable_fields', array( $this, 'get_sortable_fields' ) ); |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | function is_post_editor_screen() { |
| 42 | 42 | global $current_screen, $pagenow; |
| 43 | - return !empty( $current_screen->post_type ) && 'gravityview' != $current_screen->post_type && in_array( $pagenow , array( 'post.php' , 'post-new.php' ) ); |
|
| 43 | + return ! empty( $current_screen->post_type ) && 'gravityview' != $current_screen->post_type && in_array( $pagenow, array( 'post.php', 'post-new.php' ) ); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | |
@@ -55,15 +55,15 @@ discard block |
||
| 55 | 55 | /** |
| 56 | 56 | * @since 1.15.3 |
| 57 | 57 | */ |
| 58 | - if( ! GVCommon::has_cap( array( 'publish_gravityviews' ) ) ) { |
|
| 58 | + if ( ! GVCommon::has_cap( array( 'publish_gravityviews' ) ) ) { |
|
| 59 | 59 | return; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - if( !$this->is_post_editor_screen() ) { |
|
| 62 | + if ( ! $this->is_post_editor_screen() ) { |
|
| 63 | 63 | return; |
| 64 | 64 | } |
| 65 | 65 | ?> |
| 66 | - <a href="#TB_inline?width=600&height=800&inlineId=select_gravityview_view" class="thickbox hide-if-no-js button gform_media_link" id="add_gravityview" title="<?php esc_attr_e("Insert View", 'gravityview'); ?>"><span class="icon gv-icon-astronaut-head"></span><?php esc_html_e( 'Add View', 'gravityview' ); ?></a> |
|
| 66 | + <a href="#TB_inline?width=600&height=800&inlineId=select_gravityview_view" class="thickbox hide-if-no-js button gform_media_link" id="add_gravityview" title="<?php esc_attr_e( "Insert View", 'gravityview' ); ?>"><span class="icon gv-icon-astronaut-head"></span><?php esc_html_e( 'Add View', 'gravityview' ); ?></a> |
|
| 67 | 67 | <?php |
| 68 | 68 | |
| 69 | 69 | } |
@@ -79,16 +79,16 @@ discard block |
||
| 79 | 79 | function add_shortcode_popup() { |
| 80 | 80 | global $post; |
| 81 | 81 | |
| 82 | - if( !$this->is_post_editor_screen() ) { |
|
| 82 | + if ( ! $this->is_post_editor_screen() ) { |
|
| 83 | 83 | return; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - $post_type = get_post_type_object($post->post_type); |
|
| 86 | + $post_type = get_post_type_object( $post->post_type ); |
|
| 87 | 87 | |
| 88 | - $views = get_posts( array('post_type' => 'gravityview', 'posts_per_page' => -1 ) ); |
|
| 88 | + $views = get_posts( array( 'post_type' => 'gravityview', 'posts_per_page' => -1 ) ); |
|
| 89 | 89 | |
| 90 | 90 | // If there are no views set up yet, we get outta here. |
| 91 | - if( empty( $views ) ) { |
|
| 91 | + if ( empty( $views ) ) { |
|
| 92 | 92 | echo '<div id="select_gravityview_view"><div class="wrap">' . GravityView_Admin::no_views_text() . '</div></div>'; |
| 93 | 93 | return; |
| 94 | 94 | } |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | <div class="wrap"> |
| 100 | 100 | |
| 101 | 101 | <h2 class=""><?php esc_html_e( 'Embed a View', 'gravityview' ); ?></h2> |
| 102 | - <p class="subtitle"><?php printf( esc_attr ( __( 'Use this form to embed a View into this %s. %sLearn more about using shortcodes.%s', 'gravityview') ), $post_type->labels->singular_name, '<a href="http://docs.gravityview.co/article/73-using-the-shortcode" target="_blank" rel="noopener noreferrer">', '</a>' ); ?></p> |
|
| 102 | + <p class="subtitle"><?php printf( esc_attr( __( 'Use this form to embed a View into this %s. %sLearn more about using shortcodes.%s', 'gravityview' ) ), $post_type->labels->singular_name, '<a href="http://docs.gravityview.co/article/73-using-the-shortcode" target="_blank" rel="noopener noreferrer">', '</a>' ); ?></p> |
|
| 103 | 103 | |
| 104 | 104 | <div> |
| 105 | 105 | <h3><label for="gravityview_id"><?php esc_html_e( 'Select a View', 'gravityview' ); ?></label></h3> |
@@ -107,9 +107,9 @@ discard block |
||
| 107 | 107 | <select name="gravityview_id" id="gravityview_id"> |
| 108 | 108 | <option value=""><?php esc_html_e( '— Select a View to Insert —', 'gravityview' ); ?></option> |
| 109 | 109 | <?php |
| 110 | - foreach( $views as $view ) { |
|
| 111 | - $title = empty( $view->post_title ) ? __('(no title)', 'gravityview') : $view->post_title; |
|
| 112 | - echo '<option value="'. $view->ID .'">'. esc_html( sprintf('%s #%d', $title, $view->ID ) ) .'</option>'; |
|
| 110 | + foreach ( $views as $view ) { |
|
| 111 | + $title = empty( $view->post_title ) ? __( '(no title)', 'gravityview' ) : $view->post_title; |
|
| 112 | + echo '<option value="' . $view->ID . '">' . esc_html( sprintf( '%s #%d', $title, $view->ID ) ) . '</option>'; |
|
| 113 | 113 | } |
| 114 | 114 | ?> |
| 115 | 115 | </select> |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | |
| 126 | 126 | foreach ( $settings as $key => $setting ) { |
| 127 | 127 | |
| 128 | - if( empty( $setting['show_in_shortcode'] ) ) { continue; } |
|
| 128 | + if ( empty( $setting[ 'show_in_shortcode' ] ) ) { continue; } |
|
| 129 | 129 | |
| 130 | 130 | GravityView_Render_Settings::render_setting_row( $key, array(), NULL, 'gravityview_%s', 'gravityview_%s' ); |
| 131 | 131 | } |
@@ -134,8 +134,8 @@ discard block |
||
| 134 | 134 | </table> |
| 135 | 135 | |
| 136 | 136 | <div class="submit"> |
| 137 | - <input type="submit" class="button button-primary button-large alignleft hide-if-js" value="<?php esc_attr_e('Insert View', 'gravityview' ); ?>" id="insert_gravityview_view" /> |
|
| 138 | - <input class="button button-secondary alignright" type="submit" onclick="tb_remove(); return false;" value="<?php esc_attr_e("Cancel", 'gravityview'); ?>" /> |
|
| 137 | + <input type="submit" class="button button-primary button-large alignleft hide-if-js" value="<?php esc_attr_e( 'Insert View', 'gravityview' ); ?>" id="insert_gravityview_view" /> |
|
| 138 | + <input class="button button-secondary alignright" type="submit" onclick="tb_remove(); return false;" value="<?php esc_attr_e( "Cancel", 'gravityview' ); ?>" /> |
|
| 139 | 139 | </div> |
| 140 | 140 | |
| 141 | 141 | </div> |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | */ |
| 157 | 157 | function add_scripts_and_styles() { |
| 158 | 158 | |
| 159 | - if( ! $this->is_post_editor_screen() ) { |
|
| 159 | + if ( ! $this->is_post_editor_screen() ) { |
|
| 160 | 160 | return; |
| 161 | 161 | } |
| 162 | 162 | |
@@ -167,22 +167,22 @@ discard block |
||
| 167 | 167 | |
| 168 | 168 | $protocol = is_ssl() ? 'https://' : 'http://'; |
| 169 | 169 | |
| 170 | - wp_enqueue_style( 'jquery-ui-datepicker', $protocol.'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css', array(), GravityView_Plugin::version ); |
|
| 170 | + wp_enqueue_style( 'jquery-ui-datepicker', $protocol . 'ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/smoothness/jquery-ui.css', array(), GravityView_Plugin::version ); |
|
| 171 | 171 | |
| 172 | 172 | //enqueue styles |
| 173 | - wp_register_style( 'gravityview_postedit_styles', plugins_url('assets/css/admin-post-edit.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version ); |
|
| 173 | + wp_register_style( 'gravityview_postedit_styles', plugins_url( 'assets/css/admin-post-edit.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version ); |
|
| 174 | 174 | wp_enqueue_style( 'gravityview_postedit_styles' ); |
| 175 | 175 | |
| 176 | - $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
| 176 | + $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
| 177 | 177 | |
| 178 | 178 | // custom js |
| 179 | - wp_register_script( 'gravityview_postedit_scripts', plugins_url('assets/js/admin-post-edit'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery', 'jquery-ui-datepicker' ), GravityView_Plugin::version ); |
|
| 179 | + wp_register_script( 'gravityview_postedit_scripts', plugins_url( 'assets/js/admin-post-edit' . $script_debug . '.js', GRAVITYVIEW_FILE ), array( 'jquery', 'jquery-ui-datepicker' ), GravityView_Plugin::version ); |
|
| 180 | 180 | wp_enqueue_script( 'gravityview_postedit_scripts' ); |
| 181 | - wp_localize_script('gravityview_postedit_scripts', 'gvGlobals', array( |
|
| 182 | - 'nonce' => wp_create_nonce( 'gravityview_ajaxaddshortcode'), |
|
| 181 | + wp_localize_script( 'gravityview_postedit_scripts', 'gvGlobals', array( |
|
| 182 | + 'nonce' => wp_create_nonce( 'gravityview_ajaxaddshortcode' ), |
|
| 183 | 183 | 'loading_text' => esc_html__( 'Loading…', 'gravityview' ), |
| 184 | - 'alert_1' => esc_html__( 'Please select a View', 'gravityview'), |
|
| 185 | - )); |
|
| 184 | + 'alert_1' => esc_html__( 'Please select a View', 'gravityview' ), |
|
| 185 | + ) ); |
|
| 186 | 186 | |
| 187 | 187 | } |
| 188 | 188 | |
@@ -198,16 +198,16 @@ discard block |
||
| 198 | 198 | function get_sortable_fields() { |
| 199 | 199 | |
| 200 | 200 | // Not properly formatted request |
| 201 | - if ( empty( $_POST['viewid'] ) || !is_numeric( $_POST['viewid'] ) ) { |
|
| 201 | + if ( empty( $_POST[ 'viewid' ] ) || ! is_numeric( $_POST[ 'viewid' ] ) ) { |
|
| 202 | 202 | exit( false ); |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | // Not valid request |
| 206 | - if( empty( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'gravityview_ajaxaddshortcode' ) ) { |
|
| 206 | + if ( empty( $_POST[ 'nonce' ] ) || ! wp_verify_nonce( $_POST[ 'nonce' ], 'gravityview_ajaxaddshortcode' ) ) { |
|
| 207 | 207 | exit( false ); |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | - $viewid = (int)$_POST['viewid']; |
|
| 210 | + $viewid = (int)$_POST[ 'viewid' ]; |
|
| 211 | 211 | |
| 212 | 212 | // fetch form id assigned to the view |
| 213 | 213 | $formid = gravityview_get_form_id( $viewid ); |