Function Reference: geodir_load_custom_field_translation
Summary
Get the custom fields texts for translation
Global Values
- $wpdb
- (object) (required) WordPress database abstraction object.
- Default: None
Package
GeoDirectory
Parameters
- $translation_texts
- (array) (required) Array of text strings.
- Default: None
Return Values
- (array)
- Translation texts.
Change Log
Since: 1.4.2
1.5.7 Option values are translatable via db translation.
1.6.11 Some new labels translation for advance custom fields.
Source File
geodir_load_custom_field_translation() is located in geodirectory-functions/general_functions.php [Line: 4396]
Source Code
function geodir_load_custom_field_translation( $translation_texts = array() ) { global $wpdb; // Custom fields table $sql = "SELECT admin_title, admin_desc, site_title, clabels, required_msg, default_value, option_values, validation_msg FROM " . GEODIR_CUSTOM_FIELDS_TABLE; $rows = $wpdb->get_results( $sql ); if ( ! empty( $rows ) ) { foreach ( $rows as $row ) { if ( ! empty( $row->admin_title ) ) { $translation_texts[] = stripslashes_deep( $row->admin_title ); } if ( ! empty( $row->admin_desc ) ) { $translation_texts[] = stripslashes_deep( $row->admin_desc ); } if ( ! empty( $row->site_title ) ) { $translation_texts[] = stripslashes_deep( $row->site_title ); } if ( ! empty( $row->clabels ) ) { $translation_texts[] = stripslashes_deep( $row->clabels ); } if ( ! empty( $row->required_msg ) ) { $translation_texts[] = stripslashes_deep( $row->required_msg ); } if ( ! empty( $row->validation_msg ) ) { $translation_texts[] = stripslashes_deep( $row->validation_msg ); } if ( ! empty( $row->default_value ) ) { $translation_texts[] = stripslashes_deep( $row->default_value ); } if ( ! empty( $row->option_values ) ) { $option_values = geodir_string_values_to_options( stripslashes_deep( $row->option_values ) ); if ( ! empty( $option_values ) ) { foreach ( $option_values as $option_value ) { if ( ! empty( $option_value['label'] ) ) { $translation_texts[] = $option_value['label']; } } } } } } // Custom sorting fields table $sql = "SELECT site_title, asc_title, desc_title FROM " . GEODIR_CUSTOM_SORT_FIELDS_TABLE; $rows = $wpdb->get_results( $sql ); if ( ! empty( $rows ) ) { foreach ( $rows as $row ) { if ( ! empty( $row->site_title ) ) { $translation_texts[] = stripslashes_deep( $row->site_title ); } if ( ! empty( $row->asc_title ) ) { $translation_texts[] = stripslashes_deep( $row->asc_title ); } if ( ! empty( $row->desc_title ) ) { $translation_texts[] = stripslashes_deep( $row->desc_title ); } } } // Advance search filter fields table if ( defined( 'GEODIR_ADVANCE_SEARCH_TABLE' ) ) { $sql = "SELECT field_site_name, front_search_title, first_search_text, last_search_text, field_desc FROM " . GEODIR_ADVANCE_SEARCH_TABLE; $rows = $wpdb->get_results( $sql ); if ( ! empty( $rows ) ) { foreach ( $rows as $row ) { if ( ! empty( $row->field_site_name ) ) { $translation_texts[] = stripslashes_deep( $row->field_site_name ); } if ( ! empty( $row->front_search_title ) ) { $translation_texts[] = stripslashes_deep( $row->front_search_title ); } if ( ! empty( $row->first_search_text ) ) { $translation_texts[] = stripslashes_deep( $row->first_search_text ); } if ( ! empty( $row->last_search_text ) ) { $translation_texts[] = stripslashes_deep( $row->last_search_text ); } if ( ! empty( $row->field_desc ) ) { $translation_texts[] = stripslashes_deep( $row->field_desc ); } } } } $translation_texts = ! empty( $translation_texts ) ? array_unique( $translation_texts ) : $translation_texts; return $translation_texts; }