| @@ 299-325 (lines=27) @@ | ||
| 296 | ||
| 297 | } |
|
| 298 | ||
| 299 | public function get_recurring_period( $full = false ) { |
|
| 300 | $period = get_post_meta( $this->ID, '_wpinv_recurring_period', true ); |
|
| 301 | ||
| 302 | if ( !in_array( $period, array( 'D', 'W', 'M', 'Y' ) ) ) { |
|
| 303 | $period = 'D'; |
|
| 304 | } |
|
| 305 | ||
| 306 | if ( $full ) { |
|
| 307 | switch( $period ) { |
|
| 308 | case 'D': |
|
| 309 | $period = 'day'; |
|
| 310 | break; |
|
| 311 | case 'W': |
|
| 312 | $period = 'week'; |
|
| 313 | break; |
|
| 314 | case 'M': |
|
| 315 | $period = 'month'; |
|
| 316 | break; |
|
| 317 | case 'Y': |
|
| 318 | $period = 'year'; |
|
| 319 | break; |
|
| 320 | } |
|
| 321 | } |
|
| 322 | ||
| 323 | return apply_filters( 'wpinv_item_recurring_period', $period, $full, $this->ID ); |
|
| 324 | } |
|
| 325 | ||
| 326 | public function get_recurring_interval() { |
|
| 327 | $interval = (int)get_post_meta( $this->ID, '_wpinv_recurring_interval', true ); |
|
| 328 | ||
| @@ 348-374 (lines=27) @@ | ||
| 345 | return apply_filters( 'wpinv_item_get_free_trial', $free_trial, $this->ID ); |
|
| 346 | } |
|
| 347 | ||
| 348 | public function get_trial_period( $full = false ) { |
|
| 349 | $period = get_post_meta( $this->ID, '_wpinv_trial_period', true ); |
|
| 350 | ||
| 351 | if ( !in_array( $period, array( 'D', 'W', 'M', 'Y' ) ) ) { |
|
| 352 | $period = 'D'; |
|
| 353 | } |
|
| 354 | ||
| 355 | if ( $full ) { |
|
| 356 | switch( $period ) { |
|
| 357 | case 'D': |
|
| 358 | $period = 'day'; |
|
| 359 | break; |
|
| 360 | case 'W': |
|
| 361 | $period = 'week'; |
|
| 362 | break; |
|
| 363 | case 'M': |
|
| 364 | $period = 'month'; |
|
| 365 | break; |
|
| 366 | case 'Y': |
|
| 367 | $period = 'year'; |
|
| 368 | break; |
|
| 369 | } |
|
| 370 | } |
|
| 371 | ||
| 372 | return apply_filters( 'wpinv_item_trial_period', $period, $full, $this->ID ); |
|
| 373 | } |
|
| 374 | ||
| 375 | public function get_trial_interval() { |
|
| 376 | $interval = absint( get_post_meta( $this->ID, '_wpinv_trial_interval', true ) ); |
|
| 377 | ||