PluginProbe
Post Grid Gutenberg Blocks – PostX / 2.7.8
Post Grid Gutenberg Blocks – PostX v2.7.8
5.0.41 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 All 238 releases
ultimate-post / addons / builder / blocks / Post_Comments.php

Post_Comments.php in Post Grid Gutenberg Blocks – PostX 2.7.8, at addons/builder/blocks/Post_Comments.php

1,047 lines 45.9 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 Post_Comments{
7 public function __construct() {
8 add_action('init', array($this, 'register'));
9 }
10 public function get_attributes($default = false) {
11
12 $attributes = array(
13 'blockId' => [
14 'type' => 'string',
15 'default' => '',
16 ],
17
18 'layout' => [
19 'type' => 'string',
20 'default' => 'layout1',
21 ],
22
23 /*============================
24 Post Comment Settings
25 ============================*/
26 // Comments Form Heading
27 'replayHeading' => [
28 'type' => 'boolean',
29 'default' => true,
30 ],
31 'leaveRepText' => [
32 'type' => 'string',
33 'default' => 'Leave a Replay',
34 'style' => [
35 (object)[
36 'depends' => [
37 (object)['key'=>'replayHeading','condition'=>'==','value'=> true],
38 ],
39 ],
40 ],
41 ],
42 'HeadingColor' => [
43 'type' => 'string',
44 'default' => '#333',
45 'style' => [
46 (object)[
47 'depends' => [
48 (object)['key'=>'replayHeading','condition'=>'==','value'=> true],
49 ],
50 'selector'=>'{{ULTP}} .ultp-comments-title { color:{{HeadingColor}} }'
51 ],
52 ],
53 ],
54 'HeadingTypo' => [
55 'type' => 'object',
56 'default' => (object)['openTypography' => 1,'size' => (object)['lg' =>24, 'unit' =>'px'],'height' => (object)['lg' => 26, 'unit' =>'px']],
57 'style' => [
58 (object)[
59 'depends' => [
60 (object)['key'=>'replayHeading','condition'=>'==','value'=> true],
61 ],
62 'selector'=>'{{ULTP}} .ultp-comments-title'
63 ],
64 ],
65 ],
66 'subHeadingColor' => [
67 'type' => 'string',
68 'default' => '#888',
69 'style' => [
70 (object)[
71 'depends' => [
72 (object)['key'=>'replayHeading','condition'=>'==','value'=> true],
73 ],
74 'selector'=>'{{ULTP}} .ultp-comments-subtitle,{{ULTP}} .logged-in-as, {{ULTP}} .comment-notes { color:{{subHeadingColor}} }'
75 ],
76 ],
77 ],
78 'headingSpace' => [
79 'type' => 'object',
80 'default' => (object)['lg' =>'5', 'unit' =>'px'],
81 'style' => [
82 (object)[
83 'depends' => [
84 (object)['key'=>'replayHeading','condition'=>'==','value'=> true],
85 ],
86 'selector'=>'{{ULTP}} .ultp-comments-title { margin-bottom:{{headingSpace}} !important; }'
87 ],
88 ],
89 ],
90
91
92 /*============================
93 Comments Form Input
94 ============================*/
95 "inputPlaceHolder" => [
96 "type" => "string",
97 "default" => "Express your thoughts, idea or write a feedback by clicking here & start an awesome comment"
98 ],
99 'inputPlaceValueColor' => [
100 'type' => 'string',
101 'default' => '#555',
102 'style' => [
103 (object)[
104 'selector'=>'{{ULTP}} .ultp-comment-form ::placeholder { color:{{inputPlaceValueColor}} }'
105 ],
106 ],
107 ],
108 'inputValueColor' => [
109 'type' => 'string',
110 'default' => '#555',
111 'style' => [
112 (object)[
113 'selector'=>'{{ULTP}} .ultp-comment-form input,{{ULTP}} .ultp-comment-form textarea { color:{{inputValueColor}} }'
114 ],
115 ],
116 ],
117 'inputValueBg' => [
118 'type' => 'string',
119 'default' => '#eeee',
120 'style' => [
121 (object)[
122 'selector'=>'{{ULTP}} .ultp-comment-form input, {{ULTP}} .ultp-comment-form textarea {background-color:{{inputValueBg}}}'
123 ],
124 ],
125 ],
126 'inputValueTypo' => [
127 'type' => 'object',
128 'default' => (object)['openTypography' => 1,'size' => (object)['lg' =>15, 'unit' =>'px'],'height' => (object)['lg' =>20, 'unit' =>'px']],
129 'style' => [
130 (object)[
131 'selector'=>'{{ULTP}} .ultp-comment-form input, {{ULTP}} .ultp-comment-form textarea'
132 ],
133 ],
134 ],
135 'inputValuePad' => [
136 'type' => 'object',
137 'default' => (object)['lg' =>'15', 'unit' =>'px'],
138 'style' => [
139 (object)[
140 'selector'=>'{{ULTP}} .ultp-comment-form input, {{ULTP}} .ultp-comment-form textarea { padding:{{inputValuePad}} }'
141 ],
142 ],
143 ],
144 'inputBorder' => [
145 'type' => 'object',
146 'default' => (object)['openBorder'=>1, 'width' =>(object)['top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#e2e2e2','type' => 'solid'],
147 'style' => [
148 (object)[
149 'selector'=>'{{ULTP}} .ultp-comment-form input, {{ULTP}} .ultp-comment-input textarea'
150 ],
151 ],
152 ],
153 'inputHovBorder' => [
154 'type' => 'object',
155 'default' => (object)['openBorder'=>1, 'width' =>(object)['top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#777','type' => 'solid'],
156 'style' => [
157 (object)[
158 'selector'=>'{{ULTP}} .ultp-comment-form input:hover,{{ULTP}} .ultp-comment-form input:focus,{{ULTP}} .ultp-comment-form textarea:hover, {{ULTP}} .ultp-comment-form textarea:focus'
159 ],
160 ],
161 ],
162 'inputRadius' => [
163 'type' => 'object',
164 'default' => (object)['lg' =>'0', 'unit' =>'px'],
165 'style' => [
166 (object)[
167 'selector'=>'{{ULTP}} .ultp-comment-form input, {{ULTP}} .ultp-comment-form textarea{ border-radius:{{inputRadius}} }'
168 ],
169 ],
170 ],
171 'inputHovRadius' => [
172 'type' => 'object',
173 'default' => (object)['lg' =>'', 'unit' =>'px'],
174 'style' => [
175 (object)[
176 'selector'=>'{{ULTP}} .ultp-comment-form input:hover, {{ULTP}} .ultp-comment-form textarea:hover{ border-radius:{{inputHovRadius}} }'
177 ],
178 ],
179 ],
180 'inputSpacing' => [
181 'type' => 'object',
182 'default' => (object)['lg' =>'10', 'unit' =>'px'],
183 'style' => [
184 (object)[
185 'depends' => [
186 (object)['key'=>'inputLabel','condition'=>'==','value'=> true],
187 (object)['key'=>'layout','condition'=>'==','value'=> "layout1"],
188 ],
189 'selector'=>'{{ULTP}} .ultp-comment-form > div > label, {{ULTP}} .ultp-comment-form div > p, {{ULTP}} .ultp-comment-input,{{ULTP}} .ultp-comment-form > p,{{ULTP}} .ultp-comment-form > input { margin:{{inputSpacing}} 0px 0px !important;}'
190 ],
191 (object)[
192 'depends' => [
193 (object)['key'=>'inputLabel','condition'=>'==','value'=> true],
194 (object)['key'=>'layout','condition'=>'==','value'=> "layout2"],
195 ],
196 'selector'=>'{{ULTP}} .ultp-comment-form > div > label, {{ULTP}} .ultp-comment-form div > p, {{ULTP}} .ultp-comment-input,{{ULTP}} .ultp-comment-form > p, {{ULTP}} .ultp-comment-form > input { margin:{{inputSpacing}} 0px 0px !important} ;'
197 ],
198 (object)[
199 'depends' => [
200 (object)['key'=>'inputLabel','condition'=>'==','value'=> true],
201 (object)['key'=>'layout','condition'=>'==','value'=> "layout3"],
202 ],
203 'selector'=>'{{ULTP}} .ultp-comment-form > div > label, {{ULTP}} .ultp-comment-form div > p, {{ULTP}} .ultp-comment-input, {{ULTP}} .ultp-comment-form > p, {{ULTP}} .ultp-comment-form > input { margin:{{inputSpacing}} 0px 0px !important;}'
204 ],
205 ],
206 ],
207
208 /*============================
209 Comments Form label style
210 ============================*/
211 'inputLabel' => [
212 'type' => 'boolean',
213 'default' => true,
214 ],
215
216 "cmntInputText" => [
217 'type' => 'string',
218 'default' => "Comment's",
219 'style' => [
220 (object)[
221 'depends' => [
222 (object)['key'=>'inputLabel','condition'=>'==','value'=> true],
223 ],
224 ],
225 ],
226 ],
227 "nameInputText" => [
228 'type' => 'string',
229 'default' => "Name",
230 'style' => [
231 (object)[
232 'depends' => [
233 (object)['key'=>'inputLabel','condition'=>'==','value'=> true],
234 ],
235 ],
236 ],
237 ],
238 "emailInputText" => [
239 'type' => 'string',
240 'default' => "Email",
241 'style' => [
242 (object)[
243 'depends' => [
244 (object)['key'=>'inputLabel','condition'=>'==','value'=> true],
245 ],
246 ],
247 ],
248 ],
249 "webInputText" => [
250 'type' => 'string',
251 'default' => "Website Url",
252 'style' => [
253 (object)[
254 'depends' => [
255 (object)['key'=>'inputLabel','condition'=>'==','value'=> true],
256 ],
257 ],
258 ],
259 ],
260 'inputLabelColor' => [
261 'type' => 'string',
262 'default' => '#5a5a5a',
263 'style' => [
264 (object)[
265 'depends' => [
266 (object)['key'=>'inputLabel','condition'=>'==','value'=> true],
267 ],
268 'selector'=>'{{ULTP}} .ultp-comment-form label { color:{{inputLabelColor}} }'
269 ],
270 ],
271 ],
272 'inputLabelTypo' => [
273 'type' => 'object',
274 'default' => (object)['openTypography' => 1,'size' => (object)['lg' =>16, 'unit' =>'px'],'height' => (object)['lg' =>20, 'unit' =>'px']],
275 'style' => [
276 (object)[
277 'depends' => [
278 (object)['key'=>'inputLabel','condition'=>'==','value'=> true],
279 ],
280 'selector'=>'{{ULTP}} .ultp-comment-form label'
281 ],
282 ],
283 ],
284 'cookiesEnable' => [
285 'type' => 'boolean',
286 'default' => true,
287 ],
288 'cookiesText' => [
289 'type' => 'string',
290 'default' => "Save my name, email, and website in this browser for the next time I comment.",
291 'style' => [
292 (object)[
293 'depends' => [
294 (object)['key'=>'cookiesEnable','condition'=>'==','value'=> true],
295 ],
296 ],
297 ],
298 ],
299 'cookiesColor' => [
300 'type' => 'string',
301 'default' => "#777",
302 'style' => [
303 (object)[
304 'depends' => [
305 (object)['key'=>'cookiesEnable','condition'=>'==','value'=> true],
306 ],
307 'selector'=>'{{ULTP}} .comment-form-cookies-consent label { color:{{cookiesColor}} }'
308 ],
309 ],
310 ],
311
312 /*============================
313 Submit Button Style
314 ============================*/
315 'subBtnText' => [
316 'type' => 'string',
317 'default' => 'Post Comment',
318 ],
319 'subBtnTypo' => [
320 'type' => 'object',
321 'default' => (object)['openTypography' => 1,'size' => (object)['lg' =>15, 'unit' =>'px'],'height' => (object)['lg' =>20, 'unit' =>'px']],
322 'style' => [
323 (object)[
324 'selector'=>'{{ULTP}} .ultp-comment-btn, {{ULTP}} .form-submit > input#submit'
325 ],
326 ],
327 ],
328 'submitButton' => [
329 'type' => 'string',
330 'default' => 'normal',
331 ],
332 'subBtnColor' => [
333 'type' => 'string',
334 'default' => '#fff',
335 'style' => [
336 (object)[
337 'selector'=>'{{ULTP}} .ultp-comment-btn,{{ULTP}} .form-submit > input#submit { color:{{subBtnColor}} }'
338 ],
339 ],
340 ],
341 'subBtnBg' => [
342 'type' => 'object',
343 'default' => (object)['openColor' => 1, 'type' => 'color', 'color' => '#333'],
344 'style' => [
345 (object)[
346 'selector'=>'{{ULTP}} .ultp-comment-btn, {{ULTP}} .form-submit > input#submit'
347 ],
348 ],
349 ],
350 'subBtnBorder' => [
351 'type' => 'object',
352 'default' => (object)['openBorder'=> 1, 'width' =>(object)['top' => 0, 'right' => 0, 'bottom' => 0, 'left' => 0],'color' => '#333','type' => 'solid'],
353 'style' => [
354 (object)[
355 'selector'=>'{{ULTP}} .ultp-comment-btn, {{ULTP}} .form-submit > input#submit'
356 ],
357 ],
358 ],
359 'subBtnRadius' => [
360 'type' => 'object',
361 'default' => (object)['lg' =>'0', 'unit' =>'px'],
362 'style' => [
363 (object)[
364 'selector'=>'{{ULTP}} .ultp-comment-btn, {{ULTP}} .form-submit > input#submit { border-radius:{{subBtnRadius}} }'
365 ],
366 ],
367 ],
368 'subBtnHovColor' => [
369 'type' => 'string',
370 'default' => '',
371 'style' => [
372 (object)[
373 'selector'=>'{{ULTP}} .ultp-comment-btn:hover, {{ULTP}} .form-submit > input#submit:hover { color:{{subBtnHovColor}} }'
374 ],
375 ],
376 ],
377 'subBtnHovBg' => [
378 'type' => 'object',
379 'default' => (object)['openColor' => 0, 'type' => 'color', 'color' => '#151515'],
380 'style' => [
381 (object)[
382 'selector'=>'{{ULTP}} .ultp-comment-btn:hover, {{ULTP}} .form-submit > input#submit:hover'
383 ],
384 ],
385 ],
386 'subBtnHovBorder' => [
387 'type' => 'object',
388 'default' => (object)['openBorder'=> 1, 'width' =>(object)['top' => 0, 'right' => 0, 'bottom' => 0, 'left' => 0],'color' => '#151515','type' => 'solid'],
389 'style' => [
390 (object)[
391 'selector'=>'{{ULTP}} .ultp-comment-btn:hover, {{ULTP}} .form-submit > input#submit:hover'
392 ],
393 ],
394 ],
395
396 'subBtnHovRadius' => [
397 'type' => 'object',
398 'default' => (object)['lg' =>'0', 'unit' =>'px'],
399 'style' => [
400 (object)[
401 'selector'=>'{{ULTP}} .ultp-comment-btn:hover, {{ULTP}} .form-submit > input#submit:hover { border-radius:{{subBtnHovRadius}} }'
402 ],
403 ],
404 ],
405 'subBtnPad' => [
406 'type' => 'object',
407 'default' => (object)['lg' =>'10', 'unit' =>'px'],
408 'style' => [
409 (object)[
410 'selector'=>'{{ULTP}} .ultp-comment-btn, {{ULTP}} .form-submit > input#submit { padding:{{subBtnPad}} }'
411 ],
412 ],
413 ],
414 'subBtnSpace' => [
415 'type' => 'object',
416 'default' => (object)['lg' =>'20', 'unit' =>'px'],
417 'style' => [
418 (object)[
419 'selector'=>'{{ULTP}} .ultp-comment-btn, {{ULTP}} .form-submit > input#submit { margin:{{subBtnSpace}} 0px 0px}'
420 ],
421 ],
422 ],
423 'subBtnAlign' => [
424 'type' => 'string',
425 'default' => 'left',
426 'style' => [
427 (object)[
428 'depends' => [
429 (object)['key'=>'subBtnAlign','condition'=>'==','value'=> "left"],
430 ],
431 'selector'=>'{{ULTP}} .ultp-comment-btn, {{ULTP}} .form-submit > input#submit, {{ULTP}} .ultp-comment-btn, {{ULTP}} .form-submit { display: block !important; margin-right: auto !important; }'
432 ],
433 (object)[
434 'depends' => [
435 (object)['key'=>'subBtnAlign','condition'=>'==','value'=> "center"],
436 ],
437 'selector'=>'{{ULTP}} .ultp-comment-btn, {{ULTP}} .form-submit > input#submit, {{ULTP}} .ultp-comment-btn, {{ULTP}} .form-submit { display: block !important; margin-left: auto !important; margin-right: auto !important}'
438 ],
439 (object)[
440 'depends' => [
441 (object)['key'=>'subBtnAlign','condition'=>'==','value'=> "right"],
442 ],
443 'selector'=>'{{ULTP}} .ultp-comment-btn, {{ULTP}} .form-submit > input#submit, {{ULTP}} .ultp-comment-btn, {{ULTP}} .form-submit { display: block !important; margin-left:auto !important;}'
444 ],
445 ],
446 ],
447
448 /*============================
449 Comment Replay Style
450 ============================*/
451 // Title and total Comment Count
452 'authColor' => [
453 'type' => 'string',
454 'default' => '#333',
455 'style' => [
456 (object)[
457 'selector'=>'{{ULTP}} .ultp-comment-meta div, {{ULTP}} .comment-author a.url,{{ULTP}} .comment-author .fn {color:{{authColor}} }'
458 ],
459 ],
460 ],
461 'authHovColor' => [
462 'type' => 'string',
463 'default' => '#000',
464 'style' => [
465 (object)[
466 'selector'=>'{{ULTP}} .ultp-comment-meta div:hover ,{{ULTP}} .comment-author a.url:hover, {{ULTP}} .comment-author b:hover {color: {{authHovColor}} }'
467 ],
468 ],
469 ],
470 'authorTypo' => [
471 'type' => 'object',
472 'default' => (object)['openTypography' => 1,'size' => (object)['lg' =>18, 'unit' =>'px'],'height' => (object)['lg' =>25, 'unit' =>'px']],
473 'style' => [
474 (object)[
475 'selector'=>'{{ULTP}} .ultp-comment-meta div ,{{ULTP}} .comment-author a.url, {{ULTP}} .comment-author b'
476 ],
477 ],
478 ],
479 'commentSpace' => [
480 'type' => 'object',
481 'default' => (object)['lg' =>(object)['top' => '15','bottom' => '0','left' => '30', 'right' => '0', 'unit' =>'px']],
482 'style' => [
483 (object)[
484 'selector'=>'{{ULTP}} .ultp-replay-wrapper, {{ULTP}} .children { margin: {{commentSpace}} }'
485 ],
486 ],
487 ],
488 'replayText' => [
489 'type' => 'string',
490 'default' => 'Comments Text',
491 ],
492 'commentCount' => [
493 'type' => 'boolean',
494 'default' => true,
495 ],
496 'commentCountColor' => [
497 'type' => 'string',
498 'default' => '#055553',
499 'style' => [
500 (object)[
501 'selector'=>'{{ULTP}} .ultp-comment-replay-heading {color:{{commentCountColor}} }'
502 ],
503 ],
504 ],
505 'commentCountTypo' => [
506 'type' => 'object',
507 'default' => (object)['openTypography' => 1,'size' => (object)['lg' => 30, 'unit' =>'px'],'height' => (object)['lg' =>28, 'unit' =>'px'],'weight'=>'600'],
508 'style' => [
509 (object)[
510 'selector'=>'{{ULTP}} .ultp-comment-replay-heading'
511 ],
512 ],
513 ],
514 'commentCountSpace' => [
515 'type' => 'object',
516 'default' => (object)['lg' =>'30', 'unit' =>'px'],
517 'style' => [
518 (object)[
519 'selector'=>'{{ULTP}} .ultp-comment-replay-heading { margin:0px 0px {{commentCountSpace}} }'
520 ],
521 ],
522 ],
523 'authMetaSpace' => [
524 'type' => 'object',
525 'default' => (object)['lg' =>'7', 'unit' =>'px'],
526 'style' => [
527 (object)[
528 'selector'=>'{{ULTP}} .ultp-comment-content-heading, {{ULTP}} .comment-meta { margin:0px 0px {{authMetaSpace}} }'
529 ],
530 ],
531 ],
532
533
534 /*============================
535 Comment Replay Button
536 ============================*/
537 'replayButton' => [
538 'type' => 'string',
539 'default' => 'normal',
540 ],
541 'replayBtnTypo' => [
542 'type' => 'object',
543 'default' => (object)['openTypography' => 1,'size' => (object)['lg' =>15, 'unit' =>'px'],'height' => (object)['lg' =>20, 'unit' =>'px']],
544 'style' => [
545 (object)[
546 'selector'=>'{{ULTP}} .ultp-replay-btn, {{ULTP}} .comment-reply-link, {{ULTP}} .comment-body .reply a'
547 ],
548 ],
549 ],
550 'replayBtnColor' => [
551 'type' => 'string',
552 'default' => '#333',
553 'style' => [
554 (object)[
555 'selector'=>'{{ULTP}} .ultp-replay-btn, {{ULTP}} .comment-reply-link, {{ULTP}} .comment-body .reply a {color: {{replayBtnColor}} }'
556 ],
557 ],
558 ],
559 'replayBtnBg' => [
560 'type' => 'object',
561 'default' => (object)['openColor' => 0, 'type' => 'color', 'color' => '#f5f5f5'],
562 'style' => [
563 (object)[
564 'selector'=>'{{ULTP}} .ultp-replay-btn, {{ULTP}} .comment-reply-link, {{ULTP}} .comment-body .reply a'
565 ],
566 ],
567 ],
568 'replayBtnHovColor' => [
569 'type' => 'string',
570 'default' => '#333',
571 'style' => [
572 (object)[
573 'selector'=>'{{ULTP}} .ultp-replay-btn:hover, {{ULTP}} .comment-body .reply a:hover, {{ULTP}} .comment-reply-link:hover {color: {{replayBtnHovColor}} }'
574 ],
575 ],
576 ],
577 'replayBtnBgHov' => [
578 'type' => 'object',
579 'default' => (object)['openColor' => 0, 'type' => 'color', 'color' => '#f5f5f5'],
580 'style' => [
581 (object)[
582 'selector'=>'{{ULTP}} .ultp-replay-btn:hover, {{ULTP}} .comment-reply-link:hover, {{ULTP}} .comment-body .reply a:hover'
583 ],
584 ],
585 ],
586 'replayBtnBorder' => [
587 'type' => 'object',
588 'default' => (object)['openBorder'=>0, 'width' =>(object)['top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4','type' => 'solid'],
589 'style' => [
590 (object)[
591 'selector'=>'{{ULTP}} .ultp-replay-btn, {{ULTP}} .comment-reply-link, {{ULTP}} .comment-body .reply a'
592 ],
593 ],
594 ],
595 'replayBtnRadius' => [
596 'type' => 'object',
597 'default' => (object)['lg' =>(object)['top' => '','bottom' => '','left' => '', 'right' => '', 'unit' =>'px']],
598 'style' => [
599 (object)[
600 'selector'=>'{{ULTP}} .ultp-replay-btn, {{ULTP}} .comment-reply-link, {{ULTP}} .comment-body .reply a { border-radius:{{replayBtnRadius}}; }'
601 ],
602 ],
603 ],
604 'replayBtnPad' => [
605 'type' => 'object',
606 'default' => (object)['lg' =>(object)['top' => '5','bottom' => '5','left' => '5', 'right' => '5', 'unit' =>'px']],
607 'style' => [
608 (object)[
609 'selector'=>'{{ULTP}} .ultp-replay-btn, {{ULTP}} .comment-reply-link, {{ULTP}} .comment-body .reply a { padding:{{replayBtnPad}}; }'
610 ],
611 ],
612 ],
613 'replayBtnSpace' => [
614 'type' => 'object',
615 'default' => (object)['lg' =>'7', 'unit' =>'px'],
616 'style' => [
617 (object)[
618 'selector'=>'{{ULTP}} .ultp-replay-btn, {{ULTP}} .comment-reply-link, {{ULTP}} .comment-body .reply a { margin: {{replayBtnSpace}} 0px}'
619 ],
620 ],
621 ],
622
623
624 /*============================
625 Comment Author Meta
626 ============================*/
627 'authMeta' => [
628 'type' => 'boolean',
629 'default' => true,
630 'style' => [
631 (object)[
632 'depends' => [
633 (object)['key'=>'authMeta','condition'=>'==','value'=> true],
634 ],
635 'selector'=>'{{ULTP}} .ultp-comment-meta span, {{ULTP}} .comment-metadata , {{ULTP}} .comment-meta {display:block}'
636 ],
637 (object)[
638 'depends' => [
639 (object)['key'=>'authMeta','condition'=>'==','value'=> false],
640 ],
641 'selector'=>'{{ULTP}} .ultp-comment-meta span, {{ULTP}} .comment-metadata , {{ULTP}} .comment-meta {display:none}'
642 ],
643 ],
644 ],
645 'authMetaColor' => [
646 'type' => 'string',
647 'default' => '#9f9f9f',
648 'style' => [
649 (object)[
650 'depends' => [
651 (object)['key'=>'authMeta','condition'=>'==','value'=> true],
652 ],
653 'selector'=>'{{ULTP}} .ultp-comment-meta span ,{{ULTP}} .comment-metadata a ,{{ULTP}} .comment-meta a { color:{{authMetaColor}} }'
654 ],
655 ],
656 ],
657 'authMetaHovColor' => [
658 'type' => 'string',
659 'default' => '#000',
660 'style' => [
661 (object)[
662 'depends' => [
663 (object)['key'=>'authMeta','condition'=>'==','value'=> true],
664 ],
665 'selector'=>'{{ULTP}} .ultp-comment-meta span:hover , {{ULTP}} .comment-metadata a:hover ,{{ULTP}} .comment-meta a:hover { color:{{authMetaHovColor}} }'
666 ],
667 ],
668 ],
669 'authMetaTypo' => [
670 'type' => 'object',
671 'default' => (object)['openTypography' => 1,'size' => (object)['lg' =>12, 'unit' =>'px'],'height' => (object)['lg' =>20, 'unit' =>'px']],
672 'style' => [
673 (object)[
674 'depends' => [
675 (object)['key'=>'authMeta','condition'=>'==','value'=> true],
676 ],
677 'selector'=>'{{ULTP}} .ultp-comment-meta span, {{ULTP}} .comment-metadata a, {{ULTP}} .comment-meta a'
678 ],
679 ],
680 ],
681
682
683 /*============================
684 Comment Author Image Style
685 ============================*/
686 'authImg' => [
687 'type' => 'boolean',
688 'default' => true,
689 'style' => [
690 (object)[
691 'depends' => [
692 (object)['key'=>'authImg','condition'=>'==','value'=> true],
693 ],
694 'selector'=>'{{ULTP}} .ultp-comment-wrapper .ultp-comment-content-heading > img,{{ULTP}} .comment-author img {display: inline }'
695 ],
696 (object)[
697 'depends' => [
698 (object)['key'=>'authImg','condition'=>'==','value'=> false],
699 ],
700 'selector'=>'{{ULTP}} .ultp-comment-content-heading > img,{{ULTP}} .comment-author img {display: none }'
701 ],
702 ],
703 ],
704 'authImgRadius' => [
705 'type' => 'object',
706 'default' => (object)['lg' =>'50', 'unit' =>'px'],
707 'style' => [
708 (object)[
709 'depends' => [
710 (object)['key'=>'authImg','condition'=>'==','value'=> true],
711 ],
712 'selector'=>'{{ULTP}} .ultp-comment-content-heading > img,{{ULTP}} .comment-author img {border-radius: {{authImgRadius}} }'
713 ],
714 ],
715 ],
716
717
718 /*============================
719 Comment Replay Message Text Style
720 ============================*/
721 'replayColor' => [
722 'type' => 'string',
723 'default' => '#6c6c6c',
724 'style' => [
725 (object)[
726 'selector'=>'{{ULTP}} .ultp-comment-desc,{{ULTP}} .comment-content, {{ULTP}} .comment-body .reply ,{{ULTP}} .comment-body > p { color:{{replayColor}} }'
727 ],
728 ],
729 ],
730 'replayHovColor' => [
731 'type' => 'string',
732 'default' => '#000',
733 'style' => [
734 (object)[
735 'selector'=>'{{ULTP}} .ultp-comment-desc:hover, {{ULTP}} .comment-content:hover, {{ULTP}} .comment-body .reply:hover ,{{ULTP}} .comment-body > p:hover {color: {{replayHovColor}} }'
736 ],
737 ],
738 ],
739 'replayTypo' => [
740 'type' => 'object',
741 'default' => (object)['openTypography' => 1,'size' => (object)['lg' =>15, 'unit' =>'px'],'height' => (object)['lg' =>20, 'unit' =>'px']],
742 'style' => [
743 (object)[
744 'selector'=>'{{ULTP}} .ultp-comment-desc, {{ULTP}} .comment-content, {{ULTP}} .comment-body .reply, {{ULTP}} .comment-body > p'
745 ],
746 ],
747 ],
748
749
750 /*============================
751 replay separator Style
752 ============================*/
753 'replaySeparator' => [
754 'type' => 'boolean',
755 'default' => true,
756 'style' => [
757 (object)[
758 'depends' => [
759 (object)['key'=>'replaySeparator','condition'=>'==','value'=> true],
760 ],
761 'selector'=>'{{ULTP}} .ultp-builder-comment-replay > li:after { display: block }'
762 ],
763 (object)[
764 'depends' => [
765 (object)['key'=>'replaySeparator','condition'=>'==','value'=> false],
766 ],
767 'selector'=>'{{ULTP}} .ultp-builder-comment-replay > li:after { display: none }'
768 ],
769 ],
770 ],
771 'replaySepColor' => [
772 'type' => 'string',
773 'default' => '#c1c1c1',
774 'style' => [
775 (object)[
776 'depends' => [
777 (object)['key'=>'replaySeparator','condition'=>'==','value'=> true],
778 ],
779 'selector'=>'{{ULTP}} .ultp-builder-comment-replay > li:after { background-color:{{replaySepColor}} }'
780 ],
781 ],
782 ],
783 'replaySepSpace' => [
784 'type' => 'object',
785 'default' => (object)['lg' =>'15', 'unit' =>'px'],
786 'style' => [
787 (object)[
788 'depends' => [
789 (object)['key'=>'replaySeparator','condition'=>'==','value'=> true],
790 ],
791 'selector'=>'{{ULTP}} .ultp-builder-comment-replay > li:after { margin:{{replaySepSpace}} 0px }'
792 ],
793 ],
794 ],
795
796 //--------------------------
797 // Advanced Settings
798 //--------------------------
799 'advanceId' => [
800 'type' => 'string',
801 'default' => '',
802 ],
803 'advanceZindex' => [
804 'type' => 'number',
805 'default' => '',
806 'style' => [
807 (object)[
808 'selector' => '{{ULTP}} {z-index:{{advanceZindex}};}'
809 ],
810 ],
811 ],
812 'wrapMargin' => [
813 'type' => 'object',
814 'default' => (object)['lg' =>(object)['top' => '','bottom' => '', 'unit' =>'px']],
815 'style' => [
816 (object)[
817 'selector'=>'{{ULTP}} .ultp-block-wrapper { margin:{{wrapMargin}}; }'
818 ],
819 ],
820 ],
821 'wrapOuterPadding' => [
822 'type' => 'object',
823 'default' => (object)['lg' =>(object)['top' => '','bottom' => '','left' => '', 'right' => '', 'unit' =>'px']],
824 'style' => [
825 (object)[
826 'selector'=>'{{ULTP}} .ultp-block-wrapper { padding:{{wrapOuterPadding}}; }'
827 ],
828 ],
829 ],
830 'wrapBg' => [
831 'type' => 'object',
832 'default' => (object)['openColor' => 0, 'type' => 'color', 'color' => '#f5f5f5'],
833 'style' => [
834 (object)[
835 'selector'=>'{{ULTP}} .ultp-block-wrapper'
836 ],
837 ],
838 ],
839 'wrapBorder' => [
840 'type' => 'object',
841 'default' => (object)['openBorder'=>0, 'width' =>(object)['top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4','type' => 'solid'],
842 'style' => [
843 (object)[
844 'selector'=>'{{ULTP}} .ultp-block-wrapper'
845 ],
846 ],
847 ],
848 'wrapShadow' => [
849 'type' => 'object',
850 'default' => (object)['openShadow' => 0, 'width' => (object)['top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4'],
851 'style' => [
852 (object)[
853 'selector'=>'{{ULTP}} .ultp-block-wrapper'
854 ],
855 ],
856 ],
857 'wrapRadius' => [
858 'type' => 'object',
859 'default' => (object)['lg' =>'', 'unit' =>'px'],
860 'style' => [
861 (object)[
862 'selector'=>'{{ULTP}} .ultp-block-wrapper { border-radius:{{wrapRadius}}; }'
863 ],
864 ],
865 ],
866 'wrapHoverBackground' => [
867 'type' => 'object',
868 'default' => (object)['openColor' => 0, 'type' => 'color', 'color' => '#037fff'],
869 'style' => [
870 (object)[
871 'selector'=>'{{ULTP}} .ultp-block-wrapper:hover'
872 ],
873 ],
874 ],
875 'wrapHoverBorder' => [
876 'type' => 'object',
877 'default' => (object)['openBorder'=>0, 'width' => (object)['top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4','type' => 'solid'],
878 'style' => [
879 (object)[
880 'selector'=>'{{ULTP}} .ultp-block-wrapper:hover'
881 ],
882 ],
883 ],
884 'wrapHoverRadius' => [
885 'type' => 'object',
886 'default' => (object)['lg' =>'', 'unit' =>'px'],
887 'style' => [
888 (object)[
889 'selector'=>'{{ULTP}} .ultp-block-wrapper:hover { border-radius:{{wrapHoverRadius}}; }'
890 ],
891 ],
892 ],
893 'wrapHoverShadow' => [
894 'type' => 'object',
895 'default' => (object)['openShadow' => 0, 'width' => (object)['top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4'],
896 'style' => [
897 (object)[
898 'selector'=>'{{ULTP}} .ultp-block-wrapper:hover'
899 ],
900 ],
901 ],
902 'hideExtraLarge' => [
903 'type' => 'boolean',
904 'default' => false,
905 'style' => [
906 (object)[
907 'selector' => '{{ULTP}} {display:none;}'
908 ],
909 ],
910 ],
911 'hideDesktop' => [
912 'type' => 'boolean',
913 'default' => false,
914 'style' => [
915 (object)[
916 'selector' => '{{ULTP}} {display:none;}'
917 ],
918 ],
919 ],
920 'hideTablet' => [
921 'type' => 'boolean',
922 'default' => false,
923 'style' => [
924 (object)[
925 'selector' => '{{ULTP}} {display:none;}'
926 ],
927 ],
928 ],
929 'hideMobile' => [
930 'type' => 'boolean',
931 'default' => false,
932 'style' => [
933 (object)[
934 'selector' => '{{ULTP}} {display:none;}'
935 ],
936 ],
937 ],
938 'advanceCss' => [
939 'type' => 'string',
940 'default' => '',
941 'style' => [
942 (object)[
943 'selector' => '{{ULTP}} {display:none;}'
944 ],
945 ],
946 ],
947 );
948
949 if ($default) {
950 $temp = array();
951 foreach ($attributes as $key => $value) {
952 if (isset($value['default'])) {
953 $temp[$key] = $value['default'];
954 }
955 }
956 return $temp;
957 } else {
958 return $attributes;
959 }
960 }
961
962 public function register() {
963 register_block_type( 'ultimate-post/post-comments',
964 array(
965 'editor_script' => 'ultp-blocks-editor-script',
966 'editor_style' => 'ultp-blocks-editor-css',
967 'attributes' => $this->get_attributes(),
968 'render_callback' => array($this, 'content')
969 )
970 );
971 }
972
973 public function content($attr, $noAjax) {
974 $block_name = 'post-comments';
975 $wrapper_before = $wrapper_after = $wrapper_content = '';
976
977 if(is_single()){
978 $commenter = wp_get_current_commenter();
979 $req = get_option( 'require_name_email' );
980 $aria_req = ( $req ? " aria-required='true'" : '' );
981
982 $auth_label = $attr['inputLabel'] ? '<label for="author">' . __( ''.$attr["nameInputText"].'' ) . '' .( $req ? '<span class="required">*</span>' : '' ) . '</label>' : '';
983 $email_label = $attr['inputLabel'] ? '<label for="email">' . __( ''.$attr["emailInputText"].'' ) . '' . ( $req ? '<span class="required">*</span>' : '' ).'</label>' : '';
984 $url_label = $attr['inputLabel'] ? '<label for="url">' . __( ''.$attr["webInputText"].'', 'domainreference' ) . '</label>' : '';
985 $comment_label = $attr['inputLabel'] ? '<label for="comment">' . __( ''.$attr["cmntInputText"].'' ) . '</label>' : '';
986 $cookies_label = $attr['cookiesEnable'] ? '<p class="comment-form-cookies-consent"><input id="wp-comment-cookies-consent" name="wp-comment-cookies-consent" type="checkbox" value="yes"/><label for="wp-comment-cookies-consent">'.$attr["cookiesText"].'</label></p>' : '';
987
988 $comments_args = array(
989 'comment_field' => '<div class="comment-form-comment ultp-comment-input ultp-field-control">' .$comment_label.'<textarea class="hi" id="comment" name="comment" placeholder="'.$attr["inputPlaceHolder"].'" cols="45" rows="8" aria-required="true"></textarea></div>',
990 'fields' => apply_filters( 'comment_form_default_fields', array(
991 'author' =>'<div class="ultp-field-control ultp-comment-name">'.$auth_label.'<input id="author" placeholder="Your Name (No Keywords)" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' /></div>',
992 'email' => '<div class="ultp-field-control ultp-comment-email">'.$email_label.'<input id="email" placeholder="your-real-email@example.com" name="email" type="text" value="' . esc_attr( $commenter['comment_author_email'] ).'" size="30"' . $aria_req . ' /></div>',
993 'url' => '<div class="ultp-field-control ultp-comment-website">'.$url_label.'<input id="url" name="url" placeholder="http://your-site-name.com" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" /></div>',
994 'cookies'=> $cookies_label
995 )
996 ),
997 'class_submit' => 'ultp-comment-btn',
998 'comment_notes_after' => '',
999 'submit_button' => '<input name="%1$s" type="submit" id="%2$s" className="%3$s ultp-comment-btn" value="'.$attr['subBtnText'].'" />',
1000 'class_form' => 'ultp-comment-form',
1001 'title_reply' => ($attr['replayHeading'] ? '<div class="crunchify-text ultp-comments-title">'.$attr['leaveRepText'].'</div>' : ''),
1002 'class_container' => 'ultp-comment-form-container'
1003 );
1004
1005 $arg = array(
1006 'walker' => null,
1007 'max_depth' => '',
1008 'style' => 'ul',
1009 'callback' => null,
1010 'end-callback' => null,
1011 'type' => 'comment',
1012 'page' => '',
1013 'per_page' => '',
1014 'avatar_size' => 32,
1015 'reverse_top_level' => true,
1016 'reverse_children' => '',
1017 'format' => current_theme_supports( 'html5', 'comment-list' ) ? 'html5' : 'xhtml',
1018 'short_ping' => false,
1019 'echo' => true,
1020 );
1021
1022 $comments = get_comments(array( 'post_id' => get_the_ID() ));
1023
1024 $wrapper_before .= '<div '.($attr['advanceId']?'id="'.$attr['advanceId'].'" ':'').' class="wp-block-ultimate-post-'.$block_name.' ultp-block-'.$attr["blockId"].(isset($attr["className"])?' '.$attr["className"]:'').''.(isset($attr["align"])? ' align' .$attr["align"]:'').'">';
1025 $wrapper_before .= '<div class="ultp-block-wrapper ultp-block-comments ultp-comments-'.$attr['layout'].'">';
1026 if ($attr["commentCount"] && count($comments) > 0) {
1027 $wrapper_content .= '<div class="ultp-comment-replay-heading">';
1028 $wrapper_content .= count($comments).' '.$attr['replayText'];
1029 $wrapper_content .= '</div>';
1030 }
1031 $wrapper_content.= '<div class="ultp-builder-comment-replay">';
1032 ob_start();
1033 wp_list_comments($arg, $comments);
1034 $wrapper_content .= ob_get_clean();
1035 $wrapper_content .= '</div>';
1036 $wrapper_content .= '<div class="ultp-builder-comments">';
1037 ob_start();
1038 comment_form( $comments_args );
1039 $wrapper_content .= ob_get_clean();
1040 $wrapper_content .= '</div>';
1041 $wrapper_after .= '</div>';
1042 $wrapper_after .= '</div>';
1043 }
1044
1045 return $wrapper_before.$wrapper_content.$wrapper_after;
1046 }
1047 }