PluginProbe
Depicter — Popup & Slider Builder / 1.9.2
Depicter — Popup & Slider Builder v1.9.2
4.8.1 trunk 1.0.0 1.1.0 1.1.2 1.1.4 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.3.5 1.3.8 1.5.0 1.5.1 1.5.2 1.5.5 1.6.0 1.6.1 1.6.2 1.7.0 All 76 releases
depicter / app / src / Document / Models / Options / Loading.php

Loading.php in Depicter — Popup & Slider Builder 1.9.2, at app/src/Document/Models/Options/Loading.php

94 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Depicter\Document\Models\Options;
3
4
5 use Depicter\Document\CSS\Selector;
6 use Depicter\Html\Html;
7
8 class Loading
9 {
10 /**
11 * @var object
12 */
13 public $lazyload;
14
15 /**
16 * @var string
17 */
18 public $loadingSymbol = 'dotFlashing-dark';
19
20 /**
21 * get html of loading symbol
22 * @return \TypeRocket\Html\Html
23 */
24 public function render() {
25
26 // loadingSymbol consist of two part , the symbolID and dark or light mode
27 $loadingSymbol = explode( '-', $this->loadingSymbol );
28 $loadingMarkup = '';
29 $loadingPath = DEPICTER_PLUGIN_PATH . '/resources/scripts/loadings/snippets/'.$loadingSymbol[0].'/'.$loadingSymbol[1].'.html';
30
31 if ( in_array( $loadingSymbol[0], $this->loadingsList() ) && is_file( $loadingPath ) ) {
32 $loadingMarkup = file_get_contents( $loadingPath );
33 }
34
35 return Html::div(
36 [
37 'class' => Selector::prefixify('loading-container') . ' ' . Selector::prefixify('loading ' . $this->loadingSymbol ),
38 ],
39 $loadingMarkup
40 );
41 }
42
43 /**
44 * Get preload value
45 *
46 * @return false|string
47 */
48 public function getValue() {
49 $type = $this->lazyload->type ?? 'sequential';
50
51 switch ( $type ):
52 case 'nearby':
53 return $this->lazyload->nearbyNum ?? 1;
54 break;
55 case 'sequential':
56 return 0;
57 break;
58 case 'all':
59 return 'all';
60 break;
61 default:
62 return false;
63 break;
64 endswitch;
65
66 }
67
68 /**
69 * The list of valid loading symbol names
70 *
71 * @return array
72 */
73 public function loadingsList() {
74 return [
75 'audio',
76 'ballTriangle',
77 'bars',
78 'circles',
79 'dotFlashing',
80 'dotReplacing',
81 'dotStraightSwing',
82 'dotSwing',
83 'grid',
84 'hearts',
85 'oval',
86 'puff',
87 'rings',
88 'spinningCircles',
89 'tailSpin',
90 'threeDots'
91 ];
92 }
93 }
94