PluginProbe
Post Grid Gutenberg Blocks – PostX / 2.6.4
Post Grid Gutenberg Blocks – PostX v2.6.4
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.6.4, at blocks/News_Ticker.php

1,152 lines 51.2 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' => 'object',
68 'default' => (object)['lg'=>'160'],
69 'style' => [
70 (object)[
71 'selector'=>'{{ULTP}} .ultp-news-ticker-box { padding-left:{{tickLabelSpace}}px; } .rtl {{ULTP}} .ultp-news-ticker-box { padding-right:{{tickLabelSpace}}px !important; }'
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} .rtl {{ULTP}} .ultp-news-ticker li div img {margin-left: {{tickImgSpace}}px !important;}'
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 'queryNumPosts' => [
560 'type' => 'object',
561 'default' => (object)['lg'=>4,'sm'=>4,'xs'=>4],
562 'style' => [
563 (object)[
564 'depends' => [
565 (object)['key' => 'queryType','condition' => '!=','value' => array('customPosts', 'posts')]
566 ]
567 ],
568 ],
569 ],
570 'queryNumber' => [ // for compatibility since v.2.5.4
571 'type' => 'string',
572 'default' =>4,
573 'style' => [
574 (object)[
575 'depends' => [
576 (object)['key' => 'queryType','condition' => '!=','value' => array('customPosts', 'posts')]
577 ]
578 ],
579 ],
580 ],
581 'queryType' => [
582 'type' => 'string',
583 'default' => 'post'
584 ],
585 'queryTax' => [
586 'type' => 'string',
587 'default' => 'category',
588 'style' => [
589 (object)[
590 'depends' => [
591 (object)['key' => 'queryType','condition' => '!=','value' => array('customPosts', 'posts')]
592 ]
593 ],
594 ],
595 ],
596 'queryTaxValue' => [
597 'type' => 'string',
598 'default' => '[]',
599 'style' => [
600 (object)[
601 'depends' => [
602 (object)['key' => 'queryTax','condition' => '!=','value' => ''],
603 (object)['key' => 'queryType','condition' => '!=','value' => array('customPosts', 'posts')]
604 ]
605 ],
606 ],
607 ],
608 'queryRelation' => [
609 'type' => 'string',
610 'default' => 'OR',
611 'style' => [
612 (object)[
613 'depends' => [
614 (object)['key' => 'queryTaxValue','condition' => '!=','value' => '[]'],
615 (object)['key' => 'queryType','condition' => '!=','value' => array('customPosts', 'posts')]
616 ]
617 ],
618 ],
619 ],
620 'queryOrderBy' => [
621 'type' => 'string',
622 'default' => 'date',
623 ],
624 'metaKey' => [
625 'type' => 'string',
626 'default' => 'custom_meta_key',
627 'style' => [
628 (object)[
629 'depends' => [
630 (object)['key' => 'queryOrderBy','condition' => '==','value' => 'meta_value_num'],
631 (object)['key' => 'queryType','condition' => '!=','value' => array('customPosts', 'posts')]
632 ]
633 ],
634 ],
635 ],
636 'queryOrder' => [
637 'type' => 'string',
638 'default' => 'desc',
639 ],
640 // Include Remove from Version 2.5.4
641 // 'queryInclude' => [
642 // 'type' => 'string',
643 // 'default' => '',
644 // ],
645 'queryExclude' => [
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 'queryAuthor' => [
657 'type' => 'string',
658 'default' => '[]',
659 'style' => [
660 (object)[
661 'depends' => [
662 (object)['key' => 'queryType','condition' => '!=','value' => array('customPosts', 'posts')]
663 ]
664 ],
665 ],
666 ],
667 'queryOffset' => [
668 'type' => 'string',
669 'default' => '0',
670 'style' => [
671 (object)[
672 'depends' => [
673 (object)['key' => 'queryType','condition' => '!=','value' => array('customPosts', 'posts')]
674 ]
675 ],
676 ],
677 ],
678 'queryExcludeTerm' => [
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 'queryExcludeAuthor' => [
690 'type' => 'string',
691 'default' => '[]',
692 'style' => [
693 (object)[
694 'depends' => [
695 (object)['key' => 'queryType','condition' => '!=','value' => array('customPosts', 'posts')]
696 ]
697 ],
698 ],
699 ],
700 'querySticky' => [
701 'type' => 'boolean',
702 'default' => true,
703 'style' => [
704 (object)[
705 'depends' => [
706 (object)['key' => 'queryType','condition' => '!=','value' => array('customPosts', 'posts')]
707 ]
708 ],
709 ],
710 ],
711 'queryUnique' => [
712 'type' => 'string',
713 'default' => '',
714 'style' => [
715 (object)[
716 'depends' => [
717 (object)['key' => 'queryType','condition' => '!=','value' => array('customPosts', 'posts')]
718 ]
719 ],
720 ],
721 ],
722 'queryPosts' => [
723 'type' => 'string',
724 'default' => '[]',
725 'style' => [
726 (object)[
727 'depends' => [
728 (object)['key' => 'queryType','condition' => '==','value' => 'posts']
729 ]
730 ],
731 ],
732 ],
733 'queryCustomPosts' => [
734 'type' => 'string',
735 'default' => '[]',
736 'style' => [
737 (object)[
738 'depends' => [
739 (object)['key' => 'queryType','condition' => '==','value' => 'customPosts']
740 ]
741 ],
742 ],
743 ],
744 //--------------------------
745 // General Setting
746 //--------------------------
747 'tickerType' => [
748 'type' => 'string',
749 'default' => 'vertical',
750 ],
751 'tickerPositionEna' => [
752 'type' => 'boolean',
753 'default' => false,
754 ],
755 'tickerPosition' => [
756 'type' => 'string',
757 'default' => 'up',
758 'style' => [
759 (object)[
760 'depends' => [
761 (object)['key'=>'tickerPositionEna','condition'=>'==','value'=> true],
762 (object)['key'=>'tickerPosition','condition'=>'==','value'=> 'up'],
763 ],
764 'selector'=>'{{ULTP}} .ultp-news-sticky .ultp-newsTicker-wrap { position: fixed;width: 100%;top: 0;z-index: 101; left: 0; } .admin-bar .ultp-news-sticky .ultp-newsTicker-wrap {
765 top: 32px !important; }'
766 ],
767 (object)[
768 'depends' => [
769 (object)['key'=>'tickerPositionEna','condition'=>'==','value'=> true],
770 (object)['key'=>'tickerPosition','condition'=>'==','value'=> 'down'],
771 ],
772 'selector'=>'{{ULTP}} .ultp-news-sticky .ultp-newsTicker-wrap { position: fixed;width: 100%;bottom: 0; z-index: 9999999;left: 0; }'
773 ],
774 ],
775 ],
776 'tickerHeading' => [
777 'type' => 'boolean',
778 'default' => true,
779 ],
780 'tickTimeShow' => [
781 'type' => 'boolean',
782 'default' => true,
783 'style' => [
784 (object)[
785 'depends' => [
786 (object)['key'=>'tickerType','condition'=>'!=','value'=>'typewriter'],
787 ],
788 ],
789 ],
790 ],
791 'tickImageShow' => [
792 'type' => 'boolean',
793 'default' => false,
794 ],
795 'navControlToggle' => [
796 'type' => 'boolean',
797 'default' => true,
798 ],
799 'controlToggle' => [
800 'type' => 'boolean',
801 'default' => true,
802 'style' => [
803 (object)[
804 'depends' => [
805 (object)['key'=>'navControlToggle','condition'=>'==','value'=>true],
806 (object)['key'=>'TickNavStyle','condition'=>'!=','value'=>'nav2'],
807 ],
808 ],
809 ],
810 ],
811 'pauseOnHover' => [
812 'type' => 'boolean',
813 'default' => true,
814 ],
815 'tickerDirectionVer' => [
816 'type' => 'string',
817 'default' => 'up',
818 'style' => [
819 (object)[
820 'depends' => [
821 (object)['key'=>'tickerType','condition'=>'==','value'=>'vertical'],
822 (object)['key'=>'tickerAnimation','condition'=>'==','value'=>'slide']
823 ],
824 ],
825 ],
826 ],
827 'tickerDirectionHorizon' => [
828 'type' => 'string',
829 'default' => 'left',
830 'style' => [
831 (object)[
832 'depends' => [
833 (object)['key'=>'tickerType','condition'=>'==','value'=>'horizontal'],
834 (object)['key'=>'tickerAnimation','condition'=>'==','value'=>'slide']
835 ],
836 ],
837 (object)[
838 'depends' => [
839 (object)['key'=>'tickerType','condition'=>'==','value'=>'marquee'],
840 ],
841 ],
842 ],
843 ],
844 'tickerSpeed' => [
845 'type' => 'string',
846 'default' => '4000',
847 'style' => [
848 (object)[
849 'depends' => [(object)['key' => 'tickerType','condition' => '!=','value' => "marquee"]]
850 ],
851 ],
852 ],
853 'tickerSpeedTypewriter' => [
854 'type' => 'string',
855 'default' => '50',
856 'style' => [
857 (object)[
858 'depends' => [(object)['key' => 'tickerType','condition' => '==','value' => 'typewriter']]
859 ],
860 ],
861 ],
862 'tickerAnimation' => [
863 'type' => 'string',
864 'default' => 'slide',
865 'style' => [
866 (object)[
867 'depends' => [
868 (object)['key'=>'tickerType','condition'=>'!=','value'=>'marquee'],
869 (object)['key'=>'tickerType','condition'=>'!=','value'=>'typewriter'],
870 ],
871 ],
872 ],
873 ],
874 'typeAnimation' => [
875 'type' => 'string',
876 'default' => 'fadein',
877 'style' => [
878 (object)[
879 'depends' => [
880 (object)['key'=>'tickerType','condition'=>'==','value'=>'typewriter'],
881 ],
882 ],
883 ],
884 ],
885 'openInTab' => [
886 'type' => 'boolean',
887 'default' => false,
888 ],
889
890 //--------------------------
891 // Heading Setting/Style
892 //--------------------------
893 'headingText' => [
894 'type' => 'string',
895 'default' => 'News Ticker',
896 ],
897
898
899
900 //--------------------------
901 // Advanced
902 //--------------------------
903 'advanceId' => [
904 'type' => 'string',
905 'default' => '',
906 ],
907 'advanceZindex' => [
908 'type' => 'string',
909 'default' => '',
910 'style' => [
911 (object)[
912 'selector' => '{{ULTP}} .ultp-block-wrapper{z-index:{{advanceZindex}};}'
913 ],
914 ],
915 ],
916 'wrapMargin' => [
917 'type' => 'object',
918 'default' => (object)['lg' =>(object)['top' => '','bottom' => '', 'unit' =>'px']],
919 'style' => [
920 (object)[
921 'selector'=>'{{ULTP}} .ultp-block-wrapper { margin:{{wrapMargin}}; }'
922 ],
923 ],
924 ],
925 'wrapOuterPadding' => [
926 'type' => 'object',
927 'default' => (object)['lg' =>(object)['top' => '','bottom' => '','left' => '', 'right' => '', 'unit' =>'px']],
928 'style' => [
929 (object)[
930 'selector'=>'{{ULTP}} .ultp-block-wrapper { padding:{{wrapOuterPadding}}; }'
931 ],
932 ],
933 ],
934 'wrapBg' => [
935 'type' => 'object',
936 'default' => (object)['openColor' => 0, 'type' => 'color', 'color' => '#f5f5f5'],
937 'style' => [
938 (object)[
939 'selector'=>'{{ULTP}} .ultp-block-wrapper'
940 ],
941 ],
942 ],
943 'wrapBorder' => [
944 'type' => 'object',
945 'default' => (object)['openBorder'=>0, 'width' =>(object)['top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4','type' => 'solid'],
946 'style' => [
947 (object)[
948 'selector'=>'{{ULTP}} .ultp-block-wrapper'
949 ],
950 ],
951 ],
952 'wrapShadow' => [
953 'type' => 'object',
954 'default' => (object)['openShadow' => 0, 'width' => (object)['top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4'],
955 'style' => [
956 (object)[
957 'selector'=>'{{ULTP}} .ultp-block-wrapper'
958 ],
959 ],
960 ],
961 'wrapRadius' => [
962 'type' => 'object',
963 'default' => (object)['lg' =>'', 'unit' =>'px'],
964 'style' => [
965 (object)[
966 'selector'=>'{{ULTP}} .ultp-block-wrapper { border-radius:{{wrapRadius}}; }'
967 ],
968 ],
969 ],
970 'wrapHoverBackground' => [
971 'type' => 'object',
972 'default' => (object)['openColor' => 0, 'type' => 'color', 'color' => '#037fff'],
973 'style' => [
974 (object)[
975 'selector'=>'{{ULTP}} .ultp-block-wrapper:hover'
976 ],
977 ],
978 ],
979 'wrapHoverBorder' => [
980 'type' => 'object',
981 'default' => (object)['openBorder'=>0, 'width' => (object)['top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4','type' => 'solid'],
982 'style' => [
983 (object)[
984 'selector'=>'{{ULTP}} .ultp-block-wrapper:hover'
985 ],
986 ],
987 ],
988 'wrapHoverRadius' => [
989 'type' => 'object',
990 'default' => (object)['lg' =>'', 'unit' =>'px'],
991 'style' => [
992 (object)[
993 'selector'=>'{{ULTP}} .ultp-block-wrapper:hover { border-radius:{{wrapHoverRadius}}; }'
994 ],
995 ],
996 ],
997 'wrapHoverShadow' => [
998 'type' => 'object',
999 'default' => (object)['openShadow' => 0, 'width' => (object)['top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4'],
1000 'style' => [
1001 (object)[
1002 'selector'=>'{{ULTP}} .ultp-block-wrapper:hover'
1003 ],
1004 ],
1005 ],
1006 'hideExtraLarge' => [
1007 'type' => 'boolean',
1008 'default' => false,
1009 'style' => [
1010 (object)[
1011 'selector' => '{{ULTP}} {display:none;}'
1012 ],
1013 ],
1014 ],
1015 'hideTablet' => [
1016 'type' => 'boolean',
1017 'default' => false,
1018 'style' => [
1019 (object)[
1020 'selector' => '{{ULTP}} {display:none;}'
1021 ],
1022 ],
1023 ],
1024 'hideMobile' => [
1025 'type' => 'boolean',
1026 'default' => false,
1027 'style' => [
1028 (object)[
1029 'selector' => '{{ULTP}} {display:none;}'
1030 ],
1031 ],
1032 ],
1033 'advanceCss' => [
1034 'type' => 'string',
1035 'default' => '',
1036 'style' => [(object)['selector' => '']],
1037 ]
1038 );
1039
1040 if( $default ){
1041 $temp = array();
1042 foreach ($attributes as $key => $value) {
1043 if( isset($value['default']) ){
1044 $temp[$key] = $value['default'];
1045 }
1046 }
1047 return $temp;
1048 }else{
1049 return $attributes;
1050 }
1051 }
1052
1053 public function register() {
1054 register_block_type( 'ultimate-post/news-ticker',
1055 array(
1056 // 'title' => __('News Ticker', 'ultimate-post'),
1057 'attributes' => $this->get_attributes(),
1058 'render_callback' => array($this, 'content')
1059 )
1060 );
1061 }
1062
1063 public function content($attr, $noAjax) {
1064 global $unique_ID;
1065 if(!$noAjax){
1066 $paged = is_front_page() ? get_query_var('page') : get_query_var('paged');
1067 $attr['paged'] = $paged ? $paged : 1;
1068 }
1069
1070 $block_name = 'news-ticker';
1071 $page_post_id = ultimate_post()->get_ID();
1072 $wraper_before = $wraper_after = $post_loop = '';
1073
1074 $attr['queryNumber'] = ultimate_post()->get_post_number(4, $attr['queryNumber'], $attr['queryNumPosts']);
1075 $recent_posts = new \WP_Query( ultimate_post()->get_query( $attr ) );
1076 $arrowLeft = "";
1077 $arrowRight = "";
1078 if($attr['TickNavIconStyle'] != "icon2"){
1079 $arrowLeft .= ultimate_post()->svg_icon('left'.$attr['TickNavIconStyle']);
1080 $arrowRight .= ultimate_post()->svg_icon('right'.$attr['TickNavIconStyle']);
1081 }
1082 // print_r($recent_posts)
1083
1084
1085 if ($recent_posts->have_posts()) {
1086 $wraper_before .= '<div '.($attr['advanceId']?'id="'.$attr['advanceId'].'" ':'').' class="wp-block-ultimate-post-'.$block_name.' ultp-block-'.$attr["blockId"].''.(isset($attr["className"])?' '.$attr["className"]:'').'">';
1087 $wraper_before .= '<div class="ultp-block-wrapper ultp-news-sticky">';
1088 $wraper_before .= '<div class="ultp-block-items-wrap">';
1089
1090 $post_loop .= '<div class="ultp-news-ticker-'.$attr['TickNavStyle'].' ultp-nav-'.$attr['TickNavIconStyle'].' ultp-newsTicker-wrap ultp-newstick-'.$attr['tickerType'].' ">';
1091 if ($attr['tickerHeading'] && $attr['headingText']) {
1092 $post_loop .= '<div class="ultp-news-ticker-label">'.$attr['headingText'].'</div>';
1093 }
1094
1095 $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'] ).'">';
1096 $speed = $attr['tickerType'] != 'marquee' ? $attr['tickerSpeed'] : '';
1097 $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.'">';
1098 while ( $recent_posts->have_posts() ): $recent_posts->the_post();
1099 $post_id = get_the_ID();
1100 $title = get_the_title( $post_id );
1101 $titlelink = get_permalink( $post_id );
1102 if ($attr['queryUnique']) {
1103 $unique_ID[$attr['queryUnique']][] = $post_id;
1104 }
1105 $typeStyle = $style = '';
1106 if($attr['tickerType'] != 'marquee' && $attr['tickerType'] != 'typewriter' && $attr['tickerAnimation'] == "fadeout"){
1107 $style .= 'animation-delay:'.($speed - 1000).'ms';
1108 }
1109 if($attr['tickerType'] == 'typewriter' && $attr['typeAnimation'] == "fadeout"){
1110 $style .= 'animation-delay:'.($speed - 1000).'ms';
1111 }
1112 if($attr['tickerType'] == 'typewriter'){
1113 $typeStyle .= ' animation-duration:'.($speed - 1000).'ms';
1114 }
1115 $post_loop .= '<li style='.$style.'>';
1116 $post_loop .= '<div class="ultp-list-'.$attr['tickTxtStyle'].'">';
1117 $post_loop .= '<a '.($attr['openInTab'] ? 'target="_blank"' : '').' href="'.$titlelink.'">';
1118 if ($attr['tickImageShow'] && has_post_thumbnail()) {
1119 $post_loop .= ultimate_post()->get_image( get_post_thumbnail_id( $post_id ), 'thumbnail', '', $title, '' , '' );
1120 }
1121 $post_loop .= '<span style="'.$typeStyle.'" class="title-text" data-text="'.$title.'">'.$title.'</span>';
1122 $post_loop .= '</a>';
1123 if ( $attr['tickTimeShow'] && ($attr['tickerType'] != 'typewriter' ) ) {
1124 $post_loop .= '<span class="ultp-ticker-timebadge" >'.human_time_diff(get_the_time('U'),current_time('U')).' ago</span>';
1125 }
1126 $post_loop .= '</div>';
1127 $post_loop .= '</li>';
1128 endwhile;
1129 $post_loop .= '</ul>';
1130 $post_loop .= '</div>';
1131
1132 if ($attr['navControlToggle'] && $attr['TickNavStyle'] ) {
1133 $post_loop .= '<div class="ultp-news-ticker-controls ultp-news-ticker-vertical-controls">';
1134 $post_loop .= '<button class="ultp-news-ticker-arrow ultp-news-ticker-prev prev">'.$arrowLeft.'</button>';
1135 if ($attr['controlToggle'] && ( $attr['TickNavStyle'] == "nav1" || $attr['TickNavStyle'] == "nav3" || $attr['TickNavStyle'] == "nav4" )) {
1136 $post_loop .= '<button id="ultp-pause-btn" class="ultp-news-ticker-pause pause"></button>';
1137 }
1138 $post_loop .= '<button class="ultp-news-ticker-arrow ultp-news-ticker-next next">'.$arrowRight.'</button>';
1139 $post_loop .= '</div>';
1140 }
1141 $post_loop .= '</div>';
1142 $wraper_after .= '</div>';
1143 $wraper_after .= '</div>';
1144 $wraper_after .= '</div>';
1145
1146 wp_reset_query();
1147 }
1148
1149 return $noAjax ? $post_loop : $wraper_before.$post_loop.$wraper_after;
1150 }
1151
1152 }