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: functions-load.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* @global WPML_Term_Translation $wpml_term_translations
[2] Fix | Delete
* @global WPML_Slug_Filter $wpml_slug_filter
[3] Fix | Delete
*/
[4] Fix | Delete
[5] Fix | Delete
/**
[6] Fix | Delete
* Loads global variables providing functionality that is used throughout the plugin.
[7] Fix | Delete
*
[8] Fix | Delete
* @param null|book $is_admin If set to `null` it will read from `is_admin()`
[9] Fix | Delete
*
[10] Fix | Delete
* @global $wpml_language_resolution
[11] Fix | Delete
* @global $wpml_slug_filter
[12] Fix | Delete
* @global WPML_Term_Translation $wpml_term_translations
[13] Fix | Delete
*/
[14] Fix | Delete
function load_essential_globals( $is_admin = null ) {
[15] Fix | Delete
global $wpml_language_resolution, $wpml_term_translations, $wpdb;
[16] Fix | Delete
[17] Fix | Delete
$settings = get_option( 'icl_sitepress_settings' );
[18] Fix | Delete
if ( (bool) $settings === false ) {
[19] Fix | Delete
icl_sitepress_activate();
[20] Fix | Delete
} else {
[21] Fix | Delete
[22] Fix | Delete
if ( isset( $settings[ 'setup_complete' ] ) && $settings[ 'setup_complete' ] ) {
[23] Fix | Delete
$active_plugins = get_option( 'active_plugins' );
[24] Fix | Delete
$wpmu_sitewide_plugins = (array) maybe_unserialize( get_site_option( 'active_sitewide_plugins' ) );
[25] Fix | Delete
[26] Fix | Delete
if ( in_array( WPML_PLUGIN_BASENAME,
[27] Fix | Delete
$active_plugins,
[28] Fix | Delete
true ) === false &&
[29] Fix | Delete
in_array( WPML_PLUGIN_BASENAME,
[30] Fix | Delete
array_keys( $wpmu_sitewide_plugins ),
[31] Fix | Delete
true ) === false
[32] Fix | Delete
) {
[33] Fix | Delete
[34] Fix | Delete
// The plugin has just be reactivated.
[35] Fix | Delete
[36] Fix | Delete
// reset ajx_health_flag
[37] Fix | Delete
// set the just_reactivated flag so any posts created while
[38] Fix | Delete
// WPML was not activate will get the default language
[39] Fix | Delete
// https://onthegosystems.myjetbrains.com/youtrack/issue/wpmlcore-1924
[40] Fix | Delete
$settings[ 'ajx_health_checked' ] = 0;
[41] Fix | Delete
$settings[ 'just_reactivated' ] = 1;
[42] Fix | Delete
update_option( 'icl_sitepress_settings', $settings );
[43] Fix | Delete
}
[44] Fix | Delete
}
[45] Fix | Delete
}
[46] Fix | Delete
[47] Fix | Delete
[48] Fix | Delete
$active_language_codes = isset( $settings[ 'active_languages' ] ) ? $settings[ 'active_languages' ]
[49] Fix | Delete
: array();
[50] Fix | Delete
$active_language_codes = (bool) $active_language_codes === true
[51] Fix | Delete
? $active_language_codes : wpml_reload_active_languages_setting ();
[52] Fix | Delete
$default_lang_code = isset( $settings[ 'default_language' ] ) ? $settings[ 'default_language' ]
[53] Fix | Delete
: false;
[54] Fix | Delete
$wpml_language_resolution = new WPML_Language_Resolution( $active_language_codes, $default_lang_code );
[55] Fix | Delete
$admin = $is_admin === null ? is_admin() : $is_admin;
[56] Fix | Delete
[57] Fix | Delete
wpml_load_post_translation( $admin, $settings );
[58] Fix | Delete
$wpml_term_translations = new WPML_Term_Translation( $wpdb );
[59] Fix | Delete
$domain_validation = filter_input( INPUT_GET, '____icl_validate_domain' ) ? 1 : false;
[60] Fix | Delete
$domain_validation = filter_input( INPUT_GET, '____icl_validate_directory' ) ? 2 : $domain_validation;
[61] Fix | Delete
$url_converter = load_wpml_url_converter( $settings, $domain_validation, $default_lang_code );
[62] Fix | Delete
$directory = $domain_validation === 2 || ( is_multisite() && ! is_subdomain_install() );
[63] Fix | Delete
if ( $domain_validation ) {
[64] Fix | Delete
echo wpml_validate_host( $_SERVER['REQUEST_URI'], $url_converter, $directory );
[65] Fix | Delete
exit;
[66] Fix | Delete
}
[67] Fix | Delete
if ( $admin ) {
[68] Fix | Delete
wpml_load_admin_files();
[69] Fix | Delete
}
[70] Fix | Delete
}
[71] Fix | Delete
[72] Fix | Delete
function wpml_load_post_translation( $is_admin, $settings ) {
[73] Fix | Delete
global $wpml_post_translations, $wpdb;
[74] Fix | Delete
[75] Fix | Delete
$http_referer_factory = new WPML_URL_HTTP_Referer_Factory();
[76] Fix | Delete
$http_referer = $http_referer_factory->create();
[77] Fix | Delete
[78] Fix | Delete
if ( $is_admin === true
[79] Fix | Delete
|| $http_referer->is_rest_request_called_from_post_edit_page()
[80] Fix | Delete
|| ( defined( 'WP_CLI' ) && WP_CLI )
[81] Fix | Delete
) {
[82] Fix | Delete
$wpml_post_translations = new WPML_Admin_Post_Actions( $settings, $wpdb );
[83] Fix | Delete
} else {
[84] Fix | Delete
$wpml_post_translations = new WPML_Frontend_Post_Actions( $settings, $wpdb );
[85] Fix | Delete
wpml_load_frontend_tax_filters ();
[86] Fix | Delete
}
[87] Fix | Delete
[88] Fix | Delete
$wpml_post_translations->init();
[89] Fix | Delete
}
[90] Fix | Delete
[91] Fix | Delete
function wpml_load_request_handler( $is_admin, $active_language_codes, $default_language ) {
[92] Fix | Delete
/**
[93] Fix | Delete
* @var WPML_Request $wpml_request_handler
[94] Fix | Delete
* @var WPML_URL_Converter $wpml_url_converter
[95] Fix | Delete
*/
[96] Fix | Delete
global $wpml_request_handler, $wpml_url_converter;
[97] Fix | Delete
[98] Fix | Delete
if ( ! isset( $wpml_request_handler ) ) {
[99] Fix | Delete
require WPML_PLUGIN_PATH . '/inc/request-handling/wpml-request.class.php';
[100] Fix | Delete
require WPML_PLUGIN_PATH . '/inc/request-handling/wpml-backend-request.class.php';
[101] Fix | Delete
}
[102] Fix | Delete
[103] Fix | Delete
$wpml_cookie = new WPML_Cookie();
[104] Fix | Delete
$wp_api = new WPML_WP_API();
[105] Fix | Delete
[106] Fix | Delete
$rest_request_analyze = \WPML\Container\make( \WPML_REST_Request_Analyze::class );
[107] Fix | Delete
$is_backend_rest = $rest_request_analyze->is_rest_request()
[108] Fix | Delete
&& ! $rest_request_analyze->should_load_on_frontend();
[109] Fix | Delete
[110] Fix | Delete
if ( $is_admin === true || $is_backend_rest ) {
[111] Fix | Delete
$wpml_request_handler = new WPML_Backend_Request(
[112] Fix | Delete
$wpml_url_converter,
[113] Fix | Delete
$active_language_codes,
[114] Fix | Delete
$default_language, $wpml_cookie,
[115] Fix | Delete
$wp_api );
[116] Fix | Delete
} else {
[117] Fix | Delete
$wpml_request_handler = new WPML_Frontend_Request(
[118] Fix | Delete
$wpml_url_converter,
[119] Fix | Delete
$active_language_codes,
[120] Fix | Delete
$default_language, $wpml_cookie,
[121] Fix | Delete
$wp_api );
[122] Fix | Delete
}
[123] Fix | Delete
[124] Fix | Delete
return $wpml_request_handler;
[125] Fix | Delete
}
[126] Fix | Delete
[127] Fix | Delete
function wpml_load_query_filter( $installed ) {
[128] Fix | Delete
global $wpml_query_filter, $sitepress, $wpdb, $wpml_post_translations, $wpml_term_translations;
[129] Fix | Delete
[130] Fix | Delete
$wpml_query_filter = $wpml_query_filter ? $wpml_query_filter : new WPML_Query_Filter( $sitepress, $wpdb, $wpml_post_translations, $wpml_term_translations );
[131] Fix | Delete
if ( $installed ) {
[132] Fix | Delete
if ( ! has_filter( 'posts_join', array( $wpml_query_filter, 'posts_join_filter' ) ) ) {
[133] Fix | Delete
add_filter( 'posts_join', array( $wpml_query_filter, 'posts_join_filter' ), 10, 2 );
[134] Fix | Delete
add_filter( 'posts_where', array( $wpml_query_filter, 'posts_where_filter' ), 10, 2 );
[135] Fix | Delete
}
[136] Fix | Delete
}
[137] Fix | Delete
}
[138] Fix | Delete
[139] Fix | Delete
function load_wpml_url_converter( $settings, $domain_validation, $default_lang_code ) {
[140] Fix | Delete
/**
[141] Fix | Delete
* @var WPML_URL_Converter $wpml_url_converter
[142] Fix | Delete
* @var WPML_Language_Resolution $wpml_language_resolution
[143] Fix | Delete
*/
[144] Fix | Delete
global $wpml_url_converter, $wpml_language_resolution;
[145] Fix | Delete
[146] Fix | Delete
$url_type = isset( $settings['language_negotiation_type'] ) ? $settings['language_negotiation_type'] : false;
[147] Fix | Delete
$url_type = $domain_validation ? $domain_validation : $url_type;
[148] Fix | Delete
$active_language_codes = $wpml_language_resolution->get_active_language_codes();
[149] Fix | Delete
[150] Fix | Delete
$factory = new WPML_URL_Converter_Factory( $settings, $default_lang_code, $active_language_codes );
[151] Fix | Delete
$wpml_url_converter = $factory->create( (int) $url_type );
[152] Fix | Delete
[153] Fix | Delete
return $wpml_url_converter;
[154] Fix | Delete
}
[155] Fix | Delete
[156] Fix | Delete
/**
[157] Fix | Delete
* @param string $req_uri
[158] Fix | Delete
* @param WPML_URL_Converter $wpml_url_converter
[159] Fix | Delete
* @param bool $directory
[160] Fix | Delete
*
[161] Fix | Delete
* @return string
[162] Fix | Delete
*/
[163] Fix | Delete
function wpml_validate_host( $req_uri, $wpml_url_converter, $directory = true ) {
[164] Fix | Delete
if ( $directory === true ) {
[165] Fix | Delete
$req_uri_parts = array_filter ( explode ( '/', $req_uri ) );
[166] Fix | Delete
$lang_slug = array_pop ( $req_uri_parts );
[167] Fix | Delete
if ( strpos ( $lang_slug, '?' ) === 0 ) {
[168] Fix | Delete
$lang_slug = array_pop ( $req_uri_parts );
[169] Fix | Delete
} elseif ( strpos ( $lang_slug, '?' ) !== false ) {
[170] Fix | Delete
$parts = explode ( '?', $lang_slug );
[171] Fix | Delete
$lang_slug = array_shift ( $parts );
[172] Fix | Delete
}
[173] Fix | Delete
} else {
[174] Fix | Delete
$lang_slug = '';
[175] Fix | Delete
}
[176] Fix | Delete
[177] Fix | Delete
return '<!--' . esc_url( untrailingslashit ( trailingslashit ( $wpml_url_converter->get_abs_home () ) . $lang_slug ) ) . '-->';
[178] Fix | Delete
}
[179] Fix | Delete
[180] Fix | Delete
/**
[181] Fix | Delete
* Checks if a given taxonomy is currently translated
[182] Fix | Delete
*
[183] Fix | Delete
* @param string $taxonomy name/slug of a taxonomy
[184] Fix | Delete
* @return bool true if the taxonomy is currently set to being translatable in WPML
[185] Fix | Delete
*/
[186] Fix | Delete
function is_taxonomy_translated( $taxonomy ) {
[187] Fix | Delete
[188] Fix | Delete
return in_array( $taxonomy, array( 'category', 'post_tag', 'nav_menu' ), true )
[189] Fix | Delete
|| in_array(
[190] Fix | Delete
$taxonomy,
[191] Fix | Delete
array_keys( array_filter( icl_get_setting( 'taxonomies_sync_option', array() ) ) )
[192] Fix | Delete
);
[193] Fix | Delete
}
[194] Fix | Delete
[195] Fix | Delete
/**
[196] Fix | Delete
* Checks if a given post_type is currently translated
[197] Fix | Delete
*
[198] Fix | Delete
* @param string $post_type name/slug of a post_type
[199] Fix | Delete
* @return bool true if the post_type is currently set to being translatable in WPML
[200] Fix | Delete
*/
[201] Fix | Delete
function is_post_type_translated( $post_type ) {
[202] Fix | Delete
[203] Fix | Delete
return 'nav_menu_item' === $post_type ||
[204] Fix | Delete
in_array(
[205] Fix | Delete
$post_type,
[206] Fix | Delete
array_keys( array_filter( icl_get_setting( 'custom_posts_sync_option', array() ) ) )
[207] Fix | Delete
);
[208] Fix | Delete
}
[209] Fix | Delete
[210] Fix | Delete
function setup_admin_menus() {
[211] Fix | Delete
global $pagenow, $sitepress;
[212] Fix | Delete
[213] Fix | Delete
if ( $pagenow === 'edit-tags.php' || $pagenow === 'term.php' ) {
[214] Fix | Delete
maybe_load_translated_tax_screen ();
[215] Fix | Delete
$wpml_term_translation_help_notice = new WPML_Taxonomy_Translation_Help_Notice( wpml_get_admin_notices(), $sitepress );
[216] Fix | Delete
$wpml_term_translation_help_notice->add_hooks();
[217] Fix | Delete
}
[218] Fix | Delete
}
[219] Fix | Delete
[220] Fix | Delete
function maybe_load_translated_tax_screen() {
[221] Fix | Delete
$taxonomy_get = (string) filter_input( INPUT_GET, 'taxonomy' );
[222] Fix | Delete
$taxonomy_get = $taxonomy_get ? $taxonomy_get : 'post_tag';
[223] Fix | Delete
if ( is_taxonomy_translated( $taxonomy_get ) ) {
[224] Fix | Delete
global $wpdb, $sitepress;
[225] Fix | Delete
require WPML_PLUGIN_PATH . '/menu/term-taxonomy-menus/wpml-tax-menu-loader.class.php';
[226] Fix | Delete
new WPML_Tax_Menu_Loader( $wpdb, $sitepress, $taxonomy_get );
[227] Fix | Delete
}
[228] Fix | Delete
}
[229] Fix | Delete
[230] Fix | Delete
function wpml_reload_active_languages_setting( $override = false ) {
[231] Fix | Delete
global $wpdb, $sitepress_settings;
[232] Fix | Delete
[233] Fix | Delete
if ( true === (bool) $sitepress_settings
[234] Fix | Delete
&& ( $override || wpml_get_setting_filter( false, 'setup_complete' ) )
[235] Fix | Delete
) {
[236] Fix | Delete
if ( $wpdb->query( "SHOW TABLES LIKE '{$wpdb->prefix}icl_languages'") ) {
[237] Fix | Delete
$active_languages = $wpdb->get_col( " SELECT code
[238] Fix | Delete
FROM {$wpdb->prefix}icl_languages
[239] Fix | Delete
WHERE active = 1" );
[240] Fix | Delete
} else {
[241] Fix | Delete
$active_languages = array();
[242] Fix | Delete
}
[243] Fix | Delete
$sitepress_settings['active_languages'] = $active_languages;
[244] Fix | Delete
icl_set_setting( 'active_languages', $active_languages, true );
[245] Fix | Delete
} else {
[246] Fix | Delete
$active_languages = array();
[247] Fix | Delete
}
[248] Fix | Delete
[249] Fix | Delete
return (array) $active_languages;
[250] Fix | Delete
}
[251] Fix | Delete
[252] Fix | Delete
/**
[253] Fix | Delete
* Returns and if necessary instantiates an instance of the WPML_Installation Class
[254] Fix | Delete
*
[255] Fix | Delete
* @return \WPML_Installation
[256] Fix | Delete
*/
[257] Fix | Delete
function wpml_get_setup_instance() {
[258] Fix | Delete
global $wpml_installation, $wpdb, $sitepress;
[259] Fix | Delete
[260] Fix | Delete
if ( ! isset( $wpml_installation ) ) {
[261] Fix | Delete
$wpml_installation = new WPML_Installation( $wpdb, $sitepress );
[262] Fix | Delete
}
[263] Fix | Delete
[264] Fix | Delete
return $wpml_installation;
[265] Fix | Delete
}
[266] Fix | Delete
[267] Fix | Delete
function wpml_load_admin_files() {
[268] Fix | Delete
require_once WPML_PLUGIN_PATH . '/menu/wpml-troubleshooting-terms-menu.class.php';
[269] Fix | Delete
require_once WPML_PLUGIN_PATH . '/inc/wpml-post-edit-ajax.class.php';
[270] Fix | Delete
require_once WPML_PLUGIN_PATH . '/menu/wpml-post-status-display.class.php';
[271] Fix | Delete
require_once WPML_PLUGIN_PATH . '/inc/utilities/wpml-color-picker.class.php';
[272] Fix | Delete
}
[273] Fix | Delete
[274] Fix | Delete
function wpml_get_post_status_helper() {
[275] Fix | Delete
global $wpml_post_status, $wpdb, $sitepress;
[276] Fix | Delete
[277] Fix | Delete
if ( ! isset( $wpml_post_status ) ) {
[278] Fix | Delete
$wpml_post_status = new WPML_Post_Status( $wpdb, $sitepress->get_wp_api() );
[279] Fix | Delete
}
[280] Fix | Delete
[281] Fix | Delete
return $wpml_post_status;
[282] Fix | Delete
}
[283] Fix | Delete
[284] Fix | Delete
function wpml_get_create_post_helper() {
[285] Fix | Delete
global $sitepress;
[286] Fix | Delete
[287] Fix | Delete
return new WPML_Create_Post_Helper( $sitepress );
[288] Fix | Delete
}
[289] Fix | Delete
[290] Fix | Delete
/**
[291] Fix | Delete
* @return \TranslationManagement
[292] Fix | Delete
*/
[293] Fix | Delete
function wpml_load_core_tm() {
[294] Fix | Delete
global $iclTranslationManagement;
[295] Fix | Delete
[296] Fix | Delete
if ( !isset( $iclTranslationManagement ) ) {
[297] Fix | Delete
require_once WPML_PLUGIN_PATH . '/inc/translation-management/translation-management.class.php';
[298] Fix | Delete
$iclTranslationManagement = new TranslationManagement();
[299] Fix | Delete
}
[300] Fix | Delete
[301] Fix | Delete
return $iclTranslationManagement;
[302] Fix | Delete
}
[303] Fix | Delete
[304] Fix | Delete
function wpml_get_langs_in_dirs_val( $http_client, $wpml_url_converter, $posted_url = false ) {
[305] Fix | Delete
global $sitepress;
[306] Fix | Delete
[307] Fix | Delete
require_once WPML_PLUGIN_PATH . '/inc/url-handling/wpml-lang-url-validator.class.php';
[308] Fix | Delete
$posted_url = $posted_url ? $posted_url : (string) filter_input ( INPUT_POST, 'url' );
[309] Fix | Delete
[310] Fix | Delete
return new WPML_Lang_URL_Validator( $http_client, $wpml_url_converter, $posted_url, $sitepress );
[311] Fix | Delete
}
[312] Fix | Delete
[313] Fix | Delete
function wpml_get_root_page_actions_obj() {
[314] Fix | Delete
global $wpml_root_page_actions, $sitepress_settings;
[315] Fix | Delete
[316] Fix | Delete
if ( !isset( $wpml_root_page_actions ) ) {
[317] Fix | Delete
require_once WPML_PLUGIN_PATH . '/inc/post-translation/wpml-root-page-actions.class.php';
[318] Fix | Delete
$wpml_root_page_actions = new WPML_Root_Page_Actions( $sitepress_settings );
[319] Fix | Delete
}
[320] Fix | Delete
[321] Fix | Delete
return $wpml_root_page_actions;
[322] Fix | Delete
}
[323] Fix | Delete
[324] Fix | Delete
function wpml_get_hierarchy_sync_helper( $type = 'post' ) {
[325] Fix | Delete
global $wpdb;
[326] Fix | Delete
[327] Fix | Delete
if ( $type === 'post' ) {
[328] Fix | Delete
require_once WPML_PLUGIN_PATH . '/inc/post-translation/wpml-post-hierarchy-sync.class.php';
[329] Fix | Delete
$hierarchy_helper = new WPML_Post_Hierarchy_Sync( $wpdb );
[330] Fix | Delete
} elseif ( $type === 'term' ) {
[331] Fix | Delete
require_once WPML_PLUGIN_PATH . '/inc/taxonomy-term-translation/wpml-term-hierarchy-sync.class.php';
[332] Fix | Delete
$hierarchy_helper = new WPML_Term_Hierarchy_Sync( $wpdb );
[333] Fix | Delete
} else {
[334] Fix | Delete
$hierarchy_helper = false;
[335] Fix | Delete
}
[336] Fix | Delete
[337] Fix | Delete
return $hierarchy_helper;
[338] Fix | Delete
}
[339] Fix | Delete
[340] Fix | Delete
function wpml_maybe_setup_post_edit() {
[341] Fix | Delete
global $pagenow, $sitepress, $post_edit_screen;
[342] Fix | Delete
[343] Fix | Delete
if ( in_array( $pagenow, array( 'post.php', 'post-new.php', 'edit.php' ), true ) || defined( 'DOING_AJAX' )
[344] Fix | Delete
) {
[345] Fix | Delete
$post_edit_screen = new WPML_Post_Edit_Screen( $sitepress );
[346] Fix | Delete
add_action( 'admin_head', array( $sitepress, 'post_edit_language_options' ) );
[347] Fix | Delete
}
[348] Fix | Delete
}
[349] Fix | Delete
[350] Fix | Delete
/**
[351] Fix | Delete
* @return \WPML_Frontend_Tax_Filters
[352] Fix | Delete
*/
[353] Fix | Delete
function wpml_load_frontend_tax_filters() {
[354] Fix | Delete
global $wpml_term_filters;
[355] Fix | Delete
[356] Fix | Delete
if ( !isset( $wpml_term_filters ) ) {
[357] Fix | Delete
require WPML_PLUGIN_PATH . '/inc/taxonomy-term-translation/wpml-frontend-tax-filters.class.php';
[358] Fix | Delete
$wpml_term_filters = new WPML_Frontend_Tax_Filters();
[359] Fix | Delete
}
[360] Fix | Delete
[361] Fix | Delete
return $wpml_term_filters;
[362] Fix | Delete
}
[363] Fix | Delete
[364] Fix | Delete
/**
[365] Fix | Delete
* @return \WPML_Settings_Helper
[366] Fix | Delete
*/
[367] Fix | Delete
function wpml_load_settings_helper() {
[368] Fix | Delete
global $wpml_settings_helper, $sitepress, $wpml_post_translations;
[369] Fix | Delete
[370] Fix | Delete
if ( ! isset( $wpml_settings_helper ) ) {
[371] Fix | Delete
$wpml_settings_helper = new WPML_Settings_Helper( $wpml_post_translations, $sitepress );
[372] Fix | Delete
}
[373] Fix | Delete
[374] Fix | Delete
return $wpml_settings_helper;
[375] Fix | Delete
}
[376] Fix | Delete
[377] Fix | Delete
function wpml_get_term_translation_util() {
[378] Fix | Delete
global $sitepress;
[379] Fix | Delete
require_once WPML_PLUGIN_PATH . '/inc/taxonomy-term-translation/wpml-term-translation-utils.class.php';
[380] Fix | Delete
[381] Fix | Delete
return new WPML_Term_Translation_Utils( $sitepress );
[382] Fix | Delete
}
[383] Fix | Delete
[384] Fix | Delete
/**
[385] Fix | Delete
* @return \WPML_Term_Filters
[386] Fix | Delete
*/
[387] Fix | Delete
function wpml_load_term_filters() {
[388] Fix | Delete
global $wpml_term_filters_general, $sitepress, $wpdb;
[389] Fix | Delete
[390] Fix | Delete
if ( ! isset( $wpml_term_filters_general ) ) {
[391] Fix | Delete
require WPML_PLUGIN_PATH . '/inc/taxonomy-term-translation/wpml-term-filters.class.php';
[392] Fix | Delete
$wpml_term_filters_general = new WPML_Term_Filters( $wpdb, $sitepress );
[393] Fix | Delete
$wpml_term_filters_general->init();
[394] Fix | Delete
}
[395] Fix | Delete
[396] Fix | Delete
return $wpml_term_filters_general;
[397] Fix | Delete
}
[398] Fix | Delete
[399] Fix | Delete
function wpml_show_user_options() {
[400] Fix | Delete
global $sitepress, $current_user, $user_id, $pagenow;
[401] Fix | Delete
[402] Fix | Delete
if ( ! isset( $user_id ) && 'profile.php' === $pagenow ) {
[403] Fix | Delete
$user_id = $current_user->ID;
[404] Fix | Delete
}
[405] Fix | Delete
[406] Fix | Delete
$user = new WP_User( $user_id );
[407] Fix | Delete
$user_options_menu = new WPML_User_Options_Menu( $sitepress, $user );
[408] Fix | Delete
echo $user_options_menu->render();
[409] Fix | Delete
}
[410] Fix | Delete
[411] Fix | Delete
/**
[412] Fix | Delete
* @return \WPML_Upgrade_Command_Factory
[413] Fix | Delete
*/
[414] Fix | Delete
function wpml_get_upgrade_command_factory() {
[415] Fix | Delete
static $factory;
[416] Fix | Delete
if ( ! $factory ) {
[417] Fix | Delete
$factory = new WPML_Upgrade_Command_Factory();
[418] Fix | Delete
}
[419] Fix | Delete
[420] Fix | Delete
return $factory;
[421] Fix | Delete
}
[422] Fix | Delete
[423] Fix | Delete
function wpml_get_upgrade_schema() {
[424] Fix | Delete
global $wpdb;
[425] Fix | Delete
static $instance;
[426] Fix | Delete
[427] Fix | Delete
if ( ! $instance ) {
[428] Fix | Delete
$instance = new WPML_Upgrade_Schema( $wpdb );
[429] Fix | Delete
}
[430] Fix | Delete
[431] Fix | Delete
return $instance;
[432] Fix | Delete
}
[433] Fix | Delete
[434] Fix | Delete
/**
[435] Fix | Delete
* @param string $class_name A class implementing \IWPML_Upgrade_Command.
[436] Fix | Delete
* @param array $dependencies An array of dependencies passed to the `$class_name`'s constructor.
[437] Fix | Delete
* @param array $scopes An array of scope values. Accepted values are: `\WPML_Upgrade::SCOPE_ADMIN`, `\WPML_Upgrade::SCOPE_AJAX`, and `\WPML_Upgrade::SCOPE_FRONT_END`.
[438] Fix | Delete
* @param string|null $method The method to call to run the upgrade (otherwise, it calls the "run" method),
[439] Fix | Delete
*
[440] Fix | Delete
* @return \WPML_Upgrade_Command_Definition
[441] Fix | Delete
*/
[442] Fix | Delete
function wpml_create_upgrade_command_definition( $class_name, array $dependencies, array $scopes, $method = null ) {
[443] Fix | Delete
return wpml_get_upgrade_command_factory()->create_command_definition( $class_name, $dependencies, $scopes, $method );
[444] Fix | Delete
}
[445] Fix | Delete
[446] Fix | Delete
if ( is_admin() ) {
[447] Fix | Delete
add_action( 'personal_options', 'wpml_show_user_options' );
[448] Fix | Delete
}
[449] Fix | Delete
[450] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function