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...
File: sitepress.class.php
<?php
[0] Fix | Delete
[1] Fix | Delete
/**
[2] Fix | Delete
* Main SitePress Class
[3] Fix | Delete
*
[4] Fix | Delete
* @package wpml-core
[5] Fix | Delete
*/
[6] Fix | Delete
class SitePress extends WPML_WPDB_User implements
[7] Fix | Delete
IWPML_Current_Language,
[8] Fix | Delete
IWPML_Taxonomy_State {
[9] Fix | Delete
const AFTER_ST_PLUGIN_LOADED_HOOK = - PHP_INT_MAX + 1;
[10] Fix | Delete
[11] Fix | Delete
/** @var WPML_Taxonomy_Translation */
[12] Fix | Delete
private $taxonomy_translation;
[13] Fix | Delete
private $template_real_path;
[14] Fix | Delete
/** @var WPML_Post_Translation $post_translation */
[15] Fix | Delete
private $post_translation;
[16] Fix | Delete
/** @var WPML_Terms_Translations $term_translation */
[17] Fix | Delete
private $term_translation;
[18] Fix | Delete
/** @var WPML_Post_Duplication $post_duplication */
[19] Fix | Delete
private $post_duplication;
[20] Fix | Delete
/** @var WPML_Term_Actions $term_actions */
[21] Fix | Delete
private $term_actions;
[22] Fix | Delete
/** @var WPML_Admin_Scripts_Setup $scripts_handler */
[23] Fix | Delete
private $scripts_handler;
[24] Fix | Delete
/** @var WPML_Set_Language $language_setter */
[25] Fix | Delete
private $language_setter;
[26] Fix | Delete
/** @var WPML_Term_Query_Filter $term_query_filter */
[27] Fix | Delete
private $term_query_filter;
[28] Fix | Delete
/** @var array $settings */
[29] Fix | Delete
private $settings;
[30] Fix | Delete
private $active_languages = array();
[31] Fix | Delete
private $_admin_notices = array();
[32] Fix | Delete
private $this_lang;
[33] Fix | Delete
private $wp_query;
[34] Fix | Delete
private $admin_language;
[35] Fix | Delete
private $user_preferences = array();
[36] Fix | Delete
/** @var WPML_WP_API $wp_api */
[37] Fix | Delete
private $wp_api;
[38] Fix | Delete
/** @var WPML_Records $records */
[39] Fix | Delete
private $records;
[40] Fix | Delete
/** @var @var int $loaded_blog_id */
[41] Fix | Delete
private $loaded_blog_id;
[42] Fix | Delete
[43] Fix | Delete
/**
[44] Fix | Delete
* @var string $original_language caches the initial language when calling
[45] Fix | Delete
* \SitePress::switch_lang() for the first time.
[46] Fix | Delete
*/
[47] Fix | Delete
private $original_language;
[48] Fix | Delete
[49] Fix | Delete
/**
[50] Fix | Delete
* @var string $original_language_cookie caches the initial language value
[51] Fix | Delete
* in the user's cookie when calling \SitePress::switch_lang() for the
[52] Fix | Delete
* first time.
[53] Fix | Delete
*/
[54] Fix | Delete
private $original_language_cookie;
[55] Fix | Delete
[56] Fix | Delete
/** @var WPML_Locale $locale_utils */
[57] Fix | Delete
public $locale_utils;
[58] Fix | Delete
[59] Fix | Delete
public $footer_preview = false;
[60] Fix | Delete
[61] Fix | Delete
/**
[62] Fix | Delete
* @var icl_cache
[63] Fix | Delete
*/
[64] Fix | Delete
public $icl_translations_cache;
[65] Fix | Delete
/**
[66] Fix | Delete
* @var WPML_Flags
[67] Fix | Delete
*/
[68] Fix | Delete
private $flags;
[69] Fix | Delete
/**
[70] Fix | Delete
* @var icl_cache
[71] Fix | Delete
*/
[72] Fix | Delete
public $icl_language_name_cache;
[73] Fix | Delete
/**
[74] Fix | Delete
* @var icl_cache
[75] Fix | Delete
*/
[76] Fix | Delete
public $icl_term_taxonomy_cache;
[77] Fix | Delete
private $wpml_helper;
[78] Fix | Delete
[79] Fix | Delete
/** @var WPML_Term_Adjust_Id */
[80] Fix | Delete
private $wpml_term_adjust_id = null;
[81] Fix | Delete
[82] Fix | Delete
/**
[83] Fix | Delete
* @var array $current_request_data - Use to store temporary information during the current request
[84] Fix | Delete
*/
[85] Fix | Delete
private $current_request_data = array();
[86] Fix | Delete
[87] Fix | Delete
function __construct() {
[88] Fix | Delete
do_action( 'wpml_before_startup' );
[89] Fix | Delete
/** @var array $sitepress_settings */
[90] Fix | Delete
global $pagenow, $sitepress_settings, $wpdb, $wpml_post_translations, $locale, $wpml_term_translations;
[91] Fix | Delete
$this->wpml_helper = new WPML_Helper( $wpdb );
[92] Fix | Delete
[93] Fix | Delete
parent::__construct( $wpdb );
[94] Fix | Delete
$this->locale_utils = new WPML_Locale( $wpdb, $this, $locale );
[95] Fix | Delete
$sitepress_settings = get_option( 'icl_sitepress_settings' );
[96] Fix | Delete
$this->settings = &$sitepress_settings;
[97] Fix | Delete
$this->post_translation = &$wpml_post_translations;
[98] Fix | Delete
$this->term_translation = &$wpml_term_translations;
[99] Fix | Delete
// @since 3.1
[100] Fix | Delete
if ( is_admin() && ! $this->get_setting( 'icl_capabilities_verified' ) ) {
[101] Fix | Delete
wpml_enable_capabilities();
[102] Fix | Delete
}
[103] Fix | Delete
[104] Fix | Delete
if ( null === $pagenow && is_multisite() ) {
[105] Fix | Delete
include WPML_PLUGIN_PATH . '/inc/hacks/vars-php-multisite.php';
[106] Fix | Delete
}
[107] Fix | Delete
[108] Fix | Delete
if ( $this->settings ) {
[109] Fix | Delete
$this->verify_settings();
[110] Fix | Delete
}
[111] Fix | Delete
[112] Fix | Delete
if ( isset( $_GET['page'], $_GET['debug_action'] ) && WPML_PLUGIN_FOLDER . '/menu/troubleshooting.php' === $_GET['page'] ) {
[113] Fix | Delete
ob_start();
[114] Fix | Delete
}
[115] Fix | Delete
[116] Fix | Delete
if ( isset( $_REQUEST['icl_ajx_action'] ) ) {
[117] Fix | Delete
/**
[118] Fix | Delete
* It is very common to register a CPT on admin_init, thus
[119] Fix | Delete
* the init hook is too early in this case. This causes
[120] Fix | Delete
* malformed post guid as well as empty post content
[121] Fix | Delete
* when saving the post a second time. E.g.: Avada.
[122] Fix | Delete
*/
[123] Fix | Delete
if ( 'make_duplicates' === $_REQUEST['icl_ajx_action'] ) {
[124] Fix | Delete
add_action( 'admin_init', array( $this, 'ajax_setup' ), PHP_INT_MAX );
[125] Fix | Delete
} else {
[126] Fix | Delete
add_action( 'init', array( $this, 'ajax_setup' ), 15 );
[127] Fix | Delete
}
[128] Fix | Delete
}
[129] Fix | Delete
[130] Fix | Delete
// Process post requests
[131] Fix | Delete
if ( ! empty( $_POST ) ) {
[132] Fix | Delete
add_action( 'init', array( $this, 'process_forms' ) );
[133] Fix | Delete
}
[134] Fix | Delete
[135] Fix | Delete
$this->initialize_cache();
[136] Fix | Delete
[137] Fix | Delete
$flags_factory = new WPML_Flags_Factory( $wpdb );
[138] Fix | Delete
$this->flags = $flags_factory->create();
[139] Fix | Delete
[140] Fix | Delete
add_action( 'plugins_loaded', array( $this, 'plugin_localization' ), self::AFTER_ST_PLUGIN_LOADED_HOOK );
[141] Fix | Delete
add_action( 'plugins_loaded', array( $this, 'init' ), 1 );
[142] Fix | Delete
add_action( 'wp_loaded', array( $this, 'maybe_set_this_lang' ) );
[143] Fix | Delete
add_action( 'switch_blog', array( $this, 'init_settings' ), 10, 1 );
[144] Fix | Delete
// Administration menus
[145] Fix | Delete
add_action( 'admin_menu', array( $this, 'administration_menu' ) );
[146] Fix | Delete
[147] Fix | Delete
if ( $this->get_setting( 'existing_content_language_verified' ) && ( $this->get_setting( 'setup_complete' ) || ( ! empty( $_GET['page'] ) && $this->get_setting( 'setup_wizard_step' ) > 1 && $_GET['page'] == WPML_PLUGIN_FOLDER . '/menu/languages.php' ) ) ) {
[148] Fix | Delete
[149] Fix | Delete
// Post/page language box
[150] Fix | Delete
add_filter( 'comment_feed_join', array( $this, 'comment_feed_join' ) );
[151] Fix | Delete
[152] Fix | Delete
add_filter( 'comments_clauses', array( $this, 'comments_clauses' ), 10, 2 );
[153] Fix | Delete
[154] Fix | Delete
// Allow us to filter the Query vars before the posts query is being built and executed
[155] Fix | Delete
add_filter( 'pre_get_posts', array( $this, 'pre_get_posts' ) );
[156] Fix | Delete
[157] Fix | Delete
if ( $pagenow === 'edit.php' ) {
[158] Fix | Delete
add_action( 'quick_edit_custom_box', array( 'WPML_Terms_Translations', 'quick_edit_terms_removal' ), 10, 2 );
[159] Fix | Delete
}
[160] Fix | Delete
[161] Fix | Delete
add_filter( 'get_pages', array( $this, 'exclude_other_language_pages2' ), 10, 2 );
[162] Fix | Delete
add_filter( 'wp_dropdown_pages', array( $this, 'wp_dropdown_pages' ) );
[163] Fix | Delete
[164] Fix | Delete
add_filter( 'get_comment_link', array( $this, 'get_comment_link_filter' ) );
[165] Fix | Delete
[166] Fix | Delete
$this->set_term_filters_and_hooks();
[167] Fix | Delete
[168] Fix | Delete
add_action( 'parse_query', array( $this, 'parse_query' ) );
[169] Fix | Delete
[170] Fix | Delete
// AJAX Actions for the post edit screen
[171] Fix | Delete
add_action( 'wp_ajax_wpml_save_term', array( 'WPML_Post_Edit_Ajax', 'wpml_save_term_action' ) );
[172] Fix | Delete
add_action( 'wp_ajax_wpml_switch_post_language', array( 'WPML_Post_Edit_Ajax', 'wpml_switch_post_language' ) );
[173] Fix | Delete
add_action( 'wp_ajax_wpml_get_default_lang', array( 'WPML_Post_Edit_Ajax', 'wpml_get_default_lang' ) );
[174] Fix | Delete
[175] Fix | Delete
// AJAX Actions for the taxonomy translation screen
[176] Fix | Delete
add_action( 'wp_ajax_wpml_get_terms_and_labels_for_taxonomy_table', array( 'WPML_Taxonomy_Translation_Table_Display', 'wpml_get_terms_and_labels_for_taxonomy_table' ) );
[177] Fix | Delete
[178] Fix | Delete
// Ajax Action for the updating of term names on the troubleshooting page
[179] Fix | Delete
add_action( 'wp_ajax_wpml_update_term_names_troubleshoot', array( 'WPML_Troubleshooting_Terms_Menu', 'wpml_update_term_names_troubleshoot' ) );
[180] Fix | Delete
add_action( 'wp_ajax_wpml_generate_term_slug', array( $this->get_term_actions_helper(), 'generate_unique_term_slug_ajax_handler' ) );
[181] Fix | Delete
[182] Fix | Delete
// short circuit get default category
[183] Fix | Delete
add_filter( 'pre_option_default_category', array( $this, 'pre_option_default_category' ) );
[184] Fix | Delete
add_filter( 'update_option_default_category', array( $this, 'update_option_default_category' ), 1, 2 );
[185] Fix | Delete
[186] Fix | Delete
// back end js
[187] Fix | Delete
add_action( 'admin_enqueue_scripts', array( $this, 'backend_js' ) );
[188] Fix | Delete
[189] Fix | Delete
add_action( 'wp_head', array( $this, 'rtl_fix' ) );
[190] Fix | Delete
add_action( 'admin_print_styles', array( $this, 'rtl_fix' ) );
[191] Fix | Delete
[192] Fix | Delete
add_action( 'restrict_manage_posts', array( $this, 'restrict_manage_posts' ) );
[193] Fix | Delete
[194] Fix | Delete
// feeds links
[195] Fix | Delete
add_filter( 'feed_link', array( $this, 'feed_link' ) );
[196] Fix | Delete
[197] Fix | Delete
// commenting links
[198] Fix | Delete
add_filter( 'post_comments_feed_link', array( $this, 'post_comments_feed_link' ) );
[199] Fix | Delete
add_filter( 'trackback_url', array( $this, 'trackback_url' ) );
[200] Fix | Delete
add_filter( 'user_trailingslashit', array( $this, 'user_trailingslashit' ), 1, 2 );
[201] Fix | Delete
[202] Fix | Delete
add_filter( 'pre_option_home', array( $this, 'pre_option_home' ) );
[203] Fix | Delete
[204] Fix | Delete
if ( ! is_admin() ) {
[205] Fix | Delete
add_filter( 'attachment_link', array( $this, 'attachment_link_filter' ), 10, 2 );
[206] Fix | Delete
}
[207] Fix | Delete
[208] Fix | Delete
// Filter custom type archive link (since WP 3.1)
[209] Fix | Delete
add_filter( 'post_type_archive_link', array( $this, 'post_type_archive_link_filter' ), 10, 2 );
[210] Fix | Delete
[211] Fix | Delete
add_filter( 'author_link', array( $this, 'author_link' ) );
[212] Fix | Delete
[213] Fix | Delete
// language negotiation
[214] Fix | Delete
add_action( 'query_vars', array( $this, 'query_vars' ) );
[215] Fix | Delete
add_filter( 'language_attributes', array( $this, 'language_attributes' ) );
[216] Fix | Delete
add_filter( 'locale', array( $this, 'locale_filter' ), 10, 1 );
[217] Fix | Delete
add_filter( 'pre_option_page_on_front', array( $this, 'pre_option_page_on_front' ) );
[218] Fix | Delete
add_filter( 'pre_option_page_for_posts', array( $this, 'pre_option_page_for_posts' ) );
[219] Fix | Delete
[220] Fix | Delete
$sticky_posts_loader = new WPML_Sticky_Posts_Loader( $this );
[221] Fix | Delete
$sticky_posts_loader->add_hooks();
[222] Fix | Delete
[223] Fix | Delete
add_filter( 'trashed_post', array( $this, 'fix_trashed_front_or_posts_page_settings' ) );
[224] Fix | Delete
add_filter( 'delete_post', array( $this, 'fix_trashed_front_or_posts_page_settings' ) );
[225] Fix | Delete
[226] Fix | Delete
add_action( 'wp', array( $this, 'set_wp_query' ) );
[227] Fix | Delete
add_action( 'personal_options_update', array( $this, 'save_user_options' ) );
[228] Fix | Delete
add_action( 'edit_user_profile_update', array( $this, 'save_user_options' ) );
[229] Fix | Delete
[230] Fix | Delete
if ( ! is_admin() ) {
[231] Fix | Delete
add_action( 'wp_head', array( $this, 'meta_generator_tag' ) );
[232] Fix | Delete
}
[233] Fix | Delete
[234] Fix | Delete
if ( $this->is_setup_complete() ) {
[235] Fix | Delete
$icl_nav_menu = new WPML_Nav_Menu( $this, $wpdb, $wpml_post_translations, $wpml_term_translations );
[236] Fix | Delete
$icl_nav_menu->init_hooks();
[237] Fix | Delete
}
[238] Fix | Delete
[239] Fix | Delete
add_action( 'wp_login', array( $this, 'reset_admin_language_cookie' ) );
[240] Fix | Delete
[241] Fix | Delete
$this->handle_head_hreflang();
[242] Fix | Delete
[243] Fix | Delete
/**
[244] Fix | Delete
* add extra debug information
[245] Fix | Delete
*/
[246] Fix | Delete
add_filter( 'icl_get_extra_debug_info', array( $this, 'add_extra_debug_info' ) );
[247] Fix | Delete
[248] Fix | Delete
}else {
[249] Fix | Delete
add_action( 'admin_enqueue_scripts', function () {
[250] Fix | Delete
$this->backend_js( false );
[251] Fix | Delete
} );
[252] Fix | Delete
} //end if the initial language is set - existing_content_language_verified
[253] Fix | Delete
[254] Fix | Delete
add_filter( 'core_version_check_locale', array( $this, 'wp_upgrade_locale' ) );
[255] Fix | Delete
[256] Fix | Delete
if ( $pagenow === 'post.php' && isset( $_REQUEST['action'], $_GET['post'] ) && $_REQUEST['action'] === 'edit' ) {
[257] Fix | Delete
add_action( 'init', '_icl_trash_restore_prompt' );
[258] Fix | Delete
}
[259] Fix | Delete
[260] Fix | Delete
add_action( 'init', array( $this, 'register_assets' ), 2 );
[261] Fix | Delete
[262] Fix | Delete
add_action( 'admin_enqueue_scripts', array( $this, 'js_load' ), 2 ); // enqueue scripts - higher priority
[263] Fix | Delete
add_action( 'wp_enqueue_scripts', array( $this, 'js_load' ), 2 ); // enqueue scripts - higher priority
[264] Fix | Delete
add_filter( 'url_to_postid', array( $this, 'url_to_postid' ) );
[265] Fix | Delete
// cron job to update WPML config index file from CDN
[266] Fix | Delete
$xml_config_log_factory = new WPML_XML_Config_Log_Factory();
[267] Fix | Delete
$log = $xml_config_log_factory->create_log();
[268] Fix | Delete
[269] Fix | Delete
if ( $this->is_setup_complete() ) {
[270] Fix | Delete
$xml_config_log_notice = $xml_config_log_factory->create_notice();
[271] Fix | Delete
$xml_config_log_notice->add_hooks();
[272] Fix | Delete
}
[273] Fix | Delete
[274] Fix | Delete
$wpml_config_update_integrator = new WPML_Config_Update_Integrator( $log );
[275] Fix | Delete
$wpml_config_update_integrator->add_hooks();
[276] Fix | Delete
[277] Fix | Delete
add_action( 'core_upgrade_preamble', array( $this, 'update_index_screen' ) );
[278] Fix | Delete
add_filter( 'get_search_form', array( $this, 'get_search_form_filter' ) );
[279] Fix | Delete
$this->api_hooks();
[280] Fix | Delete
add_action( 'wpml_loaded', array( $this, 'load_dependencies' ), 10000 );
[281] Fix | Delete
do_action( 'wpml_after_startup' );
[282] Fix | Delete
}
[283] Fix | Delete
[284] Fix | Delete
/**
[285] Fix | Delete
* @since 3.2
[286] Fix | Delete
*/
[287] Fix | Delete
public function api_hooks() {
[288] Fix | Delete
/**
[289] Fix | Delete
* @deprecated in favour of lowercased namespaces
[290] Fix | Delete
*/
[291] Fix | Delete
add_filter( 'WPML_get_setting', array( $this, 'filter_get_setting' ), 10, 2 );
[292] Fix | Delete
/**
[293] Fix | Delete
* @deprecated in favour of lowercased namespaces
[294] Fix | Delete
*/
[295] Fix | Delete
add_filter( 'WPML_get_current_language', array( $this, 'get_current_language' ), 10, 0 );
[296] Fix | Delete
/**
[297] Fix | Delete
* @deprecated in favour of lowercased namespaces
[298] Fix | Delete
*/
[299] Fix | Delete
add_filter( 'WPML_get_user_admin_language', array( $this, 'get_user_admin_language_filter' ), 10, 2 );
[300] Fix | Delete
/**
[301] Fix | Delete
* @deprecated in favour of lowercased namespaces
[302] Fix | Delete
*/
[303] Fix | Delete
add_filter( 'WPML_is_admin_action_from_referer', array( $this, 'check_if_admin_action_from_referer' ), 10, 0 );
[304] Fix | Delete
/**
[305] Fix | Delete
* @deprecated in favour of lowercased namespaces
[306] Fix | Delete
*/
[307] Fix | Delete
add_filter( 'WPML_current_user', array( $this, 'get_current_user' ), 10, 0 );
[308] Fix | Delete
[309] Fix | Delete
add_filter( 'wpml_get_setting', array( $this, 'filter_get_setting' ), 10, 2 );
[310] Fix | Delete
add_action( 'wpml_set_setting', array( $this, 'action_set_setting' ), 10, 3 );
[311] Fix | Delete
add_filter( 'wpml_get_language_cookie', array( $this, 'get_language_cookie' ), 10, 0 );
[312] Fix | Delete
add_filter( 'wpml_current_language', array( $this, 'get_current_language' ), 10, 0 );
[313] Fix | Delete
add_filter( 'wpml_get_user_admin_language', array( $this, 'get_user_admin_language_filter' ), 10, 2 );
[314] Fix | Delete
add_filter( 'wpml_is_admin_action_from_referer', array( $this, 'check_if_admin_action_from_referer' ), 10, 0 );
[315] Fix | Delete
add_filter( 'wpml_current_user', array( $this, 'get_current_user' ), 10, 0 );
[316] Fix | Delete
[317] Fix | Delete
add_filter( 'wpml_new_post_source_id', array( $this, 'get_new_post_source_id' ), 10, 1 );
[318] Fix | Delete
[319] Fix | Delete
/**
[320] Fix | Delete
* @use \SitePress::get_translatable_documents_filter
[321] Fix | Delete
*/
[322] Fix | Delete
add_filter( 'wpml_translatable_documents', array( $this, 'get_translatable_documents_filter' ), 10, 2 );
[323] Fix | Delete
add_filter( 'wpml_is_translated_post_type', array( $this, 'is_translated_post_type_filter' ), 10, 2 );
[324] Fix | Delete
add_filter( 'wpml_is_display_as_translated_post_type', array( $this, 'is_display_as_translated_post_type_filter' ), 10, 2 );
[325] Fix | Delete
[326] Fix | Delete
add_filter( 'wpml_is_translated_taxonomy', array( $this, 'is_translated_taxonomy_filter' ), 10, 2 );
[327] Fix | Delete
[328] Fix | Delete
/**
[329] Fix | Delete
* @deprecated it has a wrong hook tag
[330] Fix | Delete
* @since 3.2
[331] Fix | Delete
*/
[332] Fix | Delete
add_filter( 'wpml_get_element_translations_filter', array( $this, 'get_element_translations_filter' ), 10, 6 );
[333] Fix | Delete
/**
[334] Fix | Delete
* @deprecated it has a wrong hook tag
[335] Fix | Delete
* @since 3.2
[336] Fix | Delete
*/
[337] Fix | Delete
add_filter( 'wpml_get_element_translations', array( $this, 'get_element_translations_filter' ), 10, 6 );
[338] Fix | Delete
add_filter( 'wpml_is_original_content', array( $this, 'is_original_content_filter' ), 10, 3 );
[339] Fix | Delete
add_filter( 'wpml_original_element_id', array( $this, 'get_original_element_id_filter' ), 10, 3 );
[340] Fix | Delete
add_filter( 'wpml_element_trid', array( $this, 'get_element_trid_filter' ), 10, 3 );
[341] Fix | Delete
[342] Fix | Delete
add_filter( 'wpml_is_rtl', array( $this, 'is_rtl' ) );
[343] Fix | Delete
[344] Fix | Delete
add_filter( 'wpml_home_url', 'wpml_get_home_url_filter', 10 );
[345] Fix | Delete
add_filter( 'wpml_active_languages', 'wpml_get_active_languages_filter', 10, 2 );
[346] Fix | Delete
add_filter( 'wpml_display_language_names', 'wpml_display_language_names_filter', 10, 5 );
[347] Fix | Delete
add_filter( 'wpml_display_single_language_name', array( $this, 'get_display_single_language_name_filter' ), 10, 2 );
[348] Fix | Delete
add_filter( 'wpml_element_link', 'wpml_link_to_element_filter', 10, 7 );
[349] Fix | Delete
add_filter( 'wpml_object_id', 'wpml_object_id_filter', 10, 4 );
[350] Fix | Delete
add_filter( 'wpml_translated_language_name', 'wpml_translated_language_name_filter', 10, 3 );
[351] Fix | Delete
add_filter( 'wpml_default_language', 'wpml_get_default_language_filter', 10, 1 );
[352] Fix | Delete
add_filter( 'wpml_post_language_details', 'wpml_get_language_information', 10, 2 );
[353] Fix | Delete
[354] Fix | Delete
add_action( 'wpml_add_language_form_field', 'wpml_add_language_form_field_action' );
[355] Fix | Delete
add_shortcode( 'wpml_language_form_field', 'wpml_language_form_field_shortcode' );
[356] Fix | Delete
[357] Fix | Delete
add_filter( 'wpml_element_translation_type', 'wpml_get_element_translation_type_filter', 10, 3 );
[358] Fix | Delete
add_filter( 'wpml_element_has_translations', 'wpml_element_has_translations_filter', 10, 3 );
[359] Fix | Delete
add_filter( 'wpml_content_translations', 'wpml_get_content_translations_filter', 10, 3 );
[360] Fix | Delete
add_filter( 'wpml_master_post_from_duplicate', 'wpml_get_master_post_from_duplicate_filter' );
[361] Fix | Delete
add_filter( 'wpml_post_duplicates', 'wpml_get_post_duplicates_filter' );
[362] Fix | Delete
add_filter( 'wpml_element_type', 'wpml_element_type_filter' );
[363] Fix | Delete
[364] Fix | Delete
add_filter( 'wpml_setting', 'wpml_get_setting_filter', 10, 3 );
[365] Fix | Delete
add_filter( 'wpml_sub_setting', 'wpml_get_sub_setting_filter', 10, 4 );
[366] Fix | Delete
add_filter( 'wpml_language_is_active', 'wpml_language_is_active_filter', 10, 2 );
[367] Fix | Delete
[368] Fix | Delete
add_action( 'wpml_admin_make_post_duplicates', 'wpml_admin_make_post_duplicates_action', 10, 1 );
[369] Fix | Delete
[370] Fix | Delete
/**
[371] Fix | Delete
* @deprecated This actions will be removed in future releases.
[372] Fix | Delete
*/
[373] Fix | Delete
add_action( 'wpml_make_post_duplicates', 'wpml_make_post_duplicates_action', 10, 1 );
[374] Fix | Delete
[375] Fix | Delete
add_filter( 'wpml_element_language_details', 'wpml_element_language_details_filter', 10, 2 );
[376] Fix | Delete
add_action( 'wpml_set_element_language_details', array( $this, 'set_element_language_details_action' ), 10, 1 );
[377] Fix | Delete
add_filter( 'wpml_element_language_code', 'wpml_element_language_code_filter', 10, 2 );
[378] Fix | Delete
add_filter( 'wpml_elements_without_translations', 'wpml_elements_without_translations_filter', 10, 2 );
[379] Fix | Delete
[380] Fix | Delete
add_action( 'wpml_switch_language', 'wpml_switch_language_action', 10, 1 );
[381] Fix | Delete
}
[382] Fix | Delete
[383] Fix | Delete
function init() {
[384] Fix | Delete
[385] Fix | Delete
do_action( 'wpml_before_init' );
[386] Fix | Delete
$this->locale_utils->init();
[387] Fix | Delete
$this->maybe_set_this_lang();
[388] Fix | Delete
[389] Fix | Delete
if ( function_exists( 'w3tc_add_action' ) ) {
[390] Fix | Delete
w3tc_add_action( 'w3tc_object_cache_key', 'w3tc_translate_cache_key_filter' );
[391] Fix | Delete
}
[392] Fix | Delete
[393] Fix | Delete
$this->get_user_preferences();
[394] Fix | Delete
$this->set_admin_language();
[395] Fix | Delete
[396] Fix | Delete
// Run only if existing content language has been verified, and is front-end or settings are not corrupted
[397] Fix | Delete
if ( $this->get_setting( 'existing_content_language_verified' ) ) {
[398] Fix | Delete
add_action(
[399] Fix | Delete
'wpml_verify_post_translations', array(
[400] Fix | Delete
$this,
[401] Fix | Delete
'verify_post_translations_action',
[402] Fix | Delete
), 10, 1
[403] Fix | Delete
);
[404] Fix | Delete
[405] Fix | Delete
if ( 2 === (int) $this->get_setting( 'language_negotiation_type' ) ) {
[406] Fix | Delete
add_filter( 'allowed_redirect_hosts', array( $this, 'allowed_redirect_hosts' ) );
[407] Fix | Delete
}
[408] Fix | Delete
[409] Fix | Delete
$this->move_current_language_to_the_top();
[410] Fix | Delete
[411] Fix | Delete
add_filter( 'mod_rewrite_rules', array( $this, 'rewrite_rules_filter' ), 10, 1 );
[412] Fix | Delete
[413] Fix | Delete
if (
[414] Fix | Delete
is_admin() && $this->get_setting( 'setup_complete' )
[415] Fix | Delete
&& ! $this->get_wp_api()
[416] Fix | Delete
->is_translation_queue_page() && ! $this->get_wp_api()
[417] Fix | Delete
->is_string_translation_page()
[418] Fix | Delete
) {
[419] Fix | Delete
// Admin language switcher goes to the WP admin bar
[420] Fix | Delete
if ( apply_filters( 'wpml_show_admin_language_switcher', true ) ) {
[421] Fix | Delete
add_action( 'wp_before_admin_bar_render', array( $this, 'admin_language_switcher' ) );
[422] Fix | Delete
} else {
[423] Fix | Delete
$this->set_this_lang( 'all' );
[424] Fix | Delete
}
[425] Fix | Delete
}
[426] Fix | Delete
}
[427] Fix | Delete
[428] Fix | Delete
if ( $this->is_rtl() ) {
[429] Fix | Delete
$GLOBALS['text_direction'] = 'rtl';
[430] Fix | Delete
}
[431] Fix | Delete
[432] Fix | Delete
if ( ! wpml_is_ajax() && is_admin() && ! $this->get_setting( 'dont_show_help_admin_notice' ) ) {
[433] Fix | Delete
WPML_Troubleshooting_Terms_Menu::display_terms_with_suffix_admin_notice();
[434] Fix | Delete
[435] Fix | Delete
if ( ! $this->get_setting( 'setup_wizard_step' )
[436] Fix | Delete
&& strpos( filter_input( INPUT_GET, 'page', FILTER_SANITIZE_URL ), 'menu/languages.php' ) === false
[437] Fix | Delete
&& current_user_can( 'manage_options' )
[438] Fix | Delete
) {
[439] Fix | Delete
add_action( 'admin_notices', array( $this, 'help_admin_notice' ) );
[440] Fix | Delete
}
[441] Fix | Delete
}
[442] Fix | Delete
[443] Fix | Delete
$short_v = implode( '.', array_slice( explode( '.', ICL_SITEPRESS_VERSION ), 0, 3 ) );
[444] Fix | Delete
if ( is_admin() && ( ! isset( $this->settings['hide_upgrade_notice'] ) || $this->get_setting( 'hide_upgrade_notice' ) !== $short_v ) ) {
[445] Fix | Delete
add_action( 'admin_notices', array( $this, 'upgrade_notice' ) );
[446] Fix | Delete
}
[447] Fix | Delete
[448] Fix | Delete
require_once WPML_PLUGIN_PATH . '/inc/template-constants.php';
[449] Fix | Delete
if ( defined( 'WPML_LOAD_API_SUPPORT' ) ) {
[450] Fix | Delete
require_once WPML_PLUGIN_PATH . '/inc/wpml-api.php';
[451] Fix | Delete
}
[452] Fix | Delete
[453] Fix | Delete
add_action( 'wp_footer', array( $this, 'display_wpml_footer' ), 20 );
[454] Fix | Delete
[455] Fix | Delete
if ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST ) {
[456] Fix | Delete
add_action( 'xmlrpc_call', array( $this, 'xmlrpc_call_actions' ) );
[457] Fix | Delete
add_filter( 'xmlrpc_methods', array( $this, 'xmlrpc_methods' ) );
[458] Fix | Delete
}
[459] Fix | Delete
[460] Fix | Delete
global $pagenow;
[461] Fix | Delete
[462] Fix | Delete
// set language to default and remove language switcher when in Taxonomy Translation page
[463] Fix | Delete
// If the page uses AJAX and the language must be forced to default, please use the
[464] Fix | Delete
// if ( $pagenow == 'admin-ajax.php' )above
[465] Fix | Delete
if ( is_admin()
[466] Fix | Delete
&& ( $this->is_taxonomy_related_page()
[467] Fix | Delete
|| $this->is_saving_taxonomy_labels() )
[468] Fix | Delete
) {
[469] Fix | Delete
$this->switch_to_admin_language();
[470] Fix | Delete
add_action( 'init', array( $this, 'remove_admin_language_switcher' ) );
[471] Fix | Delete
}
[472] Fix | Delete
[473] Fix | Delete
/*
[474] Fix | Delete
Posts and new inline created terms, can only be saved in an active language.
[475] Fix | Delete
* Also the content of the post-new.php should always be filtered for one specific
[476] Fix | Delete
* active language, so to display the correct taxonomy terms for selection.
[477] Fix | Delete
*/
[478] Fix | Delete
if ( $pagenow === 'post-new.php' ) {
[479] Fix | Delete
if ( ! $this->is_active_language( $this->get_current_language() ) ) {
[480] Fix | Delete
$this->switch_to_admin_language();
[481] Fix | Delete
}
[482] Fix | Delete
}
[483] Fix | Delete
[484] Fix | Delete
// Code to run when reactivating the plugin
[485] Fix | Delete
$recently_activated = $this->get_setting( 'just_reactivated' );
[486] Fix | Delete
if ( $recently_activated ) {
[487] Fix | Delete
add_action( 'init', array( $this, 'rebuild_language_information' ), 1000 );
[488] Fix | Delete
}
[489] Fix | Delete
if ( is_admin() ) {
[490] Fix | Delete
$mo_file_search = new WPML_MO_File_Search( $this );
[491] Fix | Delete
add_action( 'after_switch_theme', array( $mo_file_search, 'reload_theme_dirs' ) );
[492] Fix | Delete
}
[493] Fix | Delete
[494] Fix | Delete
do_action( 'wpml_after_init' );
[495] Fix | Delete
do_action( 'wpml_loaded', $this );
[496] Fix | Delete
[497] Fix | Delete
if ( isset( $_GET['page'] )
[498] Fix | Delete
&& WPML_PLUGIN_FOLDER . '/menu/taxonomy-translation.php' === $_GET['page']
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function