PluginProbe ʕ •ᴥ•ʔ
Daily Prayer Time / 2026.05.20
Daily Prayer Time v2026.05.20
2026.05.20 2026.05.11 2026.05.09 2026.05.05 2026.05.04 2026.05.03 2026.04.28 2026.04.28.1 trunk 2019.10.16 2019.11.19 2019.2.16 2019.3.1 2019.4.1 2019.4.5 2019.5.12 2019.5.13 2019.5.14 2019.5.19 2019.5.19.1 2019.5.21 2019.5.30 2019.5.5 2019.5.6 2019.5.7 2019.5.8 2019.5.9 2019.6.10 2019.6.2 2019.6.22 2019.7.10 2019.7.25 2019.8.1 2019.8.4 2019.9.16 2020.04.25 2020.04.26 2020.05.01 2020.05.04 2020.05.08 2020.05.17 2020.07.03 2021.01.10 2021.03.28 2021.07.20 2021.07.23 2021.07.24 2021.07.28 2021.08.01 2021.08.06 2021.08.07 2021.08.10 2021.09.12 2021.09.18 2021.09.23 2021.09.24 2021.10.01 2021.10.02 2021.10.10 2021.10.11 2021.10.15 2021.10.21 2021.10.27 2021.10.29 2022.03.24 2022.04.04 2022.04.14 2022.04.15 2022.04.21 2022.04.22 2022.05.04 2022.09.19 2022.11.14 2022.11.16 2022.12.18 2022.12.20 2023.01.27 2023.02.04 2023.02.09 2023.02.21 2023.03.08 2023.03.17 2023.03.18 2023.03.20 2023.05.04 2023.08.03 2023.08.08.16 2023.08.19 2023.08.19.1 2023.10.13 2023.10.21 2023.11.26 2023.12.28 2023.12.31 2024.03.28 2024.03.29 2024.03.30 2024.04.18 2024.04.20 2024.04.22 2024.04.26 2024.08.26 2024.09.12 2024.09.14 2024.09.17 2024.12.29 2024.12.30 2025.01.02 2025.01.17 2025.02.02 2025.03.04 2025.03.06 2025.03.08 2025.03.15 2025.03.20 2025.03.26 2025.03.27 2025.04.03 2025.06.16 2025.06.29 2025.07.15 2025.08.09 2025.10.26 2026.04.26
daily-prayer-time-for-mosques / Models / DigitalScreen.php
daily-prayer-time-for-mosques / Models Last commit date
Hijri 3 years ago Processors 1 month ago QuranADay 2 months ago StartTime 1 year ago design 1 month ago AdminMenu.php 2 years ago AssetsLoader.php 1 year ago CustomPluginSettings.php 4 years ago DPTAjaxHandler.php 4 years ago DPTHelper.php 1 month ago DSTemplateLoader.php 2 years ago DailyShortCode.php 1 month ago DigitalScreen.php 1 month ago HijriDate.php 3 years ago Init.php 4 years ago MonthlyShortCode.php 2 years ago MonthlyTimeTable.php 3 years ago Shortcodes.php 2 months ago Translator.php 4 years ago UpdateStyles.php 1 month ago Validator.php 3 years ago db.php 2 months ago dptWidget.php 4 years ago
DigitalScreen.php
723 lines
1 <?php
2 require_once(__DIR__ . '/DPTHelper.php');
3
4 class DigitalScreen extends DailyShortCode
5 {
6 /** @var array */
7 protected $row = array();
8
9 /** @var bool */
10 private $isPortrait;
11
12 /** @var bool */
13 private $isPresentation;
14
15 /** @var int */
16 private $screenTimeout = 5;
17
18 /** @var string */
19 private $scrollText;
20
21 /** @var string */
22 private $scrollSpeed = 20;
23
24 /** @var array */
25 private $presentationSlides;
26
27 /** @var string */
28 private $blinkText = 'SADAQA INCREASE YOUR WEALTH';
29
30 /** @var string */
31 private $blinkUrl;
32
33 /** @var string */
34 private $scrollUrl;
35
36 /** @var string */
37 private $verticalClass = '';
38
39 /** @var boolean */
40 private $disableOvernightDim = false;
41
42 /** @var string */
43 private $template;
44
45 /** @var DPTHelper */
46 protected $dptHelper;
47 private ?string $adhan = 'adhan';
48
49 public function __construct($attr=array())
50 {
51 parent::__construct();
52
53 $this->scrollText = esc_html(stripslashes(get_option("ds-scroll-text")));
54 $this->scrollSpeed = empty(get_option("ds-scroll-speed")) ? $this->scrollSpeed : get_option("ds-scroll-speed");
55 $this->blinkText = esc_html(stripslashes(get_option("ds-blink-text")));
56 $this->dptHelper = new DPTHelper();
57 $this->setAttributes($attr);
58 }
59
60 public function displayDigitalScreen()
61 {
62 $templateEnabled = get_option('template-chbox') === 'template';
63 $hasTemplate = !empty(get_option('dsTemplate'));
64
65 if ($this->template || ($templateEnabled && $hasTemplate)) {
66 return $this->getTemplate();
67 }
68
69 $html = $this->getTopRow();
70
71 if ($this->isPresentation) {
72 $html .= $this->getPresentationRow();
73 } else {
74 $html .= $this->getMiddleRow();
75 }
76
77 $html .= $this->getBottomRow();
78
79 return $html;
80 }
81
82 private function getTemplate()
83 {
84 if ($template = get_option('dsTemplate')) {
85 $this->template = $template;
86 }
87
88 ob_start();
89 include "design/$this->template.php";
90 $this->template = null;
91 return ob_get_clean();
92 }
93
94 private function getHiddenVariables()
95 {
96 $hiddenVariables = '
97 <input type="hidden" value="' . $this->canDimOvernight($this->getRow(), $this->disableOvernightDim) . '" id="overnightDim">
98 <input type="hidden" value="' . $this->screenTimeout . '" id="screenTimeout">
99
100 <input type="hidden" value="' . $this->getKhutbahDim($this->getRow()) . '" id="khutbahDim">
101 <input type="hidden" value="' . $this->getTaraweehDim($this->getRow()) . '" id="taraweehDim">
102 <input type="hidden" value="' . get_option('ishraq') . '" id="ishraqOption">
103 <input type="hidden" value="' . get_option('zawal') . '" id="zawalOption">
104 <input type="hidden" value="' . ($this->dptHelper->getIshraqTime($this->row['sunrise']) ? date_i18n(get_option('time_format'), strtotime($this->dptHelper->getIshraqTime($this->row['sunrise']))) : '') . '" id="ishraqTime">
105 <input type="hidden" value="' . date_i18n(get_option('time_format'), strtotime($this->row['sunrise'])) . '" id="sunriseTime">
106 <input type="hidden" value="' . date_i18n(get_option('time_format'), strtotime($this->dptHelper->getZawalTime($this->row['zuhr_begins']))) . '" id="zawalTime">
107
108 <input type="hidden" value="' . htmlspecialchars(json_encode($this->getRefreshPoints())) . '" id="refreshPoint">
109
110 <input type="hidden" value="' . get_option('activateBeep') . '" id="activateBeep">
111 <input type="hidden" value="' . get_option('quran-chbox') . '" id="quranCheckbox">
112 <input type="hidden" value="' . $this->getWpHour() . '" id="clockHour">
113
114 <input type="hidden" value="' . htmlspecialchars(json_encode($this->getFadingMessages())) . '" id="fadingMessages">
115 ';
116
117 if ($this->adhan) {
118 $hiddenVariables .= '
119 <input type="hidden" value="' . get_option('activateAdhan') . '" id="activateAdhan">
120 <input type="hidden" value="' . htmlspecialchars($this->getFajrAdhanTime(), JSON_UNESCAPED_UNICODE) . '" id="fajrAdhanTime">
121 <input type="hidden" value="' . htmlspecialchars(json_encode($this->getOtherAdhanTimes(), JSON_UNESCAPED_UNICODE)) . '" id="otherAdhanTimes">
122 ';
123
124 }
125
126 if (get_option("activateAdhan") === 'adhan') {
127 $hiddenVariables .= '
128 <input type="hidden" value="' . get_option('fajrAdhanUrl') . '" id="fajrAdhanUrl">
129 <input type="hidden" value="' . get_option('otherAdhanUrl') . '" id="otherAdhanUrl">
130 ';
131 }
132
133 return $hiddenVariables;
134 }
135
136 private function getTopRow(): string
137 {
138 $timeClass = "col-sm-3 ";
139 $dateClass = "col-sm-7 ";
140 $height = "height-100";
141 $width = "width-25";
142 if ($this->isPresentation || $this->isPortrait) {
143 $timeClass = "col-sm-4 ";
144 $dateClass = "col-sm-8 ";
145 $width = "width-100";
146 }
147 $verticalClass = "";
148 if ( $this->isPortrait ) {
149 $timeClass = "col-xs-12 vertical-time ";
150 $dateClass = "col-xs-12 vertical-date";
151 $height = "height-50 ";
152 $verticalClass = "vertical";
153 }
154
155 if ( get_option('hijri-chbox')) {
156 $date = date_i18n( 'D jS M' );
157 } else {
158 $date = date_i18n(get_option( 'date_format'));
159 }
160
161 $html = '
162 <div class="container-fluid x-board">
163 ' . $this->getHiddenVariables() . '
164
165 <div class="row top-row dpt-bg">
166 <div class="time bg-dark ' . $timeClass . 'col-xs-12 text-center ' . $height . ' ' . $width . '">
167 <div class="clock align-middle">
168 <ul class="clock">
169 <li id="hours"></li>
170 <li id="pointx">:</li>
171 <li id="min"></li>
172 <li id="pointx">:</li>
173 <li id="sec"></li>
174 </ul>
175 </div>
176 </div>
177 ';
178
179 if (!$this->isPresentation) {
180 $html .= '
181 <div class="' . $dateClass . ' col-xs-12 text-center ' . $height . '">
182 <div class="align-middle" id="date-section">
183 <span id="dsDate" class="date-eng h6 ' . $verticalClass . '">' . $date. '
184 <span id="dsHijriDate" class="'. $verticalClass . 'hijri">
185 ' . $this->getHijriDate(date("d"), date("m"), date("Y"), $this->getRow()) . '
186 </span>
187 </span>
188 </div>
189 </div>
190 <div class="col-sm-2 col-xs-12 text-right align-middle padding-null">';
191 $html .= $this->getLogoUrl();
192 $html .=
193 '</div>';
194 }
195
196 $html .=
197 '</div>';
198
199 return $html;
200 }
201
202 private function getLogoUrl()
203 {
204 if ($this->isPortrait ) {
205 return;
206 }
207
208 $isLogo = get_option('ds-logo');
209 if ( $isLogo) {
210 return '<img class="logo" src="' . $isLogo . '">';
211 } else {
212 $custom_logo_id = get_theme_mod( 'custom_logo' );
213 $image_url = wp_get_attachment_image_url ( $custom_logo_id , 'full' );
214 return '<img class="logo" src="' . $image_url . '">';
215 }
216 }
217
218 private function getMiddleRow()
219 {
220 $leftClass = "col-sm-5 col-xs-12 bg-red height-100 padding-null text-center";
221 $rightClass = "col-sm-7 col-xs-12 padding-null text-center bg-green height-100 padding-null";
222 $verticalClass = "";
223 $sunriseOrZawal = $this->dptHelper->getSunriseOrZawalOrIshraq($this->row);
224
225 if ( $this->isPortrait ) {
226 $verticalClass = "vertical";
227 $leftClass = "col-sm-12 bg-red padding-null text-center height-60";
228 $rightClass = "col-sm-12 padding-null text-center bg-green height-40";
229 }
230
231 $html = '
232 <div class="row middle-row bg-red">
233 <div class="'. $leftClass .'">
234 <table id="dsPrayerTimetable" class="table height-100 '. $verticalClass .'">
235 <thead class="bg-dark">
236 <tr>
237 <th class="dsPrayerName">
238 <span class="dpt_start">' . strtoupper($this->getLocalHeaders()['prayer']) . '</span>
239 </th>
240 <th class="dsBegins">
241 <span class="dpt_start">' . strtoupper($this->getLocalHeaders()['begins']) . '</span>
242 </th>
243 <th class="dsIqamah">
244 <span class="dpt_jamah">' . strtoupper($this->getLocalHeaders()['iqamah']) . '</span>
245 </th>
246 </tr>
247 </thead>
248 <tbody>
249 <tr class=' . $this->getNextPrayerClass('fajr', $this->row, true) . '>
250 <td class="prayerName">
251 <span>' . $this->getLocalPrayerNames()['fajr'] . '</span>
252 </td>
253 <td class="l-red">' . do_shortcode("[fajr_start]") . '</td>
254 <td>' . do_shortcode("[fajr_prayer]") . '</td>
255 </tr>
256 <tr class=' . ($sunriseOrZawal == 'zawal' ? '' : $this->getNextPrayerClass($sunriseOrZawal, $this->row)) . '>
257 <td class="prayerName"><span>' . $this->getLocalPrayerNames()[$sunriseOrZawal] . '</span></td>
258 <td class="prayerName sunrise" colspan="2">' . do_shortcode("[$sunriseOrZawal]") . '</td>
259 </tr>';
260
261
262 $html .= '
263 <tr class=' . $this->getNextPrayerClass('zuhr', $this->row) . '>
264 <td class="prayerName"><span>' . $this->getLocalPrayerNames()['zuhr'] . '</span></td>
265 <td class="l-red">' . do_shortcode("[zuhr_start]") . '</td>
266 <td>' . do_shortcode("[zuhr_prayer]") . '</td>
267 </tr>
268 ';
269
270 $html .=
271 '<tr class=' . $this->getNextPrayerClass('asr', $this->row) . '>
272 <td class="prayerName"><span>' . $this->getLocalPrayerNames()['asr'] . '</span></td>
273 <td class="l-red">' . do_shortcode("[asr_start]") . '</td>
274 <td>' . do_shortcode("[asr_prayer]") . '</td>
275 </tr>
276 <tr class=' . $this->getNextPrayerClass('maghrib', $this->row) . '>
277 <td class="prayerName"><span>' . $this->getLocalPrayerNames()['maghrib'] . '</span></td>
278 <td class="l-red">' . do_shortcode("[maghrib_start]") . '</td>
279 <td>' . do_shortcode("[maghrib_prayer]") . '</td>
280 </tr>
281 <tr class=' . $this->getNextPrayerClass('isha', $this->row) . '>
282 <td class="prayerName"><span>' . $this->getLocalPrayerNames()['isha'] . '</span></td>
283 <td class="l-red">' . do_shortcode("[isha_start]") . '</td>
284 <td>' . do_shortcode("[isha_prayer]") . '</td>
285 </tr>';
286 $html .= '
287 <tr class=' . $this->getNextPrayerClass('jumuah', $this->row) . '>
288 <td class="prayerName"><span>' . stripslashes($this->getLocalHeaders()['jumuah']) . '</span></td>
289 <td colspan="2" class="prayerName l-red sunrise">
290 ' . $this->getJumuahTimesArray($this->isPortrait) . '
291 </td>
292 </tr>';
293 $html .= '
294 </tbody>
295 </table>
296 </div>'; //left class
297
298 $transitionEffect = get_option('transitionEffect');
299 $transitionSpeed = get_option('transitionSpeed');
300 $html .='
301 <div class="'. $rightClass .'">
302 <div id="carouselExampleIndicators" class="carousel slide ' . $transitionEffect . ' height-100" data-bs-ride="carousel">
303 <div class="carousel-inner">
304 <div class="carousel-item active">
305 ' . $this->getFirstSlide() . '
306 </div>
307 ' . $this->getOtherSlides($transitionSpeed) . '
308 </div>';
309 if ( $this->isPortrait ) {
310 $html .= '<button class="carousel-control-prev" type="button" data-bs-target="#carouselExampleIndicators" data-bs-slide="prev">
311 <span class="carousel-control-prev-icon" aria-hidden="true"></span>
312 <span class="visually-hidden">Previous</span>
313 </button>
314 <button class="carousel-control-next" type="button" data-bs-target="#carouselExampleIndicators" data-bs-slide="next">
315 <span class="carousel-control-next-icon" aria-hidden="true"></span>
316 <span class="visually-hidden">Next</span>
317 </button>';
318 }
319 $html .= '</div>
320 </div>
321 </div>
322 ';
323
324 return $html;
325 }
326
327 private function getBottomRow(): string
328 {
329 if ($this->isPresentation) {
330 return '';
331 }
332
333 $verticalClass = "";
334
335 if ( $this->isPortrait ) {
336 $verticalClass = "vertical";
337 }
338
339 $html = '
340 <div class="row bottom-row">
341 <div class="notificationBackground col-sm-3 col-xs-12 text-center height-100 align-middle">
342 <div class="align-middle">
343 <span id="dsBlink" class="blink">' . $this->getBlink() . '</span>
344 </div>
345 </div>
346 <div class="col-sm-9 col-xs-12 height-100 dpt-bg">
347 <div class="align-middle">
348 <div class="text-primary scrolling">
349 <div class="dpt-ticker">
350 ' . $this->getIqamahUpdate() . '
351 </div>
352 </div>
353 </div>
354 </div>
355 </div>
356 </div>
357 ';
358
359 if ($this->isPortrait) {
360 $html = '
361 <div class="row bottom-row">
362 <div class="col-sm-12 col-xs-12 height-24">
363 <div class="align-middle">
364 <div class="text-primary scrolling-vertical">
365 <div class="dpt-ticker">
366 ' . $this->getIqamahUpdate() . '
367 </div>
368 </div>
369 </div>
370 </div>
371 <div class="notificationBackground notificationFont col-sm-12 col-xs-12 text-center height-50 align-middle">
372 <div class="align-middle">
373 <span id="dsBlink" class="blink-'.$verticalClass.'">' . $this->getBlink() . '</span>
374 </div>
375 </div>
376 </div>
377 </div>
378 ';
379 }
380
381 return $html;
382 }
383
384 private function getPresentationRow($transitionSpeed = null, $slidesOnly = false)
385 {
386 $transitionEffect = get_option('transitionEffect');
387 $transitionSpeed = $transitionSpeed ?? get_option('transitionSpeed');
388
389 if ($slidesOnly) {
390 return $this->getPresentationSlides($transitionSpeed);
391 }
392
393 $middleRow = $this->isPresentation ? 'middle-row85' : 'middle-row';
394
395 $html ='
396 <div class="row ' . $middleRow . ' bg-red height-100">
397 <div id="carouselExampleIndicators" class="carousel slide ' . $transitionEffect . ' height-100" data-bs-ride="carousel">
398 <div class="carousel-inner height-100">
399 ' . $this->getPresentationSlides($transitionSpeed) . '
400 </div>
401 </div>
402 </div>
403 ';
404
405 return $html;
406 }
407
408 private function getQuranSlides($transitionSpeed): string
409 {
410 return '<div class="carousel-item active height-100" data-bs-interval="10000">
411 <div class="nextPrayer">
412 <div class="align-middle-next-prayer">
413 <h4 id="quranVerse" class="' . $this->verticalClass . '"></h4>
414 </div>
415 </div>
416 </div>';
417 }
418
419 private function getPresentationSlides($transitionSpeed): string
420 {
421 $this->presentationSlides = $this->getSliderUrls();
422 $html = '
423 <div class="carousel-item active height-100" data-bs-interval="'. $transitionSpeed .'">
424 <img class="carousel-slide" src="' . array_shift($this->presentationSlides) . '">
425 </div>';
426
427 foreach ($this->presentationSlides as $i => $slideUrl) {
428 if (empty($slideUrl)) continue;
429 $html .= '
430 <div class="carousel-item height-100" data-bs-interval="'. $transitionSpeed .'">
431 <img class="carousel-slide " src="' . trim($slideUrl) . '">
432 </div>
433 ';
434 }
435
436 return $html;
437 }
438
439 private function getIqamahUpdate(): string
440 {
441 $orientation = 'horizontal';
442 if ($this->isPortrait) {
443 $orientation = 'vertical';
444 }
445
446 $content = '';
447
448 if ( $this->scrollText ) {
449 $content .= ' > '. $this->scrollText . ' < ';
450 }
451
452 $content .= do_shortcode("[display_iqamah_update orientation='" . $orientation . "']");
453
454 // Duplicate content so the loop is seamless (animation goes 0 → -50%)
455 return '<input type="hidden" id="scrollSpeed" value="' . $this->scrollSpeed . '">'
456 . '<span class="dpt-ticker-track" style="animation-duration:' . (int) $this->scrollSpeed . 's">'
457 . $content . $content
458 . '</span>';
459 }
460
461 private function getBlink(): string
462 {
463 $orientation = '';
464 if ($this->isPortrait) {
465 $orientation = 'vertical';
466 }
467
468 return '<a class="notificationFont blink-' .$orientation.'" target="_new" href="'. $this->blinkUrl .'">'. $this->blinkText .'</a>';
469 }
470
471 private function getFirstSlide(): string
472 {
473 $verticalClass = "";
474 $sehriClass = "sehri";
475 $iftarClass = "iftar";
476 if ( $this->isPortrait ) {
477 $verticalClass = "vertical";
478 $sehriClass = "sehri sehri-vertical";
479 $iftarClass = "iftar iftar-vertical";
480 }
481
482 if ($this->isRamadan()) {
483 $h3 = '
484 <div class="dsRamadan">
485 <div class="' . $sehriClass . '">' . $this->getLocalHeaders()['fast_begins'] . ': ' . $this->formatDateForPrayer($this->getFajrBegins(), true) . '</div>
486 <div class="' . $iftarClass . ' pull-right">' . $this->getLocalHeaders()['fast_ends']. ': ' . do_shortcode("[maghrib_start]") . '</div>
487 </div>';
488 } else {
489 $h3 = '<h3 class="'.$verticalClass.'">'. $this->getLocalTimes()['next prayer'] . '</h3>';
490 }
491
492 $html = '
493 <div class="nextPrayer">
494 <div class="align-middle-next-prayer">'
495 . $h3 .
496 '<h2 id="dsNextPrayer" class="dsNextPrayer '.$verticalClass.'"></h2>
497 </div>
498 </div>';
499
500 return $html;
501 }
502
503 private function getOtherSlides($transitionSpeed=10): ?string
504 {
505 if ( get_option('quran-chbox') ) {
506 return '<div class="carousel-item height-100" data-bs-interval="10000">
507 <div class="nextPrayer">
508 <div class="align-middle-next-prayer">
509 <h4 id="quranVerse" class="' . $this->verticalClass . '"></h4>
510 </div>
511 </div>
512 </div>';
513 }
514
515 if ( get_option('slider-chbox') ) {
516 $html = "";
517 $slides = $this->getSliderUrls();
518
519 $slides = array_filter(array_map('trim', $slides));
520 foreach ($slides as $i => $slide) {
521 $html .= '
522 <div class="carousel-item height-100" data-bs-interval="'. $transitionSpeed .'">
523 <a href="' . get_option("slider". ($i+1) . "Url") . '" style="color:' . get_option('fontColor') .'">
524 ' . $this->getImageOrMessage($slide) . '
525 </a>
526 </div>
527 ';
528
529 $nextPrayerSlide = (int)get_option('nextPrayerSlide');
530 if (!$this->isPresentation && $nextPrayerSlide > 0) {
531 $count = $i + 1;
532 if ( $count % $nextPrayerSlide == 0 ) {
533 $html .= '
534 <div class="carousel-item">
535 ' . $this->getFirstSlide() . '
536 </div>
537 ';
538 }
539 }
540 }
541
542 return $html;
543 }
544
545 return null;
546 }
547
548 private function getSliderUrls(): array
549 {
550 $slides = [];
551 if ($this->presentationSlides) {
552 return $this->presentationSlides;
553 }
554
555 foreach (range(1, 13) as $item) {
556 $slideUrl = get_option('slider' . $item);
557 if (!empty($slideUrl) && filter_var($slideUrl, FILTER_VALIDATE_URL)) {
558 $slides[] = $slideUrl;
559 }
560 }
561
562 return $slides;
563 }
564
565 public function hasSliderImages(): bool
566 {
567 return !empty($this->getSliderUrls());
568 }
569
570 private function getImageOrMessage($slide): string
571 {
572 if (filter_var($slide, FILTER_VALIDATE_URL) === FALSE) {
573 return '
574 <div class="nextPrayer">
575 <div class="align-middle-next-prayer">
576 <h4 class="sliderMessage">' . stripslashes($slide) . '</h4>
577 </div>
578 </div>
579 ';
580 }
581 return '<img class="carousel-slide" src="' . $slide . '">';
582 }
583
584 private function getRefreshPoints()
585 {
586 $result = $this->db->getPrayerTimeForToday();
587 $iqamahTimes = array($result['fajr_jamah'], $result['sunrise'], $result['zuhr_jamah'], $result['asr_jamah'], $result['maghrib_jamah'], $result['isha_jamah']);
588
589 $refreshPoints = array();
590 foreach($iqamahTimes as $iqamah) {
591 $refreshPoints[] = date( "H:i:s", strtotime( $iqamah . "-15 minutes" ) );
592 }
593
594 $minsAfterIsha = 31;
595 if($this->isRamadan()) {
596 $minsAfterIsha += (int)get_option('taraweehDim');
597 }
598
599 $refreshPoints[] = date( "H:i:s", strtotime( end($iqamahTimes) . "+" . $minsAfterIsha . " minutes" ) ); // after 30 min overnight dim is true
600
601 return $refreshPoints;
602 }
603
604 private function getOtherAdhanTimes()
605 {
606
607 $result = $this->db->getPrayerTimeForToday();
608 $iqamahTimes = array($result['zuhr_jamah'], $result['asr_jamah'], $result['maghrib_begins'], $result['isha_jamah']);
609
610 $adhanTimes = array();
611
612 $zuhrAdhanBefore = empty($min = get_option('zuhrAdhanBefore')) ? 15 : $min;
613 $adhanTimes[] = date( "H:i:s", strtotime( $iqamahTimes[0] . "-" . $zuhrAdhanBefore . " minutes" ) ); // zuhr
614
615 $asrAdhanBefore = empty($min = get_option('asrAdhanBefore')) ? 15 : $min;
616 $adhanTimes[] = date( "H:i:s", strtotime( $iqamahTimes[1] . "-" . $asrAdhanBefore . " minutes" ) ); // asr
617
618 $adhanTimes[] = date( "H:i:s", strtotime( $iqamahTimes[2] . "0 minutes" ) ); // maghrib
619
620 $ishaAdhanBefore = empty($min = get_option('ishaAdhanBefore')) ? 15 : $min;
621
622 $adhanTimes[] = date( "H:i:s", strtotime( $iqamahTimes[3] . "-" . $ishaAdhanBefore . " minutes" ) ); // isha
623
624 return $adhanTimes;
625 }
626
627 private function getFajrAdhanTime()
628 {
629 $result = $this->db->getPrayerTimeForToday();
630
631 if ( $this->isRamadan() ) {
632 return date( "H:i:s", strtotime( $result['fajr_begins'] . "0 minutes" ) ); // fajr start
633 }
634
635 $fajrAdhanBefore = empty($min = get_option('fajrAdhanBefore')) ? 15 : $min;
636
637 return date( "H:i:s", strtotime( $result['fajr_jamah'] . "-" . $fajrAdhanBefore . " minutes ") ); // fajr iqamah
638 }
639
640 private function setAttributes($attr=array())
641 {
642 if (isset($attr['mute_adhan'])) {
643 $this->adhan = null;
644 }
645
646 if ( isset($attr['view']) ) {
647 $this->isPortrait = ( strtolower(esc_attr($attr['view'])) == 'vertical' );
648 $this->isPresentation = ( strtolower(esc_attr($attr['view'])) == 'presentation' );
649
650 if ( $this->isPortrait ) {
651 $this->verticalClass = "vertical";
652 }
653 }
654
655 if ( isset($attr['dim']) ) {
656 $this->screenTimeout = esc_attr($attr['dim']);
657 }
658
659 if ( isset($attr['disable_overnight_dim'])) {
660 $this->disableOvernightDim = true;
661 }
662
663 if ( isset($attr['deactivate_tomorrow'])) {
664 add_option('deactivate_tomorrow', true);
665 } else {
666 delete_option('deactivate_tomorrow');
667 }
668
669 if ( isset($attr['scroll']) ) {
670 $this->scrollText = esc_attr($attr['scroll']);
671 }
672
673 if ( isset($attr['scroll_link']) ) {
674 $this->scrollUrl = esc_attr($attr['scroll_link']);
675 }
676
677 if ( isset($attr['blink']) ) {
678 $this->blinkText = esc_attr($attr['blink']);
679 }
680
681 if ( isset($attr['blink_link']) ) {
682 $this->blinkUrl = esc_attr($attr['blink_link']);
683 }
684
685 if ( isset($attr['slides']) ) {
686 $this->presentationSlides = explode(',', esc_attr($attr['slides']));
687 }
688
689 if ( isset($attr['template']) ) {
690 $this->template = esc_attr($attr['template']);
691 }
692 }
693
694 private function getFadingMessages()
695 {
696 if (empty(get_option('ds-fading-msg'))) {
697 return 0;
698 }
699 $messages = explode('.', get_option('ds-fading-msg'));
700 $messages = array_map('stripslashes', $messages);
701 $messages = array_filter($messages);
702
703 $gregorianDate = date_i18n( 'l ' . get_option( 'date_format' ));
704
705 $hijriCheckbox = get_option('hijri-chbox');
706
707 if ( ! empty($hijriCheckbox) ) {
708 $hijriDate = $this->getHijriDate(date("d"), date("m"), date("Y"), $this->getRow());
709 $gregorianDate = $gregorianDate . ' | ' . $hijriDate;
710 }
711 array_push($messages, $gregorianDate);
712 return $messages;
713 }
714
715 private function getWpHour()
716 {
717 $wpTimeFormat = explode(' ', date_i18n( 'l ' . get_option( 'time_format' ) ))[1];
718 $clockHour = explode(':', $wpTimeFormat);
719
720 return $clockHour[0];
721 }
722 }
723