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