PluginProbe ʕ •ᴥ•ʔ
Daily Prayer Time / 2025.03.06
Daily Prayer Time v2025.03.06
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 year ago QuranADay 1 year ago StartTime 1 year ago design 1 year ago AdminMenu.php 2 years ago AssetsLoader.php 1 year ago CustomPluginSettings.php 4 years ago DPTAjaxHandler.php 4 years ago DPTHelper.php 1 year ago DSTemplateLoader.php 2 years ago DailyShortCode.php 1 year ago DigitalScreen.php 1 year ago HijriDate.php 3 years ago Init.php 4 years ago MonthlyShortCode.php 2 years ago MonthlyTimeTable.php 3 years ago Shortcodes.php 2 years ago Translator.php 4 years ago UpdateStyles.php 1 year ago Validator.php 3 years ago db.php 1 year ago dptWidget.php 4 years ago
DigitalScreen.php
693 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
48 public function __construct($attr=array())
49 {
50 parent::__construct();
51
52 $this->scrollText = esc_html(stripslashes(get_option("ds-scroll-text")));
53 $this->scrollSpeed = empty(get_option("ds-scroll-speed")) ? $this->scrollSpeed : get_option("ds-scroll-speed");
54 $this->blinkText = esc_html(stripslashes(get_option("ds-blink-text")));
55 $this->dptHelper = new DPTHelper();
56 $this->setAttributes($attr);
57 }
58
59 public function displayDigitalScreen()
60 {
61 if ($this->template || get_option('template-chbox')) {
62 return $this->getTemplate();
63 }
64
65 $html = $this->getTopRow();
66
67 if ($this->isPresentation) {
68 $html .= $this->getPresentationRow();
69 } else {
70 $html .= $this->getMiddleRow();
71 }
72
73 $html .= $this->getBottomRow();
74
75 return $html;
76 }
77
78 private function getTemplate()
79 {
80 if ($template = get_option('dsTemplate')) {
81 $this->template = $template;
82 }
83
84 include "design/$this->template.php";
85 $this->template = null;
86 }
87
88 private function getHiddenVariables()
89 {
90 $localNumbers = $this->getLocalNumbers();
91 $localNumbers = array_combine(array_keys($localNumbers), $localNumbers);
92 $localNumbersJson = json_encode($localNumbers, JSON_UNESCAPED_UNICODE);
93
94 $timesLocal = json_encode([
95 'minute' => $this->getLocalTimes()['minute'],
96 'minutes' => $this->getLocalTimes()['minute'] . 's',
97 'hour' => $this->getLocalTimes()['hour'],
98 'hours' => $this->getLocalTimes()['hour'] . 's',
99 ],
100 JSON_UNESCAPED_UNICODE);
101
102 $hiddenVariables = '
103 <input type="hidden" value="' . $this->canDimOvernight($this->getRow(), $this->disableOvernightDim) . '" id="overnightDim">
104 <input type="hidden" value="' . $this->screenTimeout . '" id="screenTimeout">
105
106 <input type="hidden" value="' . $this->getKhutbahDim($this->getRow()) . '" id="khutbahDim">
107 <input type="hidden" value="' . $this->getTaraweehDim($this->getRow()) . '" id="taraweehDim">
108
109 <input type="hidden" value="' . htmlspecialchars(json_encode($this->getRefreshPoints())) . '" id="refreshPoint">
110
111 <input type="hidden" value="' . get_option('activateAdhan') . '" id="activateAdhan">
112 <input type="hidden" value="' . get_option('activateBeep') . '" id="activateBeep">
113 <input type="hidden" value="' . get_option('quran-chbox') . '" id="quranCheckbox">
114 <input type="hidden" value="' . $this->getWpHour() . '" id="clockHour">
115
116 <input type="hidden" value="' . htmlspecialchars(json_encode($this->getFadingMessages())) . '" id="fadingMessages">
117 <input type="hidden" value="' . htmlentities($localNumbersJson) . '" id="localizedNumbers">
118 <input type="hidden" value="' . htmlentities($timesLocal) . '" id="localizedTimes">
119 <input type="hidden" value="' . htmlspecialchars($this->getFajrAdhanTime(), JSON_UNESCAPED_UNICODE) . '" id="fajrAdhanTime">
120 <input type="hidden" value="' . htmlspecialchars(json_encode($this->getOtherAdhanTimes(), JSON_UNESCAPED_UNICODE)) . '" id="otherAdhanTimes">
121 ';
122
123 if (get_option("activateAdhan") === 'adhan') {
124 $hiddenVariables .= '
125 <input type="hidden" value="' . get_option('fajrAdhanUrl') . '" id="fajrAdhanUrl">
126 <input type="hidden" value="' . get_option('otherAdhanUrl') . '" id="otherAdhanUrl">
127 ';
128 }
129
130 return $hiddenVariables;
131 }
132
133 private function getTopRow()
134 {
135 $timeClass = "col-sm-3 ";
136 $dateClass = "col-sm-7 ";
137 $height = "height-100";
138 $verticalClass = "";
139 if ( $this->isPortrait ) {
140 $timeClass = "col-xs-12 vertical-time ";
141 $dateClass = "col-xs-12 vertical-date";
142 $height = "height-50 ";
143 $verticalClass = "vertical";
144 }
145
146 if ( get_option('hijri-chbox')) {
147 $date = date_i18n( 'D jS M' );
148 } else {
149 $date = date_i18n( 'l ' . get_option( 'date_format' ) );
150 }
151
152 $html = '
153 <div class="container-fluid x-board">
154 ' . $this->getHiddenVariables() . '
155
156 <div class="row top-row dpt-bg">
157 <div class="time bg-dark ' . $timeClass . 'col-xs-12 text-center ' . $height . '">
158 <div class="clock align-middle">
159 <ul class="clock">
160 <li id="hours"></li>
161 <li id="pointx">:</li>
162 <li id="min"></li>
163 <li id="pointx">:</li>
164 <li id="sec"></li>
165 </ul>
166 </div>
167 </div>
168 <div class="' . $dateClass . ' col-xs-12 text-center ' . $height . '">
169 <div class="align-middle" id="date-section">
170 <span id="dsDate" class="date-eng h6 ' . $verticalClass . '">' . $date. '
171 <span id="dsHijriDate" class="'. $verticalClass . 'hijri">
172 ' . $this->getHijriDate(date("d"), date("m"), date("Y"), $this->getRow()) . '
173 </span>
174 </span>
175 </div>
176 </div>
177 <div class="col-sm-2 col-xs-12 text-right align-middle padding-null">';
178
179 $html .= $this->getLogoUrl();
180
181 $html .=
182 '</div>
183 </div>';
184 return $html;
185 }
186
187 private function getLogoUrl()
188 {
189 if ($this->isPortrait ) {
190 return;
191 }
192
193 $isLogo = get_option('ds-logo');
194 if ( $isLogo) {
195 return '<img class="logo" src="' . $isLogo . '">';
196 } else {
197 $custom_logo_id = get_theme_mod( 'custom_logo' );
198 $image_url = wp_get_attachment_image_url ( $custom_logo_id , 'full' );
199 return '<img class="logo" src="' . $image_url . '">';
200 }
201 }
202
203 private function getMiddleRow()
204 {
205 $leftClass = "col-sm-5 col-xs-12 bg-red height-100 padding-null text-center";
206 $rightClass = "col-sm-7 col-xs-12 padding-null text-center bg-green height-100 padding-null";
207 $verticalClass = "";
208 $sunriseOrZawal = $this->dptHelper->getSunriseOrZawal($this->row);
209
210 if ( $this->isPortrait ) {
211 $verticalClass = "vertical";
212 $leftClass = "col-sm-12 bg-red padding-null text-center height-60";
213 $rightClass = "col-sm-12 padding-null text-center bg-green height-40";
214 }
215
216 $html = '
217 <div class="row middle-row bg-red">
218 <div class="'. $leftClass .'">
219 <table id="dsPrayerTimetable" class="table height-100 '. $verticalClass .'">
220 <thead class="bg-dark">
221 <tr>
222 <th class="dsPrayerName">
223 <span class="dpt_start">' . strtoupper($this->getLocalHeaders()['prayer']) . '</span>
224 </th>
225 <th class="dsBegins">
226 <span class="dpt_start">' . strtoupper($this->getLocalHeaders()['begins']) . '</span>
227 </th>
228 <th class="dsIqamah">
229 <span class="dpt_jamah">' . strtoupper($this->getLocalHeaders()['iqamah']) . '</span>
230 </th>
231 </tr>
232 </thead>
233 <tbody>
234 <tr class=' . $this->getNextPrayerClass('fajr', $this->row, true) . '>
235 <td class="prayerName">
236 <span>' . $this->getLocalPrayerNames()['fajr'] . '</span>
237 </td>
238 <td class="l-red">' . do_shortcode("[fajr_start]") . '</td>
239 <td>' . do_shortcode("[fajr_prayer]") . '</td>
240 </tr>
241 <tr class=' . $this->getNextPrayerClass($sunriseOrZawal, $this->row) . '>
242 <td class="prayerName"><span>' . $this->getLocalPrayerNames()[$sunriseOrZawal] . '</span></td>
243 <td class="prayerName sunrise" colspan="2">' . do_shortcode("[$sunriseOrZawal]") . '</td>
244 </tr>';
245
246
247 $html .= '
248 <tr class=' . $this->getNextPrayerClass('zuhr', $this->row) . '>
249 <td class="prayerName"><span>' . $this->getLocalPrayerNames()['zuhr'] . '</span></td>
250 <td class="l-red">' . do_shortcode("[zuhr_start]") . '</td>
251 <td>' . do_shortcode("[zuhr_prayer]") . '</td>
252 </tr>
253 ';
254
255 $html .=
256 '<tr class=' . $this->getNextPrayerClass('asr', $this->row) . '>
257 <td class="prayerName"><span>' . $this->getLocalPrayerNames()['asr'] . '</span></td>
258 <td class="l-red">' . do_shortcode("[asr_start]") . '</td>
259 <td>' . do_shortcode("[asr_prayer]") . '</td>
260 </tr>
261 <tr class=' . $this->getNextPrayerClass('maghrib', $this->row) . '>
262 <td class="prayerName"><span>' . $this->getLocalPrayerNames()['maghrib'] . '</span></td>
263 <td class="l-red">' . do_shortcode("[maghrib_start]") . '</td>
264 <td>' . do_shortcode("[maghrib_prayer]") . '</td>
265 </tr>
266 <tr class=' . $this->getNextPrayerClass('isha', $this->row) . '>
267 <td class="prayerName"><span>' . $this->getLocalPrayerNames()['isha'] . '</span></td>
268 <td class="l-red">' . do_shortcode("[isha_start]") . '</td>
269 <td>' . do_shortcode("[isha_prayer]") . '</td>
270 </tr>';
271 $html .= '
272 <tr class=' . $this->getNextPrayerClass('jumuah', $this->row) . '>
273 <td class="prayerName"><span>' . stripslashes($this->getLocalHeaders()['jumuah']) . '</span></td>
274 <td colspan="2" class="prayerName l-red sunrise">
275 ' . $this->getJumuahTimesArray($this->isPortrait) . '
276 </td>
277 </tr>';
278 $html .= '
279 </tbody>
280 </table>
281 </div>'; //left class
282
283 $transitionEffect = get_option('transitionEffect');
284 $transitionSpeed = get_option('transitionSpeed');
285 $html .='
286 <div class="'. $rightClass .'">
287 <div id="carouselExampleIndicators" class="carousel slide ' . $transitionEffect . ' height-100" data-bs-ride="carousel">
288 <div class="carousel-inner">
289 <div class="carousel-item active">
290 ' . $this->getFirstSlide() . '
291 </div>
292 ' . $this->getOtherSlides($transitionSpeed) . '
293 </div>';
294 if ( $this->isPortrait ) {
295 $html .= '<button class="carousel-control-prev" type="button" data-bs-target="#carouselExampleIndicators" data-bs-slide="prev">
296 <span class="carousel-control-prev-icon" aria-hidden="true"></span>
297 <span class="visually-hidden">Previous</span>
298 </button>
299 <button class="carousel-control-next" type="button" data-bs-target="#carouselExampleIndicators" data-bs-slide="next">
300 <span class="carousel-control-next-icon" aria-hidden="true"></span>
301 <span class="visually-hidden">Next</span>
302 </button>';
303 }
304 $html .= '</div>
305 </div>
306 </div>
307 ';
308
309 return $html;
310 }
311
312 private function getBottomRow()
313 {
314 $verticalClass = "";
315
316 if ( $this->isPortrait ) {
317 $verticalClass = "vertical";
318 }
319
320 $html = '
321 <div class="row bottom-row">
322 <div class="notificationBackground col-sm-3 col-xs-12 text-center height-100 align-middle">
323 <div class="align-middle">
324 <span id="dsBlink" class="blink">' . $this->getBlink() . '</span>
325 </div>
326 </div>
327 <div class="col-sm-9 col-xs-12 height-100 dpt-bg">
328 <div class="align-middle">
329 <h3 class="text-primary scrolling">
330 <div class="marquee">
331 <span>' . $this->getIqamahUpdate() . '</span>
332 </div>
333 </h3>
334 </div>
335 </div>
336 </div>
337 </div>
338 ';
339
340 if ($this->isPortrait) {
341 $html = '
342 <div class="row bottom-row">
343 <div class="col-sm-12 col-xs-12 height-24">
344 <div class="align-middle">
345 <h3 class="text-primary scrolling-vertical">
346 <div class="marquee">
347 <span>' . $this->getIqamahUpdate() . '</span>
348 </div>
349 </h3>
350 </div>
351 </div>
352 <div class="notificationBackground notificationFont col-sm-12 col-xs-12 text-center height-50 align-middle">
353 <div class="align-middle">
354 <span id="dsBlink" class="blink-'.$verticalClass.'">' . $this->getBlink() . '</span>
355 </div>
356 </div>
357 </div>
358 </div>
359 ';
360 }
361
362 return $html;
363 }
364
365
366 private function getQuranSlides()
367 {
368 $transitionEffect = get_option('transitionEffect');
369 $transitionSpeed = get_option('transitionSpeed');
370
371 $html ='
372 <div class="row middle-row bg-red">
373 <div id="carouselExampleIndicators" class="carousel slide ' . $transitionEffect . ' height-100" data-bs-ride="carousel">
374 <div class="carousel-inner">
375 ' . $this->getOtherSlides($transitionSpeed) . '
376 </div>
377 </div>
378 </div>
379 ';
380
381 return $html;
382 }
383
384 private function getPresentationRow()
385 {
386 $transitionEffect = get_option('transitionEffect');
387 $transitionSpeed = get_option('transitionSpeed');
388
389 $html ='
390 <div class="row middle-row bg-red height-100">
391 <div id="carouselExampleIndicators" class="carousel slide ' . $transitionEffect . ' height-100" data-bs-ride="carousel">
392 <div class="carousel-inner height-100">
393 ' . $this->getPresentationSlides($transitionSpeed) . '
394 </div>
395 </div>
396 </div>
397 ';
398
399 return $html;
400 }
401
402 private function getPresentationSlides($transitionSpeed)
403 {
404 $this->presentationSlides = $this->getSliderUrls();
405 $html = '
406 <div class="carousel-item active height-100" data-bs-interval="'. $transitionSpeed .'">
407 <img class="carousel-slide" src="' . array_shift($this->presentationSlides) . '">
408 </div>';
409
410 foreach ($this->presentationSlides as $i => $slideUrl) {
411 if (empty($slideUrl)) continue;
412 $html .= '
413 <div class="carousel-item height-100" data-bs-interval="'. $transitionSpeed .'">
414 <img class="carousel-slide " src="' . trim($slideUrl) . '">
415 </div>
416 ';
417 }
418
419 return $html;
420 }
421
422 private function getIqamahUpdate()
423 {
424 $orientation = 'horizontal';
425 if ($this->isPortrait) {
426 $orientation = 'vertical';
427 }
428
429 if ( $this->scrollText ) {
430 return '
431 <div class="dsScroll">
432 <input type="hidden" id="scrollSpeed" value="' . $this->scrollSpeed . '">
433 <a class="scroll" target="_new" href="'. $this->scrollUrl .' " >'. $this->scrollText . '</a>
434 </div>' . do_shortcode("[display_iqamah_update orientation='" . $orientation . "']");
435 } else {
436 return '
437 <div class="dsScroll">
438 <input type="hidden" id="scrollSpeed" value="' . $this->scrollSpeed . '">
439 </div>' . do_shortcode("[display_iqamah_update orientation='" . $orientation . "']");
440 }
441 }
442
443 private function getBlink()
444 {
445 $orientation = '';
446 if ($this->isPortrait) {
447 $orientation = 'vertical';
448 }
449
450 return '<a class="notificationFont blink-' .$orientation.'" target="_new" href="'. $this->blinkUrl .'">'. $this->blinkText .'</a>';
451 }
452
453 private function getFirstSlide()
454 {
455 $verticalClass = "";
456 $sehriClass = "sehri";
457 $iftarClass = "iftar";
458 if ( $this->isPortrait ) {
459 $verticalClass = "vertical";
460 $sehriClass = "sehri sehri-vertical";
461 $iftarClass = "iftar iftar-vertical";
462 }
463
464 if ($this->isRamadan()) {
465 $h3 = '
466 <div class="dsRamadan">
467 <div class="' . $sehriClass . '">' . $this->getLocalHeaders()['fast_begins'] . ': ' . $this->formatDateForPrayer($this->getFajrBegins(), true) . '</div>
468 <div class="' . $iftarClass . ' pull-right">' . $this->getLocalHeaders()['fast_ends']. ': ' . do_shortcode("[maghrib_start]") . '</div>
469 </div>';
470 } else {
471 $h3 = '<h3 class="'.$verticalClass.'">'. $this->getLocalTimes()['next prayer'] . '</h3>';
472 }
473
474 $html = '
475 <div class="nextPrayer">
476 <div class="align-middle-next-prayer">'
477 . $h3 .
478 '<h2 id="dsNextPrayer" class="dsNextPrayer '.$verticalClass.'"></h2>
479 </div>
480 </div>';
481
482 return $html;
483 }
484
485 private function getOtherSlides($transitionSpeed=10)
486 {
487 if ( get_option('quran-chbox') ) {
488 return '<div class="carousel-item height-100" data-bs-interval="10000">
489 <div class="nextPrayer">
490 <div class="align-middle-next-prayer">
491 <h4 id="quranVerse" class="' . $this->verticalClass . '"></h4>
492 </div>
493 </div>
494 </div>';
495 }
496
497 if ( get_option('slider-chbox') ) {
498 $html = "";
499 $slides = $this->getSliderUrls();
500
501 $slides = array_filter(array_map('trim', $slides));
502 foreach ($slides as $i => $slide) {
503 $html .= '
504 <div class="carousel-item height-100" data-bs-interval="'. $transitionSpeed .'">
505 <a href="' . get_option("slider". ($i+1) . "Url") . '" style="color:' . get_option('fontColor') .'">
506 ' . $this->getImageOrMessage($slide) . '
507 </a>
508 </div>
509 ';
510
511 $nextPrayerSlide = (int)get_option('nextPrayerSlide');
512 if (!$this->isPresentation && $nextPrayerSlide > 0) {
513 $count = $i + 1;
514 if ( $count % $nextPrayerSlide == 0 ) {
515 $html .= '
516 <div class="carousel-item">
517 ' . $this->getFirstSlide() . '
518 </div>
519 ';
520 }
521 }
522 }
523
524 return $html;
525 }
526
527 return null;
528 }
529
530 private function getSliderUrls(): array
531 {
532 $slides = [];
533 if ($this->presentationSlides) {
534 return $this->presentationSlides;
535 }
536
537 foreach (range(1, 11) as $item) {
538 $slides[] = get_option('slider' . $item);
539 }
540
541 return $slides;
542 }
543
544 private function getImageOrMessage($slide)
545 {
546 if (filter_var($slide, FILTER_VALIDATE_URL) === FALSE) {
547 return '
548 <div class="nextPrayer">
549 <div class="align-middle-next-prayer">
550 <h4 class="sliderMessage">' . stripslashes($slide) . '</h4>
551 </div>
552 </div>
553 ';
554 }
555 return '<img class="carousel-slide" src="' . $slide . '">';
556 }
557
558 private function getRefreshPoints()
559 {
560 $result = $this->db->getPrayerTimeForToday();
561 $iqamahTimes = array($result['fajr_jamah'], $result['sunrise'], $result['zuhr_jamah'], $result['asr_jamah'], $result['maghrib_jamah'], $result['isha_jamah']);
562
563 $refreshPoints = array();
564 foreach($iqamahTimes as $iqamah) {
565 $refreshPoints[] = date( "H:i:s", strtotime( $iqamah . "-15 minutes" ) );
566 }
567
568 $minsAfterIsha = 31;
569 if($this->isRamadan()) {
570 $minsAfterIsha += (int)get_option('taraweehDim');
571 }
572
573 $refreshPoints[] = date( "H:i:s", strtotime( end($iqamahTimes) . "+" . $minsAfterIsha . " minutes" ) ); // after 30 min overnight dim is true
574
575 return $refreshPoints;
576 }
577
578 private function getOtherAdhanTimes()
579 {
580
581 $result = $this->db->getPrayerTimeForToday();
582 $iqamahTimes = array($result['zuhr_jamah'], $result['asr_jamah'], $result['maghrib_begins'], $result['isha_jamah']);
583
584 $adhanTimes = array();
585
586 $zuhrAdhanBefore = empty($min = get_option('zuhrAdhanBefore')) ? 15 : $min;
587 $adhanTimes[] = date( "H:i:s", strtotime( $iqamahTimes[0] . "-" . $zuhrAdhanBefore . " minutes" ) ); // zuhr
588
589 $asrAdhanBefore = empty($min = get_option('asrAdhanBefore')) ? 15 : $min;
590 $adhanTimes[] = date( "H:i:s", strtotime( $iqamahTimes[1] . "-" . $asrAdhanBefore . " minutes" ) ); // asr
591
592 $adhanTimes[] = date( "H:i:s", strtotime( $iqamahTimes[2] . "0 minutes" ) ); // maghrib
593
594 $ishaAdhanBefore = empty($min = get_option('ishaAdhanBefore')) ? 15 : $min;
595
596 $adhanTimes[] = date( "H:i:s", strtotime( $iqamahTimes[3] . "-" . $ishaAdhanBefore . " minutes" ) ); // isha
597
598 return $adhanTimes;
599 }
600
601 private function getFajrAdhanTime()
602 {
603 $result = $this->db->getPrayerTimeForToday();
604
605 if ( $this->isRamadan() ) {
606 return date( "H:i:s", strtotime( $result['fajr_begins'] . "0 minutes" ) ); // fajr start
607 }
608
609 $fajrAdhanBefore = empty($min = get_option('fajrAdhanBefore')) ? 15 : $min;
610
611 return date( "H:i:s", strtotime( $result['fajr_jamah'] . "-" . $fajrAdhanBefore . " minutes ") ); // fajr iqamah
612 }
613
614 private function setAttributes($attr=array())
615 {
616 if ( isset($attr['view']) ) {
617 $this->isPortrait = ( strtolower(esc_attr($attr['view'])) == 'vertical' );
618 $this->isPresentation = ( strtolower(esc_attr($attr['view'])) == 'presentation' );
619
620 if ( $this->isPortrait ) {
621 $this->verticalClass = "vertical";
622 }
623 }
624
625 if ( isset($attr['dim']) ) {
626 $this->screenTimeout = esc_attr($attr['dim']);
627 }
628
629 if ( isset($attr['disable_overnight_dim'])) {
630 $this->disableOvernightDim = true;
631 }
632
633 if ( isset($attr['deactivate_tomorrow'])) {
634 add_option('deactivate_tomorrow', true);
635 } else {
636 delete_option('deactivate_tomorrow');
637 }
638
639 if ( isset($attr['scroll']) ) {
640 $this->scrollText = esc_attr($attr['scroll']);
641 }
642
643 if ( isset($attr['scroll_link']) ) {
644 $this->scrollUrl = esc_attr($attr['scroll_link']);
645 }
646
647 if ( isset($attr['blink']) ) {
648 $this->blinkText = esc_attr($attr['blink']);
649 }
650
651 if ( isset($attr['blink_link']) ) {
652 $this->blinkUrl = esc_attr($attr['blink_link']);
653 }
654
655 if ( isset($attr['slides']) ) {
656 $this->presentationSlides = explode(',', esc_attr($attr['slides']));
657 }
658
659 if ( isset($attr['template']) ) {
660 $this->template = esc_attr($attr['template']);
661 }
662 }
663
664 private function getFadingMessages()
665 {
666 if (empty(get_option('ds-fading-msg'))) {
667 return 0;
668 }
669 $messages = explode('.', get_option('ds-fading-msg'));
670 $messages = array_map('stripslashes', $messages);
671 $messages = array_filter($messages);
672
673 array_push($messages, date_i18n( 'l ' . get_option( 'date_format' )));
674
675 $hijriCheckbox = get_option('hijri-chbox');
676 if ( ! empty($hijriCheckbox) ) {
677 array_push($messages,
678 $this->getHijriDate(date("d"), date("m"), date("Y"), $this->getRow())
679 );
680 }
681
682 return $messages;
683 }
684
685 private function getWpHour()
686 {
687 $wpTimeFormat = explode(' ', date_i18n( 'l ' . get_option( 'time_format' ) ))[1];
688 $clockHour = explode(':', $wpTimeFormat);
689
690 return $clockHour[0];
691 }
692 }
693