1 <?php
2 /**
3 * @package Joomla.Platform
4 * @subpackage String
5 *
6 * @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
7 * @license GNU General Public License version 2 or later; see LICENSE
8 */
9
10 defined('JPATH_PLATFORM') or die;
11
12 JLoader::register('idna_convert', JPATH_LIBRARIES . '/idna_convert/idna_convert.class.php');
13
14 /**
15 * Wrapper class for JStringPunycode
16 *
17 * @package Joomla.Platform
18 * @subpackage String
19 * @since 3.4
20 */
21 class JStringWrapperPunycode
22 {
23 /**
24 * Helper wrapper method for toPunycode
25 *
26 * @param string $utfString The UTF-8 string to transform.
27 *
28 * @return string The punycode string.
29 *
30 * @see JUserHelper::toPunycode()
31 * @since 3.4
32 */
33 public function toPunycode($utfString)
34 {
35 return JStringPunycode::toPunycode($utfString);
36 }
37
38 /**
39 * Helper wrapper method for fromPunycode
40 *
41 * @param string $punycodeString The Punycode string to transform.
42 *
43 * @return string The UF-8 URL.
44 *
45 * @see JUserHelper::fromPunycode()
46 * @since 3.4
47 */
48 public function fromPunycode($punycodeString)
49 {
50 return JStringPunycode::fromPunycode($punycodeString);
51 }
52
53 /**
54 * Helper wrapper method for urlToPunycode
55 *
56 * @param string $uri The UTF-8 URL to transform.
57 *
58 * @return string The punycode URL.
59 *
60 * @see JUserHelper::urlToPunycode()
61 * @since 3.4
62 */
63 public function urlToPunycode($uri)
64 {
65 return JStringPunycode::urlToPunycode($uri);
66 }
67
68 /**
69 * Helper wrapper method for urlToUTF8
70 *
71 * @param string $uri The Punycode URL to transform.
72 *
73 * @return string The UTF-8 URL.
74 *
75 * @see JStringPunycode::urlToUTF8()
76 * @since 3.4
77 */
78 public function urlToUTF8($uri)
79 {
80 return JStringPunycode::urlToUTF8($uri);
81 }
82
83 /**
84 * Helper wrapper method for emailToPunycode
85 *
86 * @param string $email The UTF-8 email to transform.
87 *
88 * @return string The punycode email.
89 *
90 * @see JStringPunycode::emailToPunycode()
91 * @since 3.4
92 */
93 public function emailToPunycode($email)
94 {
95 return JStringPunycode::emailToPunycode($email);
96 }
97
98 /**
99 * Helper wrapper method for emailToUTF8
100 *
101 * @param string $email The punycode email to transform.
102 *
103 * @return string The punycode email.
104 *
105 * @see JStringPunycode::emailToUTF8()
106 * @since 3.4
107 */
108 public function emailToUTF8($email)
109 {
110 return JStringPunycode::emailToUTF8($email);
111 }
112 }
113