/home/techb158/on-time-movers.com/wp-content/plugins/polylang/src/admin
Edit: /home/techb158/on-time-movers.com/wp-content/plugins/polylang/src/admin/admin-strings.php (4986B)
__( 'Widget title', 'polylang' ),
'widget_text' => __( 'Widget text', 'polylang' ),
);
global $wp_registered_widgets;
$sidebars = wp_get_sidebars_widgets();
foreach ( $sidebars as $sidebar => $widgets ) {
if ( 'wp_inactive_widgets' == $sidebar || empty( $widgets ) ) {
continue;
}
foreach ( $widgets as $widget ) {
// Nothing can be done if the widget is created using pre WP2.8 API. There is no object, so we can't access it to get the widget options.
if ( ! isset( $wp_registered_widgets[ $widget ]['callback'][0] ) || ! $wp_registered_widgets[ $widget ]['callback'][0] instanceof WP_Widget ) {
continue;
}
$widget_instance = $wp_registered_widgets[ $widget ]['callback'][0];
$widget_settings = $widget_instance->get_settings();
$number = $wp_registered_widgets[ $widget ]['params'][0]['number'];
// Don't enable widget translation if the widget is visible in only one language or if there is no title.
if ( ! empty( $widget_settings[ $number ]['pll_lang'] ) ) {
continue;
}
// Widget title.
if ( ! empty( $widget_settings[ $number ]['title'] ) ) {
self::register_string( self::$default_strings['widget_title'], $widget_settings[ $number ]['title'], 'Widget' );
}
// Text of the Widget text.
if ( ! empty( $widget_settings[ $number ]['text'] ) ) {
self::register_string( self::$default_strings['widget_text'], $widget_settings[ $number ]['text'], 'Widget', true );
}
// Content of the widget custom html.
if ( $widget_instance instanceof WP_Widget_Custom_HTML && ! empty( $widget_settings[ $number ]['content'] ) ) {
self::register_string( self::$default_strings['widget_text'], $widget_settings[ $number ]['content'], 'Widget', true );
}
}
}
/**
* Filter the list of strings registered for translation
* Mainly for use by our PLL_WPML_Compat class
*
* @since 1.0.2
*
* @param array $strings list of strings
*/
self::$strings = apply_filters( 'pll_get_strings', self::$strings );
return self::$strings;
}
/**
* Performs the sanitization ( before saving in DB ) of default strings translations
*
* @since 1.6
*
* @param string $translation The string translation.
* @param string $name The name as defined in pll_register_string. Unused.
* @param string $context The context as defined in pll_register_string. Unused.
* @param string $original The original string to translate. Unused.
* @param string $previous The previous string translation.
* @return string
*/
public static function sanitize_string_translation( $translation, $name, $context, $original, $previous ) {
if ( trim( $previous ) === trim( $translation ) ) {
// Don't overwrite the translation to prevent breaking the string.
return $translation;
}
if ( $name === self::$default_strings['widget_title'] ) {
return sanitize_text_field( $translation );
}
if ( ! current_user_can( 'unfiltered_html' ) ) {
$translation = wp_kses_post( $translation );
}
return $translation;
}
}