Fix for is24Hours function
-
Asalam Alaikum,
I encountered an issue while uploading the CSV prayer times table, where valid times were flagged as invalid. I traced the issue to the is24Hours($row) function in validator.php in wp-content/plugins/daily-prayer-time-for-mosques/Models:
Below the modified code using preg_match():
private function is24Hours($row) { $afternoonPrayers = array($row[6], $row[7], $row[8], $row[9], $row[10], $row[11], $row[12]); foreach($afternoonPrayers as $time) { // echo $time; if (!preg_match('#^([01]?[0-9]|2[0-3]):[0-5][0-9]?$#', $time)) { echo "<h3 class='dptCenter ui-state-error'>$time is not in 24 hour time format for date: ". esc_html( $row[0] ) ." </br> You must follow 24 hours time format, valid time format is <span class='green'>HH:MM</span></h3>"; return false; } /* old code */ /* $firstPart = explode(':', $time); if ($firstPart[0] !== '00' && (int)$firstPart[0] < 12) { echo $firstPart[0] . $firstPart[1]; echo "<h3 class='dptCenter ui-state-error'>$time is not in 24 hour time format for date: ". esc_html( $row[0] ) ." </br> You must follow 24 hours time format, valid time format is <span class='green'>HH:MM</span></h3>"; return false; } */ } return true; }
Hope this helps!
Jamal
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Fix for is24Hours function’ is closed to new replies.