wpml-tm-email-notification-view.php
2.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
class WPML_TM_Email_Notification_View extends WPML_TM_Email_View {
const PROMOTE_TRANSLATION_SERVICES_TEMPLATE = 'notification/promote-translation-services.twig';
/**
* @param array $model
* @param string $template
*
* @return string
*/
public function render_model( array $model, $template ) {
if ( isset( $model['casual_name'] ) && $model['casual_name'] ) {
$content = $this->render_casual_header( $model['casual_name'] );
} else {
$content = $this->render_header( $model['username'] );
}
$content .= $this->template_service->show( $model, $template );
$content .= $this->render_promote_translation_services( $model );
$content .= $this->render_footer();
return $content;
}
/**
* @param array $model
*
* @return string
*/
private function render_promote_translation_services( array $model ) {
$content = '';
if ( isset( $model['promote_translation_services'] ) && $model['promote_translation_services'] ) {
$translation_services_url = esc_url( admin_url( 'admin.php?page=' . WPML_TM_FOLDER . '/menu/main.php&sm=translators' ) );
/* translators: Promote translation services: %s replaced by "professional translation services integrated with WPML" */
$promoteA = esc_html_x( 'Need faster translation work? Try one of the %s.', 'Promote translation services: %s replaced by "professional translation services integrated with WPML"', 'wpml-translation-management' );
/* translators: Promote translation services: Promote translation services: used to build a link to the translation services page */
$promoteB = esc_html_x( 'professional translation services integrated with WPML', 'Promote translation services: used to build a link to the translation services page', 'wpml-translation-management' );
$promote_model['message'] = sprintf( $promoteA, '<a href="' . $translation_services_url . '">' . $promoteB . '</a>' );
$content = $this->template_service->show( $promote_model, self::PROMOTE_TRANSLATION_SERVICES_TEMPLATE );
}
return $content;
}
/** @return string */
private function render_footer() {
$notifications_url = esc_url( admin_url( 'admin.php?page=' . WPML_TM_FOLDER . WPML_Translation_Management::PAGE_SLUG_SETTINGS . '&sm=notifications' ) );
$notifications_text = esc_html__( 'WPML Notification Settings', 'wpml-translation-management' );
$notifications_link = '<a href="' . $notifications_url . '" style="color: #ffffff;">' . $notifications_text . '</a>';
$bottom_text = sprintf(
esc_html__(
'To stop receiving notifications, log-in to %s and change your preferences.',
'wpml-translation-management'
),
$notifications_link
);
return $this->render_email_footer( $bottom_text );
}
}