de_us_urlencoded_json( $string, $encoding, $original_string ) { if ( $encoding !== 'us_urlencoded_json' ) { return $string; } $fields_to_translate = array( 'bool_value_label', 'btn_link', 'btn_text', 'date_format', 'date_picker_placeholder', 'date_picker_placeholder_2', 'date_values_format', 'description', 'features', 'first_value_label', 'image', 'label', 'link', 'marker_address', 'marker_text', 'placeholder', 'price', 'search_placeholder', 'substring', 'title', 'url', 'value', 'values', ); $rows = json_decode( rawurldecode( $original_string ), TRUE ); $result = array(); foreach ( $rows as $i => $row ) { foreach ( $row as $key => $value ) { if ( in_array( $key, $fields_to_translate ) ) { $result[ $key . '_' . $i ] = array( 'value' => $value, 'translate' => TRUE ); } else { $result[ $key . '_' . $i ] = array( 'value' => $value, 'translate' => FALSE ); } } } return $result; } add_filter( 'wpml_pb_shortcode_decode', 'wpml_pb_shortcode_decode_us_urlencoded_json', 10, 3 ); } /** * us_tr_selected_lang_page filter */ if ( ! function_exists( 'us_wpml_tr_selected_lang_page' ) ) { /** * Check Selected language on page * * @param bool $default_value * @return bool */ function us_wpml_tr_selected_lang_page( $default_value = FALSE ) { if ( ! empty( $_REQUEST['lang'] ) ) { return strtolower( $_REQUEST['lang'] ) !== 'all'; } elseif ( ! empty( $_COOKIE[ 'wp-wpml_current_language' ] ) ) { return strtolower( $_COOKIE[ 'wp-wpml_current_language' ] ) !== 'all'; } return $default_value; } add_filter( 'us_tr_selected_lang_page', 'us_wpml_tr_selected_lang_page', 10 ); } /** * us_tr_default_language filter */ if ( ! function_exists( 'us_wpml_tr_default_language' ) ) { /** * Returns the default language * * @param mixed $empty_value Filter plug * @return string */ function us_wpml_tr_default_language ( $empty_value = NULL ) { return apply_filters( 'wpml_default_language', NULL ); } add_filter( 'us_tr_default_language', 'us_wpml_tr_default_language', 10, 1 ); } /** * us_tr_current_language filter */ if ( ! function_exists( 'us_wpml_tr_current_language' ) ) { /** * Getting the current language for an interface * * @param mixed $empty_value Filter plug * @return string */ function us_wpml_tr_current_language ( $empty_value = NULL ) { return apply_filters( 'wpml_current_language', NULL ); } add_filter( 'us_tr_current_language', 'us_wpml_tr_current_language', 10, 1 ); } /** * us_tr_object_id filter */ if ( ! function_exists( 'us_wpml_tr_object_id' ) ) { /** * Return a translated post ID or term ID * * @param integer $elm_id * @param string $elm_type. Can be a post type ('post', 'product', etc.) or a taxonomy name ('category', 'product_cat', etc.) * @param bool $return_original_if_missing * @param mixed $lang_code * @return int|bool */ function us_wpml_tr_object_id( $elm_id, $elm_type = 'post', $return_original_if_missing = FALSE, $lang_code = NULL ) { if ( $tr_elm_id = apply_filters( 'wpml_object_id', $elm_id, $elm_type, $return_original_if_missing, $lang_code ) ) { return $tr_elm_id; } // If there is no translation, we will return the original $elm_id return $elm_id; } add_filter( 'us_tr_object_id', 'us_wpml_tr_object_id', 10, 4 ); } /** * us_tr_get_post_language_code filter */ if ( ! function_exists( 'us_wpml_tr_get_post_language_code' ) ) { /** * Get post language code * * @param intval|string $post_id * @return bool|string */ function us_wpml_tr_get_post_language_code( $post_id = '' ) { $wpml_post_language_details = apply_filters( 'wpml_post_language_details', NULL, $post_id ); if ( is_array( $wpml_post_language_details ) AND isset( $wpml_post_language_details['language_code'] ) ) { return $wpml_post_language_details['language_code']; } else { return NULL; } } add_filter( 'us_tr_get_post_language_code', 'us_wpml_tr_get_post_language_code', 10, 2 ); } /** * us_tr_home_url filter */ if ( ! function_exists( 'us_wpml_tr_home_url' ) ) { function us_wpml_tr_home_url() { return apply_filters( 'wpml_home_url', home_url() ); } add_filter( 'us_tr_home_url', 'us_wpml_tr_home_url', 10, 2 ); } /** * us_tr_switch_language action */ if ( ! function_exists( 'us_wpml_tr_switch_language' ) ) { /** * Switch a global language * * @param string $language_code */ function us_wpml_tr_switch_language ( $language_code = NULL ) { do_action( 'wpml_switch_language', $language_code ); } add_action( 'us_tr_switch_language', 'us_wpml_tr_switch_language', 10, 1 ); } /** * us_tr_get_term_language filter */ if ( ! function_exists( 'us_wpml_tr_get_term_language' ) ) { /** * Returns the term language. * * @param int $term_id * @return bool|string */ function us_wpml_tr_get_term_language( $term_id ) { $term = get_term( $term_id ); if ( ! ( $term instanceof WP_Term ) ) { return FALSE; } return apply_filters( 'wpml_element_language_code', NULL, array( 'element_id' => (int) $term_id, 'element_type' => $term->taxonomy ) ); } add_filter( 'us_tr_get_term_language', 'us_wpml_tr_get_term_language', 10, 1 ); } /** * us_tr_setting filter */ if ( ! function_exists( 'us_wpml_tr_setting' ) ) { /** * Returns a WPML setting value * * @param mixed|bool $default * @param string $key * @return bool */ function us_wpml_tr_setting ( $key, $default ) { return apply_filters( 'wpml_setting', $default, $key ); } add_filter( 'us_tr_setting', 'us_wpml_tr_setting', 10, 2 ); } /** * Adds multi-currency support for AJAX calls * * https://wpml.org/wcml-hook/wcml_multi_currency_ajax_actions/ */ if ( ! function_exists( 'us_add_grid_to_wpml_ajax_actions' ) ) { add_filter( 'wcml_multi_currency_ajax_actions', 'us_add_grid_to_wpml_ajax_actions' ); function us_add_grid_to_wpml_ajax_actions( $ajax_actions ) { $ajax_actions[] = 'us_ajax_grid'; $ajax_actions[] = 'us_ajax_post_list'; $ajax_actions[] = 'us_ajax_product_list'; return $ajax_actions; } } if ( ! function_exists( 'us_wpml_media_category_update_count' ) ) { add_action( 'us_media_category_update_count_callback', 'us_wpml_media_category_update_count', 10 ); /** * WPML sync count */ function us_wpml_media_category_update_count() { global $sitepress; if ( class_exists( 'WPML_Troubleshoot_Sync_Posts_Taxonomies' ) AND class_exists( 'WPML_Term_Translation_Utils' ) AND class_exists( 'WPML_Post_Types' ) ) { // WPML_SP_User class is abstract and required for WPML_Troubleshoot_Sync_Posts_Taxonomies, so we use WPML_Post_Types instead $wpml_user = new WPML_Post_Types( $sitepress ); $term_translation_utils = new WPML_Term_Translation_Utils( $sitepress ); $sync = new WPML_Troubleshoot_Sync_Posts_Taxonomies( $sitepress, $term_translation_utils ); // Imitate post data $_POST['post_type'] = 'attachment'; $_POST['batch_number'] = 0; $sync->run(); } } } if ( ! function_exists( 'us_wpml_add_og_meta_tags' ) ) { add_filter( 'us_meta_tags', 'us_wpml_add_og_meta_tags', 10, 1 ); /** * Add og:locale:alternate meta tags for WPML * @param $meta_tags * @return array */ function us_wpml_add_og_meta_tags( $meta_tags ) { if ( function_exists( 'icl_get_languages' ) AND defined( 'ICL_LANGUAGE_CODE' ) ) { $languages = icl_get_languages( 'skip_missing=0' ); $current_language = ICL_LANGUAGE_CODE; if ( ! empty( $languages ) ) { foreach ( $languages as $lang ) { if ( ! empty( $lang['language_code'] ) AND $lang['language_code'] !== $current_language AND ! empty( $lang['default_locale'] ) ) { $meta_tags['og:locale:alternate'][] = $lang['default_locale']; } } } } return (array) $meta_tags; } } if ( ! function_exists( 'us_filter_indexer_switch_wpml_language' ) ) { add_action( 'us_filter_indexer_index_post', 'us_filter_indexer_switch_wpml_language', 10, 1 ); /** * Switch WPML language to collect the filter_values correctly * @param array $args args from us_filter_indexer_index_post */ function us_filter_indexer_switch_wpml_language( $args ) { if ( empty( $args['post_id'] ) ) { return; } $post_id = (int) $args['post_id']; global $sitepress; $original_lang = $sitepress->get_current_language(); // Determine post language $lang_details = $sitepress->get_element_language_details( $post_id, 'post_' . get_post_type( $post_id ) ); if ( ! $lang_details OR empty( $lang_details->language_code ) ) { return; } $post_lang = $lang_details->language_code; // Skip if post language is the same if ( $post_lang === $original_lang ) { return; } do_action( 'wpml_switch_language', $post_lang ); // Restore original language add_action( 'shutdown', function() use ( $original_lang ) { do_action( 'wpml_switch_language', $original_lang ); }, 0 ); } } if ( ! function_exists( 'us_wpml_get_post_edit_link_with_domain' ) ) { add_filter( 'usb_get_edit_link', 'us_wpml_get_post_edit_link_with_domain', 10, 3 ); /** * Returns the edit link for a post in Live Builder, * taking into account the language and a separate domain. * * Important: Enable "Auto sign-in and sign-out for users on all domains". */ function us_wpml_get_post_edit_link_with_domain( $link, $params, $default_params ) { global $sitepress; // Separate domain for each language. if ( (int) $sitepress->get_setting( 'language_negotiation_type' ) !== 2 ) { return $link; } $language_domains = (array) $sitepress->get_setting( 'language_domains' ); $post_language_code = us_wpml_tr_get_post_language_code( (int) $default_params['post'] ); if ( isset( $language_domains[ $post_language_code ] ) ) { return str_replace( parse_url( $link, PHP_URL_HOST ), (string) $language_domains[ $post_language_code ], $link ); } return $link; } } Page not found – Granted Diesel

Page not found

The link you followed may be broken, or the page may have been removed.