PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.18.0
GiveWP – Donation Plugin and Fundraising Platform v4.18.0
4.18.0 4.17.0 4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 All 257 releases
← All changes | includes/class-give-translation.php +34 -24 2.3.1 → 4.18.0 View file →
@@ -1,6 +1,8 @@
1 1 <?php
2 2
3 +use Give\Log\Log;
4 +
3 5 /**
4 6 * Translations
5 7 *
6 8 * @package Give
@@ -34,9 +36,9 @@
34 36 * @since 2.0
35 37 * @access private
36 38 * @var
37 39 */
38 - private static $text_translations = array();
40 + private static $text_translations = array();
39 41
40 42 /**
41 43 * Singleton pattern.
42 44 *
@@ -129,9 +131,8 @@
129 131 if ( empty( $args['text'] ) ) {
130 132 /* @var WP_Error $error */
131 133 $error = new WP_Error( 'EMPTY_TEXT', __( 'Empty string is not allowed.', 'give' ), $args );
132 134 throw new Exception( $error->get_error_message( 'EMPTY_TEXT' ) );
133 -
134 135 } elseif ( empty( $args['id'] ) ) {
135 136 /* @var WP_Error $error */
136 137 $error = new WP_Error( 'EMPTY_ID', __( 'Empty ID is not allowed.', 'give' ), $args );
137 138 throw new Exception( $error->get_error_message( 'EMPTY_ID' ) );
@@ -161,10 +162,10 @@
161 162 } else {
162 163 self::$text_configs[ $args['id'] ] = $args;
163 164 }
164 165 } catch ( Exception $e ) {
165 - error_log( $e->getMessage() );
166 - }// End try().
166 + Log::error( $e->getMessage() );
167 + }// End try().
167 168
168 169 /**
169 170 * Filter the texts
170 171 *
@@ -273,13 +274,15 @@
273 274 *
274 275 * @return string
275 276 */
276 277 public static function add_label_translation( $id, $group = '', $text = '' ) {
277 - return self::get_text( array(
278 - 'id' => "{$id}_label",
279 - 'group' => $group,
280 - 'text' => $text,
281 - ) );
278 + return self::get_text(
279 + array(
280 + 'id' => "{$id}_label",
281 + 'group' => $group,
282 + 'text' => $text,
283 + )
284 + );
282 285 }
283 286
284 287 /**
285 288 * Get tooltip translation by group ( if any )
@@ -293,13 +296,15 @@
293 296 *
294 297 * @return string
295 298 */
296 299 public static function add_tooltip_translation( $id, $group = '', $text = '' ) {
297 - return self::get_text( array(
298 - 'id' => "{$id}_label",
299 - 'group' => $group,
300 - 'text' => $text,
301 - ) );
300 + return self::get_text(
301 + array(
302 + 'id' => "{$id}_label",
303 + 'group' => $group,
304 + 'text' => $text,
305 + )
306 + );
302 307 }
303 308
304 309 /**
305 310 * Get label by group ( if any )
@@ -312,13 +317,15 @@
312 317 *
313 318 * @return string
314 319 */
315 320 public static function get_label( $id, $group = '' ) {
316 - return self::get_text( array(
317 - 'id' => "{$id}_label",
318 - 'group' => $group,
319 - 'type' => 'label',
320 - ) );
321 + return self::get_text(
322 + array(
323 + 'id' => "{$id}_label",
324 + 'group' => $group,
325 + 'type' => 'label',
326 + )
327 + );
321 328 }
322 329
323 330 /**
324 331 * Get tooltip by group ( if any )
@@ -331,13 +338,15 @@
331 338 *
332 339 * @return string
333 340 */
334 341 public static function get_tooltip( $id, $group = '' ) {
335 - return self::get_text( array(
336 - 'id' => "{$id}_tooltip",
337 - 'group' => $group,
338 - 'type' => 'tooltip',
339 - ) );
342 + return self::get_text(
343 + array(
344 + 'id' => "{$id}_tooltip",
345 + 'group' => $group,
346 + 'type' => 'tooltip',
347 + )
348 + );
340 349 }
341 350
342 351 /**
343 352 * Get text by group
@@ -418,4 +427,5 @@
418 427 }
419 428
420 429 // Setup translations.
421 430 Give_Translations::get_instance()->setup();
431 +