Skip to content

Commit

Permalink
= 4.2.7.4 =
Browse files Browse the repository at this point in the history
~ Added: get_i18n_of_value method.
  • Loading branch information
tungnxt89 committed Nov 26, 2024
1 parent 00ad38c commit 3324fa1
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
24 changes: 24 additions & 0 deletions inc/class-lp-helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -693,4 +693,28 @@ public static function print_inline_script_tag( string $name_variable_script, ar
}
wp_print_inline_script_tag( $script, $tag_args );
}

/**
* Get translation of value
*
* @param string $value
*
* @return string
* @since 4.2.7.4
* @version 1.0.0
*/
public static function get_i18n_of_value( string $value ): string {
switch ( $value ) {
case 'failed':
$i18n = esc_html__( 'Failed', 'learnpress' );
break;
case 'in-progress':
$i18n = esc_html__( 'In Progress', 'learnpress' );
break;
default:
$i18n = $value;
}

return apply_filters( 'learn-press/i18n/value', $i18n, $value );
}
}
3 changes: 2 additions & 1 deletion inc/class-lp-request-handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ public static function do_ajax( $action ) {
}

public static function verify_nonce( $action, $nonce = '' ) {
return wp_verify_nonce( $nonce ? $nonce : self::get_string( "{$action}-nonce" ), $action );
return wp_verify_nonce( $nonce ? $nonce : self::get_param( "{$action}-nonce" ), $action );
}

public static function parse_action( $action ) {
Expand Down Expand Up @@ -342,6 +342,7 @@ public static function get_bool( $var, $default = false, $env = 'request' ) {
* @param string $env
*
* @return string
* @deprecated 4.2.7.4
*/
public static function get_string( $var, $default = false, $env = 'request' ) {
return self::get( $var, $default, 'string', $env );
Expand Down

0 comments on commit 3324fa1

Please sign in to comment.