Server IP : 66.29.132.124 / Your IP : 3.142.198.108 Web Server : LiteSpeed System : Linux business141.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : wavevlvu ( 1524) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/wavevlvu/misswavenigeria.com/wp-content/plugins/totalcontest-lite/src/Limitations/ |
Upload File : |
<?php namespace TotalContest\Limitations; use TotalContestVendors\TotalCore\Limitations\Limitation; /** * Class Period * @package TotalContest\Limitations */ class Period extends Limitation { /** * @return bool|\WP_Error */ public function check() { $startDate = empty( $this->args['start'] ) ? false : TotalContest( 'datetime', [ $this->args['start'], wp_timezone() ] ); $endDate = empty( $this->args['end'] ) ? false : TotalContest( 'datetime', [ $this->args['end'], wp_timezone() ] ); $now = TotalContest( 'datetime', [ 'now', wp_timezone() ] ); if ( $startDate && $startDate->getTimestamp() > $now->getTimestamp() ): $interval = $startDate->diff( $now, true ); $message = empty( $this->args['startMessage'] ) ? esc_html__( 'Not started yet, %s left.', 'totalcontest' ) : $this->args['startMessage']; $message = str_replace( [ '%s', '{{time}}' ], [ '{{time}}', $interval->format( esc_html__( '%a days, %h hours and %i minutes', 'totalcontest' ) ) ], $message ); return new \WP_Error( 'start_date', $message ); endif; if ( $endDate && $endDate->getTimestamp() < $now->getTimestamp() ): $interval = $endDate->diff( $now, true ); $message = empty( $this->args['endMessage'] ) ? esc_html__( 'Finished since %s.', 'totalcontest' ) : $this->args['endMessage']; $message = str_replace( [ '%s', '{{time}}' ], [ '{{time}}', $interval->format( esc_html__( '%a days, %h hours and %i minutes', 'totalcontest' ) ) ], $message ); return new \WP_Error( 'finish_date', $message ); endif; return true; } }