debug
9 years ago
entities
9 years ago
managers
9 years ago
sdk
9 years ago
supplements
9 years ago
class-freemius-abstract.php
9 years ago
class-freemius.php
9 years ago
class-fs-api.php
9 years ago
class-fs-logger.php
9 years ago
class-fs-plugin-updater.php
9 years ago
class-fs-security.php
9 years ago
fs-core-functions.php
9 years ago
fs-essential-functions.php
9 years ago
fs-plugin-info-dialog.php
9 years ago
i18n.php
9 years ago
index.php
9 years ago
l10n.php
9 years ago
l10n.php
251 lines
| 1 | <?php |
| 2 | /** |
| 3 | * @package Freemius |
| 4 | * @copyright Copyright (c) 2015, Freemius, Inc. |
| 5 | * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
| 6 | * @since 1.2.1.6 |
| 7 | */ |
| 8 | |
| 9 | if ( ! defined( 'ABSPATH' ) ) { |
| 10 | exit; |
| 11 | } |
| 12 | |
| 13 | /** |
| 14 | * Retrieve the translation of $text. |
| 15 | * |
| 16 | * @since 1.2.1.6 |
| 17 | * |
| 18 | * @param string $text |
| 19 | * |
| 20 | * @return string |
| 21 | */ |
| 22 | function _fs_text( $text ) { |
| 23 | return translate( $text, 'freemius' ); |
| 24 | } |
| 25 | |
| 26 | /** |
| 27 | * Retrieve the translation of $text and escapes it for safe use in an attribute. |
| 28 | * |
| 29 | * @since 1.2.1.6 |
| 30 | * |
| 31 | * @param string $text |
| 32 | * |
| 33 | * @return string |
| 34 | */ |
| 35 | function _fs_esc_attr( $text ) { |
| 36 | return esc_attr( translate( $text, 'freemius' ) ); |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * Retrieve the translation of $text and escapes it for safe use in HTML output. |
| 41 | * |
| 42 | * @since 1.2.1.6 |
| 43 | * |
| 44 | * @param string $text |
| 45 | * |
| 46 | * @return string |
| 47 | */ |
| 48 | function _fs_esc_html( $text ) { |
| 49 | return esc_html( translate( $text, 'freemius' ) ); |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * Display translated text. |
| 54 | * |
| 55 | * @since 1.2.0 |
| 56 | * |
| 57 | * @param string $text |
| 58 | */ |
| 59 | function _fs_echo( $text ) { |
| 60 | echo translate( $text, 'freemius' ); |
| 61 | } |
| 62 | |
| 63 | /** |
| 64 | * Display translated text that has been escaped for safe use in an attribute. |
| 65 | * |
| 66 | * @since 1.2.1.6 |
| 67 | * |
| 68 | * @param string $text |
| 69 | */ |
| 70 | function _fs_esc_attr_echo( $text ) { |
| 71 | echo esc_attr( translate( $text, 'freemius' ) ); |
| 72 | } |
| 73 | |
| 74 | /** |
| 75 | * Display translated text that has been escaped for safe use in HTML output. |
| 76 | * |
| 77 | * @since 1.2.1.6 |
| 78 | * |
| 79 | * @param string $text |
| 80 | */ |
| 81 | function _fs_esc_html_echo( $text ) { |
| 82 | echo esc_html( translate( $text, 'freemius' ) ); |
| 83 | } |
| 84 | |
| 85 | /** |
| 86 | * Retrieve translated string with gettext context. |
| 87 | * |
| 88 | * Quite a few times, there will be collisions with similar translatable text |
| 89 | * found in more than two places, but with different translated context. |
| 90 | * |
| 91 | * By including the context in the pot file, translators can translate the two |
| 92 | * strings differently. |
| 93 | * |
| 94 | * @since 1.2.1.6 |
| 95 | * |
| 96 | * @param string $text |
| 97 | * @param string $context |
| 98 | * |
| 99 | * @return string |
| 100 | */ |
| 101 | function _fs_x( $text, $context ) { |
| 102 | return translate_with_gettext_context( $text, $context, 'freemius' ); |
| 103 | } |
| 104 | |
| 105 | /** |
| 106 | * Display translated string with gettext context. |
| 107 | * |
| 108 | * @since 1.2.1.6 |
| 109 | * |
| 110 | * @param string $text |
| 111 | * @param string $context |
| 112 | */ |
| 113 | function _fs_ex( $text, $context ) { |
| 114 | // Avoid misleading Theme Check warning. |
| 115 | $fn = '_x'; |
| 116 | echo $fn( $text, $context, 'freemius' ); |
| 117 | } |
| 118 | |
| 119 | /** |
| 120 | * Translate string with gettext context, and escapes it for safe use in an attribute. |
| 121 | * |
| 122 | * @since 1.2.1.6 |
| 123 | * |
| 124 | * @param string $text |
| 125 | * @param string $context |
| 126 | * |
| 127 | * @return string |
| 128 | */ |
| 129 | function _fs_esc_attr_x( $text, $context ) { |
| 130 | return esc_attr( translate_with_gettext_context( $text, $context, 'freemius' ) ); |
| 131 | } |
| 132 | |
| 133 | /** |
| 134 | * Translate string with gettext context, and escapes it for safe use in HTML output. |
| 135 | * |
| 136 | * @since 2.9.0 |
| 137 | * |
| 138 | * @param string $text |
| 139 | * @param string $context |
| 140 | * |
| 141 | * @return string |
| 142 | */ |
| 143 | function _fs_esc_html_x( $text, $context ) { |
| 144 | return esc_html( translate_with_gettext_context( $text, $context, 'freemius' ) ); |
| 145 | } |
| 146 | |
| 147 | /** |
| 148 | * Translates and retrieves the singular or plural form based on the supplied number. |
| 149 | * |
| 150 | * @since 1.2.1.6 |
| 151 | * |
| 152 | * @param string $single |
| 153 | * @param string $plural |
| 154 | * @param int $number |
| 155 | * |
| 156 | * @return string |
| 157 | */ |
| 158 | function _fs_n( $single, $plural, $number ) { |
| 159 | $translations = get_translations_for_domain( 'freemius' ); |
| 160 | $translation = $translations->translate_plural( $single, $plural, $number ); |
| 161 | |
| 162 | /** |
| 163 | * Filters the singular or plural form of a string. |
| 164 | * |
| 165 | * @since WP 2.2.0 |
| 166 | * |
| 167 | * @param string $translation |
| 168 | * @param string $single |
| 169 | * @param string $plural |
| 170 | * @param string $number |
| 171 | * @param string $domain |
| 172 | */ |
| 173 | return apply_filters( 'ngettext', $translation, $single, $plural, $number, 'freemius' ); |
| 174 | } |
| 175 | |
| 176 | /** |
| 177 | * Translates and retrieves the singular or plural form based on the supplied number, with gettext context. |
| 178 | * |
| 179 | * @since 1.2.1.6 |
| 180 | * |
| 181 | * @param string $single |
| 182 | * @param string $plural |
| 183 | * @param int $number |
| 184 | * @param string $context |
| 185 | * |
| 186 | * @return string |
| 187 | */ |
| 188 | function _fs_nx($single, $plural, $number, $context ) { |
| 189 | $translations = get_translations_for_domain( 'freemius' ); |
| 190 | $translation = $translations->translate_plural( $single, $plural, $number, $context ); |
| 191 | |
| 192 | /** |
| 193 | * Filters the singular or plural form of a string with gettext context. |
| 194 | * |
| 195 | * @since WP 3.0 |
| 196 | * |
| 197 | * @param string $translation |
| 198 | * @param string $single |
| 199 | * @param string $plural |
| 200 | * @param string $number |
| 201 | * @param string $context |
| 202 | * @param string $domain |
| 203 | */ |
| 204 | return apply_filters( 'ngettext_with_context', $translation, $single, $plural, $number, $context, 'freemius' ); |
| 205 | } |
| 206 | |
| 207 | /** |
| 208 | * Registers plural strings in POT file, but does not translate them. |
| 209 | * |
| 210 | * Used when you want to keep structures with translatable plural |
| 211 | * strings and use them later when the number is known. |
| 212 | * |
| 213 | * @since 1.2.1.6 |
| 214 | * |
| 215 | * @param string $singular |
| 216 | * @param string $plural |
| 217 | * |
| 218 | * @return array |
| 219 | */ |
| 220 | function _fs_n_noop( $singular, $plural ) { |
| 221 | return array( |
| 222 | 'singular' => $singular, |
| 223 | 'plural' => $plural, |
| 224 | 'context' => null, |
| 225 | 'domain' => 'freemius' |
| 226 | ); |
| 227 | } |
| 228 | |
| 229 | /** |
| 230 | * Registers plural strings with gettext context in POT file, but does not translate them. |
| 231 | * |
| 232 | * Used when you want to keep structures with translatable plural |
| 233 | * strings and use them later when the number is known. |
| 234 | * |
| 235 | * @since 1.2.1.6 |
| 236 | * |
| 237 | * @param string $singular |
| 238 | * @param string $plural |
| 239 | * @param string $context |
| 240 | * |
| 241 | * @return array |
| 242 | */ |
| 243 | function _fs_nx_noop( $singular, $plural, $context ) { |
| 244 | return array( |
| 245 | 'singular' => $singular, |
| 246 | 'plural' => $plural, |
| 247 | 'context' => $context, |
| 248 | 'domain' => 'freemius' |
| 249 | ); |
| 250 | } |
| 251 |