/home/vianto5/hidalgoresidences.mx/wp-content/plugins/sitepress-multilingual-cms/inc/functions.php (17290B)
ICL_DEBUG_MODE no longer supported. Please use WP_DEBUG instead.
' . sprintf( esc_html__( 'This translation is currently in the trash. You need to either %1$s or %2$s it in order to continue.' ), $delete_post_link, $restore_post_link ); wp_die( $ret ); } } } } function icl_makes_duplicates( $master_post_id ) { wpml_admin_make_post_duplicates_action( (int) $master_post_id ); } function wpml_admin_make_post_duplicates_action( $master_post_id ) { $post = get_post( $master_post_id ); $post_type = $post->post_type; if ( $post->post_status == 'auto-draft' || $post->post_type == 'revision' ) { return; } global $sitepress; $iclTranslationManagement = wpml_load_core_tm(); if ( $sitepress->is_translated_post_type( $post_type ) ) { $iclTranslationManagement->make_duplicates_all( $master_post_id ); } } function icl_makes_duplicates_public( $master_post_id ) { wpml_make_post_duplicates_action( (int) $master_post_id ); } function wpml_make_post_duplicates_action( $master_post_id ) { global $sitepress; $master_post = get_post( $master_post_id ); if ( 'auto-draft' === $master_post->post_status || 'revision' === $master_post->post_type ) { return; } $active_langs = $sitepress->get_active_languages(); foreach ( $active_langs as $lang_to => $one ) { $trid = $sitepress->get_element_trid( $master_post->ID, 'post_' . $master_post->post_type ); $lang_from = $sitepress->get_source_language_by_trid( $trid ); if ( $lang_from == $lang_to ) { continue; } $sitepress->make_duplicate( $master_post_id, $lang_to ); } } function wpml_like_escape( $text ) { global $wpdb; if ( method_exists( $wpdb, 'esc_like' ) ) { return $wpdb->esc_like( $text ); } return like_escape( $text ); } function icl_do_not_promote() { return defined( 'ICL_DONT_PROMOTE' ) && ICL_DONT_PROMOTE; } function icl_convert_to_user_time( $time ) { $time_offset = get_option( 'gmt_offset' ) * 3600; $local_time = __( 'Last Update Time could not be determined', 'sitepress' ); try { $creation_time = strtotime( $time ); if ( $creation_time !== false ) { $local_time = date( 'Y-m-d H:i:s', $creation_time + $time_offset ); } } catch ( Exception $e ) { } return $local_time; } function icl_is_language_active( $language ) { global $sitepress; $active_languages = $sitepress->get_active_languages(); return isset( $active_languages[ $language ] ); } function wpml_language_is_active_filter( $empty_value, $language_code ) { global $sitepress; return $sitepress->is_active_language( $language_code ); } function wpml_strip_subdir_from_url( $url ) { global $wpml_url_converter; $subdir = wpml_parse_url( $wpml_url_converter->get_abs_home(), PHP_URL_PATH ); $subdir_slugs = ! empty( $subdir ) ? array_values( array_filter( explode( '/', $subdir ) ) ) : ['']; $url_path_expl = explode( '/', preg_replace( '#^(http|https)://#', '', $url ) ); array_shift( $url_path_expl ); $url_slugs = array_values( array_filter( $url_path_expl ) ); $url_slugs_before = $url_slugs; $url_slugs = array_diff_assoc( $url_slugs, $subdir_slugs ); $url = str_replace( '/' . join( '/', $url_slugs_before ), '/' . join( '/', $url_slugs ), $url ); return untrailingslashit( $url ); } function wpml_prepare_in( $items, $format = '%s' ) { global $wpdb; $items = (array) $items; $how_many = count( $items ); if ( $how_many > 0 ) { $placeholders = array_fill( 0, $how_many, $format ); $prepared_format = implode( ',', $placeholders ); $prepared_in = $wpdb->prepare( $prepared_format, $items ); } else { $prepared_in = ''; } return $prepared_in; } function is_not_installing_plugins() { global $sitepress; $checked = isset( $_REQUEST['checked'] ) ? (array) $_REQUEST['checked'] : array(); if ( ! isset( $_REQUEST['action'] ) ) { return true; } elseif ( $_REQUEST['action'] != 'activate' && $_REQUEST['action'] != 'activate-selected' ) { return true; } elseif ( ( ! isset( $_REQUEST['plugin'] ) || $_REQUEST['plugin'] != WPML_PLUGIN_FOLDER . '/' . basename( __FILE__ ) ) && ! in_array( WPML_PLUGIN_FOLDER . '/' . basename( __FILE__ ), $checked ) ) { return true; } elseif ( in_array( WPML_PLUGIN_FOLDER . '/' . basename( __FILE__ ), $checked ) && ! isset( $sitepress ) ) { return true; } return false; } function wpml_mb_strtolower( $string ) { if ( function_exists( 'mb_strtolower' ) ) { return mb_strtolower( $string ); } return strtolower( $string ); } function wpml_mb_strpos( $haystack, $needle, $offset = 0 ) { if ( function_exists( 'mb_strpos' ) ) { return mb_strpos( $haystack, $needle, $offset ); } return strpos( $haystack, $needle, $offset ); } function wpml_set_plugin_as_inactive() { global $icl_plugin_inactive; if ( ! defined( 'ICL_PLUGIN_INACTIVE' ) ) { define( 'ICL_PLUGIN_INACTIVE', true ); } $icl_plugin_inactive = true; } function wpml_version_is( $version_to_check, $comparison = '==' ) { return version_compare( ICL_SITEPRESS_VERSION, $version_to_check, $comparison ) && function_exists( 'wpml_site_uses_icl' ); } function icl_suppress_activation() { $active_plugins = get_option( 'active_plugins' ); $icl_sitepress_idx = array_search( WPML_PLUGIN_BASENAME, $active_plugins ); if ( false !== $icl_sitepress_idx ) { unset( $active_plugins[ $icl_sitepress_idx ] ); update_option( 'active_plugins', $active_plugins ); unset( $_GET['activate'] ); $recently_activated = get_option( 'recently_activated' ); if ( ! isset( $recently_activated[ WPML_PLUGIN_BASENAME ] ) ) { $recently_activated[ WPML_PLUGIN_BASENAME ] = time(); update_option( 'recently_activated', $recently_activated ); } } } function activate_installer( ?SitePress $sitepress = null ) { include_once WPML_PLUGIN_PATH . '/vendor/otgs/installer/loader.php'; $args = array( 'plugins_install_tab' => 1, ); if ( $sitepress ) { $args['site_key_nags'] = array( array( 'repository_id' => 'wpml', 'product_name' => 'WPML', 'condition_cb' => array( $sitepress, 'setup' ), ), ); } WP_Installer_Setup( $wp_installer_instance, $args ); } function wpml_missing_filter_input_notice() { ?>
get_var( $wpdb->prepare( "SELECT collation_name FROM information_schema.COLUMNS WHERE TABLE_NAME = '%s' AND COLUMN_NAME = 'post_type' AND table_schema = (SELECT DATABASE()) LIMIT 1", $wpdb->posts ) ); $table_name = $wpdb->prefix . 'icl_translations'; $sql = $wpdb->prepare( "ALTER TABLE `$table_name` CHANGE `element_type` `element_type` VARCHAR( 36 ) NOT NULL DEFAULT 'post_post' COLLATE %s", $correct_collate ); if ( $wpdb->query( $sql ) === false ) { throw new Exception( $wpdb->last_error ); } } function wpml_parse_url( $url, $component = -1 ) { $ret = null; $component_map = array( PHP_URL_SCHEME => 'scheme', PHP_URL_HOST => 'host', PHP_URL_PORT => 'port', PHP_URL_USER => 'user', PHP_URL_PASS => 'pass', PHP_URL_PATH => 'path', PHP_URL_QUERY => 'query', PHP_URL_FRAGMENT => 'fragment', ); if ( $component === -1 ) { $ret = wp_parse_url( $url ); } elseif ( isset( $component_map[ $component ] ) ) { $key = $component_map[ $component ]; $parsed = wp_parse_url( $url ); $ret = isset( $parsed[ $key ] ) ? $parsed[ $key ] : null; } return $ret; } function wpml_http_build_query( $query_data ) { return http_build_query( $query_data, '', '&' ); } function wpml_array_unique( $array, $sort_flags = SORT_REGULAR ) { if ( version_compare( phpversion(), '5.2.9', '>=' ) ) { return array_unique( $array, $sort_flags ); } return wpml_array_unique_fallback( $array, true ); } function wpml_array_unique_fallback( $array, $keep_key_assoc ) { $duplicate_keys = array(); $tmp = array(); foreach ( $array as $key => $val ) { if ( is_object( $val ) ) { $val = (array) $val; } if ( ! in_array( $val, $tmp ) ) { $tmp[] = $val; } else { $duplicate_keys[] = $key; } } foreach ( $duplicate_keys as $key ) { unset( $array[ $key ] ); } return $keep_key_assoc ? $array : array_values( $array ); } function wpml_is_rest_request() { return make( WPML_REST_Request_Analyze::class )->is_rest_request(); } function wpml_is_rest_enabled(bool $useCache = true) { global $wpml_dic; return $wpml_dic->make( WPML\Infrastructure\WordPress\SharedKernel\Server\Application\CheckRestIsEnabled::class )->isEnabled($useCache); } function wpml_is_cli() { return defined( 'WP_CLI' ) && WP_CLI; } function wpml_sticky_post_sync( ?SitePress $sitepress = null ) { static $instance; if ( ! $instance ) { global $wpml_post_translations; if ( ! $sitepress ) { global $sitepress; } $instance = new WPML_Sticky_Posts_Sync( $sitepress, $wpml_post_translations, new WPML_Sticky_Posts_Lang_Filter( $sitepress, $wpml_post_translations ) ); } return $instance; } function wpml_get_filesystem_direct() { static $instance; if ( ! $instance ) { $wp_api = new WPML_WP_API(); $instance = $wp_api->get_wp_filesystem_direct(); } return $instance; } function wpml_update_escaped_post( array $postarray, $lang = null, $wp_error = false ) { return wpml_get_create_post_helper()->insert_post( $postarray, $lang, $wp_error ); } function wpml_get_cache( $group = '' ) { return new WPML_WP_Cache( $group ); } if ( ! function_exists( 'wpml_is_ajax' ) ) { function wpml_is_ajax() { if ( defined( 'DOING_AJAX' ) ) { return true; } return ( isset( $_SERVER['HTTP_X_REQUESTED_WITH'] ) && wpml_mb_strtolower( $_SERVER['HTTP_X_REQUESTED_WITH'] ) == 'xmlhttprequest' ) ? true : false; } } if ( ! function_exists( 'wpml_get_flag_file_name' ) ) { function wpml_get_flag_file_name( $lang_code ) { if ( file_exists( WPML_PLUGIN_PATH . '/res/flags/' . $lang_code . '.svg' ) ) { $file = $lang_code . '.svg'; } elseif ( file_exists( WPML_PLUGIN_PATH . '/res/flags/' . $lang_code . '.png' ) ) { $file = $lang_code . '.png'; } elseif ( file_exists( WPML_PLUGIN_PATH . '/res/flags/nil.svg' ) ) { $file = 'nil.svg'; } else { $file = 'nil.png'; } return $file; } } function wpml_is_st_loaded(): bool { return defined( 'WPML_ST_VERSION' ); } function wpml_trigger_error( $function_name, $message, $error_level = E_USER_NOTICE ) { if ( function_exists( 'wp_trigger_error' ) ) { wp_trigger_error( $function_name, $message, $error_level ); } else { trigger_error( $message, $error_level ); } }