← All changes
|
WPDataAccess/Data_Dictionary/WPDA_List_Columns.php
+13
-11
5.5.32
→
5.5.85
View file →
| @@ -123,11 +123,13 @@ | ||
| 123 | 123 | |
| 124 | 124 | $this->wpdadb = WPDADB::get_db_connection( $this->schema_name ); |
| 125 | 125 | if ( null === $this->wpdadb ) { |
| 126 | 126 | if ( is_admin() ) { |
| 127 | - wp_die( sprintf( __( 'ERROR - Remote database %s not available', 'wp-data-access' ), esc_attr( $this->schema_name) ) ); | |
| 127 | + /* translators: %s = database name */ | |
| 128 | + wp_die( esc_attr( sprintf( __( 'ERROR - Remote database %s not available', 'wp-data-access' ), esc_attr( $this->schema_name) ) ) ); | |
| 128 | 129 | } else { |
| 129 | - die( sprintf( __( 'ERROR - Remote database %s not available', 'wp-data-access' ), esc_attr( $this->schema_name ) ) ); | |
| 130 | + /* translators: %s = database name */ | |
| 131 | + die( esc_attr( sprintf( __( 'ERROR - Remote database %s not available', 'wp-data-access' ), esc_attr( $this->schema_name ) ) ) ); | |
| 130 | 132 | } |
| 131 | 133 | } |
| 132 | 134 | |
| 133 | 135 | if ( '' !== $table_name ) { |
| @@ -181,9 +183,9 @@ | ||
| 181 | 183 | |
| 182 | 184 | /** |
| 183 | 185 | * Return column data type |
| 184 | 186 | * |
| 185 | - * @param $column_name Database column name | |
| 187 | + * @param $column_name string Database column name | |
| 186 | 188 | * |
| 187 | 189 | * @return string|null |
| 188 | 190 | * @since 2.7.2 |
| 189 | 191 | */ |
| @@ -194,9 +196,9 @@ | ||
| 194 | 196 | |
| 195 | 197 | /** |
| 196 | 198 | * Return column type |
| 197 | 199 | * |
| 198 | - * @param $column_name Database column name | |
| 200 | + * @param $column_name string Database column name | |
| 199 | 201 | * |
| 200 | 202 | * @return string|null |
| 201 | 203 | * @since 2.7.2 |
| 202 | 204 | */ |
| @@ -298,9 +300,9 @@ | ||
| 298 | 300 | $this->table_name, |
| 299 | 301 | ) |
| 300 | 302 | ); |
| 301 | 303 | |
| 302 | - $this->table_columns = $this->wpdadb->get_results( $query, 'ARRAY_A' ); // phpcs:ignore Standard.Category.SniffName.ErrorCode | |
| 304 | + $this->table_columns = $this->wpdadb->get_results( $query, 'ARRAY_A' ); | |
| 303 | 305 | $this->searchable_table_columns = $this->table_columns; // Contains all columns and is not modified |
| 304 | 306 | |
| 305 | 307 | foreach ( $this->table_columns as $column ) { |
| 306 | 308 | if ( isset( $column['column_name'] ) && isset( $column['data_type'] ) ) { |
| @@ -363,9 +365,9 @@ | ||
| 363 | 365 | $key_name = $result[0]['Key_name']; |
| 364 | 366 | $this->table_primary_key[] = $result[0]['Column_name']; |
| 365 | 367 | $this->table_primary_key_check[ $key_name ] = true; |
| 366 | 368 | $i = 1; |
| 367 | - while ( $i < count( $result ) ) {//phpcs:ignore - 8.1 proof | |
| 369 | + while ( $i < count( $result ) ) { // phpcs:ignore -- 8.1 proof | |
| 368 | 370 | if ( $key_name === $result[ $i ]['Key_name'] ) { |
| 369 | 371 | $this->table_primary_key[] = $result[ $i ]['Column_name']; |
| 370 | 372 | $this->table_primary_key_check[ $result[ $i ]['Column_name'] ] = true; |
| 371 | 373 | } |
| @@ -398,16 +400,16 @@ | ||
| 398 | 400 | $index = array(); |
| 399 | 401 | foreach ( $result as $row ) { |
| 400 | 402 | if ( $index_name !== $row['Key_name'] ) { |
| 401 | 403 | if ( '' !== $index_name ) { |
| 402 | - array_push( $return, $row['Column_name'] );//phpcs:ignore - 8.1 proof | |
| 404 | + array_push( $return, $row['Column_name'] ); // phpcs:ignore -- 8.1 proof | |
| 403 | 405 | $index = array(); |
| 404 | 406 | } |
| 405 | 407 | $index_name = $row['Key_name']; |
| 406 | 408 | } |
| 407 | - array_push( $index, $row['Column_name'] );//phpcs:ignore - 8.1 proof | |
| 409 | + array_push( $index, $row['Column_name'] ); // phpcs:ignore -- 8.1 proof | |
| 408 | 410 | } |
| 409 | - array_push( $return, $index );//phpcs:ignore - 8.1 proof | |
| 411 | + array_push( $return, $index ); // phpcs:ignore -- 8.1 proof | |
| 410 | 412 | } |
| 411 | 413 | |
| 412 | 414 | return $return; |
| 413 | 415 | } |
| @@ -434,9 +436,9 @@ | ||
| 434 | 436 | */ |
| 435 | 437 | protected function set_table_column_headers() { |
| 436 | 438 | |
| 437 | 439 | if ( ! isset( $this->table_columns ) ) { |
| 438 | - wp_die( __( 'ERROR: Wrong arguments [no columns found]', 'wp-data-access' ) ); | |
| 440 | + wp_die( esc_attr__( 'ERROR: Wrong arguments [no columns found]', 'wp-data-access' ) ); | |
| 439 | 441 | } |
| 440 | 442 | |
| 441 | 443 | $primary_nr = 0; |
| 442 | 444 | $this->table_column_headers = array(); |
| @@ -452,9 +454,9 @@ | ||
| 452 | 454 | $label = $this->get_default_column_label( $value['column_name'] ); |
| 453 | 455 | |
| 454 | 456 | if ( $this->is_primary_key_column( $value['column_name'] ) ) { |
| 455 | 457 | $key_text = __( 'key', 'wp-data-access' ); |
| 456 | - if ( count( $this->table_primary_key ) > 1 ) {//phpcs:ignore - 8.1 proof | |
| 458 | + if ( count( $this->table_primary_key ) > 1 ) { // phpcs:ignore -- 8.1 proof | |
| 457 | 459 | $label .= " ($key_text #" . ( ++ $primary_nr ) . ')'; |
| 458 | 460 | } else { |
| 459 | 461 | $label .= " ($key_text)"; |
| 460 | 462 | } |