Function Reference: geodirectory_load_db_language

Summary

Load language strings in to file to translate via po editor

Global Values

$wp_filesystem
(null|object) (required) WP_Filesystem object.

Default: None

Package

GeoDirectory

Return Values

(bool)
  • True if file created otherwise false.

Change Log

Since: 1.4.2

Filters

‘geodir_load_db_language’ [Line: 4342]

Source File

geodirectory_load_db_language() is located in geodirectory-functions/general_functions.php [Line: 4314]

Source Code

function geodirectory_load_db_language() {
	global $wp_filesystem;
	if ( empty( $wp_filesystem ) ) {
		require_once( ABSPATH . '/wp-admin/includes/file.php' );
		WP_Filesystem();
		global $wp_filesystem;
	}

	$language_file = geodir_plugin_path() . '/db-language.php';

	if ( is_file( $language_file ) && ! is_writable( $language_file ) ) {
		return false;
	} // Not possible to create.

	if ( ! is_file( $language_file ) && ! is_writable( dirname( $language_file ) ) ) {
		return false;
	} // Not possible to create.

	$contents_strings = array();

	/**
	 * Filter the language string from database to translate via po editor
	 *
	 * @since 1.4.2
	 * @since 1.6.16 Register the string for WPML translation.
	 *
	 * @param array $contents_strings Array of strings.
	 */
	$contents_strings = apply_filters( 'geodir_load_db_language', $contents_strings );

	$contents_strings = array_unique( $contents_strings );

	$contents_head   = array();
	$contents_head[] = "put_contents( $language_file, $contents, FS_CHMOD_FILE ) ) {
		return false;
	} // Failure; could not write file.

	return true;
}