PluginProbe
Post Grid Gutenberg Blocks – PostX / 2.5.6
Post Grid Gutenberg Blocks – PostX v2.5.6
5.0.39 5.0.38 5.0.37 5.0.36 5.0.35 5.0.34 5.0.33 5.0.32 5.0.31 5.0.30 5.0.29 5.0.28 5.0.27 5.0.26 5.0.25 5.0.23 5.0.24 5.0.22 5.0.21 5.0.20 5.0.19 5.0.18 5.0.17 2.1.1 2.1.2 All 237 releases
ultimate-post / blocks / News_Ticker.php

News_Ticker.php in Post Grid Gutenberg Blocks – PostX 2.5.6, at blocks/News_Ticker.php

1,136 lines 50.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace ULTP\blocks;
3
4 defined('ABSPATH') || exit;
5
6 class News_Ticker{
7 public function __construct() {
8 add_action('init', array($this, 'register'));
9 }
10 public function get_attributes($default = false){
11 $attributes = array(
12 'blockId' => [
13 'type' => 'string',
14 'default' => '',
15 ],
16 'previewImg' => [
17 'type' => 'string',
18 'default' => '',
19 ],
20
21 //--------------------------
22 // Label Style
23 //--------------------------
24 'tickLabelColor' => [
25 'type' => 'string',
26 'default' => '#fff',
27 'style' => [
28 (object)[
29 'selector'=>'{{ULTP}} .ultp-news-ticker-label { color:{{tickLabelColor}}; } '
30 ],
31 ],
32 ],
33 'tickLabelBg' => [
34 'type' => 'string',
35 'default' => '#1974d2',
36 'style' => [
37 (object)[
38 'selector'=>'{{ULTP}} .ultp-news-ticker-label{background-color:{{tickLabelBg}};}'
39 ],
40 (object)[
41 'depends' => [
42 (object)['key'=>'tickShapeStyle','condition'=>'!=','value'=>'normal'],
43 ],
44 'selector'=>'{{ULTP}} .ultp-news-ticker-label::after{border-color:transparent transparent transparent {{tickLabelBg}} !important}'
45 ],
46 ],
47 ],
48 'tickLabelTypo' => [
49 'type' => 'object',
50 'default' => (object)['openTypography'=>1,'size'=>(object)['lg'=>'16', 'unit'=>'px'], 'spacing'=>(object)[ 'lg'=>'0', 'unit'=>'px'], 'height'=>(object)[ 'lg'=>'27', 'unit'=>'px'],'decoration'=>'none','transform' => '','family'=>'','weight'=>'500'],
51 'style' => [
52 (object)[
53 'selector'=>'{{ULTP}} .ultp-news-ticker-label'
54 ],
55 ],
56 ],
57 'tickLabelPadding' => [
58 'type' => 'string',
59 'default' => '15',
60 'style' => [
61 (object)[
62 'selector'=>'{{ULTP}} .ultp-news-ticker-label { padding:0px {{tickLabelPadding}}px; }'
63 ],
64 ],
65 ],
66 'tickLabelSpace' => [
67 'type' => 'string',
68 'default' => '160',
69 'style' => [
70 (object)[
71 'selector'=>'{{ULTP}} .ultp-news-ticker-box { padding-left:{{tickLabelSpace}}px; }'
72 ],
73 ],
74 ],
75 'tickShapeStyle' => [
76 'type' => 'string',
77 'default' => 'normal',
78 'style' => [
79
80 (object)[
81 'depends' => [
82 (object)['key'=>'tickShapeStyle','condition'=>'==','value'=>'large'],
83 ],
84 'selector'=>'{{ULTP}} .ultp-news-ticker-label::after {border-top: 23px solid; border-left: 24px solid; border-bottom: 23px solid; right: -24px;border-color:transparent; }'
85 ],
86 (object)[
87 'depends' => [
88 (object)['key'=>'tickShapeStyle','condition'=>'==','value'=>'medium'],
89 ],
90 'selector'=>'{{ULTP}} .ultp-news-ticker-label::after { border-top: 17px solid; border-left: 20px solid;border-bottom: 17px solid;border-color:transparent;right:-20px;}'
91 ],
92 (object)[
93 'depends' => [
94 (object)['key'=>'tickShapeStyle','condition'=>'==','value'=>'small'],
95 ],
96 'selector'=>'{{ULTP}} .ultp-news-ticker-label::after { border-top: 12px solid;border-left: 15px solid;
97 border-bottom: 12px solid;border-color: transparent;right: -15px; }'
98 ],
99 (object)[
100 'depends' => [
101 (object)['key'=>'tickShapeStyle','condition'=>'==','value'=>'normal'],
102 ],
103 'selector'=>'{{ULTP}} .ultp-news-ticker-label::after {display:none !important;}'
104 ],
105 ],
106 ],
107 //--------------------------
108 // Ticker body Style
109 //--------------------------
110 'tickerContentHeight' => [
111 'type' => 'string',
112 'default' =>'45',
113 'style' => [
114 (object)[
115 'selector'=>'{{ULTP}} .ultp-news-ticker li ,.editor-styles-wrapper {{ULTP}} .ultp-newsTicker-wrap ul li ,{{ULTP}} .ultp-news-ticker-label ,{{ULTP}} .ultp-newsTicker-wrap ,{{ULTP}} .ultp-news-ticker-controls ,{{ULTP}} .ultp-news-ticker-controls button { height:{{tickerContentHeight}}px; }'
116 ],
117 ],
118 ],
119 'tickBodyColor' => [
120 'type' => 'string',
121 'default' => '#444',
122 'style' => [
123 (object)[
124 'selector'=>'{{ULTP}} .ultp-news-ticker li a, {{ULTP}} .ultp-news-ticker li div a, {{ULTP}} .ultp-news-ticker li div a span{ color:{{tickBodyColor}}; }'
125 ],
126 ],
127 ],
128 'tickBodyHovColor' => [
129 'type' => 'string',
130 'default' => '#7d7d7d',
131 'style' => [
132 (object)[
133 'selector'=>'{{ULTP}} .ultp-news-ticker li a:hover, {{ULTP}} .ultp-news-ticker li div:hover, {{ULTP}} .ultp-news-ticker li div a:hover span { color:{{tickBodyHovColor}}; }'
134 ],
135 ],
136 ],
137 'tickBodyListColor' => [
138 'type' => 'string',
139 'default' => '#037fff',
140 'style' => [
141 (object)[
142 'depends' => [
143 (object)['key'=>'tickTxtStyle','condition'=>'==','value'=>'box'],
144 ],
145 'selector'=>'{{ULTP}} .ultp-list-box::before { background-color:{{tickBodyListColor}};}'
146 ],
147 (object)[
148 'depends' => [
149 (object)['key'=>'tickTxtStyle','condition'=>'==','value'=>'circle'],
150 ],
151 'selector'=>'{{ULTP}} .ultp-list-circle::before { background-color:{{tickBodyListColor}};}'
152 ],
153 (object)[
154 'depends' => [
155 (object)['key'=>'tickTxtStyle','condition'=>'==','value'=>'hand'],
156 ],
157 'selector'=>'{{ULTP}} .ultp-list-hand::before { color:{{tickBodyListColor}};}'
158 ],
159 (object)[
160 'depends' => [
161 (object)['key'=>'tickTxtStyle','condition'=>'==','value'=>'right-sign'],
162 ],
163 'selector'=>'{{ULTP}} .ultp-list-right-sign::before { color:{{tickBodyListColor}};}'
164 ],
165 (object)[
166 'depends' => [
167 (object)['key'=>'tickTxtStyle','condition'=>'==','value'=>'right-bold'],
168 ],
169 'selector'=>'{{ULTP}} .ultp-list-right-bold::before { color:{{tickBodyListColor}};}'
170 ],
171 ],
172 ],
173 'tickerBodyBg' => [
174 'type' => 'string',
175 'default' => '#eeeeee',
176 'style' => [
177 (object)[
178 'selector'=>'{{ULTP}} .ultp-newsTicker-wrap .ultp-news-ticker-box , {{ULTP}} .ultp-news-ticker-controls {background-color:{{tickerBodyBg}}}'
179 ],
180 ],
181 ],
182 'tickBodyTypo' => [
183 'type' => 'object',
184 'default' => (object)['openTypography'=>1,'size'=>(object)['lg'=>'16', 'unit'=>'px'], 'spacing'=>(object)[ 'lg'=>'0', 'unit'=>'px'], 'height'=>(object)[ 'lg'=>'16', 'unit'=>'px'],'decoration'=>'none','transform' => '','family'=>'','weight'=>'500'],
185 'style' => [
186 (object)[
187 'selector'=>'{{ULTP}} .ultp-news-ticker li a'
188 ],
189 ],
190 ],
191 'tickBodyBorderColor' => [
192 'type' => 'string',
193 'default' => '',
194 'style' => [
195 (object)[
196 'selector'=>'{{ULTP}} .ultp-newsTicker-wrap { background-color:{{tickBodyBorderColor}};border-color:{{tickBodyBorderColor}} }'
197 ],
198 ],
199 ],
200 'tickBodyBorder' => [
201 'type' => 'object',
202 'default' => (object)['openBorder'=>0,'disableColor'=> true, 'width' => (object)[ 'top' => 0, 'right' => 0, 'bottom' => 0, 'left' => 0],'type' => 'solid' ],
203 'style' => [
204 (object)[
205 'selector'=>'{{ULTP}} .ultp-block-items-wrap .ultp-newsTicker-wrap'
206 ],
207 ],
208 ],
209 'tickBodyRadius' => [
210 'type' => 'object',
211 'default' => (object)['lg' =>'', 'unit' =>'px'],
212 'style' => [
213 (object)[
214 'selector'=>'{{ULTP}} .ultp-newsTicker-wrap ,{{ULTP}} .ultp-news-ticker-label ,{{ULTP}} .ultp-news-ticker-box { border-radius:{{tickBodyRadius}}; }{{ULTP}} .ultp-news-ticker-prev { border-top-right-radius:0px !important; border-bottom-right-radius:0px !important; border-radius: {{tickBodyRadius}}; }'
215 ],
216 ],
217 ],
218 'tickTxtStyle' => [
219 'type' => 'string',
220 'default' => 'normal',
221 'style' => [
222 (object)[
223 'selector'=>'{{ULTP}} .ultp-news-ticker li { list-style-type:none; }'
224 ],
225 ],
226 ],
227 'tickImgWidth' => [
228 'type' => 'string',
229 'default' => '30',
230 'style' => [
231 (object)[
232 'depends' => [
233 (object)['key'=>'tickImageShow','condition'=>'==','value'=>true],
234 ],
235 'selector'=>'{{ULTP}} .ultp-news-ticker li div img {width:{{tickImgWidth}}px}'
236 ],
237 ],
238 ],
239 'tickImgSpace' => [
240 'type' => 'string',
241 'default' => '10',
242 'style' => [
243 (object)[
244 'depends' => [
245 (object)['key'=>'tickImageShow','condition'=>'==','value'=>true],
246 ],
247 'selector'=>'{{ULTP}} .ultp-news-ticker li div img {margin-right: {{tickImgSpace}}px}'
248 ],
249 ],
250 ],
251 'tickImgRadius' => [
252 'type' => 'object',
253 'default' => (object)['lg' =>(object)['top' => "30",'bottom' => "30",'left' => "30",'right' => "30", 'unit' =>'px']],
254 'style' => [
255 (object)[
256 'selector'=>'{{ULTP}} .ultp-news-ticker li div img { border-radius:{{tickImgRadius}}; }'
257 ],
258 ],
259 ],
260 'tickBodySpace' => [
261 'type' => 'object',
262 'default' => (object)['lg'=>'21'],
263 'style' => [
264 (object)[
265 'depends' => [
266 (object)['key'=>'tickerType','condition'=>'==','value'=> 'marquee'],
267 ],
268 'selector'=>'{{ULTP}} .ultp-news-ticker { gap:{{tickBodySpace}}px; }'
269 ],
270 ],
271 ],
272 //--------------------------
273 // body time badge style
274 //--------------------------
275 'tickTimeBadge' => [
276 'type' => 'string',
277 'default' => 'Time Badge',
278 'style' => [
279 (object)[
280 'depends' => [
281 (object)['key'=>'tickTimeShow','condition'=>'==','value'=>true],
282 (object)['key'=>'tickerType','condition'=>'!=','value'=>'typewriter'],
283 ],
284 ],
285 ],
286 ],
287 'timeBadgeColor' => [
288 'type' => 'string',
289 'default' => '#fff',
290 'style' => [
291 (object)[
292 'depends' => [
293 (object)['key'=>'tickTimeShow','condition'=>'==','value'=>true],
294 (object)['key'=>'tickerType','condition'=>'!=','value'=>'typewriter'],
295 ],
296 'selector'=>'{{ULTP}} .ultp-news-ticker li .ultp-ticker-timebadge { color:{{timeBadgeColor}}; }'
297 ],
298 ],
299 ],
300 'timeBadgeBg' => [
301 'type' => 'object',
302 'default' => (object)['openColor' => 1, 'type' => 'color', 'color' => '#444'],
303 'style' => [
304 (object)[
305 'depends' => [
306 (object)['key'=>'tickTimeShow','condition'=>'==','value'=>true],
307 (object)['key'=>'tickerType','condition'=>'!=','value'=>'typewriter'],
308 ],
309 'selector'=>'{{ULTP}} .ultp-news-ticker li .ultp-ticker-timebadge'
310 ],
311 ],
312 ],
313 'timeBadgeTypo' => [
314 'type' => 'object',
315 'default' => (object)['openTypography'=>1,'size'=>(object)['lg'=>'12', 'unit'=>'px'], 'spacing'=>(object)[ 'lg'=>'0', 'unit'=>'px'], 'height'=>(object)[ 'lg'=>'16', 'unit'=>'px'],'decoration'=>'none','transform' => '','family'=>'','weight'=>'500'],
316 'style' => [
317 (object)[
318 'depends' => [
319 (object)['key'=>'tickTimeShow','condition'=>'==','value'=>true],
320 (object)['key'=>'tickerType','condition'=>'!=','value'=>'typewriter'],
321 ],
322 'selector'=>'{{ULTP}} .ultp-news-ticker li .ultp-ticker-timebadge'
323 ],
324 ],
325 ],
326 'timeBadgeRadius' => [
327 'type' => 'object',
328 'default' => (object)['lg' =>(object)['top' => "100",'bottom' => "100",'left' => "100",'right' => "100", 'unit' =>'px']],
329 'style' => [
330 (object)[
331 'depends' => [
332 (object)['key'=>'tickTimeShow','condition'=>'==','value'=>true],
333 (object)['key'=>'tickerType','condition'=>'!=','value'=>'typewriter'],
334 ],
335 'selector'=>'{{ULTP}} .ultp-news-ticker li .ultp-ticker-timebadge { border-radius:{{timeBadgeRadius}}; }'
336 ],
337 ],
338 ],
339 'timeBadgePadding' => [
340 'type' => 'object',
341 'default' => (object)['lg'=>(object)['top'=>3,'bottom'=>3, 'left'=>6, 'right'=>6, 'unit'=>'px']],
342 'style' => [
343 (object)[
344 'selector'=>'{{ULTP}} .ultp-news-ticker li .ultp-ticker-timebadge { padding: {{timeBadgePadding}} }'
345 ],
346 ],
347 ],
348 //--------------------------
349 // Icon Navigator
350 //--------------------------
351 'TickNavStyle' => [
352 'type' => 'string',
353 'default' => 'nav1',
354 'style' => [
355 (object)[
356 'depends' => [
357 (object)['key'=>'navControlToggle','condition'=>'==','value'=> true],
358 ],
359 ],
360 ],
361 ],
362 'TickNavIconStyle' => [
363 'type' => 'string',
364 'default' => 'Angle2',
365 'style' => [
366 (object)[
367 'depends' => [
368 (object)['key'=>'navControlToggle','condition'=>'==','value'=> true],
369 ],
370 ],
371 ],
372 ],
373 'TickNavColor' => [
374 'type' => 'string',
375 'default' => '#fff',
376 'style' => [
377 (object)[
378 'selector'=>'{{ULTP}} .ultp-news-ticker-controls button.ultp-news-ticker-arrow:after{border-color:{{TickNavColor}}} {{ULTP}} .ultp-news-ticker-controls button.ultp-news-ticker-arrow svg { fill:{{TickNavColor}}}'
379 ],
380 (object)[
381 'depends' => [
382 (object)['key'=>'TickNavIconStyle','condition'=>'==','value'=>'icon2'],
383
384 ],
385 'selector'=>'{{ULTP}} .ultp-news-ticker-controls button.ultp-news-ticker-arrow:after , {{ULTP}} button.ultp-news-ticker-arrow:before{ border-right-color:{{TickNavColor}};border-left-color: {{TickNavColor}}; } '
386 ],
387
388 ],
389 ],
390 'TickNavBg' => [
391 'type' => 'object',
392 'default' => (object)['openColor' => 1, 'type' => 'color', 'color' => '#037fff'],
393 'style' => [
394 (object)[
395 'depends' => [
396 (object)['key'=>'TickNavStyle','condition'=>'==','value'=>'nav1'],
397 ],
398 'selector'=>'{{ULTP}} .ultp-news-ticker-controls button.ultp-news-ticker-arrow'
399 ],
400 (object)[
401 'depends' => [
402 (object)['key'=>'TickNavStyle','condition'=>'==','value'=>'nav2'],
403 ],
404 'selector'=>'{{ULTP}} .ultp-news-ticker-controls button.ultp-news-ticker-arrow'
405 ],
406 (object)[
407 'depends' => [
408 (object)['key'=>'TickNavStyle','condition'=>'!=','value'=>'nav1'],
409 (object)['key'=>'TickNavStyle','condition'=>'!=','value'=>'nav2'],
410 ],
411 'selector'=>'{{ULTP}} .ultp-news-ticker-controls'
412 ],
413 ],
414 ],
415 'TickNavHovColor' => [
416 'type' => 'string',
417 'default' => '#d0d0d0f4',
418 'style' => [
419 (object)[
420 'selector'=>'{{ULTP}} .ultp-news-ticker-controls button.ultp-news-ticker-arrow:hover:after{border-color:{{TickNavHovColor}}} {{ULTP}} .ultp-news-ticker-controls button.ultp-news-ticker-arrow svg:hover { fill:{{TickNavHovColor}}}'
421 ],
422 (object)[
423 'depends' => [
424 (object)['key'=>'TickNavIconStyle','condition'=>'==','value'=>'icon2'],
425 ],
426 'selector'=>'{{ULTP}} button.ultp-news-ticker-arrow:hover:after
427 , {{ULTP}} button.ultp-news-ticker-arrow:hover:before{ border-right-color:{{TickNavHovColor}};border-left-color:{{TickNavHovColor}}; }
428 '
429 ],
430
431 ],
432 ],
433 'TickNavHovBg' => [
434 'type' => 'object',
435 'default' => (object)['openColor' => 1, 'type' => 'color', 'color' => '#53a0ff'],
436 'style' => [
437 (object)[
438 'depends' => [
439 (object)['key'=>'TickNavStyle','condition'=>'==','value'=>'nav1'],
440 ],
441 'selector'=>'{{ULTP}} .ultp-news-ticker-controls button.ultp-news-ticker-arrow:hover'
442 ],
443 (object)[
444 'depends' => [
445 (object)['key'=>'TickNavStyle','condition'=>'==','value'=>'nav2'],
446 ],
447 'selector'=>'{{ULTP}} .ultp-news-ticker-controls button.ultp-news-ticker-arrow:hover'
448 ],
449 (object)[
450 'depends' => [
451 (object)['key'=>'TickNavStyle','condition'=>'==','value'=>'nav3'],
452 ],
453 'selector'=>'{{ULTP}} .ultp-news-ticker-controls button.ultp-news-ticker-arrow:hover'
454 ],
455 (object)[
456 'depends' => [
457 (object)['key'=>'TickNavStyle','condition'=>'!=','value'=>'nav1'],
458 (object)['key'=>'TickNavStyle','condition'=>'!=','value'=>'nav2'],
459 (object)['key'=>'TickNavStyle','condition'=>'!=','value'=>'nav3'],
460 ],
461 'selector'=>'{{ULTP}} .ultp-news-ticker-controls:hover'
462 ],
463 ],
464 ],
465 // Pause Style
466 'TickNavPause' => [
467 'type' => 'string',
468 'default' => 'Pause Icon Style',
469 'style' => [
470 (object)[
471 'depends' => [
472 (object)['key'=>'TickNavStyle','condition'=>'!=','value'=>'nav2'],
473 (object)['key'=>'controlToggle','condition'=>'==','value'=>true],
474 ],
475 ],
476 ],
477 ],
478 'PauseColor' => [
479 'type' => 'string',
480 'default' => '#fff',
481 'style' => [
482 (object)[
483 'depends' => [
484 (object)['key'=>'TickNavStyle','condition'=>'!=','value'=>'nav2'],
485 (object)['key'=>'controlToggle','condition'=>'==','value'=>true],
486 ],
487 'selector'=>'{{ULTP}} .ultp-news-ticker-controls button.ultp-news-ticker-pause:before , {{ULTP}} .ultp-news-ticker-controls button.ultp-news-ticker-pause:before , {{ULTP}} .ultp-news-ticker-nav4 button.ultp-news-ticker-pause:before { border-color:{{PauseColor}};}'
488 ],
489 ],
490 ],
491 'PauseHovColor' => [
492 'type' => 'string',
493 'default' => '#d0d0d0f4',
494 'style' => [
495 (object)[
496 'depends' => [
497 (object)['key'=>'TickNavIconStyle','condition'=>'!=','value'=>'icon2'],
498 (object)['key'=>'controlToggle','condition'=>'==','value'=> true],
499 ],
500 'selector'=>'{{ULTP}} .ultp-news-ticker-controls button.ultp-news-ticker-pause:hover:before { border-color:{{PauseHovColor}};}'
501 ],
502 ]
503 ],
504 'PauseBg' => [
505 'type' => 'object',
506 'default' => (object)['openColor' => 1, 'type' => 'color', 'color' => '#2163ff'],
507 'style' => [
508 (object)[
509 'depends' => [
510 (object)['key'=>'TickNavStyle','condition'=>'==','value'=>'nav1'],
511 (object)['key'=>'controlToggle','condition'=>'==','value'=>true],
512 ],
513 'selector'=>'{{ULTP}} .ultp-news-ticker-controls button.ultp-news-ticker-pause'
514 ],
515 (object)[
516 'depends' => [
517 (object)['key'=>'TickNavStyle','condition'=>'==','value'=>'nav3'],
518 (object)['key'=>'controlToggle','condition'=>'==','value'=>true],
519 ],
520 'selector'=>'{{ULTP}} .ultp-news-ticker-controls button.ultp-news-ticker-pause'
521 ],
522 ],
523 ],
524
525 'PauseHovBg' => [
526 'type' => 'object',
527 'default' => (object)['openColor' => 1, 'type' => 'color', 'color' => '#53a0ff'],
528 'style' => [
529 (object)[
530 'depends' => [
531 (object)['key'=>'TickNavStyle','condition'=>'==','value'=>'nav1'],
532 (object)['key'=>'controlToggle','condition'=>'==','value'=>true],
533 ],
534 'selector'=>'{{ULTP}} .ultp-news-ticker-controls .ultp-news-ticker-pause:hover'
535 ],
536 (object)[
537 'depends' => [
538 (object)['key'=>'TickNavStyle','condition'=>'==','value'=>'nav3'],
539 (object)['key'=>'controlToggle','condition'=>'==','value'=>true],
540 ],
541 'selector'=>'{{ULTP}} .ultp-news-ticker-controls .ultp-news-ticker-pause:hover'
542 ],
543 ],
544 ],
545 //--------------------------
546 // Query Setting
547 //--------------------------
548 'queryQuick' => [
549 'type' => 'string',
550 'default' => '',
551 'style' => [
552 (object)[
553 'depends' => [
554 (object)['key' => 'queryType','condition' => '!=','value' => array('customPosts', 'posts')]
555 ]
556 ],
557 ],
558 ],
559 'queryNumber' => [
560 'type' => 'string',
561 'default' =>4,
562 'style' => [
563 (object)[
564 'depends' => [
565 (object)['key' => 'queryType','condition' => '!=','value' => array('customPosts', 'posts')]
566 ]
567 ],
568 ],
569 ],
570 'queryType' => [
571 'type' => 'string',
572 'default' => 'post'
573 ],
574 'queryTax' => [
575 'type' => 'string',
576 'default' => 'category',
577 'style' => [
578 (object)[
579 'depends' => [
580 (object)['key' => 'queryType','condition' => '!=','value' => array('customPosts', 'posts')]
581 ]
582 ],
583 ],
584 ],
585 'queryTaxValue' => [
586 'type' => 'string',
587 'default' => '[]',
588 'style' => [
589 (object)[
590 'depends' => [
591 (object)['key' => 'queryTax','condition' => '!=','value' => ''],
592 (object)['key' => 'queryType','condition' => '!=','value' => array('customPosts', 'posts')]
593 ]
594 ],
595 ],
596 ],
597 'queryRelation' => [
598 'type' => 'string',
599 'default' => 'OR',
600 'style' => [
601 (object)[
602 'depends' => [
603 (object)['key' => 'queryTaxValue','condition' => '!=','value' => '[]'],
604 (object)['key' => 'queryType','condition' => '!=','value' => array('customPosts', 'posts')]
605 ]
606 ],
607 ],
608 ],
609 'queryOrderBy' => [
610 'type' => 'string',
611 'default' => 'date',
612 ],
613 'metaKey' => [
614 'type' => 'string',
615 'default' => 'custom_meta_key',
616 'style' => [
617 (object)[
618 'depends' => [
619 (object)['key' => 'queryOrderBy','condition' => '==','value' => 'meta_value_num'],
620 (object)['key' => 'queryType','condition' => '!=','value' => array('customPosts', 'posts')]
621 ]
622 ],
623 ],
624 ],
625 'queryOrder' => [
626 'type' => 'string',
627 'default' => 'desc',
628 ],
629 // Include Remove from Version 2.5.4
630 'queryInclude' => [
631 'type' => 'string',
632 'default' => '',
633 ],
634 'queryExclude' => [
635 'type' => 'string',
636 'default' => '',
637 'style' => [
638 (object)[
639 'depends' => [
640 (object)['key' => 'queryType','condition' => '!=','value' => array('customPosts', 'posts')]
641 ]
642 ],
643 ],
644 ],
645 'queryAuthor' => [
646 'type' => 'string',
647 'default' => '[]',
648 'style' => [
649 (object)[
650 'depends' => [
651 (object)['key' => 'queryType','condition' => '!=','value' => array('customPosts', 'posts')]
652 ]
653 ],
654 ],
655 ],
656 'queryOffset' => [
657 'type' => 'string',
658 'default' => '0',
659 'style' => [
660 (object)[
661 'depends' => [
662 (object)['key' => 'queryType','condition' => '!=','value' => array('customPosts', 'posts')]
663 ]
664 ],
665 ],
666 ],
667 'queryExcludeTerm' => [
668 'type' => 'string',
669 'default' => '[]',
670 'style' => [
671 (object)[
672 'depends' => [
673 (object)['key' => 'queryType','condition' => '!=','value' => array('customPosts', 'posts')]
674 ]
675 ],
676 ],
677 ],
678 'queryExcludeAuthor' => [
679 'type' => 'string',
680 'default' => '[]',
681 'style' => [
682 (object)[
683 'depends' => [
684 (object)['key' => 'queryType','condition' => '!=','value' => array('customPosts', 'posts')]
685 ]
686 ],
687 ],
688 ],
689 'querySticky' => [
690 'type' => 'boolean',
691 'default' => true,
692 'style' => [
693 (object)[
694 'depends' => [
695 (object)['key' => 'queryType','condition' => '!=','value' => array('customPosts', 'posts')]
696 ]
697 ],
698 ],
699 ],
700 'queryUnique' => [
701 'type' => 'string',
702 'default' => '',
703 'style' => [
704 (object)[
705 'depends' => [
706 (object)['key' => 'queryType','condition' => '!=','value' => array('customPosts', 'posts')]
707 ]
708 ],
709 ],
710 ],
711 'queryPosts' => [
712 'type' => 'string',
713 'default' => '[]',
714 'style' => [
715 (object)[
716 'depends' => [
717 (object)['key' => 'queryType','condition' => '==','value' => 'posts']
718 ]
719 ],
720 ],
721 ],
722 'queryCustomPosts' => [
723 'type' => 'string',
724 'default' => '[]',
725 'style' => [
726 (object)[
727 'depends' => [
728 (object)['key' => 'queryType','condition' => '==','value' => 'customPosts']
729 ]
730 ],
731 ],
732 ],
733 //--------------------------
734 // General Setting
735 //--------------------------
736 'tickerType' => [
737 'type' => 'string',
738 'default' => 'vertical',
739 ],
740 'tickerPositionEna' => [
741 'type' => 'boolean',
742 'default' => false,
743 ],
744 'tickerPosition' => [
745 'type' => 'string',
746 'default' => 'up',
747 'style' => [
748 (object)[
749 'depends' => [
750 (object)['key'=>'tickerPositionEna','condition'=>'==','value'=> true],
751 (object)['key'=>'tickerPosition','condition'=>'==','value'=> 'up'],
752 ],
753 'selector'=>'{{ULTP}} .ultp-news-sticky .ultp-newsTicker-wrap { position: fixed;width: 100%;top: 0;z-index: 9999999; left: 0; }'
754 ],
755 (object)[
756 'depends' => [
757 (object)['key'=>'tickerPositionEna','condition'=>'==','value'=> true],
758 (object)['key'=>'tickerPosition','condition'=>'==','value'=> 'down'],
759 ],
760 'selector'=>'{{ULTP}} .ultp-news-sticky .ultp-newsTicker-wrap { position: fixed;width: 100%;bottom: 0; z-index: 9999999;left: 0; }'
761 ],
762 ],
763 ],
764 'tickerHeading' => [
765 'type' => 'boolean',
766 'default' => true,
767 ],
768 'tickTimeShow' => [
769 'type' => 'boolean',
770 'default' => true,
771 'style' => [
772 (object)[
773 'depends' => [
774 (object)['key'=>'tickerType','condition'=>'!=','value'=>'typewriter'],
775 ],
776 ],
777 ],
778 ],
779 'tickImageShow' => [
780 'type' => 'boolean',
781 'default' => false,
782 ],
783 'navControlToggle' => [
784 'type' => 'boolean',
785 'default' => true,
786 ],
787 'controlToggle' => [
788 'type' => 'boolean',
789 'default' => true,
790 'style' => [
791 (object)[
792 'depends' => [
793 (object)['key'=>'navControlToggle','condition'=>'==','value'=>true],
794 (object)['key'=>'TickNavStyle','condition'=>'!=','value'=>'nav2'],
795 ],
796 ],
797 ],
798 ],
799 'pauseOnHover' => [
800 'type' => 'boolean',
801 'default' => true,
802 ],
803 'tickerDirectionVer' => [
804 'type' => 'string',
805 'default' => 'up',
806 'style' => [
807 (object)[
808 'depends' => [
809 (object)['key'=>'tickerType','condition'=>'==','value'=>'vertical'],
810 (object)['key'=>'tickerAnimation','condition'=>'==','value'=>'slide']
811 ],
812 ],
813 ],
814 ],
815 'tickerDirectionHorizon' => [
816 'type' => 'string',
817 'default' => 'left',
818 'style' => [
819 (object)[
820 'depends' => [
821 (object)['key'=>'tickerType','condition'=>'==','value'=>'horizontal'],
822 (object)['key'=>'tickerAnimation','condition'=>'==','value'=>'slide']
823 ],
824 ],
825 (object)[
826 'depends' => [
827 (object)['key'=>'tickerType','condition'=>'==','value'=>'marquee'],
828 ],
829 ],
830 ],
831 ],
832 'tickerSpeed' => [
833 'type' => 'string',
834 'default' => '4000',
835 'style' => [
836 (object)[
837 'depends' => [(object)['key' => 'tickerType','condition' => '!=','value' => "marquee"]]
838 ],
839 ],
840 ],
841 'tickerSpeedTypewriter' => [
842 'type' => 'string',
843 'default' => '50',
844 'style' => [
845 (object)[
846 'depends' => [(object)['key' => 'tickerType','condition' => '==','value' => 'typewriter']]
847 ],
848 ],
849 ],
850 'tickerAnimation' => [
851 'type' => 'string',
852 'default' => 'slide',
853 'style' => [
854 (object)[
855 'depends' => [
856 (object)['key'=>'tickerType','condition'=>'!=','value'=>'marquee'],
857 (object)['key'=>'tickerType','condition'=>'!=','value'=>'typewriter'],
858 ],
859 ],
860 ],
861 ],
862 'typeAnimation' => [
863 'type' => 'string',
864 'default' => 'fadein',
865 'style' => [
866 (object)[
867 'depends' => [
868 (object)['key'=>'tickerType','condition'=>'==','value'=>'typewriter'],
869 ],
870 ],
871 ],
872 ],
873 'openInTab' => [
874 'type' => 'boolean',
875 'default' => false,
876 ],
877
878 //--------------------------
879 // Heading Setting/Style
880 //--------------------------
881 'headingText' => [
882 'type' => 'string',
883 'default' => 'News Ticker',
884 ],
885
886
887
888 //--------------------------
889 // Advanced
890 //--------------------------
891 'advanceId' => [
892 'type' => 'string',
893 'default' => '',
894 ],
895 'advanceZindex' => [
896 'type' => 'number',
897 'default' => '',
898 'style' => [
899 (object)[
900 'selector' => '{{ULTP}} {z-index:{{advanceZindex}};}'
901 ],
902 ],
903 ],
904 'wrapMargin' => [
905 'type' => 'object',
906 'default' => (object)['lg' =>(object)['top' => '','bottom' => '', 'unit' =>'px']],
907 'style' => [
908 (object)[
909 'selector'=>'{{ULTP}} .ultp-block-wrapper { margin:{{wrapMargin}}; }'
910 ],
911 ],
912 ],
913 'wrapOuterPadding' => [
914 'type' => 'object',
915 'default' => (object)['lg' =>(object)['top' => '','bottom' => '','left' => '', 'right' => '', 'unit' =>'px']],
916 'style' => [
917 (object)[
918 'selector'=>'{{ULTP}} .ultp-block-wrapper { padding:{{wrapOuterPadding}}; }'
919 ],
920 ],
921 ],
922 'wrapBg' => [
923 'type' => 'object',
924 'default' => (object)['openColor' => 0, 'type' => 'color', 'color' => '#f5f5f5'],
925 'style' => [
926 (object)[
927 'selector'=>'{{ULTP}} .ultp-block-wrapper'
928 ],
929 ],
930 ],
931 'wrapBorder' => [
932 'type' => 'object',
933 'default' => (object)['openBorder'=>0, 'width' =>(object)['top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4','type' => 'solid'],
934 'style' => [
935 (object)[
936 'selector'=>'{{ULTP}} .ultp-block-wrapper'
937 ],
938 ],
939 ],
940 'wrapShadow' => [
941 'type' => 'object',
942 'default' => (object)['openShadow' => 0, 'width' => (object)['top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4'],
943 'style' => [
944 (object)[
945 'selector'=>'{{ULTP}} .ultp-block-wrapper'
946 ],
947 ],
948 ],
949 'wrapRadius' => [
950 'type' => 'object',
951 'default' => (object)['lg' =>'', 'unit' =>'px'],
952 'style' => [
953 (object)[
954 'selector'=>'{{ULTP}} .ultp-block-wrapper { border-radius:{{wrapRadius}}; }'
955 ],
956 ],
957 ],
958 'wrapHoverBackground' => [
959 'type' => 'object',
960 'default' => (object)['openColor' => 0, 'type' => 'color', 'color' => '#037fff'],
961 'style' => [
962 (object)[
963 'selector'=>'{{ULTP}} .ultp-block-wrapper:hover'
964 ],
965 ],
966 ],
967 'wrapHoverBorder' => [
968 'type' => 'object',
969 'default' => (object)['openBorder'=>0, 'width' => (object)['top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4','type' => 'solid'],
970 'style' => [
971 (object)[
972 'selector'=>'{{ULTP}} .ultp-block-wrapper:hover'
973 ],
974 ],
975 ],
976 'wrapHoverRadius' => [
977 'type' => 'object',
978 'default' => (object)['lg' =>'', 'unit' =>'px'],
979 'style' => [
980 (object)[
981 'selector'=>'{{ULTP}} .ultp-block-wrapper:hover { border-radius:{{wrapHoverRadius}}; }'
982 ],
983 ],
984 ],
985 'wrapHoverShadow' => [
986 'type' => 'object',
987 'default' => (object)['openShadow' => 0, 'width' => (object)['top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4'],
988 'style' => [
989 (object)[
990 'selector'=>'{{ULTP}} .ultp-block-wrapper:hover'
991 ],
992 ],
993 ],
994 'hideExtraLarge' => [
995 'type' => 'boolean',
996 'default' => false,
997 'style' => [
998 (object)[
999 'selector' => '{{ULTP}} {display:none;}'
1000 ],
1001 ],
1002 ],
1003 'hideTablet' => [
1004 'type' => 'boolean',
1005 'default' => false,
1006 'style' => [
1007 (object)[
1008 'selector' => '{{ULTP}} {display:none;}'
1009 ],
1010 ],
1011 ],
1012 'hideMobile' => [
1013 'type' => 'boolean',
1014 'default' => false,
1015 'style' => [
1016 (object)[
1017 'selector' => '{{ULTP}} {display:none;}'
1018 ],
1019 ],
1020 ],
1021 'advanceCss' => [
1022 'type' => 'string',
1023 'default' => '',
1024 'style' => [(object)['selector' => '']],
1025 ]
1026 );
1027
1028 if( $default ){
1029 $temp = array();
1030 foreach ($attributes as $key => $value) {
1031 if( isset($value['default']) ){
1032 $temp[$key] = $value['default'];
1033 }
1034 }
1035 return $temp;
1036 }else{
1037 return $attributes;
1038 }
1039 }
1040
1041 public function register() {
1042 register_block_type( 'ultimate-post/news-ticker',
1043 array(
1044 'title' => __('News Ticker', 'ultimate-post'),
1045 'attributes' => $this->get_attributes(),
1046 'render_callback' => array($this, 'content')
1047 )
1048 );
1049 }
1050
1051 public function content($attr, $noAjax) {
1052 global $unique_ID;
1053 if(!$noAjax){
1054 $paged = is_front_page() ? get_query_var('page') : get_query_var('paged');
1055 $attr['paged'] = $paged ? $paged : 1;
1056 }
1057
1058 $block_name = 'news-ticker';
1059 $page_post_id = ultimate_post()->get_ID();
1060 $wraper_before = $wraper_after = $post_loop = '';
1061 $recent_posts = new \WP_Query( ultimate_post()->get_query( $attr ) );
1062 $arrowLeft = "";
1063 $arrowRight = "";
1064 if($attr['TickNavIconStyle'] != "icon2"){
1065 $arrowLeft .= ultimate_post()->svg_icon('left'.$attr['TickNavIconStyle']);
1066 $arrowRight .= ultimate_post()->svg_icon('right'.$attr['TickNavIconStyle']);
1067 }
1068
1069 if ($recent_posts->have_posts()) {
1070 $wraper_before .= '<div '.($attr['advanceId']?'id="'.$attr['advanceId'].'" ':'').' class="wp-block-ultimate-post-'.$block_name.' ultp-block-'.$attr["blockId"].''.(isset($attr["className"])?' '.$attr["className"]:'').'">';
1071 $wraper_before .= '<div class="ultp-block-wrapper ultp-news-sticky">';
1072 $wraper_before .= '<div class="ultp-block-items-wrap">';
1073
1074 $post_loop .= '<div class="ultp-news-ticker-'.$attr['TickNavStyle'].' ultp-nav-'.$attr['TickNavIconStyle'].' ultp-newsTicker-wrap ultp-newstick-'.$attr['tickerType'].' ">';
1075 if ($attr['tickerHeading'] && $attr['headingText']) {
1076 $post_loop .= '<div class="ultp-news-ticker-label">'.$attr['headingText'].'</div>';
1077 }
1078
1079 $post_loop .= '<div class="ultp-news-ticker-box ultp-animation-'.($attr['tickerType'] == 'typewriter' ? $attr['typeAnimation'] : $attr['tickerAnimation'] ).' ultp-sliderDir-'.($attr['tickerType'] == 'vertical' ? $attr['tickerDirectionVer'] : $attr['tickerDirectionHorizon'] ).'">';
1080 $speed = $attr['tickerType'] != 'marquee' ? $attr['tickerSpeed'] : '';
1081 $post_loop .= '<ul class="ultp-news-ticker" data-type="'.$attr['tickerType'].'" data-hover="'.$attr['pauseOnHover'].'" data-direction="'.($attr['tickerType'] == 'vertical' ? $attr['tickerDirectionVer'] : $attr['tickerDirectionHorizon'] ).'" data-speed="'.$speed.'">';
1082 while ( $recent_posts->have_posts() ): $recent_posts->the_post();
1083 $post_id = get_the_ID();
1084 $title = get_the_title( $post_id );
1085 $titlelink = get_permalink( $post_id );
1086 if ($attr['queryUnique']) {
1087 $unique_ID[$attr['queryUnique']][] = $post_id;
1088 }
1089 $typeStyle = $style = '';
1090 if($attr['tickerType'] != 'marquee' && $attr['tickerType'] != 'typewriter' && $attr['tickerAnimation'] == "fadeout"){
1091 $style .= 'animation-delay:'.($speed - 1000).'ms';
1092 }
1093 if($attr['tickerType'] == 'typewriter' && $attr['typeAnimation'] == "fadeout"){
1094 $style .= 'animation-delay:'.($speed - 1000).'ms';
1095 }
1096 if($attr['tickerType'] == 'typewriter'){
1097 $typeStyle .= ' animation-duration:'.($speed - 1000).'ms';
1098 }
1099 $post_loop .= '<li style='.$style.'>';
1100 $post_loop .= '<div class="ultp-list-'.$attr['tickTxtStyle'].'">';
1101 $post_loop .= '<a '.($attr['openInTab'] ? 'target="_blank"' : '').' href="'.$titlelink.'">';
1102 if ($attr['tickImageShow'] && has_post_thumbnail()) {
1103 $post_loop .= ultimate_post()->get_image( get_post_thumbnail_id( $post_id ), 'thumbnail', '', $title, '' , '' );
1104 }
1105 $post_loop .= '<span style="'.$typeStyle.'" class="title-text" data-text="'.$title.'">'.$title.'</span>';
1106 $post_loop .= '</a>';
1107 if ( $attr['tickTimeShow'] && ($attr['tickerType'] != 'typewriter' ) ) {
1108 $post_loop .= '<span class="ultp-ticker-timebadge" >'.human_time_diff(get_the_time('U'),current_time('U')).' ago</span>';
1109 }
1110 $post_loop .= '</div>';
1111 $post_loop .= '</li>';
1112 endwhile;
1113 $post_loop .= '</ul>';
1114 $post_loop .= '</div>';
1115
1116 if ($attr['navControlToggle'] && $attr['TickNavStyle'] ) {
1117 $post_loop .= '<div class="ultp-news-ticker-controls ultp-news-ticker-vertical-controls">';
1118 $post_loop .= '<button class="ultp-news-ticker-arrow ultp-news-ticker-prev prev">'.$arrowLeft.'</button>';
1119 if ($attr['controlToggle'] && ( $attr['TickNavStyle'] == "nav1" || $attr['TickNavStyle'] == "nav3" || $attr['TickNavStyle'] == "nav4" )) {
1120 $post_loop .= '<button id="ultp-pause-btn" class="ultp-news-ticker-pause pause"></button>';
1121 }
1122 $post_loop .= '<button class="ultp-news-ticker-arrow ultp-news-ticker-next next">'.$arrowRight.'</button>';
1123 $post_loop .= '</div>';
1124 }
1125 $post_loop .= '</div>';
1126 $wraper_after .= '</div>';
1127 $wraper_after .= '</div>';
1128 $wraper_after .= '</div>';
1129
1130 wp_reset_query();
1131 }
1132
1133 return $noAjax ? $post_loop : $wraper_before.$post_loop.$wraper_after;
1134 }
1135
1136 }