Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-conte.../plugins/sitepres.../inc
File: template-functions.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* SitePress Template functions
[2] Fix | Delete
* @package wpml-core
[3] Fix | Delete
*/
[4] Fix | Delete
[5] Fix | Delete
/**
[6] Fix | Delete
* @since 3.2.3
[7] Fix | Delete
* @deprecated Use 'wpml_get_capabilities' instead.
[8] Fix | Delete
*/
[9] Fix | Delete
function icl_sitepress_get_capabilities() {
[10] Fix | Delete
return wpml_get_capabilities_names();
[11] Fix | Delete
}
[12] Fix | Delete
[13] Fix | Delete
function wpml_get_capabilities_names() {
[14] Fix | Delete
$capabilities = wpml_get_capabilities();
[15] Fix | Delete
[16] Fix | Delete
return array_keys( $capabilities );
[17] Fix | Delete
}
[18] Fix | Delete
[19] Fix | Delete
function wpml_get_capabilities_labels() {
[20] Fix | Delete
$capabilities = wpml_get_capabilities();
[21] Fix | Delete
[22] Fix | Delete
return array_values( $capabilities );
[23] Fix | Delete
}
[24] Fix | Delete
[25] Fix | Delete
function wpml_get_capabilities() {
[26] Fix | Delete
$capabilities = array(
[27] Fix | Delete
'wpml_manage_translation_management' => __( 'Manage Translation Management', 'sitepress' ),
[28] Fix | Delete
'wpml_manage_languages' => __( 'Manage Languages', 'sitepress' ),
[29] Fix | Delete
'wpml_manage_theme_and_plugin_localization' => __( 'Manage Theme and Plugin localization', 'sitepress' ),
[30] Fix | Delete
'wpml_manage_support' => __( 'Manage Support', 'sitepress' ),
[31] Fix | Delete
'wpml_manage_woocommerce_multilingual' => __( 'Manage WooCommerce Multilingual', 'sitepress' ),
[32] Fix | Delete
'wpml_operate_woocommerce_multilingual' => __( 'Operate WooCommerce Multilingual. Everything on WCML except the settings tab.', 'sitepress' ),
[33] Fix | Delete
'wpml_manage_media_translation' => __( 'Manage Media translation', 'sitepress' ),
[34] Fix | Delete
'wpml_manage_navigation' => __( 'Manage Navigation', 'sitepress' ),
[35] Fix | Delete
'wpml_manage_sticky_links' => __( 'Manage Sticky Links', 'sitepress' ),
[36] Fix | Delete
'wpml_manage_string_translation' => __( 'Manage String Translation', 'sitepress' ),
[37] Fix | Delete
'wpml_manage_translation_analytics' => __( 'Manage Translation Analytics', 'sitepress' ),
[38] Fix | Delete
'wpml_manage_wp_menus_sync' => __( 'Manage WPML Menus Sync', 'sitepress' ),
[39] Fix | Delete
'wpml_manage_taxonomy_translation' => __( 'Manage Taxonomy Translation', 'sitepress' ),
[40] Fix | Delete
'wpml_manage_troubleshooting' => __( 'Manage Troubleshooting', 'sitepress' ),
[41] Fix | Delete
'wpml_manage_translation_options' => __( 'Translation options', 'sitepress' )
[42] Fix | Delete
);
[43] Fix | Delete
[44] Fix | Delete
return apply_filters( 'wpml_capabilities', $capabilities );
[45] Fix | Delete
}
[46] Fix | Delete
[47] Fix | Delete
function wpml_get_read_only_capabilities_filter( $empty ) {
[48] Fix | Delete
return wpml_get_capabilities();
[49] Fix | Delete
}
[50] Fix | Delete
[51] Fix | Delete
add_filter( 'wpml_capabilities_read_only', 'wpml_get_read_only_capabilities_filter', 10, 1 );
[52] Fix | Delete
[53] Fix | Delete
function wpml_get_roles() {
[54] Fix | Delete
$wp_roles[ 'label' ] = __( 'WPML capabilities', 'sitepress' );
[55] Fix | Delete
$wp_roles[ 'capabilities' ] = wpml_get_capabilities();
[56] Fix | Delete
[57] Fix | Delete
return apply_filters( 'wpml_roles', $wp_roles );
[58] Fix | Delete
}
[59] Fix | Delete
[60] Fix | Delete
function wpml_roles_read_only_filter( $empty ) {
[61] Fix | Delete
return wpml_get_roles();
[62] Fix | Delete
}
[63] Fix | Delete
[64] Fix | Delete
add_filter( 'wpml_roles_read_only', 'wpml_roles_read_only_filter', 10, 1 );
[65] Fix | Delete
[66] Fix | Delete
/**
[67] Fix | Delete
* @since unknown
[68] Fix | Delete
* @deprecated 3.2 use 'wpml_home_url' filter instead.
[69] Fix | Delete
*/
[70] Fix | Delete
function icl_get_home_url() {
[71] Fix | Delete
global $sitepress;
[72] Fix | Delete
$current_language = $sitepress->get_current_language();
[73] Fix | Delete
[74] Fix | Delete
return $sitepress->language_url( $current_language );
[75] Fix | Delete
}
[76] Fix | Delete
[77] Fix | Delete
/**
[78] Fix | Delete
* Get the home url in the current language
[79] Fix | Delete
* To be used in place of get_option('home')
[80] Fix | Delete
* Note: Good code will make use of get_home_url() or home_url() which apply filters natively.
[81] Fix | Delete
* In this case there is no need to replace anything.
[82] Fix | Delete
* @since 3.2
[83] Fix | Delete
* @return string
[84] Fix | Delete
* @use \SitePress::api_hooks
[85] Fix | Delete
*/
[86] Fix | Delete
function wpml_get_home_url_filter() {
[87] Fix | Delete
global $sitepress;
[88] Fix | Delete
$current_language = $sitepress->get_current_language();
[89] Fix | Delete
[90] Fix | Delete
return $sitepress->language_url( $current_language );
[91] Fix | Delete
}
[92] Fix | Delete
[93] Fix | Delete
/**
[94] Fix | Delete
* @since unknown
[95] Fix | Delete
* @deprecated 3.2 use 'wpml_active_languages' filter instead.
[96] Fix | Delete
*
[97] Fix | Delete
* @param string $a
[98] Fix | Delete
*
[99] Fix | Delete
* @return mixed
[100] Fix | Delete
*/
[101] Fix | Delete
function icl_get_languages( $a = '' ) {
[102] Fix | Delete
if ( $a ) {
[103] Fix | Delete
parse_str( $a, $args );
[104] Fix | Delete
} else {
[105] Fix | Delete
$args = '';
[106] Fix | Delete
}
[107] Fix | Delete
global $sitepress;
[108] Fix | Delete
$langs = $sitepress->get_ls_languages( $args );
[109] Fix | Delete
[110] Fix | Delete
return $langs;
[111] Fix | Delete
}
[112] Fix | Delete
[113] Fix | Delete
/**
[114] Fix | Delete
* Get a list of the active languages
[115] Fix | Delete
* Usually used to create custom language switchers
[116] Fix | Delete
* @since 3.2
[117] Fix | Delete
*
[118] Fix | Delete
* @param mixed $empty_value This is normally the value the filter will be modifying.
[119] Fix | Delete
* We are not filtering anything here therefore the NULL value
[120] Fix | Delete
* This for the filter function to actually receive the full argument list:
[121] Fix | Delete
* apply_filters( 'wpml_active_languages', '', $args)
[122] Fix | Delete
* @param array|string $args {
[123] Fix | Delete
* Optional A string of arguments to filter the language output
[124] Fix | Delete
*
[125] Fix | Delete
* @type bool $skip_missing How to treat languages with no translations. 0 | Skip language or 1 | Link to home of language for missing translations.
[126] Fix | Delete
* @type string $link_empty_to Works in conjunction with skip_missing = 0 and allows using custom links for the languages that do not have translations
[127] Fix | Delete
* for the current element. {%lang} can be used as placeholder for the language code. Empty by default.
[128] Fix | Delete
* @type string $orderby Accepts id|code|name Defaults to custom.
[129] Fix | Delete
* The custom order can be defined in the WordPress admin under WPML > Languages > Language Switcher Options
[130] Fix | Delete
* @type string $order Accepts asc|desc
[131] Fix | Delete
* }
[132] Fix | Delete
* @return array
[133] Fix | Delete
* @use \SitePress::api_hooks
[134] Fix | Delete
*/
[135] Fix | Delete
function wpml_get_active_languages_filter( $empty_value, $args = '' ) {
[136] Fix | Delete
global $sitepress;
[137] Fix | Delete
[138] Fix | Delete
$args = wp_parse_args( $args );
[139] Fix | Delete
return $sitepress->get_ls_languages( $args );
[140] Fix | Delete
}
[141] Fix | Delete
[142] Fix | Delete
/**
[143] Fix | Delete
* @since unknown
[144] Fix | Delete
* @deprecated 3.2 use 'wpml_display_language_names' filter instead.
[145] Fix | Delete
*
[146] Fix | Delete
* @param $native_name
[147] Fix | Delete
* @param bool $translated_name
[148] Fix | Delete
* @param bool $lang_native_hidden
[149] Fix | Delete
* @param bool $lang_translated_hidden
[150] Fix | Delete
*
[151] Fix | Delete
* @return string
[152] Fix | Delete
*/
[153] Fix | Delete
function icl_disp_language( $native_name, $translated_name = false, $lang_native_hidden = false, $lang_translated_hidden = false ) {
[154] Fix | Delete
$language_switcher = new SitePressLanguageSwitcher();
[155] Fix | Delete
[156] Fix | Delete
return $language_switcher->language_display( $native_name, $translated_name, ! $lang_native_hidden, ! $lang_translated_hidden );
[157] Fix | Delete
}
[158] Fix | Delete
[159] Fix | Delete
/**
[160] Fix | Delete
* @deprecated since 3.6.0 / See new Language Switcher API with use of Twig templates
[161] Fix | Delete
*
[162] Fix | Delete
* Get the native or translated language name or both
[163] Fix | Delete
* Checks if native_language_name and translated_language_name are different.
[164] Fix | Delete
* If so, it returns them both, otherwise, it returns only one.
[165] Fix | Delete
* Usually used in custom language switchers
[166] Fix | Delete
* @since 3.2
[167] Fix | Delete
*
[168] Fix | Delete
* @param mixed $empty_value
[169] Fix | Delete
*
[170] Fix | Delete
* @see \wpml_get_active_languages_filter
[171] Fix | Delete
*
[172] Fix | Delete
* @param string $native_name Required The language native name
[173] Fix | Delete
* @param string|bool $translated_name Required The language translated name Defaults to FALSE
[174] Fix | Delete
* @param bool $lang_native_hidden Optional, default is FALSE 0|false or 1|true Whether to hide the language native name or not.
[175] Fix | Delete
* @param bool $lang_translated_hidden Optional, default is FALSE 0|false or 1|true Whether to hide the language translated name or not.
[176] Fix | Delete
*
[177] Fix | Delete
* @return string HTML content
[178] Fix | Delete
* @use \SitePress::api_hooks
[179] Fix | Delete
*/
[180] Fix | Delete
function wpml_display_language_names_filter( $empty_value, $native_name, $translated_name = false, $lang_native_hidden = false, $lang_translated_hidden = false ) {
[181] Fix | Delete
$language_switcher = new SitePressLanguageSwitcher();
[182] Fix | Delete
[183] Fix | Delete
return $language_switcher->language_display( $native_name, $translated_name, ! $lang_native_hidden, ! $lang_translated_hidden );
[184] Fix | Delete
}
[185] Fix | Delete
[186] Fix | Delete
/**
[187] Fix | Delete
* @since unknown
[188] Fix | Delete
* @deprecated 3.2 use 'wpml_element_link' filter instead.
[189] Fix | Delete
*
[190] Fix | Delete
* @param $element_id
[191] Fix | Delete
* @param string $element_type
[192] Fix | Delete
* @param string $link_text
[193] Fix | Delete
* @param array $optional_parameters
[194] Fix | Delete
* @param string $anchor
[195] Fix | Delete
* @param bool $echo
[196] Fix | Delete
* @param bool $return_original_if_missing
[197] Fix | Delete
*
[198] Fix | Delete
* @return string
[199] Fix | Delete
*/
[200] Fix | Delete
function icl_link_to_element(
[201] Fix | Delete
$element_id,
[202] Fix | Delete
$element_type = 'post',
[203] Fix | Delete
$link_text = '',
[204] Fix | Delete
$optional_parameters = array(),
[205] Fix | Delete
$anchor = '',
[206] Fix | Delete
$echo = true,
[207] Fix | Delete
$return_original_if_missing = true
[208] Fix | Delete
) {
[209] Fix | Delete
return wpml_link_to_element_filter( $element_id,
[210] Fix | Delete
$element_type,
[211] Fix | Delete
$link_text,
[212] Fix | Delete
$optional_parameters,
[213] Fix | Delete
$anchor,
[214] Fix | Delete
$echo,
[215] Fix | Delete
$return_original_if_missing );
[216] Fix | Delete
}
[217] Fix | Delete
[218] Fix | Delete
/**
[219] Fix | Delete
* Get the link to an element in the current language
[220] Fix | Delete
* Produces localized links for WordPress elements (post types and taxonomy terms)
[221] Fix | Delete
* @since 3.2
[222] Fix | Delete
*
[223] Fix | Delete
* @param int $element_id Required The ID of the post type (post, page) or taxonomy term (tag or category) to link to.
[224] Fix | Delete
* @param string $element_type Optional The type of element to link to. Can be 'post', 'page', 'tag' or 'category'. Defaults to 'post'
[225] Fix | Delete
* @param string $link_text Optional The link text. Defaults to the element's name.
[226] Fix | Delete
* @param array $optional_parameters Optional Arguments for the link.
[227] Fix | Delete
* @param string $anchor Optional Anchor for the link.
[228] Fix | Delete
* @param bool $echo Optional 0|false to return or 1|true to echo the localized link. Defaults to true.
[229] Fix | Delete
* @param bool $return_original_if_missing Optional, default is TRUE If set to true it will always return a value (the original value, if translation is missing)
[230] Fix | Delete
*
[231] Fix | Delete
* @return string HTML content
[232] Fix | Delete
* @use \SitePress::api_hooks
[233] Fix | Delete
*/
[234] Fix | Delete
function wpml_link_to_element_filter(
[235] Fix | Delete
$element_id, $element_type = 'post', $link_text = '', $optional_parameters = array(), $anchor = '', $echo = true, $return_original_if_missing = true
[236] Fix | Delete
) {
[237] Fix | Delete
global $sitepress, $wpdb, $wp_post_types, $wp_taxonomies;
[238] Fix | Delete
[239] Fix | Delete
if ( $element_type == 'tag' ) {
[240] Fix | Delete
$element_type = 'post_tag';
[241] Fix | Delete
}
[242] Fix | Delete
if ( $element_type == 'page' ) {
[243] Fix | Delete
$element_type = 'post';
[244] Fix | Delete
}
[245] Fix | Delete
[246] Fix | Delete
$post_types = array_keys( (array) $wp_post_types );
[247] Fix | Delete
$taxonomies = array_keys( (array) $wp_taxonomies );
[248] Fix | Delete
[249] Fix | Delete
if ( in_array( $element_type, $taxonomies ) ) {
[250] Fix | Delete
$element_id = $wpdb->get_var( $wpdb->prepare( "SELECT term_taxonomy_id FROM {$wpdb->term_taxonomy} WHERE term_id= %d AND taxonomy=%s", $element_id, $element_type ) );
[251] Fix | Delete
} elseif ( in_array( $element_type, $post_types ) ) {
[252] Fix | Delete
$element_type = 'post';
[253] Fix | Delete
}
[254] Fix | Delete
[255] Fix | Delete
if ( ! $element_id ) {
[256] Fix | Delete
return '';
[257] Fix | Delete
}
[258] Fix | Delete
[259] Fix | Delete
if ( in_array( $element_type, $taxonomies ) ) {
[260] Fix | Delete
$icl_element_type = 'tax_' . $element_type;
[261] Fix | Delete
} elseif ( in_array( $element_type, $post_types ) ) {
[262] Fix | Delete
$icl_element_type = 'post_' . $wpdb->get_var( $wpdb->prepare( "SELECT post_type
[263] Fix | Delete
FROM {$wpdb->posts}
[264] Fix | Delete
WHERE ID = %d", $element_id ) );
[265] Fix | Delete
} else {
[266] Fix | Delete
return '';
[267] Fix | Delete
}
[268] Fix | Delete
[269] Fix | Delete
$trid = $sitepress->get_element_trid( $element_id, $icl_element_type );
[270] Fix | Delete
$translations = $sitepress->get_element_translations( $trid, $icl_element_type );
[271] Fix | Delete
[272] Fix | Delete
// current language is ICL_LANGUAGE_CODE
[273] Fix | Delete
if ( isset( $translations[ ICL_LANGUAGE_CODE ] ) ) {
[274] Fix | Delete
if ( $element_type == 'post' ) {
[275] Fix | Delete
$url = get_permalink( $translations[ ICL_LANGUAGE_CODE ]->element_id );
[276] Fix | Delete
$title = $translations[ ICL_LANGUAGE_CODE ]->post_title;
[277] Fix | Delete
} elseif ( $element_type == 'post_tag' ) {
[278] Fix | Delete
list( $term_id, $title ) = $wpdb->get_row( $wpdb->prepare( "SELECT t.term_id, t.name FROM {$wpdb->term_taxonomy} tx JOIN {$wpdb->terms} t ON t.term_id = tx.term_id WHERE tx.term_taxonomy_id = %d AND tx.taxonomy='post_tag'", $translations[ ICL_LANGUAGE_CODE ]->element_id ), ARRAY_N );
[279] Fix | Delete
$url = get_tag_link( $term_id );
[280] Fix | Delete
$title = apply_filters( 'single_cat_title', $title );
[281] Fix | Delete
} elseif ( $element_type == 'category' ) {
[282] Fix | Delete
list( $term_id, $title ) = $wpdb->get_row( $wpdb->prepare( "SELECT t.term_id, t.name FROM {$wpdb->term_taxonomy} tx JOIN {$wpdb->terms} t ON t.term_id = tx.term_id WHERE tx.term_taxonomy_id = %d AND tx.taxonomy='category'", $translations[ ICL_LANGUAGE_CODE ]->element_id ), ARRAY_N );
[283] Fix | Delete
$url = get_category_link( $term_id );
[284] Fix | Delete
$title = apply_filters( 'single_cat_title', $title );
[285] Fix | Delete
} else {
[286] Fix | Delete
list( $term_id, $title ) = $wpdb->get_row( $wpdb->prepare( "SELECT t.term_id, t.name FROM {$wpdb->term_taxonomy} tx JOIN {$wpdb->terms} t ON t.term_id = tx.term_id WHERE tx.term_taxonomy_id = %d AND tx.taxonomy=%s", $translations[ ICL_LANGUAGE_CODE ]->element_id, $element_type ), ARRAY_N );
[287] Fix | Delete
$url = get_term_link( $term_id, $element_type );
[288] Fix | Delete
$title = apply_filters( 'single_cat_title', $title );
[289] Fix | Delete
}
[290] Fix | Delete
} else {
[291] Fix | Delete
if ( ! $return_original_if_missing ) {
[292] Fix | Delete
if ( $echo ) {
[293] Fix | Delete
echo '';
[294] Fix | Delete
}
[295] Fix | Delete
[296] Fix | Delete
return '';
[297] Fix | Delete
}
[298] Fix | Delete
[299] Fix | Delete
if ( $element_type == 'post' ) {
[300] Fix | Delete
$url = get_permalink( $element_id );
[301] Fix | Delete
$title = get_the_title( $element_id );
[302] Fix | Delete
} elseif ( $element_type == 'post_tag' ) {
[303] Fix | Delete
$url = get_tag_link( $element_id );
[304] Fix | Delete
$my_tag = &get_term( $element_id, 'post_tag', OBJECT, 'display' );
[305] Fix | Delete
$title = apply_filters( 'single_tag_title', $my_tag->name );
[306] Fix | Delete
} elseif ( $element_type == 'category' ) {
[307] Fix | Delete
$url = get_category_link( $element_id );
[308] Fix | Delete
$my_cat = &get_term( $element_id, 'category', OBJECT, 'display' );
[309] Fix | Delete
$title = apply_filters( 'single_cat_title', $my_cat->name );
[310] Fix | Delete
} else {
[311] Fix | Delete
$url = get_term_link( (int) $element_id, $element_type );
[312] Fix | Delete
$my_cat = &get_term( $element_id, $element_type, OBJECT, 'display' );
[313] Fix | Delete
$title = apply_filters( 'single_cat_title', $my_cat->name );
[314] Fix | Delete
}
[315] Fix | Delete
}
[316] Fix | Delete
[317] Fix | Delete
if ( ! $url || is_wp_error( $url ) ) {
[318] Fix | Delete
return '';
[319] Fix | Delete
}
[320] Fix | Delete
[321] Fix | Delete
if ( ! empty( $optional_parameters ) ) {
[322] Fix | Delete
$url_glue = false === strpos( $url, '?' ) ? '?' : '&';
[323] Fix | Delete
$url .= $url_glue . http_build_query( $optional_parameters );
[324] Fix | Delete
}
[325] Fix | Delete
[326] Fix | Delete
if ( isset( $anchor ) && $anchor ) {
[327] Fix | Delete
$url .= '#' . $anchor;
[328] Fix | Delete
}
[329] Fix | Delete
[330] Fix | Delete
$link = '<a href="' . esc_url( $url ) . '">';
[331] Fix | Delete
if ( isset( $link_text ) && $link_text ) {
[332] Fix | Delete
$link .= esc_html( $link_text );
[333] Fix | Delete
} else {
[334] Fix | Delete
$link .= esc_html( $title );
[335] Fix | Delete
}
[336] Fix | Delete
$link .= '</a>';
[337] Fix | Delete
[338] Fix | Delete
if ( $echo ) {
[339] Fix | Delete
echo $link;
[340] Fix | Delete
}
[341] Fix | Delete
[342] Fix | Delete
return $link;
[343] Fix | Delete
}
[344] Fix | Delete
[345] Fix | Delete
/**
[346] Fix | Delete
* @since unknown
[347] Fix | Delete
* @deprecated 3.2 use 'wpml_object_id' filter instead.
[348] Fix | Delete
*
[349] Fix | Delete
* @param $element_id
[350] Fix | Delete
* @param string $element_type
[351] Fix | Delete
* @param bool $return_original_if_missing
[352] Fix | Delete
* @param null|string $ulanguage_code
[353] Fix | Delete
*
[354] Fix | Delete
* @return null|int
[355] Fix | Delete
*/
[356] Fix | Delete
function icl_object_id( $element_id, $element_type = 'post', $return_original_if_missing = false, $ulanguage_code = null ) {
[357] Fix | Delete
[358] Fix | Delete
return wpml_object_id_filter($element_id, $element_type, $return_original_if_missing, $ulanguage_code);
[359] Fix | Delete
}
[360] Fix | Delete
[361] Fix | Delete
/**
[362] Fix | Delete
* @since 3.1.6
[363] Fix | Delete
* @deprecated @since 3.2: use 'wpml_object_id' with the same arguments
[364] Fix | Delete
* @use \SitePress::api_hooks
[365] Fix | Delete
*/
[366] Fix | Delete
add_filter( 'translate_object_id', 'icl_object_id', 10, 4 );
[367] Fix | Delete
[368] Fix | Delete
/**
[369] Fix | Delete
* Get the element in the current language
[370] Fix | Delete
* @since 3.2
[371] Fix | Delete
*
[372] Fix | Delete
* @param int $element_id Use term_id for taxonomies, post_id for posts
[373] Fix | Delete
* @param string $element_type Use post, page, {custom post type name}, nav_menu, nav_menu_item, category, tag, etc.
[374] Fix | Delete
* You can also pass 'any', to let WPML guess the type, but this will only work for posts.
[375] Fix | Delete
* @param bool $return_original_if_missing Optional, default is FALSE. If set to true it will always return a value (the original value, if translation is missing).
[376] Fix | Delete
* @param string|NULL $language_code Optional, default is NULL. If missing, it will use the current language.
[377] Fix | Delete
* If set to a language code, it will return a translation for that language code or
[378] Fix | Delete
* the original if the translation is missing and $return_original_if_missing is set to TRUE.
[379] Fix | Delete
*
[380] Fix | Delete
* @return int|NULL
[381] Fix | Delete
* @use \SitePress::api_hooks
[382] Fix | Delete
*/
[383] Fix | Delete
function wpml_object_id_filter( $element_id, $element_type = 'post', $return_original_if_missing = false, $language_code = null ) {
[384] Fix | Delete
global $sitepress;
[385] Fix | Delete
return $sitepress->get_object_id( $element_id, $element_type, $return_original_if_missing, $language_code );
[386] Fix | Delete
}
[387] Fix | Delete
[388] Fix | Delete
/**
[389] Fix | Delete
* @since unknown
[390] Fix | Delete
* @deprecated 3.2 use 'wpml_translated_language_name' filter instead
[391] Fix | Delete
*
[392] Fix | Delete
* @param $lang_code
[393] Fix | Delete
* @param bool $display_code
[394] Fix | Delete
*
[395] Fix | Delete
* @return string
[396] Fix | Delete
*/
[397] Fix | Delete
function icl_get_display_language_name( $lang_code, $display_code = false ) {
[398] Fix | Delete
global $sitepress;
[399] Fix | Delete
[400] Fix | Delete
return $sitepress->get_display_language_name( $lang_code, $display_code );
[401] Fix | Delete
}
[402] Fix | Delete
[403] Fix | Delete
/**
[404] Fix | Delete
* Returns the translated name of a language in another language.
[405] Fix | Delete
* The languages involved do not need to be active.
[406] Fix | Delete
* @since 3.2
[407] Fix | Delete
*
[408] Fix | Delete
* @param mixed $empty_value
[409] Fix | Delete
*
[410] Fix | Delete
* @see \wpml_get_active_languages_filter
[411] Fix | Delete
*
[412] Fix | Delete
* @param string $lang_code The language name will be for this language. Accepts a 2-letter code e.g. en
[413] Fix | Delete
* @param string|bool $display_code The language name will display translated in this language. Accepts a 2-letter code e.g. de.
[414] Fix | Delete
* If set to false it will return the translated name in the current language. Default is FALSE.
[415] Fix | Delete
*
[416] Fix | Delete
* @return string The language translated name
[417] Fix | Delete
* @use \SitePress::api_hooks
[418] Fix | Delete
*/
[419] Fix | Delete
function wpml_translated_language_name_filter( $empty_value, $lang_code, $display_code = false ) {
[420] Fix | Delete
global $sitepress;
[421] Fix | Delete
[422] Fix | Delete
return $sitepress->get_display_language_name( $lang_code, $display_code );
[423] Fix | Delete
}
[424] Fix | Delete
[425] Fix | Delete
/**
[426] Fix | Delete
* @since unknown
[427] Fix | Delete
* @deprecated 3.2 use 'wpml_current_language' filter instead.
[428] Fix | Delete
*/
[429] Fix | Delete
function icl_get_current_language() {
[430] Fix | Delete
return apply_filters( 'wpml_current_language', '' );
[431] Fix | Delete
}
[432] Fix | Delete
[433] Fix | Delete
/**
[434] Fix | Delete
* Get the current language
[435] Fix | Delete
* @since 3.2
[436] Fix | Delete
* @deprecated Use apply_filters('wpml_current_language', '');
[437] Fix | Delete
* Example: $my_current_lang = apply_filters('wpml_current_language', '');
[438] Fix | Delete
*/
[439] Fix | Delete
function wpml_get_current_language_filter() {
[440] Fix | Delete
return wpml_get_current_language();
[441] Fix | Delete
}
[442] Fix | Delete
[443] Fix | Delete
/**
[444] Fix | Delete
* @since unknown
[445] Fix | Delete
* @deprecated 3.2 use 'wpml_default_language' filter instead
[446] Fix | Delete
*/
[447] Fix | Delete
function icl_get_default_language() {
[448] Fix | Delete
global $sitepress;
[449] Fix | Delete
[450] Fix | Delete
return $sitepress->get_default_language();
[451] Fix | Delete
}
[452] Fix | Delete
[453] Fix | Delete
/**
[454] Fix | Delete
* Get the default language
[455] Fix | Delete
* @since 3.2
[456] Fix | Delete
*
[457] Fix | Delete
* @param mixed $empty_value
[458] Fix | Delete
*
[459] Fix | Delete
* @see \wpml_get_active_languages_filter
[460] Fix | Delete
* @use \SitePress::api_hooks
[461] Fix | Delete
* @return string
[462] Fix | Delete
*/
[463] Fix | Delete
function wpml_get_default_language_filter( $empty_value) {
[464] Fix | Delete
return wpml_get_default_language();
[465] Fix | Delete
}
[466] Fix | Delete
[467] Fix | Delete
/**
[468] Fix | Delete
* Returns the default language
[469] Fix | Delete
* @since 1.3
[470] Fix | Delete
* @return string
[471] Fix | Delete
*/
[472] Fix | Delete
function wpml_get_default_language() {
[473] Fix | Delete
global $sitepress;
[474] Fix | Delete
[475] Fix | Delete
return $sitepress->get_default_language();
[476] Fix | Delete
}
[477] Fix | Delete
[478] Fix | Delete
/**
[479] Fix | Delete
* Get current language
[480] Fix | Delete
* @since 1.3
[481] Fix | Delete
* @return string
[482] Fix | Delete
*/
[483] Fix | Delete
function wpml_get_current_language() {
[484] Fix | Delete
return apply_filters( 'wpml_current_language', '' );
[485] Fix | Delete
}
[486] Fix | Delete
[487] Fix | Delete
/**
[488] Fix | Delete
* @param string $folder
[489] Fix | Delete
*
[490] Fix | Delete
* @return bool
[491] Fix | Delete
*/
[492] Fix | Delete
function icl_tf_determine_mo_folder( $folder ) {
[493] Fix | Delete
global $sitepress;
[494] Fix | Delete
$mo_file_search = new WPML_MO_File_Search( $sitepress );
[495] Fix | Delete
[496] Fix | Delete
return $mo_file_search->determine_mo_folder( $folder );
[497] Fix | Delete
}
[498] Fix | Delete
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function