@@ -141,7 +141,7 @@ |
||
| 141 | 141 | global $wpdb; |
| 142 | 142 | |
| 143 | 143 | if ( version_compare( GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) |
| 144 | - && method_exists( 'GFFormsModel', 'get_entry_notes_table_name' ) ) { |
|
| 144 | + && method_exists( 'GFFormsModel', 'get_entry_notes_table_name' ) ) { |
|
| 145 | 145 | $notes_table = GFFormsModel::get_entry_notes_table_name(); |
| 146 | 146 | } else { |
| 147 | 147 | $notes_table = GFFormsModel::get_lead_notes_table_name(); |
@@ -67,10 +67,10 @@ discard block |
||
| 67 | 67 | // Make sure the keys are all set |
| 68 | 68 | $note = wp_parse_args( $note, $default_note ); |
| 69 | 69 | |
| 70 | - GFFormsModel::add_note( intval( $note['lead_id'] ), intval( $note['user_id'] ), esc_attr( $note['user_name'] ), $note['note'], esc_attr( $note['note_type'] ) ); |
|
| 70 | + GFFormsModel::add_note( intval( $note[ 'lead_id' ] ), intval( $note[ 'user_id' ] ), esc_attr( $note[ 'user_name' ] ), $note[ 'note' ], esc_attr( $note[ 'note_type' ] ) ); |
|
| 71 | 71 | |
| 72 | 72 | // If last_error is empty string, there was no error. |
| 73 | - if( empty( $wpdb->last_error ) ) { |
|
| 73 | + if ( empty( $wpdb->last_error ) ) { |
|
| 74 | 74 | $return = $wpdb->insert_id; |
| 75 | 75 | } else { |
| 76 | 76 | $return = new WP_Error( 'gravityview-add-note', $wpdb->last_error ); |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | */ |
| 97 | 97 | public static function delete_notes( $note_ids = array() ) { |
| 98 | 98 | |
| 99 | - if( !is_array( $note_ids ) ) { |
|
| 99 | + if ( ! is_array( $note_ids ) ) { |
|
| 100 | 100 | |
| 101 | 101 | gravityview()->log->error( 'Note IDs not an array. Not processing delete request.', array( 'data' => $note_ids ) ); |
| 102 | 102 | |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | ) |
| 157 | 157 | ); |
| 158 | 158 | |
| 159 | - return $results ? $results[0] : false; |
|
| 159 | + return $results ? $results[ 0 ] : false; |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | /** |
@@ -169,8 +169,8 @@ discard block |
||
| 169 | 169 | */ |
| 170 | 170 | public static function filter_avatar( $avatar = '', $note ) { |
| 171 | 171 | |
| 172 | - if( 'gravityview' === $note->note_type && -1 === (int)$note->user_id ) { |
|
| 173 | - $avatar = sprintf( '<img src="%s" width="48" height="48" alt="GravityView" class="avatar avatar-48 gravityview-avatar" />', esc_url_raw( plugins_url( 'assets/images/floaty-avatar.png', GRAVITYVIEW_FILE ) ) ); |
|
| 172 | + if ( 'gravityview' === $note->note_type && -1 === (int)$note->user_id ) { |
|
| 173 | + $avatar = sprintf( '<img src="%s" width="48" height="48" alt="GravityView" class="avatar avatar-48 gravityview-avatar" />', esc_url_raw( plugins_url( 'assets/images/floaty-avatar.png', GRAVITYVIEW_FILE ) ) ); |
|
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | return $avatar; |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | |
| 65 | 65 | add_filter( 'icl_ls_languages', array( $this, 'wpml_ls_filter' ) ); |
| 66 | 66 | |
| 67 | - add_filter( 'gravityview_directory_link', array( $this, 'filter_gravityview_back_link') ); |
|
| 67 | + add_filter( 'gravityview_directory_link', array( $this, 'filter_gravityview_back_link' ) ); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | /** |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | function filter_gravityview_back_link( $link ) { |
| 85 | 85 | global $wpml_url_filters; |
| 86 | 86 | |
| 87 | - if( $wpml_url_filters ) { |
|
| 87 | + if ( $wpml_url_filters ) { |
|
| 88 | 88 | $link = $wpml_url_filters->permalink_filter( $link, GravityView_frontend::getInstance()->getPostId() ); |
| 89 | 89 | } |
| 90 | 90 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | private function remove_url_hooks() { |
| 102 | 102 | global $wpml_url_filters; |
| 103 | 103 | |
| 104 | - if( ! $wpml_url_filters ) { |
|
| 104 | + if ( ! $wpml_url_filters ) { |
|
| 105 | 105 | return; |
| 106 | 106 | } |
| 107 | 107 | |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | private function add_url_hooks() { |
| 130 | 130 | global $wpml_url_filters; |
| 131 | 131 | |
| 132 | - if( ! $wpml_url_filters ) { |
|
| 132 | + if ( ! $wpml_url_filters ) { |
|
| 133 | 133 | return; |
| 134 | 134 | } |
| 135 | 135 | |
@@ -178,10 +178,10 @@ discard block |
||
| 178 | 178 | |
| 179 | 179 | $this->remove_url_hooks(); |
| 180 | 180 | |
| 181 | - if( $translations ) { |
|
| 181 | + if ( $translations ) { |
|
| 182 | 182 | foreach ( $languages as $lang_code => $language ) { |
| 183 | 183 | |
| 184 | - if( ! isset( $translations[ $lang_code ] ) || ! is_object( $translations[ $lang_code ] ) ) { |
|
| 184 | + if ( ! isset( $translations[ $lang_code ] ) || ! is_object( $translations[ $lang_code ] ) ) { |
|
| 185 | 185 | continue; |
| 186 | 186 | } |
| 187 | 187 | |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | break; |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | - $languages[ $lang_code ]['url'] = $entry_link; |
|
| 218 | + $languages[ $lang_code ][ 'url' ] = $entry_link; |
|
| 219 | 219 | } |
| 220 | 220 | } |
| 221 | 221 | |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | function edit_entry_fix_hidden_fields( $fields ) { |
| 50 | 50 | |
| 51 | 51 | /** @var GF_Field $field */ |
| 52 | - foreach( $fields as &$field ) { |
|
| 52 | + foreach ( $fields as &$field ) { |
|
| 53 | 53 | if ( 'hidden' === $field->type ) { |
| 54 | 54 | |
| 55 | 55 | /** |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | */ |
| 61 | 61 | $reveal_hidden_field = apply_filters( 'gravityview/edit_entry/reveal_hidden_field', true, $field ); |
| 62 | 62 | |
| 63 | - if( ! $reveal_hidden_field ) { |
|
| 63 | + if ( ! $reveal_hidden_field ) { |
|
| 64 | 64 | continue; |
| 65 | 65 | } |
| 66 | 66 | |
@@ -10,6 +10,7 @@ discard block |
||
| 10 | 10 | * @internal |
| 11 | 11 | * @since 2.0 |
| 12 | 12 | * |
| 13 | + * @param \GravityView_View_Data $_this |
|
| 13 | 14 | * @return array|false The old array data, or false on error. |
| 14 | 15 | */ |
| 15 | 16 | function GravityView_View_Data_add_view( $view_id, $atts, $_this ) { |
@@ -62,6 +63,8 @@ discard block |
||
| 62 | 63 | * @internal |
| 63 | 64 | * @since 2.0 |
| 64 | 65 | * |
| 66 | + * @param integer $form_id |
|
| 67 | + * @param integer $count |
|
| 65 | 68 | * @return array The old associative array data as returned by |
| 66 | 69 | * \GravityView_frontend::get_view_entries(), the paging parameters |
| 67 | 70 | * and a total count of all entries. |
@@ -155,6 +158,7 @@ discard block |
||
| 155 | 158 | * @internal |
| 156 | 159 | * @since 2.0 |
| 157 | 160 | * |
| 161 | + * @param string $format |
|
| 158 | 162 | * @return null|string The value of a field in an entry. |
| 159 | 163 | */ |
| 160 | 164 | function GravityView_API_field_value( $entry, $field_settings, $format ) { |
@@ -96,18 +96,18 @@ discard block |
||
| 96 | 96 | $paging = \GV\Utils::get( $parameters, 'paging' ); |
| 97 | 97 | } else { |
| 98 | 98 | $entries = $form->entries |
| 99 | - ->filter( \GV\GF_Entry_Filter::from_search_criteria( $criteria['search_criteria'] ) ) |
|
| 100 | - ->offset( $args['offset'] ) |
|
| 101 | - ->limit( $criteria['paging']['page_size'] ); |
|
| 99 | + ->filter( \GV\GF_Entry_Filter::from_search_criteria( $criteria[ 'search_criteria' ] ) ) |
|
| 100 | + ->offset( $args[ 'offset' ] ) |
|
| 101 | + ->limit( $criteria[ 'paging' ][ 'page_size' ] ); |
|
| 102 | 102 | |
| 103 | - if ( $criteria['paging']['page_size'] ) { |
|
| 104 | - $entries = $entries->page( ( ( $criteria['paging']['offset'] - $args['offset'] ) / $criteria['paging']['page_size'] ) + 1 ); |
|
| 103 | + if ( $criteria[ 'paging' ][ 'page_size' ] ) { |
|
| 104 | + $entries = $entries->page( ( ( $criteria[ 'paging' ][ 'offset' ] - $args[ 'offset' ] ) / $criteria[ 'paging' ][ 'page_size' ] ) + 1 ); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - if ( ! empty( $criteria['sorting'] ) ) { |
|
| 107 | + if ( ! empty( $criteria[ 'sorting' ] ) ) { |
|
| 108 | 108 | $field = new \GV\Field(); |
| 109 | - $field->ID = $criteria['sorting']['key']; |
|
| 110 | - switch( strtolower( $criteria['sorting']['direction'] ) ) { |
|
| 109 | + $field->ID = $criteria[ 'sorting' ][ 'key' ]; |
|
| 110 | + switch ( strtolower( $criteria[ 'sorting' ][ 'direction' ] ) ) { |
|
| 111 | 111 | case 'asc': |
| 112 | 112 | $direction = \GV\Entry_Sort::ASC; |
| 113 | 113 | break; |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | break; |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - $mode = $criteria['sorting']['is_numeric'] ? \GV\Entry_Sort::NUMERIC : \GV\Entry_Sort::ALPHA; |
|
| 123 | + $mode = $criteria[ 'sorting' ][ 'is_numeric' ] ? \GV\Entry_Sort::NUMERIC : \GV\Entry_Sort::ALPHA; |
|
| 124 | 124 | $entries = $entries->sort( new \GV\Entry_Sort( $field, $direction, $mode ) ); |
| 125 | 125 | } |
| 126 | 126 | |
@@ -158,16 +158,16 @@ discard block |
||
| 158 | 158 | * @return null|string The value of a field in an entry. |
| 159 | 159 | */ |
| 160 | 160 | function GravityView_API_field_value( $entry, $field_settings, $format ) { |
| 161 | - if ( empty( $entry['form_id'] ) || empty( $field_settings['id'] ) ) { |
|
| 161 | + if ( empty( $entry[ 'form_id' ] ) || empty( $field_settings[ 'id' ] ) ) { |
|
| 162 | 162 | gravityview()->log->error( 'No entry or field_settings[id] supplied', array( 'data' => array( func_get_args() ) ) ); |
| 163 | 163 | return null; |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - if ( ! empty( $entry['_multi'] ) && ! empty( $field_settings['form_id'] ) && ! empty( $entry['_multi'][ $field_settings['form_id'] ] ) ) { |
|
| 167 | - $entry = $entry['_multi'][ $field_settings['form_id'] ]; |
|
| 166 | + if ( ! empty( $entry[ '_multi' ] ) && ! empty( $field_settings[ 'form_id' ] ) && ! empty( $entry[ '_multi' ][ $field_settings[ 'form_id' ] ] ) ) { |
|
| 167 | + $entry = $entry[ '_multi' ][ $field_settings[ 'form_id' ] ]; |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | - if ( empty( $entry['id'] ) || ! $entry = \GV\GF_Entry::by_id( $entry['id'] ) ) { |
|
| 170 | + if ( empty( $entry[ 'id' ] ) || ! $entry = \GV\GF_Entry::by_id( $entry[ 'id' ] ) ) { |
|
| 171 | 171 | gravityview()->log->error( 'Invalid \GV\GF_Entry supplied', array( 'data' => $entry ) ); |
| 172 | 172 | return null; |
| 173 | 173 | } |
@@ -177,18 +177,18 @@ discard block |
||
| 177 | 177 | * |
| 178 | 178 | * Fields with a numeric ID are Gravity Forms ones. |
| 179 | 179 | */ |
| 180 | - $source = is_numeric( $field_settings['id'] ) ? \GV\Source::BACKEND_GRAVITYFORMS : \GV\Source::BACKEND_INTERNAL;; |
|
| 180 | + $source = is_numeric( $field_settings[ 'id' ] ) ? \GV\Source::BACKEND_GRAVITYFORMS : \GV\Source::BACKEND_INTERNAL; ; |
|
| 181 | 181 | |
| 182 | 182 | /** Initialize the future field. */ |
| 183 | 183 | switch ( $source ): |
| 184 | 184 | /** The Gravity Forms backend. */ |
| 185 | 185 | case \GV\Source::BACKEND_GRAVITYFORMS: |
| 186 | - if ( ! $form = \GV\GF_Form::by_id( $entry['form_id'] ) ) { |
|
| 186 | + if ( ! $form = \GV\GF_Form::by_id( $entry[ 'form_id' ] ) ) { |
|
| 187 | 187 | gravityview()->log->error( 'No form Gravity Form found for entry', array( 'data' => $entry ) ); |
| 188 | 188 | return null; |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - if ( ! $field = $form::get_field( $form, $field_settings['id'] ) ) { |
|
| 191 | + if ( ! $field = $form::get_field( $form, $field_settings[ 'id' ] ) ) { |
|
| 192 | 192 | return null; |
| 193 | 193 | } |
| 194 | 194 | |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | |
| 197 | 197 | /** Our internal backend. */ |
| 198 | 198 | case \GV\Source::BACKEND_INTERNAL: |
| 199 | - if ( ! $field = \GV\Internal_Source::get_field( $field_settings['id'] ) ) { |
|
| 199 | + if ( ! $field = \GV\Internal_Source::get_field( $field_settings[ 'id' ] ) ) { |
|
| 200 | 200 | return null; |
| 201 | 201 | } |
| 202 | 202 | |
@@ -230,13 +230,13 @@ discard block |
||
| 230 | 230 | |
| 231 | 231 | /** A bail condition. */ |
| 232 | 232 | $bail = function( $label, $field_settings, $entry, $force_show_label, $form ) { |
| 233 | - if ( ! empty( $field_settings['show_label'] ) || $force_show_label ) { |
|
| 233 | + if ( ! empty( $field_settings[ 'show_label' ] ) || $force_show_label ) { |
|
| 234 | 234 | |
| 235 | - $label = isset( $field_settings['label'] ) ? $field_settings['label'] : ''; |
|
| 235 | + $label = isset( $field_settings[ 'label' ] ) ? $field_settings[ 'label' ] : ''; |
|
| 236 | 236 | |
| 237 | 237 | // Use Gravity Forms label by default, but if a custom label is defined in GV, use it. |
| 238 | - if ( ! empty( $field_settings['custom_label'] ) ) { |
|
| 239 | - $label = \GravityView_API::replace_variables( $field_settings['custom_label'], $form, $entry ); |
|
| 238 | + if ( ! empty( $field_settings[ 'custom_label' ] ) ) { |
|
| 239 | + $label = \GravityView_API::replace_variables( $field_settings[ 'custom_label' ], $form, $entry ); |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | /** |
@@ -262,19 +262,19 @@ discard block |
||
| 262 | 262 | |
| 263 | 263 | $label = ''; |
| 264 | 264 | |
| 265 | - if ( ! empty( $entry['_multi'] ) && ! empty( $field_settings['form_id'] ) && ! empty( $entry['_multi'][ $field_settings['form_id'] ] ) ) { |
|
| 266 | - $entry = $entry['_multi'][ $field_settings['form_id'] ]; |
|
| 267 | - if ( $_form = \GV\GF_Form::by_id( $field_settings['form_id'] ) ) { |
|
| 265 | + if ( ! empty( $entry[ '_multi' ] ) && ! empty( $field_settings[ 'form_id' ] ) && ! empty( $entry[ '_multi' ][ $field_settings[ 'form_id' ] ] ) ) { |
|
| 266 | + $entry = $entry[ '_multi' ][ $field_settings[ 'form_id' ] ]; |
|
| 267 | + if ( $_form = \GV\GF_Form::by_id( $field_settings[ 'form_id' ] ) ) { |
|
| 268 | 268 | $form = $_form->form; |
| 269 | 269 | } |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | - if ( empty( $entry['form_id'] ) || empty( $field_settings['id'] ) ) { |
|
| 272 | + if ( empty( $entry[ 'form_id' ] ) || empty( $field_settings[ 'id' ] ) ) { |
|
| 273 | 273 | gravityview()->log->error( 'No entry or field_settings[id] supplied', array( 'data' => array( func_get_args() ) ) ); |
| 274 | 274 | return $bail( $label, $field_settings, $entry, $force_show_label, $form ); |
| 275 | 275 | } |
| 276 | 276 | |
| 277 | - if ( empty( $entry['id'] ) || ! $gv_entry = \GV\GF_Entry::by_id( $entry['id'] ) ) { |
|
| 277 | + if ( empty( $entry[ 'id' ] ) || ! $gv_entry = \GV\GF_Entry::by_id( $entry[ 'id' ] ) ) { |
|
| 278 | 278 | gravityview()->log->error( 'Invalid \GV\GF_Entry supplied', array( 'data' => $entry ) ); |
| 279 | 279 | return $bail( $label, $field_settings, $entry, $force_show_label, $form ); |
| 280 | 280 | } |
@@ -286,31 +286,31 @@ discard block |
||
| 286 | 286 | * |
| 287 | 287 | * Fields with a numeric ID are Gravity Forms ones. |
| 288 | 288 | */ |
| 289 | - $source = is_numeric( $field_settings['id'] ) ? \GV\Source::BACKEND_GRAVITYFORMS : \GV\Source::BACKEND_INTERNAL; |
|
| 289 | + $source = is_numeric( $field_settings[ 'id' ] ) ? \GV\Source::BACKEND_GRAVITYFORMS : \GV\Source::BACKEND_INTERNAL; |
|
| 290 | 290 | |
| 291 | 291 | /** Initialize the future field. */ |
| 292 | 292 | switch ( $source ): |
| 293 | 293 | /** The Gravity Forms backend. */ |
| 294 | 294 | case \GV\Source::BACKEND_GRAVITYFORMS: |
| 295 | - if ( ! $gf_form = \GV\GF_Form::by_id( $entry['form_id'] ) ) { |
|
| 295 | + if ( ! $gf_form = \GV\GF_Form::by_id( $entry[ 'form_id' ] ) ) { |
|
| 296 | 296 | gravityview()->log->error( 'No form Gravity Form found for entry', array( 'data' => $entry ) ); |
| 297 | 297 | return $bail( $label, $field_settings, $entry->as_entry(), $force_show_label, $form ); |
| 298 | 298 | } |
| 299 | 299 | |
| 300 | - if ( ! $field = $gf_form::get_field( $gf_form, $field_settings['id'] ) ) { |
|
| 301 | - gravityview()->log->error( 'No field found for specified form and field ID #{field_id}', array( 'field_id' => $field_settings['id'], 'data' => $form ) ); |
|
| 300 | + if ( ! $field = $gf_form::get_field( $gf_form, $field_settings[ 'id' ] ) ) { |
|
| 301 | + gravityview()->log->error( 'No field found for specified form and field ID #{field_id}', array( 'field_id' => $field_settings[ 'id' ], 'data' => $form ) ); |
|
| 302 | 302 | return $bail( $label, $field_settings, $entry->as_entry(), $force_show_label, $gf_form->form ); |
| 303 | 303 | } |
| 304 | - if ( empty( $field_settings['show_label'] ) ) { |
|
| 304 | + if ( empty( $field_settings[ 'show_label' ] ) ) { |
|
| 305 | 305 | /** The label never wins... */ |
| 306 | - $field_settings['label'] = ''; |
|
| 306 | + $field_settings[ 'label' ] = ''; |
|
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | break; |
| 310 | 310 | |
| 311 | 311 | /** Our internal backend. */ |
| 312 | 312 | case \GV\Source::BACKEND_INTERNAL: |
| 313 | - if ( ! $field = \GV\Internal_Source::get_field( $field_settings['id'] ) ) { |
|
| 313 | + if ( ! $field = \GV\Internal_Source::get_field( $field_settings[ 'id' ] ) ) { |
|
| 314 | 314 | return $bail( $label, $field_settings, $entry->as_entry(), $force_show_label, $form ); |
| 315 | 315 | } |
| 316 | 316 | break; |
@@ -322,8 +322,8 @@ discard block |
||
| 322 | 322 | break; |
| 323 | 323 | endswitch; |
| 324 | 324 | |
| 325 | - if( $force_show_label ) { |
|
| 326 | - $field_settings['show_label'] = '1'; |
|
| 325 | + if ( $force_show_label ) { |
|
| 326 | + $field_settings[ 'show_label' ] = '1'; |
|
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | /** Add the field settings. */ |
@@ -457,7 +457,7 @@ discard block |
||
| 457 | 457 | '\GravityView_frontend::entry' => \GravityView_frontend::getInstance()->getEntry(), |
| 458 | 458 | '\GravityView_View::_current_entry' => \GravityView_View::getInstance()->getCurrentEntry(), |
| 459 | 459 | '\GravityView_View::fields' => \GravityView_View::getInstance()->getFields(), |
| 460 | - 'wp_actions[loop_start]' => empty( $wp_actions['loop_start'] ) ? 0 : $wp_actions['loop_start'], |
|
| 460 | + 'wp_actions[loop_start]' => empty( $wp_actions[ 'loop_start' ] ) ? 0 : $wp_actions[ 'loop_start' ], |
|
| 461 | 461 | 'wp_query::in_the_loop' => $wp_query->in_the_loop, |
| 462 | 462 | ); |
| 463 | 463 | } |
@@ -539,7 +539,7 @@ discard block |
||
| 539 | 539 | break; |
| 540 | 540 | case 'wp_actions[loop_start]': |
| 541 | 541 | global $wp_actions; |
| 542 | - $wp_actions['loop_start'] = $value; |
|
| 542 | + $wp_actions[ 'loop_start' ] = $value; |
|
| 543 | 543 | break; |
| 544 | 544 | case 'wp_query::in_the_loop': |
| 545 | 545 | global $wp_query; |
@@ -617,9 +617,7 @@ discard block |
||
| 617 | 617 | case 'request': |
| 618 | 618 | self::thaw( array( |
| 619 | 619 | '\GravityView_View::context' => ( |
| 620 | - $value->is_entry() ? 'single' : |
|
| 621 | - ( $value->is_edit_entry() ? 'edit' : |
|
| 622 | - ( $value->is_view() ? 'directory': null ) |
|
| 620 | + $value->is_entry() ? 'single' : ( $value->is_edit_entry() ? 'edit' : ( $value->is_view() ? 'directory' : null ) |
|
| 623 | 621 | ) |
| 624 | 622 | ), |
| 625 | 623 | '\GravityView_frontend::is_search' => $value->is_search(), |
@@ -673,14 +671,14 @@ discard block |
||
| 673 | 671 | global $wp_query, $wp_actions; |
| 674 | 672 | |
| 675 | 673 | $wp_query->in_the_loop = false; |
| 676 | - $wp_actions['loop_start'] = 0; |
|
| 674 | + $wp_actions[ 'loop_start' ] = 0; |
|
| 677 | 675 | } |
| 678 | 676 | } |
| 679 | 677 | |
| 680 | 678 | |
| 681 | 679 | /** Add some global fix for field capability discrepancies. */ |
| 682 | 680 | add_filter( 'gravityview/configuration/fields', function( $fields ) { |
| 683 | - if ( empty( $fields ) ) { |
|
| 681 | + if ( empty( $fields ) ) { |
|
| 684 | 682 | return $fields; |
| 685 | 683 | } |
| 686 | 684 | |
@@ -707,11 +705,11 @@ discard block |
||
| 707 | 705 | } |
| 708 | 706 | |
| 709 | 707 | foreach ( $_fields as $uid => &$_field ) { |
| 710 | - if ( ! isset( $_field['only_loggedin'] ) ) { |
|
| 708 | + if ( ! isset( $_field[ 'only_loggedin' ] ) ) { |
|
| 711 | 709 | continue; |
| 712 | 710 | } |
| 713 | 711 | /** If we do not require login, we don't require a cap. */ |
| 714 | - $_field['only_loggedin'] != '1' && ( $_field['only_loggedin_cap'] = '' ); |
|
| 712 | + $_field[ 'only_loggedin' ] != '1' && ( $_field[ 'only_loggedin_cap' ] = '' ); |
|
| 715 | 713 | } |
| 716 | 714 | } |
| 717 | 715 | return $fields; |
@@ -742,8 +740,8 @@ discard block |
||
| 742 | 740 | } |
| 743 | 741 | |
| 744 | 742 | foreach ( $_fields as $uid => &$_field ) { |
| 745 | - if ( ! empty( $_field['id'] ) && is_numeric( $_field['id'] ) && empty( $_field['form_id'] ) ) { |
|
| 746 | - $_field['form_id'] = $view->form->ID; |
|
| 743 | + if ( ! empty( $_field[ 'id' ] ) && is_numeric( $_field[ 'id' ] ) && empty( $_field[ 'form_id' ] ) ) { |
|
| 744 | + $_field[ 'form_id' ] = $view->form->ID; |
|
| 747 | 745 | } |
| 748 | 746 | } |
| 749 | 747 | } |
@@ -757,25 +755,25 @@ discard block |
||
| 757 | 755 | if ( class_exists( '\GravityView_frontend' ) ) { |
| 758 | 756 | global $wp_filter; |
| 759 | 757 | |
| 760 | - if ( empty( $wp_filter['gravityview_after'] ) ) { |
|
| 758 | + if ( empty( $wp_filter[ 'gravityview_after' ] ) ) { |
|
| 761 | 759 | return; |
| 762 | 760 | } |
| 763 | 761 | |
| 764 | 762 | /** WordPress 4.6 and lower compatibility, when WP_Hook classes were still absent. */ |
| 765 | - if ( is_array( $wp_filter['gravityview_after'] ) ) { |
|
| 766 | - if ( ! empty( $wp_filter['gravityview_after'][10] ) ) { |
|
| 767 | - foreach ( $wp_filter['gravityview_after'][10] as $function_key => $callback ) { |
|
| 763 | + if ( is_array( $wp_filter[ 'gravityview_after' ] ) ) { |
|
| 764 | + if ( ! empty( $wp_filter[ 'gravityview_after' ][ 10 ] ) ) { |
|
| 765 | + foreach ( $wp_filter[ 'gravityview_after' ][ 10 ] as $function_key => $callback ) { |
|
| 768 | 766 | if ( strpos( $function_key, 'context_not_configured_warning' ) ) { |
| 769 | - unset( $wp_filter['gravityview_after'][10][ $function_key ] ); |
|
| 767 | + unset( $wp_filter[ 'gravityview_after' ][ 10 ][ $function_key ] ); |
|
| 770 | 768 | } |
| 771 | 769 | } |
| 772 | 770 | } |
| 773 | 771 | return; |
| 774 | 772 | } |
| 775 | 773 | |
| 776 | - foreach ( $wp_filter['gravityview_after']->callbacks[10] as $function_key => $callback ) { |
|
| 774 | + foreach ( $wp_filter[ 'gravityview_after' ]->callbacks[ 10 ] as $function_key => $callback ) { |
|
| 777 | 775 | if ( strpos( $function_key, 'context_not_configured_warning' ) ) { |
| 778 | - unset( $wp_filter['gravityview_after']->callbacks[10][ $function_key ] ); |
|
| 776 | + unset( $wp_filter[ 'gravityview_after' ]->callbacks[ 10 ][ $function_key ] ); |
|
| 779 | 777 | } |
| 780 | 778 | } |
| 781 | 779 | } |
@@ -102,7 +102,7 @@ |
||
| 102 | 102 | * |
| 103 | 103 | * @param array $entry The array ID. |
| 104 | 104 | * |
| 105 | - * @return \GV\Entry|null An instance of this entry or null if not found. |
|
| 105 | + * @return null|GF_Entry An instance of this entry or null if not found. |
|
| 106 | 106 | */ |
| 107 | 107 | public static function from_entry( $entry ) { |
| 108 | 108 | if ( empty( $entry['id'] ) ) { |
@@ -105,14 +105,14 @@ discard block |
||
| 105 | 105 | * @return \GV\Entry|null An instance of this entry or null if not found. |
| 106 | 106 | */ |
| 107 | 107 | public static function from_entry( $entry ) { |
| 108 | - if ( empty( $entry['id'] ) ) { |
|
| 108 | + if ( empty( $entry[ 'id' ] ) ) { |
|
| 109 | 109 | return null; |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | $self = new self(); |
| 113 | 113 | $self->entry = $entry; |
| 114 | 114 | |
| 115 | - $self->ID = $self->entry['id']; |
|
| 115 | + $self->ID = $self->entry[ 'id' ]; |
|
| 116 | 116 | $self->slug = \GravityView_API::get_entry_slug( $self->ID, $self->as_entry() ); |
| 117 | 117 | |
| 118 | 118 | return $self; |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | * @return bool Whether the offset exists or not. |
| 128 | 128 | */ |
| 129 | 129 | public function offsetExists( $offset ) { |
| 130 | - return isset( $this->entry[$offset] ); |
|
| 130 | + return isset( $this->entry[ $offset ] ); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | /** |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | * @return mixed The value of the requested entry data. |
| 143 | 143 | */ |
| 144 | 144 | public function offsetGet( $offset ) { |
| 145 | - return $this->entry[$offset]; |
|
| 145 | + return $this->entry[ $offset ]; |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | /** |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | * - Checks PHP version numbers |
| 208 | 208 | * - Sets self::$is_compatible[__CLASS__] to boolean value |
| 209 | 209 | * |
| 210 | - * @return boolean Is the extension supported? |
|
| 210 | + * @return boolean|null Is the extension supported? |
|
| 211 | 211 | */ |
| 212 | 212 | protected function is_extension_supported() { |
| 213 | 213 | |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | /** |
| 330 | 330 | * Add a notice to be displayed in the admin. |
| 331 | 331 | * |
| 332 | - * @param array $notice Array with `class` and `message` keys. The message is not escaped. |
|
| 332 | + * @param string $notice Array with `class` and `message` keys. The message is not escaped. |
|
| 333 | 333 | * |
| 334 | 334 | * @return void |
| 335 | 335 | */ |
@@ -244,13 +244,13 @@ |
||
| 244 | 244 | $this->_remote_update_url, |
| 245 | 245 | $this->_path, |
| 246 | 246 | array( |
| 247 | - 'version' => $this->_version, // current version number |
|
| 248 | - 'license' => $license['license'], |
|
| 249 | - 'item_id' => $this->_item_id, // The ID of the download on _remote_update_url |
|
| 250 | - 'item_name' => $this->_title, // name of this plugin |
|
| 251 | - 'author' => strip_tags( $this->_author ) // author of this plugin |
|
| 252 | - ) |
|
| 253 | - ); |
|
| 247 | + 'version' => $this->_version, // current version number |
|
| 248 | + 'license' => $license['license'], |
|
| 249 | + 'item_id' => $this->_item_id, // The ID of the download on _remote_update_url |
|
| 250 | + 'item_name' => $this->_title, // name of this plugin |
|
| 251 | + 'author' => strip_tags( $this->_author ) // author of this plugin |
|
| 252 | + ) |
|
| 253 | + ); |
|
| 254 | 254 | } |
| 255 | 255 | |
| 256 | 256 | /** |
@@ -180,13 +180,13 @@ discard block |
||
| 180 | 180 | $tab = wp_parse_args( $tab_settings, $tab_defaults ); |
| 181 | 181 | |
| 182 | 182 | // Force the screen to be GravityView |
| 183 | - $tab['screen'] = 'gravityview'; |
|
| 183 | + $tab[ 'screen' ] = 'gravityview'; |
|
| 184 | 184 | |
| 185 | 185 | if ( class_exists( 'GravityView_Metabox_Tab' ) ) { |
| 186 | - $metabox = new \GravityView_Metabox_Tab( $tab['id'], $tab['title'], $tab['file'], $tab['icon-class'], $tab['callback'], $tab['callback_args'] ); |
|
| 186 | + $metabox = new \GravityView_Metabox_Tab( $tab[ 'id' ], $tab[ 'title' ], $tab[ 'file' ], $tab[ 'icon-class' ], $tab[ 'callback' ], $tab[ 'callback_args' ] ); |
|
| 187 | 187 | \GravityView_Metabox_Tabs::add( $metabox ); |
| 188 | 188 | } else { |
| 189 | - add_meta_box( 'gravityview_' . $tab['id'], $tab['title'], $tab['callback'], $tab['screen'], $tab['context'], $tab['priority'] ); |
|
| 189 | + add_meta_box( 'gravityview_' . $tab[ 'id' ], $tab[ 'title' ], $tab[ 'callback' ], $tab[ 'screen' ], $tab[ 'context' ], $tab[ 'priority' ] ); |
|
| 190 | 190 | } |
| 191 | 191 | } |
| 192 | 192 | |
@@ -211,14 +211,14 @@ discard block |
||
| 211 | 211 | */ |
| 212 | 212 | protected function is_extension_supported() { |
| 213 | 213 | |
| 214 | - self::$is_compatible = is_array( self::$is_compatible ) ? self::$is_compatible : array( get_called_class() => (bool) self::$is_compatible ); |
|
| 214 | + self::$is_compatible = is_array( self::$is_compatible ) ? self::$is_compatible : array( get_called_class() => (bool)self::$is_compatible ); |
|
| 215 | 215 | |
| 216 | 216 | if ( ! function_exists( 'gravityview' ) ) { |
| 217 | 217 | $message = sprintf( __( 'Could not activate the %s Extension; GravityView is not active.', 'gravityview' ), esc_html( $this->_title ) ); |
| 218 | - } else if ( false === version_compare( Plugin::$version, $this->_min_gravityview_version , ">=" ) ) { |
|
| 219 | - $message = sprintf( __( 'The %s Extension requires GravityView Version %s or newer.', 'gravityview' ), esc_html( $this->_title ), '<tt>'.$this->_min_gravityview_version.'</tt>' ); |
|
| 220 | - } else if ( isset( $this->_min_php_version ) && false === version_compare( phpversion(), $this->_min_php_version , ">=" ) ) { |
|
| 221 | - $message = sprintf( __( 'The %s Extension requires PHP Version %s or newer. Please ask your host to upgrade your server\'s PHP.', 'gravityview' ), esc_html( $this->_title ), '<tt>'.$this->_min_php_version.'</tt>' ); |
|
| 218 | + } else if ( false === version_compare( Plugin::$version, $this->_min_gravityview_version, ">=" ) ) { |
|
| 219 | + $message = sprintf( __( 'The %s Extension requires GravityView Version %s or newer.', 'gravityview' ), esc_html( $this->_title ), '<tt>' . $this->_min_gravityview_version . '</tt>' ); |
|
| 220 | + } else if ( isset( $this->_min_php_version ) && false === version_compare( phpversion(), $this->_min_php_version, ">=" ) ) { |
|
| 221 | + $message = sprintf( __( 'The %s Extension requires PHP Version %s or newer. Please ask your host to upgrade your server\'s PHP.', 'gravityview' ), esc_html( $this->_title ), '<tt>' . $this->_min_php_version . '</tt>' ); |
|
| 222 | 222 | } else if ( ! empty( $this->_max_gravityview_version ) && false === version_compare( $this->_max_gravityview_version, Plugin::$version, ">" ) ) { |
| 223 | 223 | $message = sprintf( __( 'The %s Extension is not compatible with this version of GravityView. Please update the Extension to the latest version.', 'gravityview' ), esc_html( $this->_title ) ); |
| 224 | 224 | } else { |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | $lang_dir = dirname( plugin_basename( $path ) ) . '/languages/'; |
| 258 | 258 | |
| 259 | 259 | // Traditional WordPress plugin locale filter |
| 260 | - $locale = apply_filters( 'plugin_locale', get_locale(), $this->_text_domain ); |
|
| 260 | + $locale = apply_filters( 'plugin_locale', get_locale(), $this->_text_domain ); |
|
| 261 | 261 | |
| 262 | 262 | $mofile = sprintf( '%1$s-%2$s.mo', $this->_text_domain, $locale ); |
| 263 | 263 | |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | */ |
| 285 | 285 | public function settings() { |
| 286 | 286 | // If doing ajax, get outta here |
| 287 | - if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) { |
|
| 287 | + if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) { |
|
| 288 | 288 | return; |
| 289 | 289 | } |
| 290 | 290 | |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | // Don't update if invalid license. |
| 298 | - if ( false === $license || empty( $license['status'] ) || strtolower( $license['status'] ) !== 'valid' ) { |
|
| 298 | + if ( false === $license || empty( $license[ 'status' ] ) || strtolower( $license[ 'status' ] ) !== 'valid' ) { |
|
| 299 | 299 | return; |
| 300 | 300 | } |
| 301 | 301 | |
@@ -304,9 +304,9 @@ discard block |
||
| 304 | 304 | $this->_path, |
| 305 | 305 | array( |
| 306 | 306 | 'version' => $this->_version, // current version number |
| 307 | - 'license' => $license['license'], |
|
| 307 | + 'license' => $license[ 'license' ], |
|
| 308 | 308 | 'item_id' => $this->_item_id, // The ID of the download on _remote_update_url |
| 309 | - 'item_name' => $this->_title, // name of this plugin |
|
| 309 | + 'item_name' => $this->_title, // name of this plugin |
|
| 310 | 310 | 'author' => strip_tags( $this->_author ) // author of this plugin |
| 311 | 311 | ) |
| 312 | 312 | ); |
@@ -335,16 +335,16 @@ discard block |
||
| 335 | 335 | */ |
| 336 | 336 | public static function add_notice( $notice = array() ) { |
| 337 | 337 | |
| 338 | - if ( is_array( $notice ) && empty( $notice['message'] ) ) { |
|
| 338 | + if ( is_array( $notice ) && empty( $notice[ 'message' ] ) ) { |
|
| 339 | 339 | gravityview()->log->error( 'Notice not set', array( 'data' => $notice ) ); |
| 340 | 340 | return; |
| 341 | 341 | } else if ( is_string( $notice ) ) { |
| 342 | 342 | $notice = array( 'message' => $notice ); |
| 343 | 343 | } |
| 344 | 344 | |
| 345 | - $notice['class'] = empty( $notice['class'] ) ? 'error' : $notice['class']; |
|
| 345 | + $notice[ 'class' ] = empty( $notice[ 'class' ] ) ? 'error' : $notice[ 'class' ]; |
|
| 346 | 346 | |
| 347 | - self::$admin_notices []= $notice; |
|
| 347 | + self::$admin_notices [ ] = $notice; |
|
| 348 | 348 | } |
| 349 | 349 | |
| 350 | 350 | /** |
@@ -358,8 +358,8 @@ discard block |
||
| 358 | 358 | } |
| 359 | 359 | |
| 360 | 360 | foreach ( self::$admin_notices as $key => $notice ) { |
| 361 | - echo '<div id="message" class="'. esc_attr( $notice['class'] ).'">'; |
|
| 362 | - echo wpautop( $notice['message'] ); |
|
| 361 | + echo '<div id="message" class="' . esc_attr( $notice[ 'class' ] ) . '">'; |
|
| 362 | + echo wpautop( $notice[ 'message' ] ); |
|
| 363 | 363 | echo '<div class="clear"></div>'; |
| 364 | 364 | echo '</div>'; |
| 365 | 365 | } |
@@ -284,7 +284,7 @@ |
||
| 284 | 284 | */ |
| 285 | 285 | public function settings() { |
| 286 | 286 | // If doing ajax, get outta here |
| 287 | - if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) { |
|
| 287 | + if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) { |
|
| 288 | 288 | return; |
| 289 | 289 | } |
| 290 | 290 | |
@@ -54,7 +54,7 @@ |
||
| 54 | 54 | * @param \GV\GF_Form $form The Gravity Form form. |
| 55 | 55 | * @param int $field_id The Gravity Form field ID for the $form. |
| 56 | 56 | * |
| 57 | - * @return \GV\Field|null The requested field or null if not found. |
|
| 57 | + * @return null|GF_Field The requested field or null if not found. |
|
| 58 | 58 | */ |
| 59 | 59 | public static function by_id( $form, $field_id ) { |
| 60 | 60 | |
@@ -27,17 +27,17 @@ discard block |
||
| 27 | 27 | * @return \GV\GF_Field|null The field implementation or null on error. |
| 28 | 28 | */ |
| 29 | 29 | public static function from_configuration( $configuration ) { |
| 30 | - if ( empty( $configuration['id'] ) || ! is_numeric( $configuration['id'] ) ) { |
|
| 30 | + if ( empty( $configuration[ 'id' ] ) || ! is_numeric( $configuration[ 'id' ] ) ) { |
|
| 31 | 31 | gravityview()->log->error( 'Invalid configuration[id] supplied.' ); |
| 32 | 32 | return null; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - if ( empty( $configuration['form_id'] ) || ! $form = \GV\GF_Form::by_id( $configuration['form_id'] ) ) { |
|
| 35 | + if ( empty( $configuration[ 'form_id' ] ) || ! $form = \GV\GF_Form::by_id( $configuration[ 'form_id' ] ) ) { |
|
| 36 | 36 | gravityview()->log->error( 'Invalid configuration[form_id] supplied.' ); |
| 37 | 37 | return null; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - $field = self::by_id( $form, $configuration['id'] ); |
|
| 40 | + $field = self::by_id( $form, $configuration[ 'id' ] ); |
|
| 41 | 41 | |
| 42 | 42 | if ( ! $field ) { |
| 43 | 43 | gravityview()->log->error( 'Invalid configuration[id] supplied.' ); |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | /** This is a complex Gravity Forms input. */ |
| 113 | 113 | if ( $input = \GFFormsModel::get_input( $this->field, $this->ID ) ) { |
| 114 | - $label = ! empty( $input['customLabel'] ) ? $input['customLabel'] : $input['label']; |
|
| 114 | + $label = ! empty( $input[ 'customLabel' ] ) ? $input[ 'customLabel' ] : $input[ 'label' ]; |
|
| 115 | 115 | } else { |
| 116 | 116 | /** This is a field with one label. */ |
| 117 | 117 | $label = $this->field->get_field_label( true, $this->label ); |
@@ -132,10 +132,8 @@ |
||
| 132 | 132 | /** |
| 133 | 133 | * Get a \GV\Field by Form and Field ID for this data source. |
| 134 | 134 | * |
| 135 | - * @param \GV\GF_Form $form The Gravity Form form ID. |
|
| 136 | - * @param int $field_id The Gravity Form field ID for the $form_id. |
|
| 137 | 135 | * |
| 138 | - * @return \GV\Field|null The requested field or null if not found. |
|
| 136 | + * @return null|GF_Field The requested field or null if not found. |
|
| 139 | 137 | */ |
| 140 | 138 | public static function get_field( /** varargs */ ) { |
| 141 | 139 | $args = func_get_args(); |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | $self = new self(); |
| 56 | 56 | $self->form = $form; |
| 57 | 57 | |
| 58 | - $self->ID = $self->form['id']; |
|
| 58 | + $self->ID = $self->form[ 'id' ]; |
|
| 59 | 59 | |
| 60 | 60 | return $self; |
| 61 | 61 | } |
@@ -98,11 +98,11 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | /** The offset and limit */ |
| 100 | 100 | if ( ! empty( $offset->limit ) ) { |
| 101 | - $paging['page_size'] = $offset->limit; |
|
| 101 | + $paging[ 'page_size' ] = $offset->limit; |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | if ( ! empty( $offset->offset ) ) { |
| 105 | - $paging['offset'] = $offset->offset; |
|
| 105 | + $paging[ 'offset' ] = $offset->offset; |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | foreach ( \GFAPI::get_entries( $form->ID, $search_criteria, $sorting, $paging ) as $entry ) { |
@@ -159,8 +159,8 @@ discard block |
||
| 159 | 159 | */ |
| 160 | 160 | public function get_fields() { |
| 161 | 161 | $fields = array(); |
| 162 | - foreach ( $this['fields'] as $field ) { |
|
| 163 | - foreach ( empty( $field['inputs'] ) ? array( $field['id'] ) : wp_list_pluck( $field['inputs'], 'id' ) as $id ) { |
|
| 162 | + foreach ( $this[ 'fields' ] as $field ) { |
|
| 163 | + foreach ( empty( $field[ 'inputs' ] ) ? array( $field[ 'id' ] ) : wp_list_pluck( $field[ 'inputs' ], 'id' ) as $id ) { |
|
| 164 | 164 | if ( is_numeric( $id ) ) { |
| 165 | 165 | $fields[ $id ] = self::get_field( $this, $id ); |
| 166 | 166 | } else { |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | * @return bool Whether the offset exists or not. |
| 198 | 198 | */ |
| 199 | 199 | public function offsetExists( $offset ) { |
| 200 | - return isset( $this->form[$offset] ); |
|
| 200 | + return isset( $this->form[ $offset ] ); |
|
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | /** |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | * @return mixed The value of the requested form data. |
| 213 | 213 | */ |
| 214 | 214 | public function offsetGet( $offset ) { |
| 215 | - return $this->form[$offset]; |
|
| 215 | + return $this->form[ $offset ]; |
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | /** |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | * Generate the status message box HTML based on the current status |
| 351 | 351 | * |
| 352 | 352 | * @since 1.7.4 |
| 353 | - * @param $message |
|
| 353 | + * @param string $message |
|
| 354 | 354 | * @param string $class |
| 355 | 355 | * |
| 356 | 356 | * @return string |
@@ -470,6 +470,9 @@ discard block |
||
| 470 | 470 | $this->settings->update( $settings ); |
| 471 | 471 | } |
| 472 | 472 | |
| 473 | + /** |
|
| 474 | + * @param boolean $echo |
|
| 475 | + */ |
|
| 473 | 476 | public function settings_edd_license_activation( $field, $echo ) { |
| 474 | 477 | $script_debug = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
| 475 | 478 | |
@@ -569,7 +572,6 @@ discard block |
||
| 569 | 572 | * Check the GravityView license information |
| 570 | 573 | * |
| 571 | 574 | * @since 1.19.3 |
| 572 | - * @param bool $force Whether to force checking license, even if AJAX |
|
| 573 | 575 | * |
| 574 | 576 | * @return void |
| 575 | 577 | */ |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | 'author' => self::author, |
| 97 | 97 | 'language' => get_locale(), |
| 98 | 98 | 'url' => home_url(), |
| 99 | - 'beta' => $this->settings->get( 'beta' ), |
|
| 99 | + 'beta' => $this->settings->get( 'beta' ), |
|
| 100 | 100 | ); |
| 101 | 101 | |
| 102 | 102 | if ( ! empty( $action ) ) { |
@@ -463,7 +463,7 @@ discard block |
||
| 463 | 463 | private function license_call_update_settings( $license_data, $data ) { |
| 464 | 464 | $settings = array(); |
| 465 | 465 | |
| 466 | - $settings['license_key'] = $license_data->license_key = trim( $data['license'] ); |
|
| 466 | + $settings['license_key'] = $license_data->license_key = trim( $data['license'] ); |
|
| 467 | 467 | $settings['license_key_status'] = $license_data->license; |
| 468 | 468 | $settings['license_key_response'] = (array)$license_data; |
| 469 | 469 | |
@@ -597,14 +597,14 @@ discard block |
||
| 597 | 597 | // Call the custom API. |
| 598 | 598 | $response = wp_remote_post( self::url, array( |
| 599 | 599 | 'timeout' => 15, |
| 600 | - 'sslverify' => false, |
|
| 601 | - 'body' => array( |
|
| 602 | - 'edd_action' => 'check_license', |
|
| 603 | - 'license' => trim( $this->settings->get( 'license_key' ) ), |
|
| 604 | - 'item_name' => self::name, |
|
| 605 | - 'url' => home_url(), |
|
| 606 | - 'site_data' => $this->get_site_data(), |
|
| 607 | - ), |
|
| 600 | + 'sslverify' => false, |
|
| 601 | + 'body' => array( |
|
| 602 | + 'edd_action' => 'check_license', |
|
| 603 | + 'license' => trim( $this->settings->get( 'license_key' ) ), |
|
| 604 | + 'item_name' => self::name, |
|
| 605 | + 'url' => home_url(), |
|
| 606 | + 'site_data' => $this->get_site_data(), |
|
| 607 | + ), |
|
| 608 | 608 | )); |
| 609 | 609 | |
| 610 | 610 | // make sure the response came back okay |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | ); |
| 101 | 101 | |
| 102 | 102 | if ( ! empty( $action ) ) { |
| 103 | - $settings['edd_action'] = esc_attr( $action ); |
|
| 103 | + $settings[ 'edd_action' ] = esc_attr( $action ); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | return array_map( 'urlencode', $settings ); |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | 'format' => 'json', |
| 157 | 157 | ) ); |
| 158 | 158 | |
| 159 | - if ( $is_ajax && empty( $data['license'] ) ) { |
|
| 159 | + if ( $is_ajax && empty( $data[ 'license' ] ) ) { |
|
| 160 | 160 | die( -1 ); |
| 161 | 161 | } |
| 162 | 162 | |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | // most likely a mistake. |
| 198 | 198 | } else if ( $license_data->license !== 'failed' && $update_license ) { |
| 199 | 199 | |
| 200 | - if ( ! empty( $data['field_id'] ) ) { |
|
| 200 | + if ( ! empty( $data[ 'field_id' ] ) ) { |
|
| 201 | 201 | set_transient( self::status_transient_key, $license_data, DAY_IN_SECONDS ); |
| 202 | 202 | } |
| 203 | 203 | |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | if ( empty( $license_data ) ) { |
| 225 | 225 | $message = ''; |
| 226 | 226 | } else { |
| 227 | - if( ! empty( $license_data->error ) ) { |
|
| 227 | + if ( ! empty( $license_data->error ) ) { |
|
| 228 | 228 | $class = 'error'; |
| 229 | 229 | $string_key = $license_data->error; |
| 230 | 230 | } else { $class = $license_data->license; |
@@ -250,17 +250,17 @@ discard block |
||
| 250 | 250 | */ |
| 251 | 251 | public function license_details( $response = array() ) { |
| 252 | 252 | |
| 253 | - $response = (array) $response; |
|
| 253 | + $response = (array)$response; |
|
| 254 | 254 | |
| 255 | 255 | $return = ''; |
| 256 | 256 | $wrapper = '<span class="gv-license-details" aria-live="polite" aria-busy="false">%s</span>'; |
| 257 | 257 | |
| 258 | - if ( ! empty( $response['license_key'] ) ) { |
|
| 258 | + if ( ! empty( $response[ 'license_key' ] ) ) { |
|
| 259 | 259 | $return .= '<h3>' . esc_html__( 'License Details:', 'gravityview' ) . '</h3>'; |
| 260 | 260 | |
| 261 | 261 | if ( in_array( Utils::get( $response, 'license' ), array( 'invalid', 'deactivated' ) ) ) { |
| 262 | - $return .= $this->strings( $response['license'], $response ); |
|
| 263 | - } elseif ( ! empty( $response['license_name'] ) ) { |
|
| 262 | + $return .= $this->strings( $response[ 'license' ], $response ); |
|
| 263 | + } elseif ( ! empty( $response[ 'license_name' ] ) ) { |
|
| 264 | 264 | $response_keys = array( |
| 265 | 265 | 'license_name' => '', |
| 266 | 266 | 'license_limit' => '', |
@@ -274,19 +274,19 @@ discard block |
||
| 274 | 274 | // Make sure all the keys are set |
| 275 | 275 | $response = wp_parse_args( $response, $response_keys ); |
| 276 | 276 | |
| 277 | - $login_link = sprintf( '<a href="%s" class="howto" rel="external">%s</a>', esc_url( sprintf( 'https://gravityview.co/wp-login.php?username=%s', $response['customer_email'] ) ), esc_html__( 'Access your GravityView account', 'gravityview' ) ); |
|
| 278 | - $local_text = ( ! empty( $response['is_local'] ) ? '<span class="howto">' . __( 'This development site does not count toward license activation limits', 'gravityview' ) . '</span>' : '' ); |
|
| 277 | + $login_link = sprintf( '<a href="%s" class="howto" rel="external">%s</a>', esc_url( sprintf( 'https://gravityview.co/wp-login.php?username=%s', $response[ 'customer_email' ] ) ), esc_html__( 'Access your GravityView account', 'gravityview' ) ); |
|
| 278 | + $local_text = ( ! empty( $response[ 'is_local' ] ) ? '<span class="howto">' . __( 'This development site does not count toward license activation limits', 'gravityview' ) . '</span>' : '' ); |
|
| 279 | 279 | $details = array( |
| 280 | - 'license' => sprintf( esc_html__( 'License level: %s', 'gravityview' ), esc_html( $response['license_name'] ), esc_html( $response['license_limit'] ) ), |
|
| 281 | - 'licensed_to' => sprintf( esc_html_x( 'Licensed to: %1$s (%2$s)', '1: Customer name; 2: Customer email', 'gravityview' ), esc_html__( $response['customer_name'], 'gravityview' ), esc_html__( $response['customer_email'], 'gravityview' ) ) . $login_link, |
|
| 282 | - 'activations' => sprintf( esc_html__( 'Activations: %d of %s sites', 'gravityview' ), intval( $response['site_count'] ), esc_html( $response['license_limit'] ) ) . $local_text, |
|
| 283 | - 'expires' => 'lifetime' === $response['expires'] ? '' : sprintf( esc_html__( 'Renew on: %s', 'gravityview' ), date_i18n( get_option( 'date_format' ), strtotime( $response['expires'] ) - DAY_IN_SECONDS ) ), |
|
| 284 | - 'upgrade' => $this->get_upgrade_html( $response['upgrades'] ), |
|
| 280 | + 'license' => sprintf( esc_html__( 'License level: %s', 'gravityview' ), esc_html( $response[ 'license_name' ] ), esc_html( $response[ 'license_limit' ] ) ), |
|
| 281 | + 'licensed_to' => sprintf( esc_html_x( 'Licensed to: %1$s (%2$s)', '1: Customer name; 2: Customer email', 'gravityview' ), esc_html__( $response[ 'customer_name' ], 'gravityview' ), esc_html__( $response[ 'customer_email' ], 'gravityview' ) ) . $login_link, |
|
| 282 | + 'activations' => sprintf( esc_html__( 'Activations: %d of %s sites', 'gravityview' ), intval( $response[ 'site_count' ] ), esc_html( $response[ 'license_limit' ] ) ) . $local_text, |
|
| 283 | + 'expires' => 'lifetime' === $response[ 'expires' ] ? '' : sprintf( esc_html__( 'Renew on: %s', 'gravityview' ), date_i18n( get_option( 'date_format' ), strtotime( $response[ 'expires' ] ) - DAY_IN_SECONDS ) ), |
|
| 284 | + 'upgrade' => $this->get_upgrade_html( $response[ 'upgrades' ] ), |
|
| 285 | 285 | ); |
| 286 | 286 | |
| 287 | - if ( ! empty( $response['error'] ) && 'expired' === $response['error'] ) { |
|
| 288 | - unset( $details['upgrade'] ); |
|
| 289 | - $details['expires'] = '<div class="error inline"><p>' . $this->strings( 'expired', $response ) . '</p></div>'; |
|
| 287 | + if ( ! empty( $response[ 'error' ] ) && 'expired' === $response[ 'error' ] ) { |
|
| 288 | + unset( $details[ 'upgrade' ] ); |
|
| 289 | + $details[ 'expires' ] = '<div class="error inline"><p>' . $this->strings( 'expired', $response ) . '</p></div>'; |
|
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | $return .= '<ul><li>' . implode( '</li><li>', array_filter( $details ) ) . '</li></ul>'; |
@@ -312,20 +312,20 @@ discard block |
||
| 312 | 312 | if ( ! empty( $upgrades ) ) { |
| 313 | 313 | |
| 314 | 314 | $locale_parts = explode( '_', get_locale() ); |
| 315 | - $is_english = ( 'en' === $locale_parts[0] ); |
|
| 315 | + $is_english = ( 'en' === $locale_parts[ 0 ] ); |
|
| 316 | 316 | |
| 317 | 317 | $output .= '<h4>' . esc_html__( 'Upgrades available:', 'gravityview' ) . '</h4>'; |
| 318 | 318 | $output .= '<ul class="ul-disc">'; |
| 319 | 319 | |
| 320 | 320 | foreach ( $upgrades as $upgrade_id => $upgrade ) { |
| 321 | - $upgrade = (object) $upgrade; |
|
| 321 | + $upgrade = (object)$upgrade; |
|
| 322 | 322 | |
| 323 | 323 | $anchor_text = sprintf( esc_html_x( 'Upgrade to %1$s for %2$s', '1: GravityView upgrade name, 2: Cost of upgrade', 'gravityview' ), esc_attr( $upgrade->name ), esc_attr( $upgrade->price ) ); |
| 324 | 324 | |
| 325 | 325 | if ( $is_english && isset( $upgrade->description ) ) { |
| 326 | 326 | $message = esc_html( $upgrade->description ); |
| 327 | 327 | } else { |
| 328 | - switch( $upgrade->price_id ) { |
|
| 328 | + switch ( $upgrade->price_id ) { |
|
| 329 | 329 | // Interstellar |
| 330 | 330 | case 1: |
| 331 | 331 | default: |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | 'invalid' => esc_html__( 'The license key entered is invalid.', 'gravityview' ), |
| 384 | 384 | 'missing' => esc_html__( 'Invalid license key.', 'gravityview' ), |
| 385 | 385 | 'revoked' => esc_html__( 'This license key has been revoked.', 'gravityview' ), |
| 386 | - 'expired' => sprintf( esc_html__( 'This license key has expired. %sRenew your license on the GravityView website%s to receive updates and support.', 'gravityview' ), '<a href="'. esc_url( $this->get_license_renewal_url( $license_data ) ) .'">', '</a>' ), |
|
| 386 | + 'expired' => sprintf( esc_html__( 'This license key has expired. %sRenew your license on the GravityView website%s to receive updates and support.', 'gravityview' ), '<a href="' . esc_url( $this->get_license_renewal_url( $license_data ) ) . '">', '</a>' ), |
|
| 387 | 387 | 'capability' => esc_html__( 'You don\'t have the ability to edit plugin settings.', 'gravityview' ), |
| 388 | 388 | |
| 389 | 389 | 'verifying_license' => esc_html__( 'Verifying license…', 'gravityview' ), |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | |
| 407 | 407 | if ( ! empty( $license_data->renewal_url ) ) { |
| 408 | 408 | $renew_license_url = $license_data->renewal_url; |
| 409 | - } elseif( ! empty( $license_data->license_key ) ) { |
|
| 409 | + } elseif ( ! empty( $license_data->license_key ) ) { |
|
| 410 | 410 | $renew_license_url = sprintf( 'https://gravityview.co/checkout/?download_id=17&edd_license_key=%s', $license_data->license_key ); |
| 411 | 411 | } else { |
| 412 | 412 | $renew_license_url = 'https://gravityview.co/account/'; |
@@ -423,7 +423,7 @@ discard block |
||
| 423 | 423 | * @return array|WP_Error |
| 424 | 424 | */ |
| 425 | 425 | private function _license_get_remote_response( $data, $license = '' ) { |
| 426 | - $api_params = $this->_get_edd_settings( $data['edd_action'], $license ); |
|
| 426 | + $api_params = $this->_get_edd_settings( $data[ 'edd_action' ], $license ); |
|
| 427 | 427 | |
| 428 | 428 | $url = add_query_arg( $api_params, self::url ); |
| 429 | 429 | |
@@ -463,9 +463,9 @@ discard block |
||
| 463 | 463 | private function license_call_update_settings( $license_data, $data ) { |
| 464 | 464 | $settings = array(); |
| 465 | 465 | |
| 466 | - $settings['license_key'] = $license_data->license_key = trim( $data['license'] ); |
|
| 467 | - $settings['license_key_status'] = $license_data->license; |
|
| 468 | - $settings['license_key_response'] = (array)$license_data; |
|
| 466 | + $settings[ 'license_key' ] = $license_data->license_key = trim( $data[ 'license' ] ); |
|
| 467 | + $settings[ 'license_key_status' ] = $license_data->license; |
|
| 468 | + $settings[ 'license_key_response' ] = (array)$license_data; |
|
| 469 | 469 | |
| 470 | 470 | $this->settings->update( $settings ); |
| 471 | 471 | } |
@@ -480,7 +480,7 @@ discard block |
||
| 480 | 480 | |
| 481 | 481 | if ( ! empty( $key ) ) { |
| 482 | 482 | $response = $this->settings->get( 'license_key_response' ); |
| 483 | - $response = is_array( $response ) ? (object) $response : json_decode( $response ); |
|
| 483 | + $response = is_array( $response ) ? (object)$response : json_decode( $response ); |
|
| 484 | 484 | } else { |
| 485 | 485 | $response = array(); |
| 486 | 486 | } |
@@ -522,11 +522,11 @@ discard block |
||
| 522 | 522 | |
| 523 | 523 | $submit = '<div class="gv-edd-button-wrapper">'; |
| 524 | 524 | foreach ( $fields as $field ) { |
| 525 | - $field['type'] = 'button'; |
|
| 526 | - $field['class'] = isset( $field['class'] ) ? $field['class'] . ' '. $class : $class; |
|
| 527 | - $field['style'] = 'margin-left: 10px;'; |
|
| 528 | - if( $disabled_attribute ) { |
|
| 529 | - $field['disabled'] = $disabled_attribute; |
|
| 525 | + $field[ 'type' ] = 'button'; |
|
| 526 | + $field[ 'class' ] = isset( $field[ 'class' ] ) ? $field[ 'class' ] . ' ' . $class : $class; |
|
| 527 | + $field[ 'style' ] = 'margin-left: 10px;'; |
|
| 528 | + if ( $disabled_attribute ) { |
|
| 529 | + $field[ 'disabled' ] = $disabled_attribute; |
|
| 530 | 530 | } |
| 531 | 531 | $submit .= $this->settings->as_html( $field, $echo ); |
| 532 | 532 | } |
@@ -605,7 +605,7 @@ discard block |
||
| 605 | 605 | 'url' => home_url(), |
| 606 | 606 | 'site_data' => $this->get_site_data(), |
| 607 | 607 | ), |
| 608 | - )); |
|
| 608 | + ) ); |
|
| 609 | 609 | |
| 610 | 610 | // make sure the response came back okay |
| 611 | 611 | if ( is_wp_error( $response ) ) { |
@@ -636,45 +636,45 @@ discard block |
||
| 636 | 636 | $theme_data = wp_get_theme(); |
| 637 | 637 | $theme = $theme_data->Name . ' ' . $theme_data->Version; |
| 638 | 638 | |
| 639 | - $data['gv_version'] = Plugin::$version; |
|
| 640 | - $data['php_version'] = phpversion(); |
|
| 641 | - $data['wp_version'] = get_bloginfo( 'version' ); |
|
| 642 | - $data['gf_version'] = \GFForms::$version; |
|
| 643 | - $data['server'] = Utils::get( $_SERVER, 'SERVER_SOFTWARE' ); |
|
| 644 | - $data['multisite'] = is_multisite(); |
|
| 645 | - $data['theme'] = $theme; |
|
| 646 | - $data['url'] = home_url(); |
|
| 647 | - $data['license_key'] = $this->settings->get( 'license_key' ); |
|
| 648 | - $data['beta'] = $this->settings->get( 'beta' ); |
|
| 639 | + $data[ 'gv_version' ] = Plugin::$version; |
|
| 640 | + $data[ 'php_version' ] = phpversion(); |
|
| 641 | + $data[ 'wp_version' ] = get_bloginfo( 'version' ); |
|
| 642 | + $data[ 'gf_version' ] = \GFForms::$version; |
|
| 643 | + $data[ 'server' ] = Utils::get( $_SERVER, 'SERVER_SOFTWARE' ); |
|
| 644 | + $data[ 'multisite' ] = is_multisite(); |
|
| 645 | + $data[ 'theme' ] = $theme; |
|
| 646 | + $data[ 'url' ] = home_url(); |
|
| 647 | + $data[ 'license_key' ] = $this->settings->get( 'license_key' ); |
|
| 648 | + $data[ 'beta' ] = $this->settings->get( 'beta' ); |
|
| 649 | 649 | |
| 650 | 650 | // View Data |
| 651 | 651 | $gravityview_posts = wp_count_posts( 'gravityview', 'readable' ); |
| 652 | 652 | |
| 653 | - $data['view_count'] = null; |
|
| 654 | - $data['view_first'] = null; |
|
| 655 | - $data['view_latest'] = null; |
|
| 653 | + $data[ 'view_count' ] = null; |
|
| 654 | + $data[ 'view_first' ] = null; |
|
| 655 | + $data[ 'view_latest' ] = null; |
|
| 656 | 656 | |
| 657 | 657 | if ( $gravityview_posts->publish ) { |
| 658 | - $data['view_count'] = $gravityview_posts->publish; |
|
| 658 | + $data[ 'view_count' ] = $gravityview_posts->publish; |
|
| 659 | 659 | |
| 660 | 660 | $first = get_posts( 'numberposts=1&post_type=gravityview&post_status=publish&order=ASC' ); |
| 661 | 661 | $latest = get_posts( 'numberposts=1&post_type=gravityview&post_status=publish&order=DESC' ); |
| 662 | 662 | |
| 663 | 663 | if ( $first = array_shift( $first ) ) { |
| 664 | - $data['view_first'] = $first->post_date; |
|
| 664 | + $data[ 'view_first' ] = $first->post_date; |
|
| 665 | 665 | } |
| 666 | 666 | if ( $latest = array_pop( $latest ) ) { |
| 667 | - $data['view_latest'] = $latest->post_date; |
|
| 667 | + $data[ 'view_latest' ] = $latest->post_date; |
|
| 668 | 668 | } |
| 669 | 669 | } |
| 670 | 670 | |
| 671 | 671 | // Form counts |
| 672 | 672 | if ( class_exists( 'GFFormsModel' ) ) { |
| 673 | 673 | $form_data = \GFFormsModel::get_form_count(); |
| 674 | - $data['forms_total'] = Utils::get( $form_data, 'total', 0 ); |
|
| 675 | - $data['forms_active'] = Utils::get( $form_data, 'active', 0 ); |
|
| 676 | - $data['forms_inactive'] = Utils::get( $form_data, 'inactive', 0 ); |
|
| 677 | - $data['forms_trash'] = Utils::get( $form_data, 'inactive', 0 ); |
|
| 674 | + $data[ 'forms_total' ] = Utils::get( $form_data, 'total', 0 ); |
|
| 675 | + $data[ 'forms_active' ] = Utils::get( $form_data, 'active', 0 ); |
|
| 676 | + $data[ 'forms_inactive' ] = Utils::get( $form_data, 'inactive', 0 ); |
|
| 677 | + $data[ 'forms_trash' ] = Utils::get( $form_data, 'inactive', 0 ); |
|
| 678 | 678 | } |
| 679 | 679 | |
| 680 | 680 | // Retrieve current plugin information |
@@ -682,13 +682,13 @@ discard block |
||
| 682 | 682 | include ABSPATH . '/wp-admin/includes/plugin.php'; |
| 683 | 683 | } |
| 684 | 684 | |
| 685 | - $data['integrations'] = self::get_related_plugins_and_extensions(); |
|
| 686 | - $data['active_plugins'] = get_option( 'active_plugins', array() ); |
|
| 687 | - $data['inactive_plugins'] = array(); |
|
| 688 | - $data['locale'] = get_locale(); |
|
| 685 | + $data[ 'integrations' ] = self::get_related_plugins_and_extensions(); |
|
| 686 | + $data[ 'active_plugins' ] = get_option( 'active_plugins', array() ); |
|
| 687 | + $data[ 'inactive_plugins' ] = array(); |
|
| 688 | + $data[ 'locale' ] = get_locale(); |
|
| 689 | 689 | |
| 690 | 690 | // Validate request on the GV server |
| 691 | - $data['hash'] = 'gv_version.url.locale:' . sha1( $data['gv_version'] . $data['url'] . $data['locale'] ); |
|
| 691 | + $data[ 'hash' ] = 'gv_version.url.locale:' . sha1( $data[ 'gv_version' ] . $data[ 'url' ] . $data[ 'locale' ] ); |
|
| 692 | 692 | |
| 693 | 693 | return $data; |
| 694 | 694 | } |
@@ -718,7 +718,7 @@ discard block |
||
| 718 | 718 | |
| 719 | 719 | $plugin_data = get_plugin_data( $active_plugin ); |
| 720 | 720 | |
| 721 | - $extensions[] = sprintf( '%s %s', $plugin_data['Name'], $plugin_data['Version'] ); |
|
| 721 | + $extensions[ ] = sprintf( '%s %s', $plugin_data[ 'Name' ], $plugin_data[ 'Version' ] ); |
|
| 722 | 722 | } |
| 723 | 723 | |
| 724 | 724 | if ( ! empty( $extensions ) ) { |
@@ -174,7 +174,8 @@ discard block |
||
| 174 | 174 | if ( empty( $license_data ) ) { |
| 175 | 175 | if ( $is_ajax ) { |
| 176 | 176 | exit( json_encode( array() ) ); |
| 177 | - } else { // Non-ajax call |
|
| 177 | + } else { |
|
| 178 | +// Non-ajax call |
|
| 178 | 179 | return json_encode( array() ); |
| 179 | 180 | } |
| 180 | 181 | } |
@@ -207,7 +208,8 @@ discard block |
||
| 207 | 208 | |
| 208 | 209 | if ( $is_ajax ) { |
| 209 | 210 | exit( $json ); |
| 210 | - } else { // Non-ajax call |
|
| 211 | + } else { |
|
| 212 | +// Non-ajax call |
|
| 211 | 213 | return ( Utils::_GET( 'format', Utils::get( $data, 'format' ) ) === 'object' ) ? $license_data : $json; |
| 212 | 214 | } |
| 213 | 215 | } |