| @@ -125,9 +125,9 @@ | ||
| 125 | 125 | public function chart_filter_custom_group_by( LP_Filter $filter, array $dates, string $time_field ) { |
| 126 | 126 | $diff1 = date_create( $dates[0] ); |
| 127 | 127 | $diff2 = date_create( $dates[1] ); |
| 128 | 128 | if ( ! $diff1 || ! $diff2 ) { |
| 129 | - throw new Exception( 'Custom filter date is invalid.', 'learnpress' ); | |
| 129 | + throw new Exception( __( 'Custom filter date is invalid.', 'learnpress' ) ); | |
| 130 | 130 | } |
| 131 | 131 | $diff = date_diff( $diff1, $diff2, true ); |
| 132 | 132 | $y = $diff->y; |
| 133 | 133 | $m = $diff->m; |
| @@ -179,9 +179,9 @@ | ||
| 179 | 179 | * @return LP_Filter |
| 180 | 180 | */ |
| 181 | 181 | public function previous_days_filter( LP_Filter $filter, int $value, string $time_field, $is_until = false ) { |
| 182 | 182 | if ( $value < 2 ) { |
| 183 | - throw new Exception( 'Day must be greater than 2 days.', 'learnpress' ); | |
| 183 | + throw new Exception( __( 'Day must be greater than 2 days.', 'learnpress' ) ); | |
| 184 | 184 | } |
| 185 | 185 | if ( $is_until ) { |
| 186 | 186 | $filter->where[] = "AND $time_field <= CURDATE()"; |
| 187 | 187 | } else { |
| @@ -211,9 +211,9 @@ | ||
| 211 | 211 | * @return LP_Filter |
| 212 | 212 | */ |
| 213 | 213 | public function previous_months_filter( LP_Filter $filter, int $value, string $time_field, $is_until = false ) { |
| 214 | 214 | if ( $value < 2 ) { |
| 215 | - throw new Exception( 'Values must be greater than 2 months.', 'learnpress' ); | |
| 215 | + throw new Exception( __( 'Values must be greater than 2 months.', 'learnpress' ) ); | |
| 216 | 216 | } |
| 217 | 217 | if ( $is_until ) { |
| 218 | 218 | $filter->where[] = "AND $time_field <= CURDATE()"; |
| 219 | 219 | } else { |
| @@ -246,9 +246,9 @@ | ||
| 246 | 246 | * @return LP_Filter |
| 247 | 247 | */ |
| 248 | 248 | public function custom_time_filter( LP_Filter $filter, array $dates, string $time_field, $is_until = false ) { |
| 249 | 249 | if ( empty( $dates ) ) { |
| 250 | - throw new Exception( 'Select date', 'learnpress' ); | |
| 250 | + throw new Exception( __( 'Select date', 'learnpress' ) ); | |
| 251 | 251 | } |
| 252 | 252 | sort( $dates ); |
| 253 | 253 | if ( $is_until ) { |
| 254 | 254 | $filter->where[] = $this->wpdb->prepare( "AND cast( $time_field as DATE) <= cast(%s as DATE)", $dates[1] ); |
| @@ -274,9 +274,9 @@ | ||
| 274 | 274 | * @return LP_Filter |
| 275 | 275 | */ |
| 276 | 276 | public function filter_time( LP_Filter $filter, string $type, string $time_field, $value = false, $is_until = false ) { |
| 277 | 277 | if ( ! $value ) { |
| 278 | - throw new Exception( 'Empty statistic time', 'learnpress' ); | |
| 278 | + throw new Exception( __( 'Empty statistic time', 'learnpress' ) ); | |
| 279 | 279 | } |
| 280 | 280 | switch ( $type ) { |
| 281 | 281 | case 'date': |
| 282 | 282 | $filter = $this->date_filter( $filter, $value, $time_field, $is_until ); |
| @@ -295,9 +295,9 @@ | ||
| 295 | 295 | break; |
| 296 | 296 | case 'custom': |
| 297 | 297 | $value = explode( '+', $value ); |
| 298 | 298 | if ( count( $value ) !== 2 ) { |
| 299 | - throw new Exception( 'Invalid custom time', 'learnpress' ); | |
| 299 | + throw new Exception( __( 'Invalid custom time', 'learnpress' ) ); | |
| 300 | 300 | } |
| 301 | 301 | $filter = $this->custom_time_filter( $filter, $value, $time_field, $is_until ); |
| 302 | 302 | default: |
| 303 | 303 | // code... |
| @@ -339,13 +339,13 @@ | ||
| 339 | 339 | $filter = $this->chart_filter_granularity_group_by( $filter, $granularity, $time_field ); |
| 340 | 340 | break; |
| 341 | 341 | } |
| 342 | 342 | if ( empty( $value ) ) { |
| 343 | - throw new Exception( 'Empty statistic time', 'learnpress' ); | |
| 343 | + throw new Exception( __( 'Empty statistic time', 'learnpress' ) ); | |
| 344 | 344 | } |
| 345 | 345 | $value = explode( '+', $value ); |
| 346 | 346 | if ( count( $value ) !== 2 ) { |
| 347 | - throw new Exception( 'Invalid custom time', 'learnpress' ); | |
| 347 | + throw new Exception( __( 'Invalid custom time', 'learnpress' ) ); | |
| 348 | 348 | } |
| 349 | 349 | $filter = $this->chart_filter_custom_group_by( $filter, $value, $time_field ); |
| 350 | 350 | default: |
| 351 | 351 | // code... |