Changeset 3382840
- Timestamp:
- 10/22/2025 05:42:04 PM (5 months ago)
- Location:
- muslim-prayer-times/trunk
- Files:
-
- 4 edited
-
includes/helpers.php (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
-
settings-ajax.php (modified) (3 diffs)
-
settings.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
muslim-prayer-times/trunk/includes/helpers.php
r3303241 r3382840 169 169 170 170 // Helper function to calculate Fajr Iqama times for a collection of days 171 function muslprti_calculate_fajr_iqama($days_data, $fajr_rule, $fajr_minutes_after, $fajr_minutes_before_shuruq, $is_weekly, $fajr_rounding ) {171 function muslprti_calculate_fajr_iqama($days_data, $fajr_rule, $fajr_minutes_after, $fajr_minutes_before_shuruq, $is_weekly, $fajr_rounding, $fajr_min_time = '00:00', $fajr_max_time = '23:59') { 172 172 $results = []; 173 173 … … 231 231 } 232 232 233 // Denormalize the result to account for DST before storing233 // Denormalize the result to account for DST before applying constraints 234 234 // Use the original date for denormalization to maintain correct DST information 235 235 $day_fajr_iqama = muslprti_denormalize_time_for_dst($day_fajr_iqama); 236 237 // Create min_fajr_time and max_fajr_time as DateTime objects 238 $min_fajr_time = clone $day_date; 239 list($hours, $minutes) = explode(':', $fajr_min_time); 240 $min_fajr_time->setTime((int)$hours, (int)$minutes); 241 242 $max_fajr_time = clone $day_date; 243 list($hours, $minutes) = explode(':', $fajr_max_time); 244 $max_fajr_time->setTime((int)$hours, (int)$minutes); 245 246 // Apply minimum constraint: use the greater of calculated time or min_fajr_time 247 if (muslprti_time_to_minutes($day_fajr_iqama) < muslprti_time_to_minutes($min_fajr_time)) { 248 $day_fajr_iqama = $min_fajr_time; 249 } 250 251 // Apply maximum constraint: use the lesser of result or max_fajr_time 252 if (muslprti_time_to_minutes($day_fajr_iqama) > muslprti_time_to_minutes($max_fajr_time)) { 253 $day_fajr_iqama = $max_fajr_time; 254 } 236 255 237 256 $results[$day_index] = $day_fajr_iqama; -
muslim-prayer-times/trunk/readme.txt
r3307273 r3382840 3 3 Tags: prayer times, muslim, islamic, mosque, salah 4 4 Requires at least: 5.0 5 Tested up to: 6.8 5 Tested up to: 6.8.3 6 6 Stable tag: 1.0.2 7 7 Requires PHP: 7.0 … … 151 151 Initial release of Muslim Prayer Times plugin. 152 152 153 = 1.0.2 = 154 * Added support for custom date format 155 * Minor bug fixed 153 = 1.0.3 = 154 Bug fixes. -
muslim-prayer-times/trunk/settings-ajax.php
r3307273 r3382840 150 150 $fajr_daily_change = isset($opts['fajr_daily_change']) ? $opts['fajr_daily_change'] : 0; 151 151 $fajr_rounding = isset($opts['fajr_rounding']) ? $opts['fajr_rounding'] : 1; 152 $fajr_min_time = isset($opts['fajr_min_time']) ? $opts['fajr_min_time'] : '05:00'; 153 $fajr_max_time = isset($opts['fajr_max_time']) ? $opts['fajr_max_time'] : '07:00'; 152 154 153 155 $dhuhr_rule = isset($opts['dhuhr_rule']) ? $opts['dhuhr_rule'] : 'after_athan'; … … 223 225 // Store this day's data 224 226 $day_index = $processed_days; 227 $date_prefix = $current_date->format('Y-m-d') . ' '; 225 228 $week_days_data[$day_index] = [ 226 229 'date' => clone $current_date, 227 230 'formatted_date' => $current_date->format('Y-m-d'), 228 231 'athan' => [ 229 'fajr' => new DateTime($ times['Fajr'], $dtz),230 'sunrise' => new DateTime($ times['Sunrise'], $dtz),231 'dhuhr' => new DateTime($ times['Dhuhr'], $dtz),232 'asr' => new DateTime($ times['Asr'], $dtz),233 'maghrib' => new DateTime($ times['Maghrib'], $dtz),234 'isha' => new DateTime($ times['Isha'], $dtz)232 'fajr' => new DateTime($date_prefix . $times['Fajr'], $dtz), 233 'sunrise' => new DateTime($date_prefix . $times['Sunrise'], $dtz), 234 'dhuhr' => new DateTime($date_prefix . $times['Dhuhr'], $dtz), 235 'asr' => new DateTime($date_prefix . $times['Asr'], $dtz), 236 'maghrib' => new DateTime($date_prefix . $times['Maghrib'], $dtz), 237 'isha' => new DateTime($date_prefix . $times['Isha'], $dtz) 235 238 ] 236 239 ]; … … 248 251 $fajr_rule, 249 252 $fajr_minutes_after, 250 $fajr_minutes_before_shuruq, 253 $fajr_minutes_before_shuruq, 251 254 $is_weekly && !$fajr_daily_change, 252 $fajr_rounding 255 $fajr_rounding, 256 $fajr_min_time, 257 $fajr_max_time 253 258 ); 254 259 -
muslim-prayer-times/trunk/settings.php
r3307273 r3382840 378 378 $opts['fajr_daily_change'] = isset($_POST['muslprti_fajr_daily_change']) ? 1 : 0; 379 379 $opts['fajr_rounding'] = isset($_POST['muslprti_fajr_rounding']) ? intval(wp_unslash($_POST['muslprti_fajr_rounding'])) : 1; 380 $opts['fajr_min_time'] = isset($_POST['muslprti_fajr_min_time']) ? sanitize_text_field(wp_unslash($_POST['muslprti_fajr_min_time'])) : '05:00'; 381 $opts['fajr_max_time'] = isset($_POST['muslprti_fajr_max_time']) ? sanitize_text_field(wp_unslash($_POST['muslprti_fajr_max_time'])) : '07:00'; 380 382 381 383 // Dhuhr rules … … 472 474 $fajr_daily_change = isset($opts['fajr_daily_change']) ? $opts['fajr_daily_change'] : 0; 473 475 $fajr_rounding = isset($opts['fajr_rounding']) ? $opts['fajr_rounding'] : 1; 476 $fajr_min_time = isset($opts['fajr_min_time']) ? $opts['fajr_min_time'] : '05:00'; 477 $fajr_max_time = isset($opts['fajr_max_time']) ? $opts['fajr_max_time'] : '07:00'; 474 478 475 479 // Dhuhr defaults … … 739 743 <p class="description">Note: For safety, this will never be less than 15 minutes before sunrise.</p> 740 744 </div> 745 </div> 746 747 <div class="iqama-rule-option"> 748 <p><strong>Time constraints (applies to all rules):</strong></p> 749 <p> 750 <label>Minimum Fajr time: <input type="time" name="muslprti_fajr_min_time" value="<?php echo esc_attr($fajr_min_time); ?>"></label><br> 751 <label>Maximum Fajr time: <input type="time" name="muslprti_fajr_max_time" value="<?php echo esc_attr($fajr_max_time); ?>"></label> 752 </p> 753 <p class="description">These settings ensure Fajr Iqama is never before the minimum time or after the maximum time. For "before Shuruq" rule, the maximum is automatically limited to the calculated time before sunrise.</p> 741 754 </div> 742 755 </div>
Note: See TracChangeset
for help on using the changeset viewer.