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.../themes/Divi/includes/builder/frontend.../theme-bu...
File: wpml.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Disable language filtering of terms in TB.
[2] Fix | Delete
*
[3] Fix | Delete
* @since 4.2
[4] Fix | Delete
*
[5] Fix | Delete
* @param string $parent_id
[6] Fix | Delete
* @param string $child_type
[7] Fix | Delete
* @param string $child_value
[8] Fix | Delete
*/
[9] Fix | Delete
function et_theme_builder_wpml_disable_term_filters( $parent_id, $child_type, $child_value ) {
[10] Fix | Delete
global $sitepress;
[11] Fix | Delete
[12] Fix | Delete
if ( ! $sitepress || 'taxonomy' !== $child_type ) {
[13] Fix | Delete
return;
[14] Fix | Delete
}
[15] Fix | Delete
[16] Fix | Delete
remove_filter( 'terms_clauses', array( $sitepress, 'terms_clauses' ), 10 );
[17] Fix | Delete
remove_filter( 'get_terms_args', array( $sitepress, 'get_terms_args_filter' ), 10 );
[18] Fix | Delete
remove_filter( 'get_term', array( $sitepress, 'get_term_adjust_id' ), 1 );
[19] Fix | Delete
}
[20] Fix | Delete
add_action( 'et_theme_builder_before_get_template_setting_child_options', 'et_theme_builder_wpml_disable_term_filters', 10, 3 );
[21] Fix | Delete
[22] Fix | Delete
/**
[23] Fix | Delete
* Enable language filtering of terms in TB.
[24] Fix | Delete
*
[25] Fix | Delete
* @since 4.2
[26] Fix | Delete
*
[27] Fix | Delete
* @param string $parent_id
[28] Fix | Delete
* @param string $child_type
[29] Fix | Delete
* @param string $child_value
[30] Fix | Delete
*/
[31] Fix | Delete
function et_theme_builder_wpml_enable_term_filters( $parent_id, $child_type, $child_value ) {
[32] Fix | Delete
global $sitepress;
[33] Fix | Delete
[34] Fix | Delete
if ( ! $sitepress || 'taxonomy' !== $child_type ) {
[35] Fix | Delete
return;
[36] Fix | Delete
}
[37] Fix | Delete
[38] Fix | Delete
add_filter( 'terms_clauses', array( $sitepress, 'terms_clauses' ), 10, 3 );
[39] Fix | Delete
add_filter( 'get_terms_args', array( $sitepress, 'get_terms_args_filter' ), 10, 2 );
[40] Fix | Delete
add_filter( 'get_term', array( $sitepress, 'get_term_adjust_id' ), 1, 1 );
[41] Fix | Delete
}
[42] Fix | Delete
add_action( 'et_theme_builder_after_get_template_setting_child_options', 'et_theme_builder_wpml_enable_term_filters', 10, 3 );
[43] Fix | Delete
[44] Fix | Delete
/**
[45] Fix | Delete
* Normalize an object ID to it's base language ID if it is a translation.
[46] Fix | Delete
*
[47] Fix | Delete
* @since 4.2
[48] Fix | Delete
*
[49] Fix | Delete
* @param integer $id
[50] Fix | Delete
* @param string $type
[51] Fix | Delete
* @param string $subtype
[52] Fix | Delete
*
[53] Fix | Delete
* @return integer
[54] Fix | Delete
*/
[55] Fix | Delete
function et_theme_builder_wpml_normalize_object_id( $id, $type, $subtype ) {
[56] Fix | Delete
return apply_filters( 'wpml_object_id', $id, $subtype, true );
[57] Fix | Delete
}
[58] Fix | Delete
add_filter( 'et_theme_builder_template_setting_filter_validation_id', 'et_theme_builder_wpml_normalize_object_id', 10, 3 );
[59] Fix | Delete
[60] Fix | Delete
/**
[61] Fix | Delete
* Prioritize IDs for the current active language over translated IDs
[62] Fix | Delete
* when comparing template settings priority.
[63] Fix | Delete
*
[64] Fix | Delete
* @since 4.2
[65] Fix | Delete
*
[66] Fix | Delete
* @param string $prioritized_setting
[67] Fix | Delete
* @param string $a
[68] Fix | Delete
* @param string $b
[69] Fix | Delete
* @param ET_Theme_Builder_Request $request
[70] Fix | Delete
*
[71] Fix | Delete
* @return string
[72] Fix | Delete
*/
[73] Fix | Delete
function et_theme_builder_wpml_prioritize_translated_id( $prioritized_setting, $a, $b, $request ) {
[74] Fix | Delete
$a_id = '';
[75] Fix | Delete
$a_id_translated = '';
[76] Fix | Delete
$b_id = '';
[77] Fix | Delete
$b_id_translated = '';
[78] Fix | Delete
$a_matches = array();
[79] Fix | Delete
$b_matches = array();
[80] Fix | Delete
[81] Fix | Delete
// Match singular:post_type:<post_type>:id:<id>
[82] Fix | Delete
$singular = '/^singular:post_type:([^:]+):id:(\d+)$/i';
[83] Fix | Delete
// Match singular:post_type:<post_type>:children:id:<id>
[84] Fix | Delete
$singular_children = '/^singular:post_type:([^:]+):children:id:(\d+)$/i';
[85] Fix | Delete
// Match singular:taxonomy:<taxonomy>:term:id:<id>
[86] Fix | Delete
$singular_term = '/^singular:taxonomy:([^:]+):term:id:(\d+)$/i';
[87] Fix | Delete
// Match archive:taxonomy:<taxonomy>:term:id:<id>
[88] Fix | Delete
$archive_term = '/^archive:taxonomy:([^:]+):term:id:(\d+)$/i';
[89] Fix | Delete
[90] Fix | Delete
if ( preg_match( $singular, $a, $a_matches ) && preg_match( $singular, $b, $b_matches ) ) {
[91] Fix | Delete
$a_id = (int) $a_matches[2];
[92] Fix | Delete
$a_id_translated = et_theme_builder_wpml_normalize_object_id( $a_id, 'post', $a_matches[1] );
[93] Fix | Delete
$b_id = (int) $b_matches[2];
[94] Fix | Delete
$b_id_translated = et_theme_builder_wpml_normalize_object_id( $b_id, 'post', $b_matches[1] );
[95] Fix | Delete
} else if ( preg_match( $singular_children, $a, $a_matches ) && preg_match( $singular_children, $b, $b_matches ) ) {
[96] Fix | Delete
$a_id = (int) $a_matches[2];
[97] Fix | Delete
$a_id_translated = et_theme_builder_wpml_normalize_object_id( $a_id, 'post', $a_matches[1] );
[98] Fix | Delete
$b_id = (int) $b_matches[2];
[99] Fix | Delete
$b_id_translated = et_theme_builder_wpml_normalize_object_id( $b_id, 'post', $b_matches[1] );
[100] Fix | Delete
} else if ( preg_match( $singular_term, $a, $a_matches ) && preg_match( $singular_term, $b, $b_matches ) ) {
[101] Fix | Delete
$a_id = (int) $a_matches[2];
[102] Fix | Delete
$a_id_translated = et_theme_builder_wpml_normalize_object_id( $a_id, 'taxonomy', $a_matches[1] );
[103] Fix | Delete
$b_id = (int) $b_matches[2];
[104] Fix | Delete
$b_id_translated = et_theme_builder_wpml_normalize_object_id( $b_id, 'taxonomy', $b_matches[1] );
[105] Fix | Delete
} else if ( preg_match( $archive_term, $a, $a_matches ) && preg_match( $archive_term, $b, $b_matches ) ) {
[106] Fix | Delete
$a_id = (int) $a_matches[2];
[107] Fix | Delete
$a_id_translated = et_theme_builder_wpml_normalize_object_id( $a_id, 'taxonomy', $a_matches[1] );
[108] Fix | Delete
$b_id = (int) $b_matches[2];
[109] Fix | Delete
$b_id_translated = et_theme_builder_wpml_normalize_object_id( $b_id, 'taxonomy', $b_matches[1] );
[110] Fix | Delete
}
[111] Fix | Delete
[112] Fix | Delete
if ( $a_id && $a_id_translated && $a_id_translated === $a_id ) {
[113] Fix | Delete
// $a is an exact match for the current request and not a translated match so we prioritize it.
[114] Fix | Delete
return $a;
[115] Fix | Delete
}
[116] Fix | Delete
[117] Fix | Delete
if ( $b_id && $b_id_translated && $b_id_translated === $b_id ) {
[118] Fix | Delete
// $b is an exact match for the current request and not a translated match so we prioritize it.
[119] Fix | Delete
return $b;
[120] Fix | Delete
}
[121] Fix | Delete
[122] Fix | Delete
// Neither $a nor $b are exact matches so don't prioritize either.
[123] Fix | Delete
return $prioritized_setting;
[124] Fix | Delete
}
[125] Fix | Delete
add_filter( 'et_theme_builder_prioritized_template_setting', 'et_theme_builder_wpml_prioritize_translated_id', 10, 6 );
[126] Fix | Delete
[127] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function