Passed
Push — master ( 8b5e26...f79285 )
by Michael
04:32
created

XoopsMailerLocal   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 40
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A encodeSubject() 0 5 1
A encodeFromName() 0 5 1
1
<?php
2
/*
3
 You may not change or alter any portion of this comment or credits
4
 of supporting developers from this source code or any supporting source code
5
 which is considered copyrighted (c) material of the original comment or credit authors.
6
7
 This program is distributed in the hope that it will be useful,
8
 but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
*/
11
12
/**
13
 *  Xoops Language
14
 *
15
 * @copyright       (c) 2000-2020 XOOPS Project (www.xoops.org)
16
 * @license             GNU GPL 2 (https://www.gnu.org/licenses/gpl-2.0.html)
17
 * @package             kernel
18
 * @subpackage          Xoops Mailer Local Language
19
 * @since               2.3.0
20
 * @author              Taiwen Jiang <[email protected]>
21
 */
22
defined('XOOPS_ROOT_PATH') || exit('Restricted access');
23
/**
24
 * Localize the mail functions
25
 *
26
 * The English localization is solely for demonstration
27
 */
28
// Do not change the class name
29
class XoopsMailerLocal extends XoopsMailer
30
{
31
    /**
32
     * Constructor
33
     */
34
    public function __construct()
35
    {
36
        parent::__construct();
37
        // It is supposed no need to change the charset
38
        $this->charSet = strtolower(_CHARSET);
39
        // You MUST specify the language code value so that the file exists: XOOPS_ROOT_PAT/class/mail/phpmailer/language/lang-["your-language-code"].php
40
        $this->multimailer->setLanguage('en');
41
    }
42
43
    /**
44
     * Multibyte languages are encouraged to make their proper method for encoding FromName
45
     *
46
     * @param $text
47
     *
48
     * @return mixed
49
     */
50
    public function encodeFromName($text)
51
    {
52
        // Activate the following line if needed
53
        // $text = "=?{$this->charSet}?B?".base64_encode($text)."?=";
54
        return $text;
55
    }
56
57
    /**
58
     * Multibyte languages are encouraged to make their proper method for encoding Subject
59
     *
60
     * @param $text
61
     *
62
     * @return mixed
63
     */
64
    public function encodeSubject($text)
65
    {
66
        // Activate the following line if needed
67
        // $text = "=?{$this->charSet}?B?".base64_encode($text)."?=";
68
        return $text;
69
    }
70
}
71