* changed hook for initialization of email templates paths;

* removed `load_plugin_textdomain` due to (article)[https://make.wordpress.org/core/2024/10/21/i18n-improvements-6-7/#Enhanced-support-for-only-using-PHP-translation-files]
* deprecated `UM()->localize()` function;
* deprecated `um_language_textdomain` filter hook;
This commit is contained in:
Mykyta Synelnikov
2024-11-29 14:09:23 +02:00
parent f5d81f1a41
commit b892a70756
4 changed files with 47 additions and 64 deletions
+16 -19
View File
@@ -47,25 +47,8 @@ if ( ! class_exists( 'um\core\Mail' ) ) {
* Mail constructor.
*/
public function __construct() {
//mandrill compatibility
add_action( 'init', array( &$this, 'init_paths' ), 0 ); // init class variables on zero-priority.
add_filter( 'mandrill_nl2br', array( &$this, 'mandrill_nl2br' ) );
add_action( 'plugins_loaded', array( &$this, 'init_paths' ), 99 ); // @todo change to init.
}
/**
* Mandrill compatibility
*
* @param $nl2br
* @param string $message
* @return bool
*/
public function mandrill_nl2br( $nl2br, $message = '' ) {
// text emails
if ( ! UM()->options()->get( 'email_html' ) ) {
$nl2br = true;
}
return $nl2br;
}
/**
@@ -85,7 +68,7 @@ if ( ! class_exists( 'um\core\Mail' ) ) {
* @example <caption>Extends email templates path.</caption>
* function my_email_templates_path_by_slug( $paths ) {
* // your code here
* $paths['{template_name}'] = '{template_path}';
* $paths['template_name'] = 'template_path';
* return $paths;
* }
* add_filter( 'um_email_templates_path_by_slug', 'my_email_templates_path_by_slug' );
@@ -93,6 +76,20 @@ if ( ! class_exists( 'um\core\Mail' ) ) {
$this->path_by_slug = apply_filters( 'um_email_templates_path_by_slug', $this->path_by_slug );
}
/**
* Mandrill compatibility
*
* @param $nl2br
* @return bool
*/
public function mandrill_nl2br( $nl2br ) {
if ( ! UM()->options()->get( 'email_html' ) ) {
$nl2br = true; // nl2br for text emails
}
return $nl2br;
}
/**
* Check blog ID on multisite, return '' if single site.
*