@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | * @return \GV\Field The field implementation from configuration (\GV\GF_Field, \GV\Internal_Field). |
| 167 | 167 | */ |
| 168 | 168 | public static function from_configuration( $configuration ) { |
| 169 | - if ( empty( $configuration['id'] ) ) { |
|
| 169 | + if ( empty( $configuration[ 'id' ] ) ) { |
|
| 170 | 170 | $field = new self(); |
| 171 | 171 | gravityview()->log->error( 'Trying to get field from configuration without a field ID.', array( 'data' => $configuration ) ); |
| 172 | 172 | $field->update_configuration( $configuration ); |
@@ -179,8 +179,8 @@ discard block |
||
| 179 | 179 | } else { |
| 180 | 180 | $trace = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS ); |
| 181 | 181 | } |
| 182 | - $trace = $trace[1]; |
|
| 183 | - if ( $trace['function'] == 'from_configuration' && $trace['class'] == __CLASS__ ) { |
|
| 182 | + $trace = $trace[ 1 ]; |
|
| 183 | + if ( $trace[ 'function' ] == 'from_configuration' && $trace[ 'class' ] == __CLASS__ ) { |
|
| 184 | 184 | $field = new self(); |
| 185 | 185 | gravityview()->log->error( 'Infinite loop protection tripped. Returning default class here.' ); |
| 186 | 186 | $field->update_configuration( $configuration ); |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | /** Determine the field implementation to use, and try to use. */ |
| 191 | - $field_class = is_numeric( $configuration['id'] ) ? '\GV\GF_Field' : '\GV\Internal_Field'; |
|
| 191 | + $field_class = is_numeric( $configuration[ 'id' ] ) ? '\GV\GF_Field' : '\GV\Internal_Field'; |
|
| 192 | 192 | |
| 193 | 193 | /** |
| 194 | 194 | * @filter `gravityview/field/class` Filter the field class about to be created from the configuration. |
@@ -227,24 +227,24 @@ discard block |
||
| 227 | 227 | public function update_configuration( $configuration ) { |
| 228 | 228 | $configuration = wp_parse_args( $configuration, $this->as_configuration() ); |
| 229 | 229 | |
| 230 | - if ( $this->ID != $configuration['id'] ) { |
|
| 230 | + if ( $this->ID != $configuration[ 'id' ] ) { |
|
| 231 | 231 | /** Smelling trouble here... */ |
| 232 | 232 | gravityview()->log->warning( 'ID is being changed for {field_class} instance, but implementation is not. Use ::from_configuration instead', array( 'field_class', __CLASS__ ) ); |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | - $this->ID = $configuration['id']; |
|
| 236 | - $this->label = $configuration['label']; |
|
| 237 | - $this->show_label = $configuration['show_label'] == '1'; |
|
| 238 | - $this->custom_label = $configuration['custom_label']; |
|
| 239 | - $this->custom_class = $configuration['custom_class']; |
|
| 240 | - $this->cap = $configuration['only_loggedin'] == '1' ? $configuration['only_loggedin_cap'] : ''; |
|
| 241 | - $this->search_filter = $configuration['search_filter'] == '1'; |
|
| 242 | - $this->show_as_link = $configuration['show_as_link'] == '1'; |
|
| 235 | + $this->ID = $configuration[ 'id' ]; |
|
| 236 | + $this->label = $configuration[ 'label' ]; |
|
| 237 | + $this->show_label = $configuration[ 'show_label' ] == '1'; |
|
| 238 | + $this->custom_label = $configuration[ 'custom_label' ]; |
|
| 239 | + $this->custom_class = $configuration[ 'custom_class' ]; |
|
| 240 | + $this->cap = $configuration[ 'only_loggedin' ] == '1' ? $configuration[ 'only_loggedin_cap' ] : ''; |
|
| 241 | + $this->search_filter = $configuration[ 'search_filter' ] == '1'; |
|
| 242 | + $this->show_as_link = $configuration[ 'show_as_link' ] == '1'; |
|
| 243 | 243 | |
| 244 | 244 | /** Shared among all field types (sort of). */ |
| 245 | 245 | $shared_configuration_keys = array( |
| 246 | 246 | 'id', 'label', 'show_label', 'custom_label', 'custom_class', |
| 247 | - 'only_loggedin' ,'only_loggedin_cap', 'search_filter', 'show_as_link', |
|
| 247 | + 'only_loggedin', 'only_loggedin_cap', 'search_filter', 'show_as_link', |
|
| 248 | 248 | ); |
| 249 | 249 | |
| 250 | 250 | /** Everything else goes into the properties for now. @todo subclasses! */ |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | public function get_label( View $view = null, Source $source = null, Entry $entry = null, Request $request = null ) { |
| 271 | 271 | /** A custom label is available. */ |
| 272 | 272 | if ( ! empty( $this->custom_label ) ) { |
| 273 | - return \GravityView_API::replace_variables( $this->custom_label, $source ? $source->form ? : null : null, $entry ? $entry->as_entry() : null ); |
|
| 273 | + return \GravityView_API::replace_variables( $this->custom_label, $source ? $source->form ?: null : null, $entry ? $entry->as_entry() : null ); |
|
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | return ''; |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | * @return mixed|null The value for the given configuration key, null if doesn't exist. |
| 348 | 348 | */ |
| 349 | 349 | public function __get( $key ) { |
| 350 | - switch( $key ): |
|
| 350 | + switch ( $key ): |
|
| 351 | 351 | default: |
| 352 | 352 | if ( isset( $this->configuration[ $key ] ) ) { |
| 353 | 353 | return $this->configuration[ $key ]; |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | * @return boolean Whether this $key is set or not. |
| 364 | 364 | */ |
| 365 | 365 | public function __isset( $key ) { |
| 366 | - switch( $key ): |
|
| 366 | + switch ( $key ): |
|
| 367 | 367 | default: |
| 368 | 368 | return isset( $this->configuration[ $key ] ); |
| 369 | 369 | endswitch; |
@@ -54,7 +54,7 @@ |
||
| 54 | 54 | do_action( 'gravityview_render_entry_' . $view->ID, $entry, $view, $request ); |
| 55 | 55 | |
| 56 | 56 | /** Entry does not belong to this view. */ |
| 57 | - if ( $view->form && $view->form->ID != $entry['form_id'] ) { |
|
| 57 | + if ( $view->form && $view->form->ID != $entry[ 'form_id' ] ) { |
|
| 58 | 58 | gravityview()->log->error( 'The requested entry does not belong to this view. Entry #{entry_id}, #View {view_id}', array( 'entry_id' => $entry->ID, 'view_id' => $view->ID ) ); |
| 59 | 59 | return null; |
| 60 | 60 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | public static function is_add_oembed_preview() { |
| 47 | 47 | /** The preview request is a parse-embed AJAX call without a type set. */ |
| 48 | - return ( self::is_ajax() && ! empty( $_POST['action'] ) && $_POST['action'] == 'parse-embed' && ! isset( $_POST['type'] ) ); |
|
| 48 | + return ( self::is_ajax() && ! empty( $_POST[ 'action' ] ) && $_POST[ 'action' ] == 'parse-embed' && ! isset( $_POST[ 'type' ] ) ); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | /** |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | * @return boolean |
| 64 | 64 | */ |
| 65 | 65 | public static function is_rest() { |
| 66 | - return ! empty( $GLOBALS['wp']->query_vars['rest_route'] ); |
|
| 66 | + return ! empty( $GLOBALS[ 'wp' ]->query_vars[ 'rest_route' ] ); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | /** |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | $get = $_GET; |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - return $this->is_view() && ( isset( $get['gv_search'] ) || isset( $get['gv_start'] ) || isset( $get['gv_end'] ) || isset( $get['gv_by'] ) || isset( $get['gv_id'] ) ); |
|
| 144 | + return $this->is_view() && ( isset( $get[ 'gv_search' ] ) || isset( $get[ 'gv_start' ] ) || isset( $get[ 'gv_end' ] ) || isset( $get[ 'gv_by' ] ) || isset( $get[ 'gv_id' ] ) ); |
|
| 145 | 145 | } |
| 146 | 146 | } |
| 147 | 147 | |
@@ -113,18 +113,18 @@ |
||
| 113 | 113 | global $post; |
| 114 | 114 | |
| 115 | 115 | if ( ! $this->request->is_view() && $post ) { |
| 116 | - $specifics []= sprintf( '%spost-%d-view-%d-entry-%d-%s.php', $slug_dir, $post->ID, $this->view->ID, $this->entry->ID, $slug_name ); |
|
| 117 | - $specifics []= sprintf( '%spost-%d-entry-%d-%s.php', $slug_dir, $post->ID, $this->entry->ID, $slug_name ); |
|
| 118 | - $specifics []= sprintf( '%spost-%d-view-%d-%s.php', $slug_dir, $post->ID, $this->view->ID, $slug_name ); |
|
| 119 | - $specifics []= sprintf( '%spost-%d-%s.php', $slug_dir, $post->ID, $slug_name ); |
|
| 116 | + $specifics [ ] = sprintf( '%spost-%d-view-%d-entry-%d-%s.php', $slug_dir, $post->ID, $this->view->ID, $this->entry->ID, $slug_name ); |
|
| 117 | + $specifics [ ] = sprintf( '%spost-%d-entry-%d-%s.php', $slug_dir, $post->ID, $this->entry->ID, $slug_name ); |
|
| 118 | + $specifics [ ] = sprintf( '%spost-%d-view-%d-%s.php', $slug_dir, $post->ID, $this->view->ID, $slug_name ); |
|
| 119 | + $specifics [ ] = sprintf( '%spost-%d-%s.php', $slug_dir, $post->ID, $slug_name ); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - $specifics []= sprintf( '%sview-%d-entry-%d-%s.php', $slug_dir, $this->view->ID, $this->entry->ID, $slug_name ); |
|
| 123 | - $specifics []= sprintf( '%sform-%d-entry-%d-%s.php', $slug_dir, $this->view->form->ID, $this->entry->ID, $slug_name ); |
|
| 124 | - $specifics []= sprintf( '%sview-%d-%s.php', $slug_dir, $this->view->ID, $slug_name ); |
|
| 125 | - $specifics []= sprintf( '%sform-%d-%s.php', $slug_dir, $this->view->form->ID, $slug_name ); |
|
| 122 | + $specifics [ ] = sprintf( '%sview-%d-entry-%d-%s.php', $slug_dir, $this->view->ID, $this->entry->ID, $slug_name ); |
|
| 123 | + $specifics [ ] = sprintf( '%sform-%d-entry-%d-%s.php', $slug_dir, $this->view->form->ID, $this->entry->ID, $slug_name ); |
|
| 124 | + $specifics [ ] = sprintf( '%sview-%d-%s.php', $slug_dir, $this->view->ID, $slug_name ); |
|
| 125 | + $specifics [ ] = sprintf( '%sform-%d-%s.php', $slug_dir, $this->view->form->ID, $slug_name ); |
|
| 126 | 126 | |
| 127 | - $specifics []= sprintf( '%sentry-%d-%s.php', $slug_dir, $this->entry->ID, $slug_name ); |
|
| 127 | + $specifics [ ] = sprintf( '%sentry-%d-%s.php', $slug_dir, $this->entry->ID, $slug_name ); |
|
| 128 | 128 | |
| 129 | 129 | return array_merge( $specifics, $templates ); |
| 130 | 130 | } |
@@ -78,7 +78,7 @@ |
||
| 78 | 78 | if ( $this->field ) { |
| 79 | 79 | return array( |
| 80 | 80 | 'key' => $this->field->ID, |
| 81 | - 'direction' => $this->direction ? : self::ASC, |
|
| 81 | + 'direction' => $this->direction ?: self::ASC, |
|
| 82 | 82 | 'is_numeric' => self::ALPHA ? true : false, |
| 83 | 83 | ); |
| 84 | 84 | } |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | if ( ! $entry instanceof Entry ) { |
| 45 | 45 | continue; |
| 46 | 46 | } |
| 47 | - $_entry->entries[ $entry['form_id'] ] = &$entry; |
|
| 47 | + $_entry->entries[ $entry[ 'form_id' ] ] = &$entry; |
|
| 48 | 48 | } |
| 49 | 49 | return $_entry; |
| 50 | 50 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | foreach ( $this->entries as $entry ) { |
| 67 | 67 | $entry = $entry->as_entry(); |
| 68 | - $_entry['_multi'][ $entry['form_id'] ] = $entry; |
|
| 68 | + $_entry[ '_multi' ][ $entry[ 'form_id' ] ] = $entry; |
|
| 69 | 69 | } |
| 70 | 70 | } |
| 71 | 71 | |
@@ -50,8 +50,8 @@ |
||
| 50 | 50 | /** |
| 51 | 51 | * By array. |
| 52 | 52 | */ |
| 53 | - if ( is_array( $view ) && ! empty( $view['id'] ) ) { |
|
| 54 | - return $this->get( $view['id'] ); |
|
| 53 | + if ( is_array( $view ) && ! empty( $view[ 'id' ] ) ) { |
|
| 54 | + return $this->get( $view[ 'id' ] ); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
@@ -28,14 +28,14 @@ |
||
| 28 | 28 | * @return \GV\internal_Field|null The field implementation or null on error. |
| 29 | 29 | */ |
| 30 | 30 | public static function from_configuration( $configuration ) { |
| 31 | - if ( empty( $configuration['id'] ) || ! is_string( $configuration['id'] ) ) { |
|
| 31 | + if ( empty( $configuration[ 'id' ] ) || ! is_string( $configuration[ 'id' ] ) ) { |
|
| 32 | 32 | gravityview()->log->error( 'Invalid configuration[id] supplied.' ); |
| 33 | 33 | return null; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | $field = new self(); |
| 37 | - $field->ID = $configuration['id']; |
|
| 38 | - $field->type = $configuration['id']; |
|
| 37 | + $field->ID = $configuration[ 'id' ]; |
|
| 38 | + $field->type = $configuration[ 'id' ]; |
|
| 39 | 39 | $field->update_configuration( $configuration ); |
| 40 | 40 | |
| 41 | 41 | return $field; |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | /** |
| 85 | 85 | * @var string The REST API functionality identifier. |
| 86 | 86 | */ |
| 87 | - const FEATURE_REST = 'rest_api'; |
|
| 87 | + const FEATURE_REST = 'rest_api'; |
|
| 88 | 88 | |
| 89 | 89 | /** |
| 90 | 90 | * Get the global instance of \GV\Plugin. |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | include_once $this->dir( 'includes/class-frontend-views.php' ); |
| 211 | 211 | include_once $this->dir( 'includes/class-gravityview-admin-bar.php' ); |
| 212 | 212 | include_once $this->dir( 'includes/class-gravityview-entry-list.php' ); |
| 213 | - include_once $this->dir( 'includes/class-gravityview-merge-tags.php'); /** @since 1.8.4 */ |
|
| 213 | + include_once $this->dir( 'includes/class-gravityview-merge-tags.php' ); /** @since 1.8.4 */ |
|
| 214 | 214 | include_once $this->dir( 'includes/class-data.php' ); |
| 215 | 215 | include_once $this->dir( 'includes/class-gravityview-shortcode.php' ); |
| 216 | 216 | include_once $this->dir( 'includes/class-gravityview-entry-link-shortcode.php' ); |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | } |
| 243 | 243 | if ( ! $loaded ) { |
| 244 | 244 | $locale = apply_filters( 'plugin_locale', get_locale(), 'gravityview' ); |
| 245 | - $mofile = $this->dir( 'languages' ) . '/gravityview-'. $locale .'.mo'; |
|
| 245 | + $mofile = $this->dir( 'languages' ) . '/gravityview-' . $locale . '.mo'; |
|
| 246 | 246 | load_textdomain( 'gravityview', $mofile ); |
| 247 | 247 | } |
| 248 | 248 | } |
@@ -375,7 +375,7 @@ discard block |
||
| 375 | 375 | */ |
| 376 | 376 | public function is_compatible_wordpress( $version = null ) { |
| 377 | 377 | |
| 378 | - if( ! $version ) { |
|
| 378 | + if ( ! $version ) { |
|
| 379 | 379 | $version = self::$min_wp_version; |
| 380 | 380 | } |
| 381 | 381 | |
@@ -416,8 +416,8 @@ discard block |
||
| 416 | 416 | * @return string The version of PHP. |
| 417 | 417 | */ |
| 418 | 418 | private function get_php_version() { |
| 419 | - return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] ) ? |
|
| 420 | - $GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] : phpversion(); |
|
| 419 | + return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE' ] ) ? |
|
| 420 | + $GLOBALS[ 'GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE' ] : phpversion(); |
|
| 421 | 421 | } |
| 422 | 422 | |
| 423 | 423 | /** |
@@ -428,8 +428,8 @@ discard block |
||
| 428 | 428 | * @return string The version of WordPress. |
| 429 | 429 | */ |
| 430 | 430 | private function get_wordpress_version() { |
| 431 | - return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE'] ) ? |
|
| 432 | - $GLOBALS['GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE'] : $GLOBALS['wp_version']; |
|
| 431 | + return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE' ] ) ? |
|
| 432 | + $GLOBALS[ 'GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE' ] : $GLOBALS[ 'wp_version' ]; |
|
| 433 | 433 | } |
| 434 | 434 | |
| 435 | 435 | /** |
@@ -440,13 +440,13 @@ discard block |
||
| 440 | 440 | * @return string|null The version of Gravity Forms or null if inactive. |
| 441 | 441 | */ |
| 442 | 442 | private function get_gravityforms_version() { |
| 443 | - if ( ! class_exists( '\GFCommon' ) || ! empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE'] ) ) { |
|
| 443 | + if ( ! class_exists( '\GFCommon' ) || ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE' ] ) ) { |
|
| 444 | 444 | gravityview()->log->error( 'Gravity Forms is inactive or not installed.' ); |
| 445 | 445 | return null; |
| 446 | 446 | } |
| 447 | 447 | |
| 448 | - return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] ) ? |
|
| 449 | - $GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] : \GFCommon::$version; |
|
| 448 | + return ! empty( $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE' ] ) ? |
|
| 449 | + $GLOBALS[ 'GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE' ] : \GFCommon::$version; |
|
| 450 | 450 | } |
| 451 | 451 | |
| 452 | 452 | /** |
@@ -502,9 +502,9 @@ discard block |
||
| 502 | 502 | $tables = array(); |
| 503 | 503 | |
| 504 | 504 | if ( version_compare( \GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) ) { |
| 505 | - $tables []= \GFFormsModel::get_entry_meta_table_name(); |
|
| 505 | + $tables [ ] = \GFFormsModel::get_entry_meta_table_name(); |
|
| 506 | 506 | } |
| 507 | - $tables []= \GFFormsModel::get_lead_meta_table_name(); |
|
| 507 | + $tables [ ] = \GFFormsModel::get_lead_meta_table_name(); |
|
| 508 | 508 | |
| 509 | 509 | foreach ( $tables as $meta_table ) { |
| 510 | 510 | $sql = " |
@@ -522,13 +522,13 @@ discard block |
||
| 522 | 522 | $tables = array(); |
| 523 | 523 | |
| 524 | 524 | if ( version_compare( \GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_notes_table_name' ) ) { |
| 525 | - $tables[] = \GFFormsModel::get_entry_notes_table_name(); |
|
| 525 | + $tables[ ] = \GFFormsModel::get_entry_notes_table_name(); |
|
| 526 | 526 | } |
| 527 | 527 | |
| 528 | - $tables[] = \GFFormsModel::get_lead_notes_table_name(); |
|
| 528 | + $tables[ ] = \GFFormsModel::get_lead_notes_table_name(); |
|
| 529 | 529 | |
| 530 | - $disapproved = __('Disapproved the Entry for GravityView', 'gravityview'); |
|
| 531 | - $approved = __('Approved the Entry for GravityView', 'gravityview'); |
|
| 530 | + $disapproved = __( 'Disapproved the Entry for GravityView', 'gravityview' ); |
|
| 531 | + $approved = __( 'Approved the Entry for GravityView', 'gravityview' ); |
|
| 532 | 532 | |
| 533 | 533 | $suppress = $wpdb->suppress_errors(); |
| 534 | 534 | foreach ( $tables as $notes_table ) { |