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