r> 1
+{"translation-revision-date":"2021-11-28 05:01:06+0000","generator":"GlotPress\/3.0.0-alpha.2","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","plural-forms":"nplurals=1; plural=0;","lang":"th"},"Annotation":["\u0e04\u0e33\u0e2d\u0e18\u0e34\u0e1a\u0e32\u0e22\u0e40\u0e1e\u0e34\u0e48\u0e21\u0e40\u0e15\u0e34\u0e21"]}},"comment":{"reference":"wp-includes\/js\/dist\/annotations.js"}}

+ 1 - 1
app/wp-content/languages/th-320f4ad9792aaa6dedb1e71cbdf85d57.json

@@ -1 +1 @@
1
-{"translation-revision-date":"2021-09-30 09:11:37+0000","generator":"GlotPress\/3.0.0-alpha.2","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","plural-forms":"nplurals=1; plural=0;","lang":"th"},"Notifications":["\u0e01\u0e32\u0e23\u0e41\u0e08\u0e49\u0e07\u0e40\u0e15\u0e37\u0e2d\u0e19"]}},"comment":{"reference":"wp-includes\/js\/dist\/a11y.js"}}
1
+{"translation-revision-date":"2021-11-28 05:01:06+0000","generator":"GlotPress\/3.0.0-alpha.2","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","plural-forms":"nplurals=1; plural=0;","lang":"th"},"Notifications":["\u0e01\u0e32\u0e23\u0e41\u0e08\u0e49\u0e07\u0e40\u0e15\u0e37\u0e2d\u0e19"]}},"comment":{"reference":"wp-includes\/js\/dist\/a11y.js"}}

File diff suppressed because it is too large
+ 1 - 1
app/wp-content/languages/th-440127dd25bde48a531ded36f33e927b.json


File diff suppressed because it is too large
+ 1 - 1
app/wp-content/languages/th-49c6d4acf36cf3aca9f0b2a77617304f.json


File diff suppressed because it is too large
+ 1 - 1
app/wp-content/languages/th-4a38fe1c0c45989e44682ba6109d9f46.json


File diff suppressed because it is too large
+ 1 - 1
app/wp-content/languages/th-4bfa11da57ff2600004bb500368247f4.json


File diff suppressed because it is too large
+ 1 - 1
app/wp-content/languages/th-5251f7623766a714c8207c7edb938628.json


+ 1 - 1
app/wp-content/languages/th-529362903a5a05b34b06b5e793fb4cf8.json

@@ -1 +1 @@
1
-{"translation-revision-date":"2021-10-10 08:48:56+0000","generator":"GlotPress\/3.0.0-alpha.2","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","plural-forms":"nplurals=1; plural=0;","lang":"th"},"Dismiss this notice.":["\u0e22\u0e01\u0e40\u0e25\u0e34\u0e01\u0e04\u0e33\u0e40\u0e15\u0e37\u0e2d\u0e19\u0e19\u0e35\u0e49"]}},"comment":{"reference":"wp-admin\/js\/application-passwords.js"}}
1
+{"translation-revision-date":"2021-11-28 05:36:52+0000","generator":"GlotPress\/3.0.0-alpha.2","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","plural-forms":"nplurals=1; plural=0;","lang":"th"},"Dismiss this notice.":["\u0e22\u0e01\u0e40\u0e25\u0e34\u0e01\u0e04\u0e33\u0e40\u0e15\u0e37\u0e2d\u0e19\u0e19\u0e35\u0e49"]}},"comment":{"reference":"wp-admin\/js\/application-passwords.js"}}

File diff suppressed because it is too large
+ 1 - 1
app/wp-content/languages/th-569e85ef168299eb8c8f24d8ef8c8a78.json


File diff suppressed because it is too large
+ 1 - 1
app/wp-content/languages/th-6025add6bde16aaeb12787d250f9b414.json


File diff suppressed because it is too large
+ 1 - 1
app/wp-content/languages/th-68f2cec7514bf8563c723a4d675fcfe6.json


File diff suppressed because it is too large
+ 1 - 1
app/wp-content/languages/th-7233008897033de5ee0d14f86a42a65a.json


File diff suppressed because it is too large
+ 1 - 1
app/wp-content/languages/th-7289286ed59e90a8f36ae797df62220b.json


File diff suppressed because it is too large
+ 1 - 1
app/wp-content/languages/th-77fdfadaf2e1ca3a027d1956b910bc50.json


File diff suppressed because it is too large
+ 1 - 1
app/wp-content/languages/th-7b74c8457eaa7fcc50db41b431f8a003.json


+ 1 - 1
app/wp-content/languages/th-7d5ca435e60d92f024d46c9257aaa0f7.json

@@ -1 +1 @@
1
-{"translation-revision-date":"2021-09-30 09:11:37+0000","generator":"GlotPress\/3.0.0-alpha.2","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","plural-forms":"nplurals=1; plural=0;","lang":"th"},"tag delimiter\u0004,":[","]}},"comment":{"reference":"wp-admin\/js\/tags-suggest.js"}}
1
+{"translation-revision-date":"2021-11-28 05:01:06+0000","generator":"GlotPress\/3.0.0-alpha.2","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","plural-forms":"nplurals=1; plural=0;","lang":"th"},"tag delimiter\u0004,":[","]}},"comment":{"reference":"wp-admin\/js\/tags-suggest.js"}}

File diff suppressed because it is too large
+ 1 - 1
app/wp-content/languages/th-7f13c36c641b114bf18cd0bcc9ecc7e0.json


File diff suppressed because it is too large
+ 1 - 1
app/wp-content/languages/th-803bf1ce2131e13efc590c1bc47851fc.json


File diff suppressed because it is too large
+ 1 - 1
app/wp-content/languages/th-81c889563f09dd13de1701135dc62941.json


File diff suppressed because it is too large
+ 1 - 1
app/wp-content/languages/th-81d6f084cb273e02e15b01bd9ece87f7.json


File diff suppressed because it is too large
+ 1 - 1
app/wp-content/languages/th-8240df461220d1d3a028a9a4c5652a5b.json


File diff suppressed because it is too large
+ 1 - 1
app/wp-content/languages/th-8860e58c20c6a2ab5876a0f07be43bd9.json


File diff suppressed because it is too large
+ 1 - 1
app/wp-content/languages/th-93882e8f9976382d7f724ac595ed7151.json


File diff suppressed because it is too large
+ 1 - 1
app/wp-content/languages/th-947c76bb5095da30e16668eec15406b2.json


File diff suppressed because it is too large
+ 1 - 1
app/wp-content/languages/th-9b256ea9cd54df92095e04c76758ceb0.json


File diff suppressed because it is too large
+ 1 - 1
app/wp-content/languages/th-9c3519f4870fac83dc0dbf18cb6bd4c4.json


+ 1 - 1
app/wp-content/languages/th-9d47a87c240c1d10701cd6a02b28aa1b.json

@@ -1 +1 @@
1
-{"translation-revision-date":"2021-09-30 09:11:37+0000","generator":"GlotPress\/3.0.0-alpha.2","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","plural-forms":"nplurals=1; plural=0;","lang":"th"},"tag delimiter\u0004,":[","]}},"comment":{"reference":"wp-admin\/js\/tags-box.js"}}
1
+{"translation-revision-date":"2021-11-28 05:01:06+0000","generator":"GlotPress\/3.0.0-alpha.2","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","plural-forms":"nplurals=1; plural=0;","lang":"th"},"tag delimiter\u0004,":[","]}},"comment":{"reference":"wp-admin\/js\/tags-box.js"}}

+ 1 - 1
app/wp-content/languages/th-a25d1cc7bf7ca0b4e114f6bea64943f4.json

@@ -1 +1 @@
1
-{"translation-revision-date":"2021-09-30 09:11:37+0000","generator":"GlotPress\/3.0.0-alpha.2","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","plural-forms":"nplurals=1; plural=0;","lang":"th"},"Backtick":["\u0e40\u0e01\u0e23\u0e1f (`)"],"Period":["\u0e0a\u0e48\u0e27\u0e07\u0e40\u0e27\u0e25\u0e32"],"Comma":["\u0e04\u0e2d\u0e21\u0e21\u0e48\u0e32"]}},"comment":{"reference":"wp-includes\/js\/dist\/keycodes.js"}}
1
+{"translation-revision-date":"2021-11-28 05:01:06+0000","generator":"GlotPress\/3.0.0-alpha.2","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","plural-forms":"nplurals=1; plural=0;","lang":"th"},"Backtick":["\u0e40\u0e01\u0e23\u0e1f (`)"],"Period":["\u0e0a\u0e48\u0e27\u0e07\u0e40\u0e27\u0e25\u0e32"],"Comma":["\u0e04\u0e2d\u0e21\u0e21\u0e48\u0e32"]}},"comment":{"reference":"wp-includes\/js\/dist\/keycodes.js"}}

File diff suppressed because it is too large
+ 1 - 1
app/wp-content/languages/th-a9dc201dcd011fe71849743133052619.json


+ 1 - 0
app/wp-content/languages/th-aabfce98c410957228848dc581e3c420.json

@@ -0,0 +1 @@
1
+{"translation-revision-date":"2021-11-28 05:36:52+0000","generator":"GlotPress\/3.0.0-alpha.2","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","plural-forms":"nplurals=1; plural=0;","lang":"th"},"Your new password for %s is:":["\u0e23\u0e2b\u0e31\u0e2a\u0e1c\u0e48\u0e32\u0e19\u0e43\u0e2b\u0e21\u0e48\u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a %s \u0e04\u0e37\u0e2d:"]}},"comment":{"reference":"wp-admin\/js\/auth-app.js"}}

+ 1 - 1
app/wp-content/languages/th-ac23eee47530ac63a1178c827db28087.json

@@ -1 +1 @@
1
-{"translation-revision-date":"2021-09-30 09:11:37+0000","generator":"GlotPress\/3.0.0-alpha.2","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","plural-forms":"nplurals=1; plural=0;","lang":"th"},"text direction\u0004ltr":["ltr"]}},"comment":{"reference":"wp-includes\/js\/dist\/i18n.js"}}
1
+{"translation-revision-date":"2021-11-28 05:01:06+0000","generator":"GlotPress\/3.0.0-alpha.2","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","plural-forms":"nplurals=1; plural=0;","lang":"th"},"text direction\u0004ltr":["ltr"]}},"comment":{"reference":"wp-includes\/js\/dist\/i18n.js"}}

File diff suppressed because it is too large
+ 1 - 1
app/wp-content/languages/th-bf0f094965d3d4a95b47babcb35fc136.json


+ 1 - 1
app/wp-content/languages/th-bf23b24175490c2e46aaf92ff6a0c70f.json

@@ -1 +1 @@
1
-{"translation-revision-date":"2021-09-30 09:11:37+0000","generator":"GlotPress\/3.0.0-alpha.2","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","plural-forms":"nplurals=1; plural=0;","lang":"th"},"Dismiss":["\u0e1b\u0e34\u0e14"]}},"comment":{"reference":"wp-includes\/js\/wp-pointer.js"}}
1
+{"translation-revision-date":"2021-11-28 05:01:06+0000","generator":"GlotPress\/3.0.0-alpha.2","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","plural-forms":"nplurals=1; plural=0;","lang":"th"},"Dismiss":["\u0e1b\u0e34\u0e14"]}},"comment":{"reference":"wp-includes\/js\/wp-pointer.js"}}

+ 1 - 1
app/wp-content/languages/th-ca28138671823450e87dfd354f7afc6b.json

@@ -1 +1 @@
1
-{"translation-revision-date":"2021-10-10 08:48:56+0000","generator":"GlotPress\/3.0.0-alpha.2","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","plural-forms":"nplurals=1; plural=0;","lang":"th"},"Changes saved.":["\u0e1a\u0e31\u0e19\u0e17\u0e36\u0e01\u0e01\u0e32\u0e23\u0e40\u0e1b\u0e25\u0e35\u0e48\u0e22\u0e19\u0e41\u0e1b\u0e25\u0e07\u0e41\u0e25\u0e49\u0e27"]}},"comment":{"reference":"wp-admin\/js\/inline-edit-tax.js"}}
1
+{"translation-revision-date":"2021-11-28 05:36:52+0000","generator":"GlotPress\/3.0.0-alpha.2","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","plural-forms":"nplurals=1; plural=0;","lang":"th"},"Changes saved.":["\u0e1a\u0e31\u0e19\u0e17\u0e36\u0e01\u0e01\u0e32\u0e23\u0e40\u0e1b\u0e25\u0e35\u0e48\u0e22\u0e19\u0e41\u0e1b\u0e25\u0e07\u0e41\u0e25\u0e49\u0e27"]}},"comment":{"reference":"wp-admin\/js\/inline-edit-tax.js"}}

File diff suppressed because it is too large
+ 1 - 1
app/wp-content/languages/th-daeb084aab42199d26393a56c3465bc0.json


File diff suppressed because it is too large
+ 1 - 1
app/wp-content/languages/th-e2791ba830489d23043be8650a22a22b.json


File diff suppressed because it is too large
+ 1 - 1
app/wp-content/languages/th-e2e4c4b80f3adf2c70b431bfdb1b4872.json


File diff suppressed because it is too large
+ 1 - 1
app/wp-content/languages/th-e53526243551a102928735ec9eed4edf.json


File diff suppressed because it is too large
+ 1 - 1
app/wp-content/languages/th-f575f481034e90e21d832e415fd95fcf.json


File diff suppressed because it is too large
+ 1 - 1
app/wp-content/languages/th-f8f49d9fc4a9cf7d78ec99285417bd9c.json


BIN
app/wp-content/languages/th.mo


+ 70 - 1
app/wp-content/languages/th.po

@@ -2,7 +2,7 @@
2 2
 # This file is distributed under the same license as the WordPress - 5.8.x - Development package.
3 3
 msgid ""
4 4
 msgstr ""
5
-"PO-Revision-Date: 2021-09-30 09:11:37+0000\n"
5
+"PO-Revision-Date: 2021-11-28 05:01:06+0000\n"
6 6
 "MIME-Version: 1.0\n"
7 7
 "Content-Type: text/plain; charset=UTF-8\n"
8 8
 "Content-Transfer-Encoding: 8bit\n"
@@ -390,16 +390,41 @@ msgctxt "block keyword"
390 390
 msgid "poetry"
391 391
 msgstr "บทกวี"
392 392
 
393
+#: wp-includes/blocks/verse/block.json
394
+msgctxt "block description"
395
+msgid "Insert poetry. Use special spacing formats. Or quote song lyrics."
396
+msgstr "สอดแทรกบทกวี เพิ่มความโดดเด่นด้วยพื้นที่ว่างรอบตัวอักษร จะคำคมหรือบทเพลงก็เอาอยู่ "
397
+
393 398
 #: wp-includes/blocks/text-columns/block.json
394 399
 msgctxt "block description"
395 400
 msgid "This block is deprecated. Please use the Columns block instead."
396 401
 msgstr "บล็อกนี้ถูกยกเลิกการใช้งานแล้ว โปรดใช้บล็อกคอลัมน์แทน"
397 402
 
403
+#: wp-includes/blocks/tag-cloud/block.json
404
+msgctxt "block description"
405
+msgid "A cloud of your most used tags."
406
+msgstr "แหล่งเก็บแท็กที่ถูกใช้บ่อย"
407
+
398 408
 #: wp-includes/blocks/table/block.json
399 409
 msgctxt "block style label"
400 410
 msgid "Stripes"
401 411
 msgstr "Stripes"
402 412
 
413
+#: wp-includes/blocks/table/block.json
414
+msgctxt "block description"
415
+msgid "Insert a table — perfect for sharing charts and data."
416
+msgstr "แทรกตาราง — เหมาะสำหรับการนำเสนอแผนภูมิและข้อมูล"
417
+
418
+#: wp-includes/blocks/spacer/block.json
419
+msgctxt "block description"
420
+msgid "Add white space between blocks and customize its height."
421
+msgstr "เพิ่มระยะห่างระหว่างบล็อก และปรับแต่งความสูง"
422
+
423
+#: wp-includes/blocks/social-links/block.json
424
+msgctxt "block style label"
425
+msgid "Pill Shape"
426
+msgstr "รูปร่างเม็ดยา"
427
+
403 428
 #: wp-includes/blocks/social-links/block.json
404 429
 msgctxt "block style label"
405 430
 msgid "Logos Only"
@@ -513,6 +538,11 @@ msgid "Query Loop"
513 538
 msgstr "Query Loop"
514 539
 
515 540
 #: wp-includes/blocks/query-title/block.json
541
+msgctxt "block description"
542
+msgid "Display the query title."
543
+msgstr "แสดงหัวข้อจากการสืบค้น"
544
+
545
+#: wp-includes/blocks/query-title/block.json
516 546
 msgctxt "block title"
517 547
 msgid "Query Title"
518 548
 msgstr "Query Title"
@@ -538,6 +568,11 @@ msgid "Query Pagination Previous"
538 568
 msgstr "Query Pagination Previous"
539 569
 
540 570
 #: wp-includes/blocks/query-pagination-numbers/block.json
571
+msgctxt "block description"
572
+msgid "Displays a list of page numbers for pagination"
573
+msgstr "แสดงการให้เลขหน้า"
574
+
575
+#: wp-includes/blocks/query-pagination-numbers/block.json
541 576
 msgctxt "block title"
542 577
 msgid "Query Pagination Numbers"
543 578
 msgstr "Query Pagination Numbers"
@@ -552,6 +587,11 @@ msgctxt "block style label"
552 587
 msgid "Solid color"
553 588
 msgstr "สีทึบ"
554 589
 
590
+#: wp-includes/blocks/pullquote/block.json
591
+msgctxt "block description"
592
+msgid "Give special visual emphasis to a quote from your text."
593
+msgstr "สร้างความดึงดูดสายตาให้กับการอ้างอิงคำคมได้มากขึ้น"
594
+
555 595
 #: wp-includes/blocks/post-terms/block.json
556 596
 msgctxt "block title"
557 597
 msgid "Post Terms"
@@ -1014,6 +1054,10 @@ msgstr "<strong>ข้อผิดพลาด</strong>:  ลิงก์ล้
1014 1054
 msgid "Block HTML:"
1015 1055
 msgstr "บล็อก HTML"
1016 1056
 
1057
+#: wp-includes/widgets/class-wp-widget-block.php:37
1058
+msgid "A widget containing a block."
1059
+msgstr "วิดเจ็ตมีบล็อกเป็นส่วนประกอบ"
1060
+
1017 1061
 #. translators: 1 & 2: Deprecation replacement options.
1018 1062
 #: wp-includes/user.php:3733 wp-includes/user.php:3975
1019 1063
 msgid "%1$s or %2$s"
@@ -1023,6 +1067,16 @@ msgstr "%1$s หรือ %2$s"
1023 1067
 msgid "<strong>Error</strong>: Unknown email address. Check again or try your username."
1024 1068
 msgstr "<strong>ผิดพลาด</strong>: ไม่ทราบอีเมล โปรดตรวจสอบอีกครั้งหรือลองด้วยชื่อผู้ใช้งาน"
1025 1069
 
1070
+#. translators: %s: User name.
1071
+#: wp-includes/user.php:154
1072
+msgid "<strong>Error</strong>: The username <strong>%s</strong> is not registered on this site. If you are unsure of your username, try your email address instead."
1073
+msgstr "<strong>เกิดข้อผิดพลาด</strong>: ชื่อผู้ใช้<strong>%s</strong> ไม่อยู่ในระบบของเว็บไซต์นี้ หากไม่แน่เรื่องชื่อผู้ใช้ กรุณาใช้อีเมลเพื่อลองใหม่อีกครั้ง"
1074
+
1075
+#: wp-includes/taxonomy.php:646
1076
+msgctxt "navigation link block description"
1077
+msgid "A link to a category."
1078
+msgstr "ลิงก์ไปที่หมวดหมู่"
1079
+
1026 1080
 #: wp-includes/taxonomy.php:645
1027 1081
 msgctxt "navigation link block description"
1028 1082
 msgid "A link to a tag."
@@ -1074,6 +1128,10 @@ msgstr "ชนิดของวิดเจ็ตไม่ถูกต้อง
1074 1128
 msgid "Post ID."
1075 1129
 msgstr "ID เรื่อง"
1076 1130
 
1131
+#: wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php:576
1132
+msgid "Status of template."
1133
+msgstr "สถานะของเทมเพลต"
1134
+
1077 1135
 #: wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php:570
1078 1136
 msgid "Description of template."
1079 1137
 msgstr "คำอธิบายของเทมเพลต"
@@ -1082,6 +1140,17 @@ msgstr "คำอธิบายของเทมเพลต"
1082 1140
 msgid "Content of template."
1083 1141
 msgstr "เนื้อหาของเทมเพลต"
1084 1142
 
1143
+#: wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php:193
1144
+#: wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php:222
1145
+#: wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php:277
1146
+#: wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php:315
1147
+msgid "No templates exist with that id."
1148
+msgstr "ไม่มีเทมเพลตที่ตรงกับ ID ที่ระบุ"
1149
+
1150
+#: wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php:121
1151
+msgid "Sorry, you are not allowed to access the templates on this site."
1152
+msgstr "ขออภัย คุณไม่ได้รับอนุญาตให้เข้าถึงเทมเพลตบนเว็บนี้"
1153
+
1085 1154
 #: wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php:79
1086 1155
 msgid "The id of a template"
1087 1156
 msgstr "ID ของเทมเพลต"

+ 135 - 0
app/wp-content/plugins/nextend-facebook-connect/NSL/GDPR.php

@@ -0,0 +1,135 @@
1
+<?php
2
+
3
+namespace NSL;
4
+
5
+use NextendSocialLogin;
6
+
7
+class GDPR {
8
+
9
+    public function __construct() {
10
+        add_action('admin_init', array(
11
+            $this,
12
+            'add_privacy_policy_content'
13
+        ));
14
+
15
+        add_filter('wp_privacy_personal_data_exporters', array(
16
+            $this,
17
+            'register_exporter'
18
+        ), -1);
19
+
20
+        /*
21
+        add_filter('wp_privacy_personal_data_erasers', array(
22
+            $this,
23
+            'register_eraser'
24
+        ));
25
+        */
26
+    }
27
+
28
+    public function add_privacy_policy_content() {
29
+        if (!function_exists('wp_add_privacy_policy_content')) {
30
+            return;
31
+        }
32
+
33
+        $content = '';
34
+        $content .= '<h2>' . __('What personal data we collect and why we collect it') . '</h2>';
35
+        $content .= '<p class="privacy-policy-tutorial">' . sprintf(__('%1$s collects data when a visitor register, login or link the account with with any of the enabled social provider. It collects the following data: email address, name, social provider identifier and access token. Also it can collect profile picture and more fields with the Pro Addon\'s sync data feature.', 'nextend-facebook-connect'), 'Nextend Social Login') . '</p>';
36
+
37
+        $content .= '<h2>' . __('Who we share your data with') . '</h2>';
38
+        $content .= '<p class="privacy-policy-tutorial">' . sprintf(__('%1$s stores the personal data on your site and does not share it with anyone except the access token which used for the authenticated communication with the social providers.', 'nextend-facebook-connect'), 'Nextend Social Login') . '</p>';
39
+
40
+        $content .= '<h2>' . __('Does the plugin share personal data with third parties', 'nextend-facebook-connect') . '</h2>';
41
+        $content .= '<p class="privacy-policy-tutorial">' . sprintf(__('%1$s use the access token what the social provider gave to communicate with the providers to verify account and securely access personal data.', 'nextend-facebook-connect'), 'Nextend Social Login') . '</p>';
42
+
43
+        $content .= '<h2>' . __('How long we retain your data', 'nextend-facebook-connect') . '</h2>';
44
+        $content .= '<p class="privacy-policy-tutorial">' . sprintf(__('%1$s removes the collected personal data when the user deleted from WordPress.', 'nextend-facebook-connect'), 'Nextend Social Login') . '</p>';
45
+
46
+        $content .= '<h2>' . __('Does the plugin use personal data collected by others?', 'nextend-facebook-connect') . '</h2>';
47
+        $content .= '<p class="privacy-policy-tutorial">' . sprintf(__('%1$s use the personal data collected by the social providers to create account on your site when the visitor authorize it.', 'nextend-facebook-connect'), 'Nextend Social Login') . '</p>';
48
+
49
+        $content .= '<h2>' . __('Does the plugin store things in the browser?', 'nextend-facebook-connect') . '</h2>';
50
+        $content .= '<p class="privacy-policy-tutorial">' . sprintf(__('Yes, %1$s must create a cookie for visitors who use the social login authorization flow. This cookie required for every provider to secure the communication and to redirect the user back to the last location.', 'nextend-facebook-connect'), 'Nextend Social Login') . '</p>';
51
+
52
+        $content .= '<h2>' . __('Does the plugin collect telemetry data, directly or indirectly?', 'nextend-facebook-connect') . '</h2>';
53
+        $content .= '<p class="privacy-policy-tutorial">' . __('No') . '</p>';
54
+
55
+        $content .= '<h2>' . __('Does the plugin enqueue JavaScript, tracking pixels or embed iframes from a third party?', 'nextend-facebook-connect') . '</h2>';
56
+        $content .= '<p class="privacy-policy-tutorial">' . __('No') . '</p>';
57
+
58
+
59
+        wp_add_privacy_policy_content('Nextend Social Login', wp_kses_post($content));
60
+    }
61
+
62
+
63
+    public function register_exporter($exporters) {
64
+        $exporters['nextend-facebook-connect'] = array(
65
+            'exporter_friendly_name' => 'Nextend Social Login',
66
+            'callback'               => array(
67
+                $this,
68
+                'exporter'
69
+            ),
70
+        );
71
+
72
+        return $exporters;
73
+    }
74
+
75
+    public function exporter($email_address, $page = 1) {
76
+        $email_address = trim($email_address);
77
+
78
+        $data_to_export = array();
79
+
80
+        $user = get_user_by('email', $email_address);
81
+
82
+        if (!$user) {
83
+            return array(
84
+                'data' => array(),
85
+                'done' => true,
86
+            );
87
+        }
88
+
89
+        $user_data_to_export = array();
90
+
91
+        foreach (NextendSocialLogin::$allowedProviders as $provider) {
92
+            $user_data_to_export = array_merge($user_data_to_export, $provider->exportPersonalData($user->ID));
93
+        }
94
+
95
+
96
+        if (!empty($user_data_to_export)) {
97
+            $data_to_export[] = array(
98
+                'group_id'    => 'user',
99
+                'group_label' => __('User'),
100
+                'item_id'     => "user-{$user->ID}",
101
+                'data'        => $user_data_to_export,
102
+            );
103
+        }
104
+
105
+
106
+        return array(
107
+            'data' => $data_to_export,
108
+            'done' => true,
109
+        );
110
+    }
111
+
112
+    public function register_eraser($erasers) {
113
+        $erasers['nextend-facebook-connect'] = array(
114
+            'exporter_friendly_name' => 'Nextend Social Login',
115
+            'callback'               => array(
116
+                $this,
117
+                'eraser'
118
+            ),
119
+        );
120
+
121
+        return $erasers;
122
+    }
123
+
124
+    public function eraser($email_address, $page = 1) {
125
+        return array(
126
+            'items_removed'  => false,
127
+            'items_retained' => false,
128
+            'messages'       => array(),
129
+            'done'           => true,
130
+        );
131
+    }
132
+}
133
+
134
+
135
+new GDPR();

+ 214 - 0
app/wp-content/plugins/nextend-facebook-connect/NSL/Notices.php

@@ -0,0 +1,214 @@
1
+<?php
2
+
3
+namespace NSL;
4
+
5
+use NSL\Persistent\Persistent;
6
+use WP_Error;
7
+
8
+class Notices {
9
+
10
+    private static $notices;
11
+
12
+    private static $instance;
13
+
14
+    public static function init() {
15
+        if (self::$instance === null) {
16
+            self::$instance = new self;
17
+        }
18
+    }
19
+
20
+    private function __construct() {
21
+        if (is_admin() || (isset($_GET['nsl-notice']) && $_GET['nsl-notice'] == 1)) {
22
+            add_action('init', array(
23
+                $this,
24
+                'load'
25
+            ), 11);
26
+
27
+            if (basename($_SERVER['PHP_SELF']) !== 'options-general.php' || empty($_GET['page']) || $_GET['page'] !== 'nextend-social-login') {
28
+                add_action('admin_notices', array(
29
+                    $this,
30
+                    'admin_notices'
31
+                ));
32
+            }
33
+
34
+            add_action('admin_print_footer_scripts', array(
35
+                $this,
36
+                'notices_fallback'
37
+            ));
38
+            add_action('wp_print_footer_scripts', array(
39
+                $this,
40
+                'notices_fallback'
41
+            ));
42
+        }
43
+    }
44
+
45
+    public function load() {
46
+        self::$notices = maybe_unserialize(self::get());
47
+        if (!is_array(self::$notices)) {
48
+            self::$notices = array();
49
+        }
50
+    }
51
+
52
+    private static function add($type, $message) {
53
+        if (!isset(self::$notices[$type])) {
54
+            self::$notices[$type] = array();
55
+        }
56
+
57
+        if (!in_array($message, self::$notices[$type])) {
58
+            self::$notices[$type][] = $message;
59
+        }
60
+
61
+        self::set();
62
+    }
63
+
64
+    /**
65
+     * @param $message string|WP_Error
66
+     */
67
+    public static function addError($message) {
68
+        if (is_wp_error($message)) {
69
+            foreach ($message->get_error_messages() as $m) {
70
+                self::add('error', $m);
71
+            }
72
+        } else {
73
+            self::add('error', $message);
74
+        }
75
+    }
76
+
77
+    public static function getErrors() {
78
+        if (isset(self::$notices['error'])) {
79
+
80
+            $errors = self::$notices['error'];
81
+
82
+            unset(self::$notices['error']);
83
+            self::set();
84
+
85
+            return $errors;
86
+        }
87
+
88
+        return false;
89
+    }
90
+
91
+    public static function addSuccess($message) {
92
+        self::add('success', $message);
93
+    }
94
+
95
+    public static function displayNotices() {
96
+
97
+        $html = self::getHTML();
98
+
99
+        if (!empty($html)) {
100
+            echo '<div class="nsl-admin-notices">' . $html . '</div>';
101
+        }
102
+    }
103
+
104
+    public function admin_notices() {
105
+        echo self::getHTML();
106
+    }
107
+
108
+    /**
109
+     * Displays the non-displayed notices in lightbox as a fallback
110
+     */
111
+    public function notices_fallback() {
112
+
113
+        $html = self::getHTML();
114
+
115
+        if (!empty($html)) {
116
+            ?>
117
+            <div id="nsl-notices-fallback" onclick="this.parentNode.removeChild(this);">
118
+                <?php echo $html; ?>
119
+                <style>
120
+                    #nsl-notices-fallback {
121
+                        position: fixed;
122
+                        right: 10px;
123
+                        top: 10px;
124
+                        z-index: 10000;
125
+                    }
126
+
127
+                    .admin-bar #nsl-notices-fallback {
128
+                        top: 42px;
129
+                    }
130
+
131
+                    #nsl-notices-fallback > div {
132
+                        position: relative;
133
+                        background: #fff;
134
+                        border-left: 4px solid #fff;
135
+                        box-shadow: 0 1px 1px 0 rgba(0, 0, 0, .1);
136
+                        margin: 5px 15px 2px;
137
+                        padding: 1px 20px;
138
+                    }
139
+
140
+                    #nsl-notices-fallback > div.error {
141
+                        display: block;
142
+                        border-left-color: #dc3232;
143
+                    }
144
+
145
+                    #nsl-notices-fallback > div.updated {
146
+                        display: block;
147
+                        border-left-color: #46b450;
148
+                    }
149
+
150
+                    #nsl-notices-fallback p {
151
+                        margin: .5em 0;
152
+                        padding: 2px;
153
+                    }
154
+
155
+                    #nsl-notices-fallback > div:after {
156
+                        position: absolute;
157
+                        right: 5px;
158
+                        top: 5px;
159
+                        content: '\00d7';
160
+                        display: block;
161
+                        height: 16px;
162
+                        width: 16px;
163
+                        line-height: 16px;
164
+                        text-align: center;
165
+                        font-size: 20px;
166
+                        cursor: pointer;
167
+                    }
168
+                </style>
169
+            </div>
170
+            <?php
171
+        }
172
+    }
173
+
174
+    private static function getHTML() {
175
+        $html = '';
176
+        if (isset(self::$notices['success'])) {
177
+            foreach (self::$notices['success'] AS $message) {
178
+                $html .= '<div class="updated"><p>' . $message . '</p></div>';
179
+            }
180
+        }
181
+
182
+        if (isset(self::$notices['error'])) {
183
+            foreach (self::$notices['error'] AS $message) {
184
+                $html .= '<div class="error"><p>' . $message . '</p></div>';
185
+            }
186
+        }
187
+
188
+        self::clear();
189
+
190
+        return $html;
191
+    }
192
+
193
+    private static function get() {
194
+        return Persistent::get('notices');
195
+    }
196
+
197
+    private static function set() {
198
+        Persistent::set('notices', self::$notices);
199
+    }
200
+
201
+    public static function clear() {
202
+
203
+        Persistent::delete('notices');
204
+        self::$notices = array();
205
+    }
206
+
207
+    public static function hasErrors() {
208
+        if (isset(self::$notices['error'])) {
209
+            return true;
210
+        }
211
+
212
+        return false;
213
+    }
214
+}

+ 93 - 0
app/wp-content/plugins/nextend-facebook-connect/NSL/Persistent/Persistent.php

@@ -0,0 +1,93 @@
1
+<?php
2
+
3
+namespace NSL\Persistent;
4
+
5
+use NSL\Persistent\Storage\Session;
6
+use NSL\Persistent\Storage\StorageAbstract;
7
+use NSL\Persistent\Storage\Transient;
8
+use WP_User;
9
+
10
+require_once dirname(__FILE__) . '/Storage/Abstract.php';
11
+require_once dirname(__FILE__) . '/Storage/Session.php';
12
+require_once dirname(__FILE__) . '/Storage/Transient.php';
13
+
14
+class Persistent {
15
+
16
+    private static $instance;
17
+
18
+    /** @var StorageAbstract */
19
+    private $storage;
20
+
21
+    public function __construct() {
22
+        self::$instance = $this;
23
+        add_action('init', array(
24
+            $this,
25
+            'init'
26
+        ), 0);
27
+
28
+        add_action('wp_login', array(
29
+            $this,
30
+            'transferSessionToUser'
31
+        ), 10, 2);
32
+    }
33
+
34
+    public function init() {
35
+        if ($this->storage === NULL) {
36
+            if (is_user_logged_in()) {
37
+                $this->storage = new Transient();
38
+            } else {
39
+                $this->storage = new Session();
40
+            }
41
+        }
42
+    }
43
+
44
+    public static function set($key, $value) {
45
+        if (self::$instance->storage) {
46
+            self::$instance->storage->set($key, $value);
47
+        }
48
+    }
49
+
50
+    public static function get($key) {
51
+        if (self::$instance->storage) {
52
+            return self::$instance->storage->get($key);
53
+        }
54
+
55
+        return false;
56
+    }
57
+
58
+    public static function delete($key) {
59
+        if (self::$instance->storage) {
60
+            self::$instance->storage->delete($key);
61
+        }
62
+    }
63
+
64
+    /**
65
+     * @param          $user_login
66
+     * @param WP_User  $user
67
+     */
68
+    public function transferSessionToUser($user_login, $user = null) {
69
+
70
+        if (!$user) { // For do_action( 'wp_login' ) calls that lacked passing the 2nd arg.
71
+            $user = get_user_by('login', $user_login);
72
+        }
73
+
74
+        $newStorage = new Transient($user->ID);
75
+        /**
76
+         * $this->storage might be NULL if init action not called yet
77
+         */
78
+        if ($this->storage !== NULL) {
79
+            $newStorage->transferData($this->storage);
80
+        }
81
+
82
+        $this->storage = $newStorage;
83
+    }
84
+
85
+    public static function clear() {
86
+        if (self::$instance->storage) {
87
+            self::$instance->storage->clear();
88
+        }
89
+    }
90
+}
91
+
92
+
93
+new Persistent();

+ 72 - 0
app/wp-content/plugins/nextend-facebook-connect/NSL/Persistent/Storage/Abstract.php

@@ -0,0 +1,72 @@
1
+<?php
2
+
3
+namespace NSL\Persistent\Storage;
4
+
5
+abstract class StorageAbstract {
6
+
7
+    protected $sessionId = null;
8
+
9
+    protected $data = array();
10
+
11
+    public function set($key, $value) {
12
+        $this->load(true);
13
+
14
+        $this->data[$key] = $value;
15
+
16
+        $this->store();
17
+    }
18
+
19
+    public function get($key) {
20
+        $this->load();
21
+
22
+        if (isset($this->data[$key])) {
23
+            return $this->data[$key];
24
+        }
25
+
26
+        return null;
27
+    }
28
+
29
+    public function delete($key) {
30
+        $this->load();
31
+
32
+        if (isset($this->data[$key])) {
33
+            unset($this->data[$key]);
34
+            $this->store();
35
+        }
36
+    }
37
+
38
+    public function clear() {
39
+        $this->data = array();
40
+        $this->store();
41
+    }
42
+
43
+    protected function load($createSession = false) {
44
+        static $isLoaded = false;
45
+
46
+        if (!$isLoaded) {
47
+            $data = maybe_unserialize(get_site_transient($this->sessionId));
48
+            if (is_array($data)) {
49
+                $this->data = $data;
50
+            }
51
+            $isLoaded = true;
52
+        }
53
+    }
54
+
55
+    private function store() {
56
+        if (empty($this->data)) {
57
+            delete_site_transient($this->sessionId);
58
+        } else {
59
+            set_site_transient($this->sessionId, $this->data, apply_filters('nsl_persistent_expiration', HOUR_IN_SECONDS));
60
+        }
61
+    }
62
+
63
+    /**
64
+     * @param StorageAbstract $storage
65
+     */
66
+    public function transferData($storage) {
67
+        $this->data = $storage->data;
68
+        $this->store();
69
+
70
+        $storage->clear();
71
+    }
72
+}

+ 86 - 0
app/wp-content/plugins/nextend-facebook-connect/NSL/Persistent/Storage/Session.php

@@ -0,0 +1,86 @@
1
+<?php
2
+
3
+namespace NSL\Persistent\Storage;
4
+
5
+class Session extends StorageAbstract {
6
+
7
+    /**
8
+     * @var string name of the cookie. Can be changed with nsl_session_name filter and NSL_SESSION_NAME constant.
9
+     *
10
+     * @see https://pantheon.io/docs/caching-advanced-topics/
11
+     */
12
+    private $sessionName = 'SESSnsl';
13
+
14
+    public function __construct() {
15
+
16
+        /**
17
+         * WP Engine hosting needs custom cookie name to prevent caching.
18
+         *
19
+         * @see https://wpengine.com/support/wpengine-ecommerce/
20
+         */
21
+        if (class_exists('WpePlugin_common', false)) {
22
+            $this->sessionName = 'wordpress_nsl';
23
+        }
24
+        if (defined('NSL_SESSION_NAME')) {
25
+            $this->sessionName = NSL_SESSION_NAME;
26
+        }
27
+        $this->sessionName = apply_filters('nsl_session_name', $this->sessionName);
28
+    }
29
+
30
+    public function clear() {
31
+        parent::clear();
32
+
33
+        $this->destroy();
34
+    }
35
+
36
+    private function destroy() {
37
+        $sessionID = $this->sessionId;
38
+        if ($sessionID) {
39
+            $this->setCookie($sessionID, time() - YEAR_IN_SECONDS, apply_filters('nsl_session_use_secure_cookie', false));
40
+
41
+            add_action('shutdown', array(
42
+                $this,
43
+                'destroySiteTransient'
44
+            ));
45
+        }
46
+    }
47
+
48
+    public function destroySiteTransient() {
49
+        $sessionID = $this->sessionId;
50
+        if ($sessionID) {
51
+            delete_site_transient('nsl_' . $sessionID);
52
+        }
53
+    }
54
+
55
+    protected function load($createSession = false) {
56
+        static $isLoaded = false;
57
+        if ($this->sessionId === null) {
58
+            if (isset($_COOKIE[$this->sessionName])) {
59
+                $this->sessionId = 'nsl_persistent_' . md5(SECURE_AUTH_KEY . $_COOKIE[$this->sessionName]);
60
+            } else if ($createSession) {
61
+                $unique = uniqid('nsl', true);
62
+
63
+                $this->setCookie($unique, apply_filters('nsl_session_cookie_expiration', 0), apply_filters('nsl_session_use_secure_cookie', false));
64
+
65
+                $this->sessionId = 'nsl_persistent_' . md5(SECURE_AUTH_KEY . $unique);
66
+
67
+                $isLoaded = true;
68
+            }
69
+        }
70
+
71
+        if (!$isLoaded) {
72
+            if ($this->sessionId !== null) {
73
+                $data = maybe_unserialize(get_site_transient($this->sessionId));
74
+                if (is_array($data)) {
75
+                    $this->data = $data;
76
+                }
77
+                $isLoaded = true;
78
+            }
79
+        }
80
+    }
81
+
82
+    private function setCookie($value, $expire, $secure = false) {
83
+
84
+        setcookie($this->sessionName, $value, $expire, COOKIEPATH ? COOKIEPATH : '/', COOKIE_DOMAIN, $secure);
85
+    }
86
+}

+ 13 - 0
app/wp-content/plugins/nextend-facebook-connect/NSL/Persistent/Storage/Transient.php

@@ -0,0 +1,13 @@
1
+<?php
2
+
3
+namespace NSL\Persistent\Storage;
4
+
5
+class Transient extends StorageAbstract {
6
+
7
+    public function __construct($user_id = false) {
8
+        if ($user_id === false) {
9
+            $user_id = get_current_user_id();
10
+        }
11
+        $this->sessionId = 'nsl_persistent_' . $user_id;
12
+    }
13
+}

+ 72 - 0
app/wp-content/plugins/nextend-facebook-connect/NSL/REST.php

@@ -0,0 +1,72 @@
1
+<?php
2
+
3
+namespace NSL;
4
+
5
+use Exception;
6
+use NextendSocialLogin;
7
+use WP_Error;
8
+use WP_REST_Request;
9
+use WP_REST_Response;
10
+use function add_action;
11
+use function register_rest_route;
12
+
13
+class REST {
14
+
15
+    public function __construct() {
16
+        add_action('rest_api_init', array(
17
+            $this,
18
+            'rest_api_init'
19
+        ));
20
+    }
21
+
22
+    public function rest_api_init() {
23
+        register_rest_route('nextend-social-login/v1', '/(?P<provider>\w[\w\s\-]*)/get_user', array(
24
+            'args' => array(
25
+                'provider'     => array(
26
+                    'required'          => true,
27
+                    'validate_callback' => array(
28
+                        $this,
29
+                        'validate_provider'
30
+                    )
31
+                ),
32
+                'access_token' => array(
33
+                    'required' => true,
34
+                ),
35
+            ),
36
+            array(
37
+                'methods'             => 'POST',
38
+                'callback'            => array(
39
+                    $this,
40
+                    'get_user'
41
+                ),
42
+                'permission_callback' => '__return_true'
43
+            ),
44
+        ));
45
+
46
+    }
47
+
48
+    public function validate_provider($providerID) {
49
+        return NextendSocialLogin::isProviderEnabled($providerID);
50
+    }
51
+
52
+    /**
53
+     * @param WP_REST_Request $request Full details about the request.
54
+     *
55
+     * @return WP_Error|WP_REST_Response
56
+     */
57
+    public function get_user($request) {
58
+
59
+        $provider = NextendSocialLogin::$enabledProviders[$request['provider']];
60
+        try {
61
+            $user = $provider->findUserByAccessToken($request['access_token']);
62
+        } catch (Exception $e) {
63
+            return new WP_Error('error', $e->getMessage());
64
+        }
65
+
66
+        return $user;
67
+    }
68
+
69
+}
70
+
71
+new REST();
72
+

+ 71 - 0
app/wp-content/plugins/nextend-facebook-connect/admin/EditUser.php

@@ -0,0 +1,71 @@
1
+<?php
2
+/** @var $user WP_User */
3
+?>
4
+
5
+<?php foreach (NextendSocialLogin::$enabledProviders AS $provider): ?>
6
+    <?php
7
+    $settings = $provider->settings;
8
+    if (!$provider->isUserConnected($user->ID)) continue;
9
+    $hasData = false;
10
+    ob_start();
11
+    ?>
12
+
13
+    <h2><?php echo $provider->getLabel(); ?></h2>
14
+
15
+    <table class="form-table">
16
+        <tbody>
17
+        <?php foreach ($provider->getSyncFields() AS $fieldName => $fieldData): ?>
18
+            <tr>
19
+                <?php
20
+                $meta_key = $settings->get('sync_fields/fields/' . $fieldName . '/meta_key');
21
+                $value    = get_user_meta($user->ID, $meta_key, true);
22
+                if (isset($value) && $value !== '') {
23
+                    ?>
24
+                    <th><label><?php echo $fieldData['label'] ?></label></th>
25
+                    <td>
26
+                        <?php
27
+
28
+                        $unSerialized = maybe_unserialize($value);
29
+                        if (is_array($unSerialized) || is_object($unSerialized)) {
30
+
31
+                            echo "<pre>";
32
+                            print_r(formatUserMeta((array)$unSerialized));
33
+
34
+                            echo "</pre>";
35
+                        } else {
36
+                            echo esc_html($value);
37
+                        }
38
+                        $hasData = true;
39
+                        ?>
40
+                    </td>
41
+                    <?php
42
+                }
43
+                ?>
44
+            </tr>
45
+        <?php endforeach; ?>
46
+
47
+        </tbody>
48
+    </table>
49
+    <?php
50
+    if ($hasData) {
51
+        echo ob_get_clean();
52
+    } else {
53
+        ob_end_clean();
54
+    }
55
+    ?>
56
+<?php endforeach; ?>
57
+
58
+<?php
59
+
60
+function formatUserMeta($user_meta, $level = '') {
61
+    $formatted_usermeta = '';
62
+    if (is_array($user_meta)) {
63
+        foreach ($user_meta as $meta_key => $meta_value) {
64
+            $formatted_usermeta .= formatUserMeta($meta_value, $level . '[' . $meta_key . ']');
65
+        }
66
+    } else {
67
+        $formatted_usermeta .= "\n" . $level . ' = ' . $user_meta;
68
+    }
69
+
70
+    return $formatted_usermeta;
71
+}

File diff suppressed because it is too large
+ 1023 - 0
app/wp-content/plugins/nextend-facebook-connect/admin/admin.php


BIN
app/wp-content/plugins/nextend-facebook-connect/admin/images/buttons/default.png


BIN
app/wp-content/plugins/nextend-facebook-connect/admin/images/buttons/fullwidth.png


BIN
app/wp-content/plugins/nextend-facebook-connect/admin/images/buttons/icon.png


BIN
app/wp-content/plugins/nextend-facebook-connect/admin/images/error.png


BIN
app/wp-content/plugins/nextend-facebook-connect/admin/images/exclamation-mark.png


BIN
app/wp-content/plugins/nextend-facebook-connect/admin/images/facebook/black.png


BIN
app/wp-content/plugins/nextend-facebook-connect/admin/images/facebook/dark.png


BIN
app/wp-content/plugins/nextend-facebook-connect/admin/images/facebook/light.png


BIN
app/wp-content/plugins/nextend-facebook-connect/admin/images/facebook/white.png


BIN
app/wp-content/plugins/nextend-facebook-connect/admin/images/google/dark.png


BIN
app/wp-content/plugins/nextend-facebook-connect/admin/images/google/light.png


BIN
app/wp-content/plugins/nextend-facebook-connect/admin/images/google/uniform.png


BIN
app/wp-content/plugins/nextend-facebook-connect/admin/images/layouts/above-separator.png


BIN
app/wp-content/plugins/nextend-facebook-connect/admin/images/layouts/above.png


BIN
app/wp-content/plugins/nextend-facebook-connect/admin/images/layouts/below-floating.png


BIN
app/wp-content/plugins/nextend-facebook-connect/admin/images/layouts/below-separator.png


BIN
app/wp-content/plugins/nextend-facebook-connect/admin/images/layouts/below.png


BIN
app/wp-content/plugins/nextend-facebook-connect/admin/images/layouts/default-separator.png


BIN
app/wp-content/plugins/nextend-facebook-connect/admin/images/layouts/default.png


BIN
app/wp-content/plugins/nextend-facebook-connect/admin/images/notice.png


BIN
app/wp-content/plugins/nextend-facebook-connect/admin/images/notice/nslnotice.png


BIN
app/wp-content/plugins/nextend-facebook-connect/admin/images/nsl-logo.png


BIN
app/wp-content/plugins/nextend-facebook-connect/admin/images/ok.png


BIN
app/wp-content/plugins/nextend-facebook-connect/admin/images/padlock.png


BIN
app/wp-content/plugins/nextend-facebook-connect/admin/images/stars-big.png


BIN
app/wp-content/plugins/nextend-facebook-connect/admin/images/stars-small.png


BIN
app/wp-content/plugins/nextend-facebook-connect/admin/images/test-needed.png


+ 38 - 0
app/wp-content/plugins/nextend-facebook-connect/admin/interim.php

@@ -0,0 +1,38 @@
1
+<?php
2
+if (!defined('ABSPATH')) {
3
+    exit;
4
+}
5
+
6
+global $interim_login;
7
+$customize_login = isset($_REQUEST['customize-login']);
8
+if ($customize_login) {
9
+    wp_enqueue_script('customize-base');
10
+}
11
+
12
+$message = '<p class="message">' . __('You have logged in successfully.') . '</p>';
13
+$interim_login = 'success';
14
+?><!DOCTYPE html>
15
+<!--[if IE 8]>
16
+<html xmlns="http://www.w3.org/1999/xhtml" class="ie8" <?php language_attributes(); ?>>
17
+<![endif]-->
18
+<!--[if !(IE 8) ]><!-->
19
+<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
20
+<!--<![endif]-->
21
+<head>
22
+    <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>"/>
23
+    <title><?php __('You have logged in successfully.'); ?></title>
24
+</head>
25
+<body class="login interim-login interim-login-success">
26
+<?php
27
+echo $message;
28
+/** This action is documented in wp-login.php */
29
+do_action('login_footer'); ?>
30
+<?php if ($customize_login) : ?>
31
+    <script type="text/javascript">setTimeout(function () {
32
+            new wp.customize.Messenger({url: '<?php echo wp_customize_url(); ?>', channel: 'login'}).send(
33
+                'login');
34
+        }, 1000);</script>
35
+<?php endif; ?>
36
+</body>
37
+</html>
38
+<?php exit;

+ 77 - 0
app/wp-content/plugins/nextend-facebook-connect/admin/notice.php

@@ -0,0 +1,77 @@
1
+<?php
2
+
3
+
4
+$current = time();
5
+if (mktime(0, 0, 0, 11, 23, 2021) <= $current && $current < mktime(0, 0, 0, 12, 1, 2021)) {
6
+    if (get_option('nsl_bf_2021') != '1') {
7
+
8
+        add_action('admin_notices', function () {
9
+            ?>
10
+            <div class="notice notice-info is-dismissible" data-nsldismissable="nsl_bf_2021" style="display:grid;grid-template-columns: 100px auto;padding-top: 25px; padding-bottom: 22px;">
11
+                <img alt="Nextend Social Login" src="<?php echo plugins_url('images/notice/nslnotice.png', NSL_ADMIN_PATH) ?>" width="74" height="74" style="grid-row: 1 / 4; align-self: center;justify-self: center">
12
+                <h3 style="margin:0;">Nextend Social Login - Black Friday Deal</h3>
13
+                <p style="margin:0 0 2px;">Don't miss out on our biggest sale of the year! Get your <b>Pro Addon</b>
14
+                    with <b>40% OFF</b> to access <b>WooCommerce support</b>, Apple provider and much more!
15
+                    Limited time offer expires on November 30.</p>
16
+                <p style="margin:0;">
17
+                    <a class="button button-primary" href="https://nextendweb.com/social-login/?coupon=SAVE4021&utm_source=wpfree&utm_medium=wp&utm_campaign=bf21#pricing" target="_blank">
18
+                        Buy Now</a>
19
+                    <a class="button button-dismiss" href="#">Dismiss</a>
20
+                </p>
21
+            </div>
22
+            <?php
23
+        });
24
+
25
+        add_action('admin_footer', function () {
26
+            ?>
27
+            <script>
28
+                (function () {
29
+                    function ready(fn) {
30
+                        if (document.readyState === "complete" || document.readyState === "interactive") {
31
+                            fn();
32
+                        } else {
33
+                            document.addEventListener("DOMContentLoaded", fn);
34
+                        }
35
+                    }
36
+
37
+                    function serialize(obj) {
38
+                        return Object.keys(obj).reduce(function (a, k) {
39
+                            a.push(k + '=' + encodeURIComponent(obj[k]));
40
+                            return a;
41
+                        }, []).join('&');
42
+                    }
43
+
44
+                    ready(function () {
45
+                        setTimeout(function () {
46
+                            const buttons = document.querySelectorAll("div[data-nsldismissable] .notice-dismiss, div[data-nsldismissable] .button-dismiss");
47
+                            for (let i = 0; i < buttons.length; i++) {
48
+                                buttons[i].addEventListener('click', function (e) {
49
+                                    e.preventDefault();
50
+
51
+                                    const http = new XMLHttpRequest();
52
+                                    http.open('POST', ajaxurl, true);
53
+                                    http.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=UTF-8");
54
+
55
+                                    http.send(serialize({
56
+                                        'action': 'nsl_dismiss_admin_notice',
57
+                                        'nonce': <?php echo json_encode(wp_create_nonce('nsl-dismissible-notice')); ?>
58
+                                    }));
59
+
60
+                                    e.target.closest('.is-dismissible').remove();
61
+                                });
62
+                            }
63
+                        }, 1000);
64
+                    });
65
+                })();
66
+            </script>
67
+            <?php
68
+        });
69
+
70
+        add_action('wp_ajax_nsl_dismiss_admin_notice', function () {
71
+            check_ajax_referer('nsl-dismissible-notice', 'nonce');
72
+
73
+            update_option('nsl_bf_2021', '1');
74
+            wp_die();
75
+        });
76
+    }
77
+}

File diff suppressed because it is too large
+ 529 - 0
app/wp-content/plugins/nextend-facebook-connect/admin/style.css


+ 201 - 0
app/wp-content/plugins/nextend-facebook-connect/admin/templates-provider/buttons.php

@@ -0,0 +1,201 @@
1
+<?php
2
+defined('ABSPATH') || die();
3
+/** @var $this NextendSocialProviderAdmin */
4
+
5
+$provider = $this->getProvider();
6
+
7
+$settings = $provider->settings;
8
+
9
+$isPRO = apply_filters('nsl-pro', false);
10
+?>
11
+<div class="nsl-admin-sub-content">
12
+    <script type="text/javascript">
13
+
14
+        document.addEventListener("DOMContentLoaded", function () {
15
+            window.resetButtonToDefault = function (id) {
16
+                var defaultButtonValues = {
17
+                    '#login_label': <?php echo wp_json_encode($settings->get('login_label', 'default')); ?>,
18
+                    '#register_label': <?php echo wp_json_encode($settings->get('register_label', 'default')); ?>,
19
+                    '#link_label': <?php echo wp_json_encode($settings->get('link_label', 'default')); ?>,
20
+                    '#unlink_label': <?php echo wp_json_encode($settings->get('unlink_label', 'default')); ?>,
21
+                    '#custom_default_button': <?php echo wp_json_encode($provider->getRawDefaultButton()); ?>,
22
+                    '#custom_icon_button': <?php echo wp_json_encode($provider->getRawIconButton()); ?>
23
+                };
24
+
25
+                var inputField = document.querySelector(id),
26
+                    codeMirror = inputField.parentNode.querySelector('.CodeMirror');
27
+
28
+                inputField.value = defaultButtonValues[id];
29
+                if (codeMirror) {
30
+                    codeMirror.CodeMirror.setValue(defaultButtonValues[id]);
31
+                }
32
+                return false;
33
+            };
34
+
35
+            var defaultButton = document.getElementById('custom_default_button_enabled');
36
+            defaultButton.addEventListener('change', function () {
37
+                if (this.checked) {
38
+                    document.getElementById('custom_default_button_textarea_container').style.removeProperty('display');
39
+
40
+                    var inputField = document.getElementById('custom_default_button'),
41
+                        codeMirror = inputField.parentNode.querySelector('.CodeMirror');
42
+                    if (codeMirror) {
43
+                        codeMirror.CodeMirror.refresh();
44
+                    }
45
+                } else {
46
+                    document.getElementById('custom_default_button_textarea_container').style.display = 'none';
47
+                }
48
+            });
49
+
50
+            var defaultIcon = document.getElementById('custom_icon_button_enabled');
51
+            defaultIcon.addEventListener('change', function () {
52
+                if (this.checked) {
53
+                    document.getElementById('custom_icon_button_textarea_container').style.removeProperty('display');
54
+
55
+                    var inputField = document.getElementById('custom_icon_button');
56
+                    var codeMirror = inputField.parentNode.querySelector('.CodeMirror');
57
+                    if (codeMirror) {
58
+                        codeMirror.CodeMirror.refresh();
59
+                    }
60
+                } else {
61
+                    document.getElementById('custom_icon_button_textarea_container').style.display = 'none';
62
+                }
63
+            });
64
+        });
65
+
66
+    </script>
67
+
68
+    <form method="post" action="<?php echo admin_url('admin-post.php'); ?>" novalidate="novalidate">
69
+
70
+        <?php wp_nonce_field('nextend-social-login'); ?>
71
+        <input type="hidden" name="action" value="nextend-social-login"/>
72
+        <input type="hidden" name="view" value="provider-<?php echo $provider->getId(); ?>"/>
73
+        <input type="hidden" name="subview" value="buttons"/>
74
+
75
+        <table class="form-table">
76
+            <tbody>
77
+            <?php
78
+            $buttonsPath = $provider->getPath() . '/admin/buttons.php';
79
+            if (file_exists($buttonsPath)) {
80
+                include($buttonsPath);
81
+            }
82
+            ?>
83
+
84
+            <tr>
85
+                <th scope="row"><label
86
+                            for="login_label"><?php _e('Login label', 'nextend-facebook-connect'); ?></label></th>
87
+                <td>
88
+                    <input name="login_label" type="text" id="login_label"
89
+                           value="<?php echo esc_attr($settings->get('login_label')); ?>" class="regular-text">
90
+                    <p class="description"><a href="#"
91
+                                              onclick="return resetButtonToDefault('#login_label');"><?php _e('Reset to default', 'nextend-facebook-connect'); ?></a>
92
+                    </p>
93
+                </td>
94
+            </tr>
95
+
96
+            <?php
97
+            $useCustomRegisterLabel = NextendSocialLogin::$settings->get('custom_register_label');
98
+            if ($useCustomRegisterLabel): ?>
99
+                <tr>
100
+                    <th scope="row"><label
101
+                                for="register_label"><?php _e('Register label', 'nextend-facebook-connect'); ?></label>
102
+                    </th>
103
+                    <td>
104
+                        <input name="register_label" type="text" id="register_label"
105
+                               value="<?php echo esc_attr($settings->get('register_label')); ?>" class="regular-text">
106
+                        <p class="description"><a href="#"
107
+                                                  onclick="return resetButtonToDefault('#register_label');"><?php _e('Reset to default', 'nextend-facebook-connect'); ?></a>
108
+                        </p>
109
+                    </td>
110
+                </tr>
111
+            <?php endif; ?>
112
+
113
+            <tr>
114
+                <th scope="row"><label for="link_label"><?php _e('Link label', 'nextend-facebook-connect'); ?></label>
115
+                </th>
116
+                <td>
117
+                    <input name="link_label" type="text" id="link_label"
118
+                           value="<?php echo esc_attr($settings->get('link_label')); ?>" class="regular-text">
119
+                    <p class="description"><a href="#"
120
+                                              onclick="return resetButtonToDefault('#link_label');"><?php _e('Reset to default', 'nextend-facebook-connect'); ?></a>
121
+                    </p>
122
+                </td>
123
+            </tr>
124
+            <tr>
125
+                <th scope="row"><label
126
+                            for="unlink_label"><?php _e('Unlink label', 'nextend-facebook-connect'); ?></label></th>
127
+                <td>
128
+                    <input name="unlink_label" type="text" id="unlink_label"
129
+                           value="<?php echo esc_attr($settings->get('unlink_label')); ?>" class="regular-text">
130
+                    <p class="description"><a href="#"
131
+                                              onclick="return resetButtonToDefault('#unlink_label');"><?php _e('Reset to default', 'nextend-facebook-connect'); ?></a>
132
+                    </p>
133
+                </td>
134
+            </tr>
135
+            <tr>
136
+                <th scope="row"><label
137
+                            for="custom_default_button"><?php _e('Default button', 'nextend-facebook-connect'); ?></label>
138
+                </th>
139
+                <td>
140
+                    <?php
141
+                    $useCustom      = false;
142
+                    $buttonTemplate = $settings->get('custom_default_button');
143
+                    if (!empty($buttonTemplate)) {
144
+                        $useCustom = true;
145
+                    } else {
146
+                        $buttonTemplate = $provider->getRawDefaultButton();
147
+                    }
148
+                    ?>
149
+                    <fieldset><label for="custom_default_button_enabled">
150
+                            <input name="custom_default_button_enabled" type="checkbox"
151
+                                   id="custom_default_button_enabled"
152
+                                   value="1" <?php if ($useCustom): ?> checked<?php endif; ?>>
153
+                            <?php _e('Use custom button', 'nextend-facebook-connect'); ?></label>
154
+                    </fieldset>
155
+                    <div id="custom_default_button_textarea_container" <?php if (!$useCustom): ?> style="display:none;"<?php endif; ?>>
156
+                        <textarea cols="160" rows="6" name="custom_default_button" id="custom_default_button"
157
+                                  class="nextend-html-editor"
158
+                                  aria-describedby="editor-keyboard-trap-help-1 editor-keyboard-trap-help-2 editor-keyboard-trap-help-3 editor-keyboard-trap-help-4"><?php echo esc_textarea($buttonTemplate); ?></textarea>
159
+                        <p class="description"><a href="#"
160
+                                                  onclick="return resetButtonToDefault('#custom_default_button');"><?php _e('Reset to default', 'nextend-facebook-connect'); ?></a><br><br><?php printf(__('Use the %s in your custom button\'s code to make the label show up.', 'nextend-facebook-connect'), "<code>{{label}}</code>"); ?>
161
+                        </p>
162
+                    </div>
163
+                </td>
164
+            </tr>
165
+            <?php if ($isPRO): ?>
166
+                <tr>
167
+                    <th scope="row"><label
168
+                                for="custom_icon_button"><?php _e('Icon button', 'nextend-facebook-connect'); ?></label>
169
+                    </th>
170
+                    <td>
171
+                        <?php
172
+                        $useCustom      = false;
173
+                        $buttonTemplate = $settings->get('custom_icon_button');
174
+                        if (!empty($buttonTemplate)) {
175
+                            $useCustom = true;
176
+                        } else {
177
+                            $buttonTemplate = $provider->getRawIconButton();
178
+                        }
179
+                        ?>
180
+                        <fieldset><label for="custom_icon_button_enabled">
181
+                                <input name="custom_icon_button_enabled" type="checkbox" id="custom_icon_button_enabled"
182
+                                       value="1" <?php if ($useCustom): ?> checked<?php endif; ?>>
183
+                                <?php _e('Use custom button', 'nextend-facebook-connect'); ?></label>
184
+                        </fieldset>
185
+                        <div id="custom_icon_button_textarea_container" <?php if (!$useCustom): ?> style="display:none;"<?php endif; ?>>
186
+                        <textarea cols="160" rows="6" name="custom_icon_button" id="custom_icon_button"
187
+                                  class="nextend-html-editor"
188
+                                  aria-describedby="editor-keyboard-trap-help-1 editor-keyboard-trap-help-2 editor-keyboard-trap-help-3 editor-keyboard-trap-help-4"><?php echo esc_textarea($buttonTemplate); ?></textarea>
189
+                            <p class="description"><a href="#"
190
+                                                      onclick="return resetButtonToDefault('#custom_icon_button');"><?php _e('Reset to default', 'nextend-facebook-connect'); ?></a>
191
+                            </p>
192
+                        </div>
193
+                    </td>
194
+                </tr>
195
+            <?php endif; ?>
196
+            </tbody>
197
+        </table>
198
+        <p class="submit"><input type="submit" name="submit" id="submit" class="button button-primary"
199
+                                 value="<?php _e('Save Changes'); ?>"></p>
200
+    </form>
201
+</div>

+ 25 - 0
app/wp-content/plugins/nextend-facebook-connect/admin/templates-provider/menu.php

@@ -0,0 +1,25 @@
1
+<?php
2
+defined('ABSPATH') || die();
3
+/** @var $this NextendSocialProviderAdmin */
4
+/** @var $view string */
5
+
6
+$proBadge = '';
7
+if (!NextendSocialLoginAdmin::isPro()) {
8
+    $proBadge = '<span class="nsl-pro-badge">Pro</span>';
9
+}
10
+?>
11
+<div class="nsl-admin-sub-nav-bar">
12
+    <a href="<?php echo $this->getUrl(); ?>"
13
+       class="nsl-admin-nav-tab<?php if ($view === 'getting-started'): ?> nsl-admin-nav-tab-active<?php endif; ?>"><?php _e('Getting Started', 'nextend-facebook-connect'); ?></a>
14
+    <a href="<?php echo $this->getUrl('settings'); ?>"
15
+       class="nsl-admin-nav-tab<?php if ($view === 'settings'): ?> nsl-admin-nav-tab-active<?php endif; ?>"><?php _e('Settings', 'nextend-facebook-connect'); ?></a>
16
+    <a href="<?php echo $this->getUrl('buttons'); ?>"
17
+       class="nsl-admin-nav-tab<?php if ($view === 'buttons'): ?> nsl-admin-nav-tab-active<?php endif; ?>"><?php _e('Buttons', 'nextend-facebook-connect'); ?></a>
18
+
19
+    <?php if ($this->provider->hasSyncFields()): ?>
20
+        <a href="<?php echo $this->getUrl('sync-data'); ?>"
21
+           class="nsl-admin-nav-tab<?php if ($view === 'sync-data'): ?> nsl-admin-nav-tab-active<?php endif; ?>"><?php _e('Sync data', 'nextend-facebook-connect'); ?><?php echo $proBadge; ?></a>
22
+    <?php endif; ?>
23
+    <a href="<?php echo $this->getUrl('usage'); ?>"
24
+       class="nsl-admin-nav-tab<?php if ($view === 'usage'): ?> nsl-admin-nav-tab-active<?php endif; ?>"><?php _e('Usage', 'nextend-facebook-connect'); ?></a>
25
+</div>

+ 73 - 0
app/wp-content/plugins/nextend-facebook-connect/admin/templates-provider/settings-other.php

@@ -0,0 +1,73 @@
1
+<?php
2
+defined('ABSPATH') || die();
3
+/** @var $this NextendSocialProviderAdmin */
4
+
5
+$provider = $this->getProvider();
6
+
7
+$settings = $provider->settings;
8
+?>
9
+
10
+<hr/>
11
+<h2><?php _e('Other settings', 'nextend-facebook-connect'); ?></h2>
12
+<table class="form-table">
13
+    <tbody>
14
+    <tr>
15
+        <th scope="row"><label
16
+                    for="user_prefix"><?php _e('Username prefix on register', 'nextend-facebook-connect'); ?></label>
17
+        </th>
18
+        <td><input name="user_prefix" type="text" id="user_prefix"
19
+                   value="<?php echo esc_attr($settings->get('user_prefix')); ?>" class="regular-text"></td>
20
+    </tr>
21
+    <tr>
22
+        <th scope="row"><label
23
+                    for="user_fallback"><?php _e('Fallback username prefix on register', 'nextend-facebook-connect'); ?></label>
24
+        </th>
25
+        <td><input name="user_fallback" type="text" id="user_fallback"
26
+                   value="<?php echo esc_attr($settings->get('user_fallback')); ?>" class="regular-text">
27
+            <p class="description" id="tagline-user_fallback"><?php _e('Used when username is invalid or not stored', 'nextend-facebook-connect'); ?></p>
28
+        </td>
29
+    </tr>
30
+    <?php if (NextendSocialLogin::$settings->get('terms_show') == 1): ?>
31
+        <tr>
32
+            <th scope="row"><?php _e('Terms and conditions', 'nextend-facebook-connect'); ?></th>
33
+            <td>
34
+                <?php
35
+                $terms              = $settings->get('terms');
36
+                $hasOverriddenTerms = !empty($terms);
37
+                ?>
38
+                <fieldset>
39
+                    <label for="terms_override">
40
+                        <input type="hidden" name="terms_override" value="0">
41
+                        <input type="checkbox" name="terms_override" id="terms_override"
42
+                               value="1" <?php if ($hasOverriddenTerms) : ?> checked="checked" <?php endif; ?>>
43
+                        <?php printf(__('Override global "%1$s"', 'nextend-facebook-connect'), __('Terms and conditions', 'nextend-facebook-connect')); ?>
44
+                    </label>
45
+
46
+                    <div id="nsl-terms" <?php if (!$hasOverriddenTerms) : ?> style="display:none;" <?php endif; ?>>
47
+                        <?php
48
+                        wp_editor($terms, 'terms', array(
49
+                            'textarea_rows' => 4,
50
+                            'media_buttons' => false
51
+                        ));
52
+                        ?>
53
+                    </div>
54
+                </fieldset>
55
+                <script type="text/javascript">
56
+                    (function ($) {
57
+
58
+                        $(document).ready(function () {
59
+                            $('#terms_override').on('change', function () {
60
+                                if ($(this).is(':checked')) {
61
+                                    $('#nsl-terms').css('display', '');
62
+                                } else {
63
+                                    $('#nsl-terms').css('display', 'none');
64
+                                }
65
+                            });
66
+                        });
67
+                    })(jQuery);
68
+                </script>
69
+            </td>
70
+        </tr>
71
+    <?php endif; ?>
72
+    </tbody>
73
+</table>

+ 141 - 0
app/wp-content/plugins/nextend-facebook-connect/admin/templates-provider/settings-pro.php

@@ -0,0 +1,141 @@
1
+<?php
2
+defined('ABSPATH') || die();
3
+/** @var $this NextendSocialProviderAdmin */
4
+
5
+$provider = $this->getProvider();
6
+
7
+$settings = $provider->settings;
8
+
9
+$isPRO = apply_filters('nsl-pro', false);
10
+
11
+$attr = '';
12
+if (!$isPRO) {
13
+    $attr = ' disabled ';
14
+}
15
+?>
16
+
17
+    <hr/>
18
+    <h1><?php _e('PRO settings', 'nextend-facebook-connect'); ?></h1>
19
+
20
+
21
+<?php
22
+NextendSocialLoginAdmin::showProBox();
23
+?>
24
+    <input type="hidden" name="tested" id="tested" value="<?php echo esc_attr($settings->get('tested')); ?>"/>
25
+    <table class="form-table" <?php if (!$isPRO): ?> style="opacity:0.5;"<?php endif; ?>>
26
+        <tbody>
27
+        <tr>
28
+            <th scope="row"><?php _e('Ask E-mail on registration', 'nextend-facebook-connect'); ?></th>
29
+            <td>
30
+                <fieldset>
31
+                    <legend class="screen-reader-text">
32
+                        <span><?php _e('Ask E-mail on registration', 'nextend-facebook-connect'); ?></span></legend>
33
+                    <label><input type="radio" name="ask_email"
34
+                                  value="never" <?php if ($settings->get('ask_email') == 'never') : ?> checked="checked" <?php endif; ?><?php echo $attr; ?>>
35
+                        <span><?php _e('Never', 'nextend-facebook-connect'); ?></span></label><br>
36
+                    <label><input type="radio" name="ask_email"
37
+                                  value="when-empty" <?php if ($settings->get('ask_email') == 'when-empty') : ?> checked="checked" <?php endif; ?><?php echo $attr; ?>>
38
+                        <span><?php _e('When email is not provided or empty', 'nextend-facebook-connect'); ?></span></label><br>
39
+                    <label><input type="radio" name="ask_email"
40
+                                  value="always" <?php if ($settings->get('ask_email') == 'always') : ?> checked="checked" <?php endif; ?><?php echo $attr; ?>>
41
+                        <span><?php _e('Always', 'nextend-facebook-connect'); ?></span></label><br>
42
+                </fieldset>
43
+            </td>
44
+        </tr>
45
+        <tr>
46
+            <th scope="row"><?php _e('Ask Username on registration', 'nextend-facebook-connect'); ?></th>
47
+            <td>
48
+                <fieldset>
49
+                    <legend class="screen-reader-text">
50
+                        <span><?php _e('Ask Username on registration', 'nextend-facebook-connect'); ?></span></legend>
51
+                    <label><input type="radio" name="ask_user"
52
+                                  value="never" <?php if ($settings->get('ask_user') == 'never') : ?> checked="checked" <?php endif; ?><?php echo $attr; ?>>
53
+                        <span><?php _e('Never, generate automatically', 'nextend-facebook-connect'); ?></span></label><br>
54
+                    <label><input type="radio" name="ask_user"
55
+                                  value="when-empty" <?php if ($settings->get('ask_user') == 'when-empty') : ?> checked="checked" <?php endif; ?><?php echo $attr; ?>>
56
+                        <span><?php _e('When username is empty or invalid', 'nextend-facebook-connect'); ?></span></label><br>
57
+                    <label><input type="radio" name="ask_user"
58
+                                  value="always" <?php if ($settings->get('ask_user') == 'always') : ?> checked="checked" <?php endif; ?><?php echo $attr; ?>>
59
+                        <span><?php _e('Always', 'nextend-facebook-connect'); ?></span></label><br>
60
+                </fieldset>
61
+            </td>
62
+        </tr>
63
+        <tr>
64
+            <th scope="row"><?php _e('Ask Password on registration', 'nextend-facebook-connect'); ?></th>
65
+            <td>
66
+                <fieldset>
67
+                    <label><input type="radio" name="ask_password"
68
+                                  value="never" <?php if ($settings->get('ask_password') == 'never') : ?> checked="checked" <?php endif; ?><?php echo $attr; ?>>
69
+                        <span><?php _e('Never', 'nextend-facebook-connect'); ?></span></label><br>
70
+                    <label><input type="radio" name="ask_password"
71
+                                  value="always" <?php if ($settings->get('ask_password') == 'always') : ?> checked="checked" <?php endif; ?><?php echo $attr; ?>>
72
+                        <span><?php _e('Always', 'nextend-facebook-connect'); ?></span></label><br>
73
+                </fieldset>
74
+            </td>
75
+        </tr>
76
+        <tr>
77
+            <th scope="row"><?php _e('Automatically connect the existing account upon registration', 'nextend-facebook-connect'); ?></th>
78
+            <td>
79
+                <fieldset>
80
+                    <legend class="screen-reader-text">
81
+                        <span><?php _e('Automatically connect the existing account upon registration', 'nextend-facebook-connect'); ?></span>
82
+                    </legend>
83
+                    <label><input type="radio" name="auto_link"
84
+                                  value="disabled" <?php if ($settings->get('auto_link') == 'disabled') : ?> checked="checked" <?php endif; ?><?php echo $attr; ?>>
85
+                        <span><?php _e('Disabled', 'nextend-facebook-connect'); ?></span></label><br>
86
+                    <label><input type="radio" name="auto_link"
87
+                                  value="email" <?php if ($settings->get('auto_link') == 'email') : ?> checked="checked" <?php endif; ?><?php echo $attr; ?>>
88
+                        <span><?php _e('Automatic, based on email address', 'nextend-facebook-connect'); ?></span></label><br>
89
+                </fieldset>
90
+            </td>
91
+        </tr>
92
+        <tr>
93
+            <th scope="row"><?php _e('Disable login for the selected roles', 'nextend-facebook-connect'); ?></th>
94
+            <td>
95
+                <?php
96
+                $wp_roles = new WP_Roles();
97
+                $roles    = $wp_roles->get_names();
98
+
99
+                $disable_roles = $settings->get('disabled_roles');
100
+                foreach ($roles AS $roleKey => $label):
101
+                    ?>
102
+                    <fieldset><label for="disabled_roles_<?php echo esc_attr($roleKey); ?>">
103
+                            <input name="disabled_roles[]" type="checkbox"
104
+                                   id="disabled_roles_<?php echo esc_attr($roleKey); ?>"
105
+                                   value="<?php echo esc_attr($roleKey); ?>" <?php if (in_array($roleKey, $disable_roles)) : ?> checked <?php endif ?> <?php echo $attr; ?> />
106
+                            <?php echo $label; ?></label>
107
+                    </fieldset>
108
+                <?php endforeach; ?>
109
+                <input type="hidden" name="disabled_roles[]" value=""/>
110
+            </td>
111
+        </tr>
112
+        <tr>
113
+            <th scope="row"><?php _e('Default roles for user who registered with this provider', 'nextend-facebook-connect'); ?></th>
114
+            <td>
115
+                <?php
116
+                $register_roles = $settings->get('register_roles');
117
+                ?>
118
+                <fieldset><label for="register_roles_default">
119
+                        <input name="register_roles[]" type="checkbox" id="register_roles_default"
120
+                               value="default" <?php if (in_array('default', $register_roles)) : ?> checked <?php endif ?> <?php echo $attr; ?> />
121
+                        <?php _e('Default', 'nextend-facebook-connect'); ?></label>
122
+                </fieldset>
123
+                <?php
124
+                foreach ($roles AS $roleKey => $label):
125
+                    ?>
126
+                    <fieldset><label for="register_roles_<?php echo esc_attr($roleKey); ?>">
127
+                            <input name="register_roles[]" type="checkbox"
128
+                                   id="register_roles_<?php echo esc_attr($roleKey); ?>"
129
+                                   value="<?php echo esc_attr($roleKey); ?>" <?php if (in_array($roleKey, $register_roles)) : ?> checked <?php endif ?> <?php echo $attr; ?> />
130
+                            <?php echo $label; ?></label>
131
+                    </fieldset>
132
+                <?php endforeach; ?>
133
+                <input type="hidden" name="register_roles[]" value=""/>
134
+            </td>
135
+        </tr>
136
+        </tbody>
137
+    </table>
138
+<?php if ($isPRO): ?>
139
+    <p class="submit"><input type="submit" name="submit" id="submit" class="button button-primary"
140
+                             value="<?php _e('Save Changes'); ?>"></p>
141
+<?php endif; ?>

+ 126 - 0
app/wp-content/plugins/nextend-facebook-connect/admin/templates-provider/sync-data.php

@@ -0,0 +1,126 @@
1
+<?php
2
+defined('ABSPATH') || die();
3
+/** @var $this NextendSocialProviderAdmin */
4
+
5
+$provider = $this->getProvider();
6
+
7
+$settings = $provider->settings;
8
+
9
+$isPRO = apply_filters('nsl-pro', false);
10
+
11
+$attr = '';
12
+if (!$isPRO) {
13
+    $attr = ' disabled ';
14
+}
15
+?>
16
+
17
+<div class="nsl-admin-sub-content">
18
+
19
+    <?php
20
+    NextendSocialLoginAdmin::showProBox();
21
+    ?>
22
+
23
+    <form method="post" action="<?php echo admin_url('admin-post.php'); ?>" novalidate="novalidate">
24
+
25
+        <?php wp_nonce_field('nextend-social-login'); ?>
26
+        <input type="hidden" name="action" value="nextend-social-login"/>
27
+        <input type="hidden" name="view" value="provider-<?php echo $provider->getId(); ?>"/>
28
+        <input type="hidden" name="subview" value="sync-data"/>
29
+        <input type="hidden" name="settings_saved" value="1"/>
30
+
31
+        <?php
32
+        $sync_warning_message = apply_filters('nsl_' . $provider->getId() . '_sync_warning', false);
33
+        if (!empty($sync_warning_message)): ?>
34
+            <div class="notice notice-warning">
35
+                <p>
36
+                    <?php echo $sync_warning_message; ?>
37
+                </p>
38
+            </div>
39
+        <?php endif; ?>
40
+
41
+        <table class="form-table">
42
+            <tbody>
43
+            <tr>
44
+                <th scope="row"><label>Sync fields</label></th>
45
+                <td>
46
+                    <fieldset>
47
+                        <label for="sync_fields_register">
48
+                            <input type="checkbox" id="sync_fields_register"
49
+                                   value="1" checked disabled/>
50
+                            <?php _e('Register', 'nextend-facebook-connect'); ?>
51
+                        </label>
52
+                    </fieldset>
53
+                    <fieldset>
54
+                        <label for="sync_fields_login">
55
+                            <input name="sync_fields[login]" type="hidden" value="0"/>
56
+                            <input name="sync_fields[login]" type="checkbox" id="sync_fields_login"
57
+                                   value="1" <?php if ($settings->get('sync_fields/login')): ?> checked<?php endif; ?> <?php echo $attr; ?>/>
58
+                            <?php _e('Login', 'nextend-facebook-connect'); ?>
59
+                        </label>
60
+                    </fieldset>
61
+                    <fieldset>
62
+                        <label for="sync_fields_link">
63
+                            <input name="sync_fields[link]" type="hidden" value="0"/>
64
+                            <input name="sync_fields[link]" type="checkbox" id="sync_fields_link"
65
+                                   value="1" <?php if ($settings->get('sync_fields/link')): ?> checked<?php endif; ?> <?php echo $attr; ?>/>
66
+                            <?php _e('Link', 'nextend-facebook-connect'); ?>
67
+                        </label>
68
+                    </fieldset>
69
+                </td>
70
+            </tr>
71
+            <?php
72
+
73
+            $syncFields = $provider->getSyncFields();
74
+            foreach ($syncFields AS $fieldName => $fieldData):
75
+                ?>
76
+                <tr>
77
+                    <th scope="row"><label for="sync_fields_locale"><?php echo $fieldData['label']; ?></label></th>
78
+                    <td>
79
+                        <fieldset>
80
+                            <label for="sync_fields_<?php echo $fieldName; ?>_enabled">
81
+                                <input name="sync_fields[fields][<?php echo $fieldName; ?>][enabled]" type="hidden" value="0" <?php echo $attr; ?>/>
82
+                                <input name="sync_fields[fields][<?php echo $fieldName; ?>][enabled]" type="checkbox" id="sync_fields_<?php echo $fieldName; ?>_enabled"
83
+                                       value="1" <?php if ($settings->get('sync_fields/fields/' . $fieldName . '/enabled')): ?> checked<?php endif; ?> <?php echo $attr; ?>/>
84
+                                <?php _e('Store in meta key', 'nextend-facebook-connect'); ?>
85
+                            </label>
86
+                            <input name="sync_fields[fields][<?php echo $fieldName; ?>][meta_key]" type="text" id="sync_fields_<?php echo $fieldName; ?>_meta_key"
87
+                                   value="<?php echo esc_attr($settings->get('sync_fields/fields/' . $fieldName . '/meta_key')); ?>" class="regular-text" <?php echo $attr; ?>/>
88
+                        </fieldset>
89
+                        <?php
90
+                        $description = $provider->getSyncDataFieldDescription($fieldName);
91
+                        ?>
92
+                        <?php if (!empty($description)): ?>
93
+                            <p class="description">
94
+                                <?php echo $description; ?>
95
+                            </p>
96
+                        <?php endif; ?>
97
+                    </td>
98
+                </tr>
99
+            <?php endforeach; ?>
100
+            </tbody>
101
+        </table>
102
+        <?php if ($isPRO): ?>
103
+            <p class="submit">
104
+                <input type="submit" name="submit" id="submit" class="button button-primary" value="<?php _e('Save Changes'); ?>">
105
+            </p>
106
+        <?php endif; ?>
107
+    </form>
108
+</div>
109
+
110
+<script type="text/javascript">
111
+    (function ($) {
112
+
113
+        $(document).ready(function () {
114
+            var $checkboxes = $('input[type="checkbox"]');
115
+            $checkboxes.on('change', function (e) {
116
+                var $checkbox = $(this);
117
+                $checkbox.closest('td').toggleClass('nsl-admin-setting-disabled', !$checkbox.is(':checked'));
118
+            });
119
+
120
+            $checkboxes.each(function () {
121
+                var $checkbox = $(this);
122
+                $checkbox.closest('td').toggleClass('nsl-admin-setting-disabled', !$checkbox.is(':checked'));
123
+            });
124
+        });
125
+    })(jQuery);
126
+</script>

+ 47 - 0
app/wp-content/plugins/nextend-facebook-connect/admin/templates-provider/usage.php

@@ -0,0 +1,47 @@
1
+<?php
2
+defined('ABSPATH') || die();
3
+/** @var $this NextendSocialProviderAdmin */
4
+
5
+$provider = $this->getProvider();
6
+?>
7
+<div class="nsl-admin-sub-content">
8
+
9
+    <h4><?php _e('Shortcode', 'nextend-facebook-connect'); ?></h4>
10
+
11
+    <p>
12
+        <b><?php _e('Important!', 'nextend-facebook-connect'); ?></b>
13
+        &nbsp;<?php _e('The shortcodes are only rendered for users who haven\'t logged in yet!', 'nextend-facebook-connect'); ?>
14
+        &nbsp;<a href="https://nextendweb.com/nextend-social-login-docs/theme-developer/#shortcode"><?php _e('See the full list of shortcode parameters.', 'nextend-facebook-connect'); ?></a>
15
+    </p>
16
+
17
+    <?php
18
+    $shortcodes = array(
19
+        '[nextend_social_login]',
20
+        '[nextend_social_login provider="' . $provider->getId() . '"]',
21
+        '[nextend_social_login provider="' . $provider->getId() . '" style="icon"]',
22
+        '[nextend_social_login provider="' . $provider->getId() . '" style="icon" redirect="https://nextendweb.com/"]',
23
+        '[nextend_social_login trackerdata="source"]'
24
+    );
25
+    ?>
26
+
27
+    <textarea readonly cols="160" rows="6" class="nextend-html-editor-readonly"
28
+              aria-describedby="editor-keyboard-trap-help-1 editor-keyboard-trap-help-2 editor-keyboard-trap-help-3 editor-keyboard-trap-help-4"><?php echo implode("\n\n", $shortcodes); ?></textarea>
29
+
30
+
31
+    <h4><?php _e('Simple link', 'nextend-facebook-connect'); ?></h4>
32
+
33
+    <?php
34
+    $html = '<a href="' . $provider->getLoginUrl() . '" data-plugin="nsl" data-action="connect" data-redirect="current" data-provider="' . esc_attr($provider->getId()) . '" data-popupwidth="' . $provider->getPopupWidth() . '" data-popupheight="' . $provider->getPopupHeight() . '">' . "\n\t" . __('Click here to login or register', 'nextend-facebook-connect') . "\n" . '</a>';
35
+    ?>
36
+    <textarea readonly cols="160" rows="6" class="nextend-html-editor-readonly"
37
+              aria-describedby="editor-keyboard-trap-help-1 editor-keyboard-trap-help-2 editor-keyboard-trap-help-3 editor-keyboard-trap-help-4"><?php echo esc_textarea($html); ?></textarea>
38
+
39
+    <h4><?php _e('Image button', 'nextend-facebook-connect'); ?></h4>
40
+
41
+    <?php
42
+    $html = '<a href="' . $provider->getLoginUrl() . '" data-plugin="nsl" data-action="connect" data-redirect="current" data-provider="' . esc_attr($provider->getId()) . '" data-popupwidth="' . $provider->getPopupWidth() . '" data-popupheight="' . $provider->getPopupHeight() . '">' . "\n\t" . '<img src="' . __('Image url', 'nextend-facebook-connect') . '" alt="" />' . "\n" . '</a>';
43
+    ?>
44
+    <textarea readonly cols="160" rows="6" class="nextend-html-editor-readonly"
45
+              aria-describedby="editor-keyboard-trap-help-1 editor-keyboard-trap-help-2 editor-keyboard-trap-help-3 editor-keyboard-trap-help-4"><?php echo esc_textarea($html); ?></textarea>
46
+
47
+</div>

+ 66 - 0
app/wp-content/plugins/nextend-facebook-connect/admin/templates/debug.php

@@ -0,0 +1,66 @@
1
+<div class="nsl-admin-content">
2
+    <style>
3
+        .nsl-admin-notices {
4
+            display: none;
5
+        }
6
+    </style>
7
+    <h1 class="title"><?php _e('Debug', 'nextend-facebook-connect'); ?></h1>
8
+    <?php
9
+
10
+
11
+    if (NextendSocialLoginAdmin::isPro()) {
12
+        $activation_data = NextendSocialLogin::getLicense();
13
+
14
+        $proAddonState = NextendSocialLoginAdmin::getProState();
15
+        echo "<p><b>Pro Addon State</b>: " . $proAddonState . "</p>";
16
+
17
+        echo "<p><b>Authorized Domain</b>: " . $activation_data['domain'] . "</p>";
18
+
19
+        $currentDomain = NextendSocialLogin::getDomain();
20
+        echo "<p><b>Current Domain</b>: " . $currentDomain . "</p><br>";
21
+
22
+        $licenseKey = substr($activation_data['license_key'], 0, 8);
23
+        echo "<p><b>License Key</b>: " . $licenseKey . "...</p>";
24
+
25
+        $isLicenseKeyOk = NextendSocialLogin::hasLicense();
26
+        echo "<p><b>License Key OK</b>: " . (boolval($isLicenseKeyOk) ? 'Yes' : 'No') . "</p><br>";
27
+    }
28
+
29
+    $defaultRedirect = NextendSocialLogin::$settings->get('default_redirect');
30
+    echo "<p><b>Default Redirect URL</b>: " . $defaultRedirect . "</p>";
31
+
32
+    $defaultRedirectReg = NextendSocialLogin::$settings->get('default_redirect_reg');
33
+    echo "<p><b>Default Reg Redirect URL</b>: " . $defaultRedirectReg . "</p><br>";
34
+
35
+    $fixRedirect = NextendSocialLogin::$settings->get('redirect');
36
+    echo "<p><b>Fix Redirect URL</b>: " . $fixRedirect . "</p>";
37
+
38
+    $fixRedirectReg = NextendSocialLogin::$settings->get('redirect_reg');
39
+    echo "<p><b>Fix Reg Redirect URL</b>: " . $fixRedirectReg . "</p><br>";
40
+
41
+    echo '<h1>' . __('Test network connection with providers', 'nextend-facebook-connect') . '</h1>';
42
+
43
+    if (!function_exists('curl_init')) {
44
+        ?>
45
+
46
+        <div class="error">
47
+            <p>
48
+                <?php _e('You don\'t have cURL support, please enable it in php.ini!', 'nextend-facebook-connect'); ?>
49
+            </p>
50
+        </div>
51
+
52
+        <?php
53
+    } else {
54
+        foreach (NextendSocialLogin::$allowedProviders AS $provider) {
55
+            ?>
56
+            <p>
57
+                <a target="_blank" href="<?php echo add_query_arg('provider', $provider->getId(), NextendSocialLoginAdmin::getAdminUrl('test-connection')); ?>" class="button button-primary">
58
+                    <?php printf(__('Test %1$s connection', 'nextend-facebook-connect'), $provider->getLabel()); ?>
59
+                </a>
60
+            </p>
61
+            <?php
62
+        }
63
+    }
64
+
65
+    ?>
66
+</div>

+ 40 - 0
app/wp-content/plugins/nextend-facebook-connect/admin/templates/fix-redirect-uri.php

@@ -0,0 +1,40 @@
1
+<div class="nsl-admin-content">
2
+    <h1 class="title"><?php _e('Fix Oauth Redirect URIs', 'nextend-facebook-connect'); ?></h1>
3
+    <?php
4
+    /** @var NextendSocialProvider[] $wrongOauthProviders */
5
+    $wrongOauthProviders = array();
6
+    foreach (NextendSocialLogin::$enabledProviders AS $provider) {
7
+        if (!$provider->checkOauthRedirectUrl()) {
8
+            $wrongOauthProviders[] = $provider;
9
+        }
10
+    }
11
+    ?>
12
+
13
+    <div class="nsl-admin-fix-redirect-uri">
14
+        <?php
15
+        if (count($wrongOauthProviders) === 0) {
16
+            echo '<div class="updated"><p>' . __('Every Oauth Redirect URI seems fine', 'nextend-facebook-connect') . '</p></div>';
17
+
18
+            foreach (NextendSocialLogin::$enabledProviders AS $provider) {
19
+                $provider->getAdmin()
20
+                         ->renderOauthChangedInstruction();
21
+            }
22
+        } else {
23
+            ?>
24
+            <p><?php printf(__('%s detected that your login url changed. You must update the Oauth redirect URIs in the related social applications.', 'nextend-facebook-connect'), '<b>Nextend Social Login</b>'); ?></p>
25
+
26
+            <?php
27
+            foreach ($wrongOauthProviders AS $provider) {
28
+                $provider->getAdmin()
29
+                         ->renderOauthChangedInstruction();
30
+            }
31
+            ?>
32
+
33
+
34
+            <a href="<?php echo wp_nonce_url(NextendSocialLoginAdmin::getAdminUrl('update_oauth_redirect_url'), 'nextend-social-login_update_oauth_redirect_url'); ?>" class="button button-primary">
35
+                <?php _e('Got it', 'nextend-facebook-connect'); ?>
36
+            </a>
37
+
38
+        <?php } ?>
39
+    </div>
40
+</div>

+ 4 - 0
app/wp-content/plugins/nextend-facebook-connect/admin/templates/footer.php

@@ -0,0 +1,4 @@
1
+<?php
2
+defined('ABSPATH') || die();
3
+?>
4
+</div>

+ 0 - 0
app/wp-content/plugins/nextend-facebook-connect/admin/templates/global-settings.php


Some files were not shown because too many files changed in this diff

tum/whitesports - Gogs: Simplico Git Service

No Description

class-wp-comment-query.php 44KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205
  1. <?php
  2. /**
  3. * Comment API: WP_Comment_Query class
  4. *
  5. * @package WordPress
  6. * @subpackage Comments
  7. * @since 4.4.0
  8. */
  9. /**
  10. * Core class used for querying comments.
  11. *
  12. * @since 3.1.0
  13. *
  14. * @see WP_Comment_Query::__construct() for accepted arguments.
  15. */
  16. class WP_Comment_Query {
  17. /**
  18. * SQL for database query.
  19. *
  20. * @since 4.0.1
  21. * @var string
  22. */
  23. public $request;
  24. /**
  25. * Metadata query container
  26. *
  27. * @since 3.5.0
  28. * @var WP_Meta_Query A meta query instance.
  29. */
  30. public $meta_query = false;
  31. /**
  32. * Metadata query clauses.
  33. *
  34. * @since 4.4.0
  35. * @var array
  36. */
  37. protected $meta_query_clauses;
  38. /**
  39. * SQL query clauses.
  40. *
  41. * @since 4.4.0
  42. * @var array
  43. */
  44. protected $sql_clauses = array(
  45. 'select' => '',
  46. 'from' => '',
  47. 'where' => array(),
  48. 'groupby' => '',
  49. 'orderby' => '',
  50. 'limits' => '',
  51. );
  52. /**
  53. * SQL WHERE clause.
  54. *
  55. * Stored after the {@see 'comments_clauses'} filter is run on the compiled WHERE sub-clauses.
  56. *
  57. * @since 4.4.2
  58. * @var string
  59. */
  60. protected $filtered_where_clause;
  61. /**
  62. * Date query container
  63. *
  64. * @since 3.7.0
  65. * @var WP_Date_Query A date query instance.
  66. */
  67. public $date_query = false;
  68. /**
  69. * Query vars set by the user.
  70. *
  71. * @since 3.1.0
  72. * @var array
  73. */
  74. public $query_vars;
  75. /**
  76. * Default values for query vars.
  77. *
  78. * @since 4.2.0
  79. * @var array
  80. */
  81. public $query_var_defaults;
  82. /**
  83. * List of comments located by the query.
  84. *
  85. * @since 4.0.0
  86. * @var array
  87. */
  88. public $comments;
  89. /**
  90. * The amount of found comments for the current query.
  91. *
  92. * @since 4.4.0
  93. * @var int
  94. */
  95. public $found_comments = 0;
  96. /**
  97. * The number of pages.
  98. *
  99. * @since 4.4.0
  100. * @var int
  101. */
  102. public $max_num_pages = 0;
  103. /**
  104. * Make private/protected methods readable for backward compatibility.
  105. *
  106. * @since 4.0.0
  107. *
  108. * @param string $name Method to call.
  109. * @param array $arguments Arguments to pass when calling.
  110. * @return mixed|false Return value of the callback, false otherwise.
  111. */
  112. public function __call( $name, $arguments ) {
  113. if ( 'get_search_sql' === $name ) {
  114. return $this->get_search_sql( ...$arguments );
  115. }
  116. return false;
  117. }
  118. /**
  119. * Constructor.
  120. *
  121. * Sets up the comment query, based on the query vars passed.
  122. *
  123. * @since 4.2.0
  124. * @since 4.4.0 `$parent__in` and `$parent__not_in` were added.
  125. * @since 4.4.0 Order by `comment__in` was added. `$update_comment_meta_cache`, `$no_found_rows`,
  126. * `$hierarchical`, and `$update_comment_post_cache` were added.
  127. * @since 4.5.0 Introduced the `$author_url` argument.
  128. * @since 4.6.0 Introduced the `$cache_domain` argument.
  129. * @since 4.9.0 Introduced the `$paged` argument.
  130. *
  131. * @param string|array $query {
  132. * Optional. Array or query string of comment query parameters. Default empty.
  133. *
  134. * @type string $author_email Comment author email address. Default empty.
  135. * @type string $author_url Comment author URL. Default empty.
  136. * @type int[] $author__in Array of author IDs to include comments for. Default empty.
  137. * @type int[] $author__not_in Array of author IDs to exclude comments for. Default empty.
  138. * @type int[] $comment__in Array of comment IDs to include. Default empty.
  139. * @type int[] $comment__not_in Array of comment IDs to exclude. Default empty.
  140. * @type bool $count Whether to return a comment count (true) or array of
  141. * comment objects (false). Default false.
  142. * @type array $date_query Date query clauses to limit comments by. See WP_Date_Query.
  143. * Default null.
  144. * @type string $fields Comment fields to return. Accepts 'ids' for comment IDs
  145. * only or empty for all fields. Default empty.
  146. * @type int $ID Currently unused.
  147. * @type array $include_unapproved Array of IDs or email addresses of users whose unapproved
  148. * comments will be returned by the query regardless of
  149. * `$status`. Default empty.
  150. * @type int $karma Karma score to retrieve matching comments for.
  151. * Default empty.
  152. * @type string $meta_key Include comments with a matching comment meta key.
  153. * Default empty.
  154. * @type string $meta_value Include comments with a matching comment meta value.
  155. * Requires `$meta_key` to be set. Default empty.
  156. * @type array $meta_query Meta query clauses to limit retrieved comments by.
  157. * See WP_Meta_Query. Default empty.
  158. * @type int $number Maximum number of comments to retrieve.
  159. * Default empty (no limit).
  160. * @type int $paged When used with $number, defines the page of results to return.
  161. * When used with $offset, $offset takes precedence. Default 1.
  162. * @type int $offset Number of comments to offset the query. Used to build
  163. * LIMIT clause. Default 0.
  164. * @type bool $no_found_rows Whether to disable the `SQL_CALC_FOUND_ROWS` query.
  165. * Default: true.
  166. * @type string|array $orderby Comment status or array of statuses. To use 'meta_value'
  167. * or 'meta_value_num', `$meta_key` must also be defined.
  168. * To sort by a specific `$meta_query` clause, use that
  169. * clause's array key. Accepts 'comment_agent',
  170. * 'comment_approved', 'comment_author',
  171. * 'comment_author_email', 'comment_author_IP',
  172. * 'comment_author_url', 'comment_content', 'comment_date',
  173. * 'comment_date_gmt', 'comment_ID', 'comment_karma',
  174. * 'comment_parent', 'comment_post_ID', 'comment_type',
  175. * 'user_id', 'comment__in', 'meta_value', 'meta_value_num',
  176. * the value of $meta_key, and the array keys of
  177. * `$meta_query`. Also accepts false, an empty array, or
  178. * 'none' to disable `ORDER BY` clause.
  179. * Default: 'comment_date_gmt'.
  180. * @type string $order How to order retrieved comments. Accepts 'ASC', 'DESC'.
  181. * Default: 'DESC'.
  182. * @type int $parent Parent ID of comment to retrieve children of.
  183. * Default empty.
  184. * @type int[] $parent__in Array of parent IDs of comments to retrieve children for.
  185. * Default empty.
  186. * @type int[] $parent__not_in Array of parent IDs of comments *not* to retrieve
  187. * children for. Default empty.
  188. * @type int[] $post_author__in Array of author IDs to retrieve comments for.
  189. * Default empty.
  190. * @type int[] $post_author__not_in Array of author IDs *not* to retrieve comments for.
  191. * Default empty.
  192. * @type int $post_ID Currently unused.
  193. * @type int $post_id Limit results to those affiliated with a given post ID.
  194. * Default 0.
  195. * @type int[] $post__in Array of post IDs to include affiliated comments for.
  196. * Default empty.
  197. * @type int[] $post__not_in Array of post IDs to exclude affiliated comments for.
  198. * Default empty.
  199. * @type int $post_author Post author ID to limit results by. Default empty.
  200. * @type string|array $post_status Post status or array of post statuses to retrieve
  201. * affiliated comments for. Pass 'any' to match any value.
  202. * Default empty.
  203. * @type string $post_type Post type or array of post types to retrieve affiliated
  204. * comments for. Pass 'any' to match any value. Default empty.
  205. * @type string $post_name Post name to retrieve affiliated comments for.
  206. * Default empty.
  207. * @type int $post_parent Post parent ID to retrieve affiliated comments for.
  208. * Default empty.
  209. * @type string $search Search term(s) to retrieve matching comments for.
  210. * Default empty.
  211. * @type string|array $status Comment statuses to limit results by. Accepts an array
  212. * or space/comma-separated list of 'hold' (`comment_status=0`),
  213. * 'approve' (`comment_status=1`), 'all', or a custom
  214. * comment status. Default 'all'.
  215. * @type string|array $type Include comments of a given type, or array of types.
  216. * Accepts 'comment', 'pings' (includes 'pingback' and
  217. * 'trackback'), or any custom type string. Default empty.
  218. * @type string[] $type__in Include comments from a given array of comment types.
  219. * Default empty.
  220. * @type string[] $type__not_in Exclude comments from a given array of comment types.
  221. * Default empty.
  222. * @type int $user_id Include comments for a specific user ID. Default empty.
  223. * @type bool|string $hierarchical Whether to include comment descendants in the results.
  224. * - 'threaded' returns a tree, with each comment's children
  225. * stored in a `children` property on the `WP_Comment` object.
  226. * - 'flat' returns a flat array of found comments plus
  227. * their children.
  228. * - Boolean `false` leaves out descendants.
  229. * The parameter is ignored (forced to `false`) when
  230. * `$fields` is 'ids' or 'counts'. Accepts 'threaded',
  231. * 'flat', or false. Default: false.
  232. * @type string $cache_domain Unique cache key to be produced when this query is stored in
  233. * an object cache. Default is 'core'.
  234. * @type bool $update_comment_meta_cache Whether to prime the metadata cache for found comments.
  235. * Default true.
  236. * @type bool $update_comment_post_cache Whether to prime the cache for comment posts.
  237. * Default false.
  238. * }
  239. */
  240. public function __construct( $query = '' ) {
  241. $this->query_var_defaults = array(
  242. 'author_email' => '',
  243. 'author_url' => '',
  244. 'author__in' => '',
  245. 'author__not_in' => '',
  246. 'include_unapproved' => '',
  247. 'fields' => '',
  248. 'ID' => '',
  249. 'comment__in' => '',
  250. 'comment__not_in' => '',
  251. 'karma' => '',
  252. 'number' => '',
  253. 'offset' => '',
  254. 'no_found_rows' => true,
  255. 'orderby' => '',
  256. 'order' => 'DESC',
  257. 'paged' => 1,
  258. 'parent' => '',
  259. 'parent__in' => '',
  260. 'parent__not_in' => '',
  261. 'post_author__in' => '',
  262. 'post_author__not_in' => '',
  263. 'post_ID' => '',
  264. 'post_id' => 0,
  265. 'post__in' => '',
  266. 'post__not_in' => '',
  267. 'post_author' => '',
  268. 'post_name' => '',
  269. 'post_parent' => '',
  270. 'post_status' => '',
  271. 'post_type' => '',
  272. 'status' => 'all',
  273. 'type' => '',
  274. 'type__in' => '',
  275. 'type__not_in' => '',
  276. 'user_id' => '',
  277. 'search' => '',
  278. 'count' => false,
  279. 'meta_key' => '',
  280. 'meta_value' => '',
  281. 'meta_query' => '',
  282. 'date_query' => null, // See WP_Date_Query.
  283. 'hierarchical' => false,
  284. 'cache_domain' => 'core',
  285. 'update_comment_meta_cache' => true,
  286. 'update_comment_post_cache' => false,
  287. );
  288. if ( ! empty( $query ) ) {
  289. $this->query( $query );
  290. }
  291. }
  292. /**
  293. * Parse arguments passed to the comment query with default query parameters.
  294. *
  295. * @since 4.2.0 Extracted from WP_Comment_Query::query().
  296. *
  297. * @param string|array $query WP_Comment_Query arguments. See WP_Comment_Query::__construct()
  298. */
  299. public function parse_query( $query = '' ) {
  300. if ( empty( $query ) ) {
  301. $query = $this->query_vars;
  302. }
  303. $this->query_vars = wp_parse_args( $query, $this->query_var_defaults );
  304. /**
  305. * Fires after the comment query vars have been parsed.
  306. *
  307. * @since 4.2.0
  308. *
  309. * @param WP_Comment_Query $this The WP_Comment_Query instance (passed by reference).
  310. */
  311. do_action_ref_array( 'parse_comment_query', array( &$this ) );
  312. }
  313. /**
  314. * Sets up the WordPress query for retrieving comments.
  315. *
  316. * @since 3.1.0
  317. * @since 4.1.0 Introduced 'comment__in', 'comment__not_in', 'post_author__in',
  318. * 'post_author__not_in', 'author__in', 'author__not_in', 'post__in',
  319. * 'post__not_in', 'include_unapproved', 'type__in', and 'type__not_in'
  320. * arguments to $query_vars.
  321. * @since 4.2.0 Moved parsing to WP_Comment_Query::parse_query().
  322. *
  323. * @param string|array $query Array or URL query string of parameters.
  324. * @return array|int List of comments, or number of comments when 'count' is passed as a query var.
  325. */
  326. public function query( $query ) {
  327. $this->query_vars = wp_parse_args( $query );
  328. return $this->get_comments();
  329. }
  330. /**
  331. * Get a list of comments matching the query vars.
  332. *
  333. * @since 4.2.0
  334. *
  335. * @global wpdb $wpdb WordPress database abstraction object.
  336. *
  337. * @return int|array List of comments or number of found comments if `$count` argument is true.
  338. */
  339. public function get_comments() {
  340. global $wpdb;
  341. $this->parse_query();
  342. // Parse meta query.
  343. $this->meta_query = new WP_Meta_Query();
  344. $this->meta_query->parse_query_vars( $this->query_vars );
  345. /**
  346. * Fires before comments are retrieved.
  347. *
  348. * @since 3.1.0
  349. *
  350. * @param WP_Comment_Query $this Current instance of WP_Comment_Query (passed by reference).
  351. */
  352. do_action_ref_array( 'pre_get_comments', array( &$this ) );
  353. // Reparse query vars, in case they were modified in a 'pre_get_comments' callback.
  354. $this->meta_query->parse_query_vars( $this->query_vars );
  355. if ( ! empty( $this->meta_query->queries ) ) {
  356. $this->meta_query_clauses = $this->meta_query->get_sql( 'comment', $wpdb->comments, 'comment_ID', $this );
  357. }
  358. $comment_data = null;
  359. /**
  360. * Filters the comments data before the query takes place.
  361. *
  362. * Return a non-null value to bypass WordPress' default comment queries.
  363. *
  364. * The expected return type from this filter depends on the value passed
  365. * in the request query vars:
  366. * - When `$this->query_vars['count']` is set, the filter should return
  367. * the comment count as an integer.
  368. * - When `'ids' === $this->query_vars['fields']`, the filter should return
  369. * an array of comment IDs.
  370. * - Otherwise the filter should return an array of WP_Comment objects.
  371. *
  372. * Note that if the filter returns an array of comment data, it will be assigned
  373. * to the `comments` property of the current WP_Comment_Query instance.
  374. *
  375. * Filtering functions that require pagination information are encouraged to set
  376. * the `found_comments` and `max_num_pages` properties of the WP_Comment_Query object,
  377. * passed to the filter by reference. If WP_Comment_Query does not perform a database
  378. * query, it will not have enough information to generate these values itself.
  379. *
  380. * @since 5.3.0
  381. * @since 5.6.0 The returned array of comment data is assigned to the `comments` property
  382. * of the current WP_Comment_Query instance.
  383. *
  384. * @param array|int|null $comment_data Return an array of comment data to short-circuit WP's comment query,
  385. * the comment count as an integer if `$this->query_vars['count']` is set,
  386. * or null to allow WP to run its normal queries.
  387. * @param WP_Comment_Query $query The WP_Comment_Query instance, passed by reference.
  388. */
  389. $comment_data = apply_filters_ref_array( 'comments_pre_query', array( $comment_data, &$this ) );
  390. if ( null !== $comment_data ) {
  391. if ( is_array( $comment_data ) && ! $this->query_vars['count'] ) {
  392. $this->comments = $comment_data;
  393. }
  394. return $comment_data;
  395. }
  396. /*
  397. * Only use the args defined in the query_var_defaults to compute the key,
  398. * but ignore 'fields', which does not affect query results.
  399. */
  400. $_args = wp_array_slice_assoc( $this->query_vars, array_keys( $this->query_var_defaults ) );
  401. unset( $_args['fields'] );
  402. $key = md5( serialize( $_args ) );
  403. $last_changed = wp_cache_get_last_changed( 'comment' );
  404. $cache_key = "get_comments:$key:$last_changed";
  405. $cache_value = wp_cache_get( $cache_key, 'comment' );
  406. if ( false === $cache_value ) {
  407. $comment_ids = $this->get_comment_ids();
  408. if ( $comment_ids ) {
  409. $this->set_found_comments();
  410. }
  411. $cache_value = array(
  412. 'comment_ids' => $comment_ids,
  413. 'found_comments' => $this->found_comments,
  414. );
  415. wp_cache_add( $cache_key, $cache_value, 'comment' );
  416. } else {
  417. $comment_ids = $cache_value['comment_ids'];
  418. $this->found_comments = $cache_value['found_comments'];
  419. }
  420. if ( $this->found_comments && $this->query_vars['number'] ) {
  421. $this->max_num_pages = ceil( $this->found_comments / $this->query_vars['number'] );
  422. }
  423. // If querying for a count only, there's nothing more to do.
  424. if ( $this->query_vars['count'] ) {
  425. // $comment_ids is actually a count in this case.
  426. return (int) $comment_ids;
  427. }
  428. $comment_ids = array_map( 'intval', $comment_ids );
  429. if ( 'ids' === $this->query_vars['fields'] ) {
  430. $this->comments = $comment_ids;
  431. return $this->comments;
  432. }
  433. _prime_comment_caches( $comment_ids, $this->query_vars['update_comment_meta_cache'] );
  434. // Fetch full comment objects from the primed cache.
  435. $_comments = array();
  436. foreach ( $comment_ids as $comment_id ) {
  437. $_comment = get_comment( $comment_id );
  438. if ( $_comment ) {
  439. $_comments[] = $_comment;
  440. }
  441. }
  442. // Prime comment post caches.
  443. if ( $this->query_vars['update_comment_post_cache'] ) {
  444. $comment_post_ids = array();
  445. foreach ( $_comments as $_comment ) {
  446. $comment_post_ids[] = $_comment->comment_post_ID;
  447. }
  448. _prime_post_caches( $comment_post_ids, false, false );
  449. }
  450. /**
  451. * Filters the comment query results.
  452. *
  453. * @since 3.1.0
  454. *
  455. * @param WP_Comment[] $_comments An array of comments.
  456. * @param WP_Comment_Query $query Current instance of WP_Comment_Query (passed by reference).
  457. */
  458. $_comments = apply_filters_ref_array( 'the_comments', array( $_comments, &$this ) );
  459. // Convert to WP_Comment instances.
  460. $comments = array_map( 'get_comment', $_comments );
  461. if ( $this->query_vars['hierarchical'] ) {
  462. $comments = $this->fill_descendants( $comments );
  463. }
  464. $this->comments = $comments;
  465. return $this->comments;
  466. }
  467. /**
  468. * Used internally to get a list of comment IDs matching the query vars.
  469. *
  470. * @since 4.4.0
  471. *
  472. * @global wpdb $wpdb WordPress database abstraction object.
  473. *
  474. * @return int|array A single count of comment IDs if a count query. An array of comment IDs if a full query.
  475. */
  476. protected function get_comment_ids() {
  477. global $wpdb;
  478. // Assemble clauses related to 'comment_approved'.
  479. $approved_clauses = array();
  480. // 'status' accepts an array or a comma-separated string.
  481. $status_clauses = array();
  482. $statuses = wp_parse_list( $this->query_vars['status'] );
  483. // Empty 'status' should be interpreted as 'all'.
  484. if ( empty( $statuses ) ) {
  485. $statuses = array( 'all' );
  486. }
  487. // 'any' overrides other statuses.
  488. if ( ! in_array( 'any', $statuses, true ) ) {
  489. foreach ( $statuses as $status ) {
  490. switch ( $status ) {
  491. case 'hold':
  492. $status_clauses[] = "comment_approved = '0'";
  493. break;
  494. case 'approve':
  495. $status_clauses[] = "comment_approved = '1'";
  496. break;
  497. case 'all':
  498. case '':
  499. $status_clauses[] = "( comment_approved = '0' OR comment_approved = '1' )";
  500. break;
  501. default:
  502. $status_clauses[] = $wpdb->prepare( 'comment_approved = %s', $status );
  503. break;
  504. }
  505. }
  506. if ( ! empty( $status_clauses ) ) {
  507. $approved_clauses[] = '( ' . implode( ' OR ', $status_clauses ) . ' )';
  508. }
  509. }
  510. // User IDs or emails whose unapproved comments are included, regardless of $status.
  511. if ( ! empty( $this->query_vars['include_unapproved'] ) ) {
  512. $include_unapproved = wp_parse_list( $this->query_vars['include_unapproved'] );
  513. $unapproved_ids = array();
  514. $unapproved_emails = array();
  515. foreach ( $include_unapproved as $unapproved_identifier ) {
  516. // Numeric values are assumed to be user IDs.
  517. if ( is_numeric( $unapproved_identifier ) ) {
  518. $approved_clauses[] = $wpdb->prepare( "( user_id = %d AND comment_approved = '0' )", $unapproved_identifier );
  519. } else {
  520. // Otherwise we match against email addresses.
  521. if ( ! empty( $_GET['unapproved'] ) && ! empty( $_GET['moderation-hash'] ) ) {
  522. // Only include requested comment.
  523. $approved_clauses[] = $wpdb->prepare( "( comment_author_email = %s AND comment_approved = '0' AND comment_ID = %d )", $unapproved_identifier, (int) $_GET['unapproved'] );
  524. } else {
  525. // Include all of the author's unapproved comments.
  526. $approved_clauses[] = $wpdb->prepare( "( comment_author_email = %s AND comment_approved = '0' )", $unapproved_identifier );
  527. }
  528. }
  529. }
  530. }
  531. // Collapse comment_approved clauses into a single OR-separated clause.
  532. if ( ! empty( $approved_clauses ) ) {
  533. if ( 1 === count( $approved_clauses ) ) {
  534. $this->sql_clauses['where']['approved'] = $approved_clauses[0];
  535. } else {
  536. $this->sql_clauses['where']['approved'] = '( ' . implode( ' OR ', $approved_clauses ) . ' )';
  537. }
  538. }
  539. $order = ( 'ASC' === strtoupper( $this->query_vars['order'] ) ) ? 'ASC' : 'DESC';
  540. // Disable ORDER BY with 'none', an empty array, or boolean false.
  541. if ( in_array( $this->query_vars['orderby'], array( 'none', array(), false ), true ) ) {
  542. $orderby = '';
  543. } elseif ( ! empty( $this->query_vars['orderby'] ) ) {
  544. $ordersby = is_array( $this->query_vars['orderby'] ) ?
  545. $this->query_vars['orderby'] :
  546. preg_split( '/[,\s]/', $this->query_vars['orderby'] );
  547. $orderby_array = array();
  548. $found_orderby_comment_id = false;
  549. foreach ( $ordersby as $_key => $_value ) {
  550. if ( ! $_value ) {
  551. continue;
  552. }
  553. if ( is_int( $_key ) ) {
  554. $_orderby = $_value;
  555. $_order = $order;
  556. } else {
  557. $_orderby = $_key;
  558. $_order = $_value;
  559. }
  560. if ( ! $found_orderby_comment_id && in_array( $_orderby, array( 'comment_ID', 'comment__in' ), true ) ) {
  561. $found_orderby_comment_id = true;
  562. }
  563. $parsed = $this->parse_orderby( $_orderby );
  564. if ( ! $parsed ) {
  565. continue;
  566. }
  567. if ( 'comment__in' === $_orderby ) {
  568. $orderby_array[] = $parsed;
  569. continue;
  570. }
  571. $orderby_array[] = $parsed . ' ' . $this->parse_order( $_order );
  572. }
  573. // If no valid clauses were found, order by comment_date_gmt.
  574. if ( empty( $orderby_array ) ) {
  575. $orderby_array[] = "$wpdb->comments.comment_date_gmt $order";
  576. }
  577. // To ensure determinate sorting, always include a comment_ID clause.
  578. if ( ! $found_orderby_comment_id ) {
  579. $comment_id_order = '';
  580. // Inherit order from comment_date or comment_date_gmt, if available.
  581. foreach ( $orderby_array as $orderby_clause ) {
  582. if ( preg_match( '/comment_date(?:_gmt)*\ (ASC|DESC)/', $orderby_clause, $match ) ) {
  583. $comment_id_order = $match[1];
  584. break;
  585. }
  586. }
  587. // If no date-related order is available, use the date from the first available clause.
  588. if ( ! $comment_id_order ) {
  589. foreach ( $orderby_array as $orderby_clause ) {
  590. if ( false !== strpos( 'ASC', $orderby_clause ) ) {
  591. $comment_id_order = 'ASC';
  592. } else {
  593. $comment_id_order = 'DESC';
  594. }
  595. break;
  596. }
  597. }
  598. // Default to DESC.
  599. if ( ! $comment_id_order ) {
  600. $comment_id_order = 'DESC';
  601. }
  602. $orderby_array[] = "$wpdb->comments.comment_ID $comment_id_order";
  603. }
  604. $orderby = implode( ', ', $orderby_array );
  605. } else {
  606. $orderby = "$wpdb->comments.comment_date_gmt $order";
  607. }
  608. $number = absint( $this->query_vars['number'] );
  609. $offset = absint( $this->query_vars['offset'] );
  610. $paged = absint( $this->query_vars['paged'] );
  611. $limits = '';
  612. if ( ! empty( $number ) ) {
  613. if ( $offset ) {
  614. $limits = 'LIMIT ' . $offset . ',' . $number;
  615. } else {
  616. $limits = 'LIMIT ' . ( $number * ( $paged - 1 ) ) . ',' . $number;
  617. }
  618. }
  619. if ( $this->query_vars['count'] ) {
  620. $fields = 'COUNT(*)';
  621. } else {
  622. $fields = "$wpdb->comments.comment_ID";
  623. }
  624. $post_id = absint( $this->query_vars['post_id'] );
  625. if ( ! empty( $post_id ) ) {
  626. $this->sql_clauses['where']['post_id'] = $wpdb->prepare( 'comment_post_ID = %d', $post_id );
  627. }
  628. // Parse comment IDs for an IN clause.
  629. if ( ! empty( $this->query_vars['comment__in'] ) ) {
  630. $this->sql_clauses['where']['comment__in'] = "$wpdb->comments.comment_ID IN ( " . implode( ',', wp_parse_id_list( $this->query_vars['comment__in'] ) ) . ' )';
  631. }
  632. // Parse comment IDs for a NOT IN clause.
  633. if ( ! empty( $this->query_vars['comment__not_in'] ) ) {
  634. $this->sql_clauses['where']['comment__not_in'] = "$wpdb->comments.comment_ID NOT IN ( " . implode( ',', wp_parse_id_list( $this->query_vars['comment__not_in'] ) ) . ' )';
  635. }
  636. // Parse comment parent IDs for an IN clause.
  637. if ( ! empty( $this->query_vars['parent__in'] ) ) {
  638. $this->sql_clauses['where']['parent__in'] = 'comment_parent IN ( ' . implode( ',', wp_parse_id_list( $this->query_vars['parent__in'] ) ) . ' )';
  639. }
  640. // Parse comment parent IDs for a NOT IN clause.
  641. if ( ! empty( $this->query_vars['parent__not_in'] ) ) {
  642. $this->sql_clauses['where']['parent__not_in'] = 'comment_parent NOT IN ( ' . implode( ',', wp_parse_id_list( $this->query_vars['parent__not_in'] ) ) . ' )';
  643. }
  644. // Parse comment post IDs for an IN clause.
  645. if ( ! empty( $this->query_vars['post__in'] ) ) {
  646. $this->sql_clauses['where']['post__in'] = 'comment_post_ID IN ( ' . implode( ',', wp_parse_id_list( $this->query_vars['post__in'] ) ) . ' )';
  647. }
  648. // Parse comment post IDs for a NOT IN clause.
  649. if ( ! empty( $this->query_vars['post__not_in'] ) ) {
  650. $this->sql_clauses['where']['post__not_in'] = 'comment_post_ID NOT IN ( ' . implode( ',', wp_parse_id_list( $this->query_vars['post__not_in'] ) ) . ' )';
  651. }
  652. if ( '' !== $this->query_vars['author_email'] ) {
  653. $this->sql_clauses['where']['author_email'] = $wpdb->prepare( 'comment_author_email = %s', $this->query_vars['author_email'] );
  654. }
  655. if ( '' !== $this->query_vars['author_url'] ) {
  656. $this->sql_clauses['where']['author_url'] = $wpdb->prepare( 'comment_author_url = %s', $this->query_vars['author_url'] );
  657. }
  658. if ( '' !== $this->query_vars['karma'] ) {
  659. $this->sql_clauses['where']['karma'] = $wpdb->prepare( 'comment_karma = %d', $this->query_vars['karma'] );
  660. }
  661. // Filtering by comment_type: 'type', 'type__in', 'type__not_in'.
  662. $raw_types = array(
  663. 'IN' => array_merge( (array) $this->query_vars['type'], (array) $this->query_vars['type__in'] ),
  664. 'NOT IN' => (array) $this->query_vars['type__not_in'],
  665. );
  666. $comment_types = array();
  667. foreach ( $raw_types as $operator => $_raw_types ) {
  668. $_raw_types = array_unique( $_raw_types );
  669. foreach ( $_raw_types as $type ) {
  670. switch ( $type ) {
  671. // An empty translates to 'all', for backward compatibility.
  672. case '':
  673. case 'all':
  674. break;
  675. case 'comment':
  676. case 'comments':
  677. $comment_types[ $operator ][] = "''";
  678. $comment_types[ $operator ][] = "'comment'";
  679. break;
  680. case 'pings':
  681. $comment_types[ $operator ][] = "'pingback'";
  682. $comment_types[ $operator ][] = "'trackback'";
  683. break;
  684. default:
  685. $comment_types[ $operator ][] = $wpdb->prepare( '%s', $type );
  686. break;
  687. }
  688. }
  689. if ( ! empty( $comment_types[ $operator ] ) ) {
  690. $types_sql = implode( ', ', $comment_types[ $operator ] );
  691. $this->sql_clauses['where'][ 'comment_type__' . strtolower( str_replace( ' ', '_', $operator ) ) ] = "comment_type $operator ($types_sql)";
  692. }
  693. }
  694. $parent = $this->query_vars['parent'];
  695. if ( $this->query_vars['hierarchical'] && ! $parent ) {
  696. $parent = 0;
  697. }
  698. if ( '' !== $parent ) {
  699. $this->sql_clauses['where']['parent'] = $wpdb->prepare( 'comment_parent = %d', $parent );
  700. }
  701. if ( is_array( $this->query_vars['user_id'] ) ) {
  702. $this->sql_clauses['where']['user_id'] = 'user_id IN (' . implode( ',', array_map( 'absint', $this->query_vars['user_id'] ) ) . ')';
  703. } elseif ( '' !== $this->query_vars['user_id'] ) {
  704. $this->sql_clauses['where']['user_id'] = $wpdb->prepare( 'user_id = %d', $this->query_vars['user_id'] );
  705. }
  706. // Falsey search strings are ignored.
  707. if ( strlen( $this->query_vars['search'] ) ) {
  708. $search_sql = $this->get_search_sql(
  709. $this->query_vars['search'],
  710. array( 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_author_IP', 'comment_content' )
  711. );
  712. // Strip leading 'AND'.
  713. $this->sql_clauses['where']['search'] = preg_replace( '/^\s*AND\s*/', '', $search_sql );
  714. }
  715. // If any post-related query vars are passed, join the posts table.
  716. $join_posts_table = false;
  717. $plucked = wp_array_slice_assoc( $this->query_vars, array( 'post_author', 'post_name', 'post_parent' ) );
  718. $post_fields = array_filter( $plucked );
  719. if ( ! empty( $post_fields ) ) {
  720. $join_posts_table = true;
  721. foreach ( $post_fields as $field_name => $field_value ) {
  722. // $field_value may be an array.
  723. $esses = array_fill( 0, count( (array) $field_value ), '%s' );
  724. // phpcs:ignore WordPress.DB.PreparedSQLPlaceholders.UnfinishedPrepare
  725. $this->sql_clauses['where'][ $field_name ] = $wpdb->prepare( " {$wpdb->posts}.{$field_name} IN (" . implode( ',', $esses ) . ')', $field_value );
  726. }
  727. }
  728. // 'post_status' and 'post_type' are handled separately, due to the specialized behavior of 'any'.
  729. foreach ( array( 'post_status', 'post_type' ) as $field_name ) {
  730. $q_values = array();
  731. if ( ! empty( $this->query_vars[ $field_name ] ) ) {
  732. $q_values = $this->query_vars[ $field_name ];
  733. if ( ! is_array( $q_values ) ) {
  734. $q_values = explode( ',', $q_values );
  735. }
  736. // 'any' will cause the query var to be ignored.
  737. if ( in_array( 'any', $q_values, true ) || empty( $q_values ) ) {
  738. continue;
  739. }
  740. $join_posts_table = true;
  741. $esses = array_fill( 0, count( $q_values ), '%s' );
  742. // phpcs:ignore WordPress.DB.PreparedSQLPlaceholders.UnfinishedPrepare
  743. $this->sql_clauses['where'][ $field_name ] = $wpdb->prepare( " {$wpdb->posts}.{$field_name} IN (" . implode( ',', $esses ) . ')', $q_values );
  744. }
  745. }
  746. // Comment author IDs for an IN clause.
  747. if ( ! empty( $this->query_vars['author__in'] ) ) {
  748. $this->sql_clauses['where']['author__in'] = 'user_id IN ( ' . implode( ',', wp_parse_id_list( $this->query_vars['author__in'] ) ) . ' )';
  749. }
  750. // Comment author IDs for a NOT IN clause.
  751. if ( ! empty( $this->query_vars['author__not_in'] ) ) {
  752. $this->sql_clauses['where']['author__not_in'] = 'user_id NOT IN ( ' . implode( ',', wp_parse_id_list( $this->query_vars['author__not_in'] ) ) . ' )';
  753. }
  754. // Post author IDs for an IN clause.
  755. if ( ! empty( $this->query_vars['post_author__in'] ) ) {
  756. $join_posts_table = true;
  757. $this->sql_clauses['where']['post_author__in'] = 'post_author IN ( ' . implode( ',', wp_parse_id_list( $this->query_vars['post_author__in'] ) ) . ' )';
  758. }
  759. // Post author IDs for a NOT IN clause.
  760. if ( ! empty( $this->query_vars['post_author__not_in'] ) ) {
  761. $join_posts_table = true;
  762. $this->sql_clauses['where']['post_author__not_in'] = 'post_author NOT IN ( ' . implode( ',', wp_parse_id_list( $this->query_vars['post_author__not_in'] ) ) . ' )';
  763. }
  764. $join = '';
  765. $groupby = '';
  766. if ( $join_posts_table ) {
  767. $join .= "JOIN $wpdb->posts ON $wpdb->posts.ID = $wpdb->comments.comment_post_ID";
  768. }
  769. if ( ! empty( $this->meta_query_clauses ) ) {
  770. $join .= $this->meta_query_clauses['join'];
  771. // Strip leading 'AND'.
  772. $this->sql_clauses['where']['meta_query'] = preg_replace( '/^\s*AND\s*/', '', $this->meta_query_clauses['where'] );
  773. if ( ! $this->query_vars['count'] ) {
  774. $groupby = "{$wpdb->comments}.comment_ID";
  775. }
  776. }
  777. if ( ! empty( $this->query_vars['date_query'] ) && is_array( $this->query_vars['date_query'] ) ) {
  778. $this->date_query = new WP_Date_Query( $this->query_vars['date_query'], 'comment_date' );
  779. $this->sql_clauses['where']['date_query'] = preg_replace( '/^\s*AND\s*/', '', $this->date_query->get_sql() );
  780. }
  781. $where = implode( ' AND ', $this->sql_clauses['where'] );
  782. $pieces = array( 'fields', 'join', 'where', 'orderby', 'limits', 'groupby' );
  783. /**
  784. * Filters the comment query clauses.
  785. *
  786. * @since 3.1.0
  787. *
  788. * @param string[] $pieces An associative array of comment query clauses.
  789. * @param WP_Comment_Query $query Current instance of WP_Comment_Query (passed by reference).
  790. */
  791. $clauses = apply_filters_ref_array( 'comments_clauses', array( compact( $pieces ), &$this ) );
  792. $fields = isset( $clauses['fields'] ) ? $clauses['fields'] : '';
  793. $join = isset( $clauses['join'] ) ? $clauses['join'] : '';
  794. $where = isset( $clauses['where'] ) ? $clauses['where'] : '';
  795. $orderby = isset( $clauses['orderby'] ) ? $clauses['orderby'] : '';
  796. $limits = isset( $clauses['limits'] ) ? $clauses['limits'] : '';
  797. $groupby = isset( $clauses['groupby'] ) ? $clauses['groupby'] : '';
  798. $this->filtered_where_clause = $where;
  799. if ( $where ) {
  800. $where = 'WHERE ' . $where;
  801. }
  802. if ( $groupby ) {
  803. $groupby = 'GROUP BY ' . $groupby;
  804. }
  805. if ( $orderby ) {
  806. $orderby = "ORDER BY $orderby";
  807. }
  808. $found_rows = '';
  809. if ( ! $this->query_vars['no_found_rows'] ) {
  810. $found_rows = 'SQL_CALC_FOUND_ROWS';
  811. }
  812. $this->sql_clauses['select'] = "SELECT $found_rows $fields";
  813. $this->sql_clauses['from'] = "FROM $wpdb->comments $join";
  814. $this->sql_clauses['groupby'] = $groupby;
  815. $this->sql_clauses['orderby'] = $orderby;
  816. $this->sql_clauses['limits'] = $limits;
  817. $this->request = "{$this->sql_clauses['select']} {$this->sql_clauses['from']} {$where} {$this->sql_clauses['groupby']} {$this->sql_clauses['orderby']} {$this->sql_clauses['limits']}";
  818. if ( $this->query_vars['count'] ) {
  819. return (int) $wpdb->get_var( $this->request );
  820. } else {
  821. $comment_ids = $wpdb->get_col( $this->request );
  822. return array_map( 'intval', $comment_ids );
  823. }
  824. }
  825. /**
  826. * Populates found_comments and max_num_pages properties for the current
  827. * query if the limit clause was used.
  828. *
  829. * @since 4.6.0
  830. *
  831. * @global wpdb $wpdb WordPress database abstraction object.
  832. */
  833. private function set_found_comments() {
  834. global $wpdb;
  835. if ( $this->query_vars['number'] && ! $this->query_vars['no_found_rows'] ) {
  836. /**
  837. * Filters the query used to retrieve found comment count.
  838. *
  839. * @since 4.4.0
  840. *
  841. * @param string $found_comments_query SQL query. Default 'SELECT FOUND_ROWS()'.
  842. * @param WP_Comment_Query $comment_query The `WP_Comment_Query` instance.
  843. */
  844. $found_comments_query = apply_filters( 'found_comments_query', 'SELECT FOUND_ROWS()', $this );
  845. $this->found_comments = (int) $wpdb->get_var( $found_comments_query );
  846. }
  847. }
  848. /**
  849. * Fetch descendants for located comments.
  850. *
  851. * Instead of calling `get_children()` separately on each child comment, we do a single set of queries to fetch
  852. * the descendant trees for all matched top-level comments.
  853. *
  854. * @since 4.4.0
  855. *
  856. * @global wpdb $wpdb WordPress database abstraction object.
  857. *
  858. * @param WP_Comment[] $comments Array of top-level comments whose descendants should be filled in.
  859. * @return array
  860. */
  861. protected function fill_descendants( $comments ) {
  862. global $wpdb;
  863. $levels = array(
  864. 0 => wp_list_pluck( $comments, 'comment_ID' ),
  865. );
  866. $key = md5( serialize( wp_array_slice_assoc( $this->query_vars, array_keys( $this->query_var_defaults ) ) ) );
  867. $last_changed = wp_cache_get_last_changed( 'comment' );
  868. // Fetch an entire level of the descendant tree at a time.
  869. $level = 0;
  870. $exclude_keys = array( 'parent', 'parent__in', 'parent__not_in' );
  871. do {
  872. // Parent-child relationships may be cached. Only query for those that are not.
  873. $child_ids = array();
  874. $uncached_parent_ids = array();
  875. $_parent_ids = $levels[ $level ];
  876. foreach ( $_parent_ids as $parent_id ) {
  877. $cache_key = "get_comment_child_ids:$parent_id:$key:$last_changed";
  878. $parent_child_ids = wp_cache_get( $cache_key, 'comment' );
  879. if ( false !== $parent_child_ids ) {
  880. $child_ids = array_merge( $child_ids, $parent_child_ids );
  881. } else {
  882. $uncached_parent_ids[] = $parent_id;
  883. }
  884. }
  885. if ( $uncached_parent_ids ) {
  886. // Fetch this level of comments.
  887. $parent_query_args = $this->query_vars;
  888. foreach ( $exclude_keys as $exclude_key ) {
  889. $parent_query_args[ $exclude_key ] = '';
  890. }
  891. $parent_query_args['parent__in'] = $uncached_parent_ids;
  892. $parent_query_args['no_found_rows'] = true;
  893. $parent_query_args['hierarchical'] = false;
  894. $parent_query_args['offset'] = 0;
  895. $parent_query_args['number'] = 0;
  896. $level_comments = get_comments( $parent_query_args );
  897. // Cache parent-child relationships.
  898. $parent_map = array_fill_keys( $uncached_parent_ids, array() );
  899. foreach ( $level_comments as $level_comment ) {
  900. $parent_map[ $level_comment->comment_parent ][] = $level_comment->comment_ID;
  901. $child_ids[] = $level_comment->comment_ID;
  902. }
  903. foreach ( $parent_map as $parent_id => $children ) {
  904. $cache_key = "get_comment_child_ids:$parent_id:$key:$last_changed";
  905. wp_cache_set( $cache_key, $children, 'comment' );
  906. }
  907. }
  908. $level++;
  909. $levels[ $level ] = $child_ids;
  910. } while ( $child_ids );
  911. // Prime comment caches for non-top-level comments.
  912. $descendant_ids = array();
  913. for ( $i = 1, $c = count( $levels ); $i < $c; $i++ ) {
  914. $descendant_ids = array_merge( $descendant_ids, $levels[ $i ] );
  915. }
  916. _prime_comment_caches( $descendant_ids, $this->query_vars['update_comment_meta_cache'] );
  917. // Assemble a flat array of all comments + descendants.
  918. $all_comments = $comments;
  919. foreach ( $descendant_ids as $descendant_id ) {
  920. $all_comments[] = get_comment( $descendant_id );
  921. }
  922. // If a threaded representation was requested, build the tree.
  923. if ( 'threaded' === $this->query_vars['hierarchical'] ) {
  924. $threaded_comments = array();
  925. $ref = array();
  926. foreach ( $all_comments as $k => $c ) {
  927. $_c = get_comment( $c->comment_ID );
  928. // If the comment isn't in the reference array, it goes in the top level of the thread.
  929. if ( ! isset( $ref[ $c->comment_parent ] ) ) {
  930. $threaded_comments[ $_c->comment_ID ] = $_c;
  931. $ref[ $_c->comment_ID ] = $threaded_comments[ $_c->comment_ID ];
  932. // Otherwise, set it as a child of its parent.
  933. } else {
  934. $ref[ $_c->comment_parent ]->add_child( $_c );
  935. $ref[ $_c->comment_ID ] = $ref[ $_c->comment_parent ]->get_child( $_c->comment_ID );
  936. }
  937. }
  938. // Set the 'populated_children' flag, to ensure additional database queries aren't run.
  939. foreach ( $ref as $_ref ) {
  940. $_ref->populated_children( true );
  941. }
  942. $comments = $threaded_comments;
  943. } else {
  944. $comments = $all_comments;
  945. }
  946. return $comments;
  947. }
  948. /**
  949. * Used internally to generate an SQL string for searching across multiple columns
  950. *
  951. * @since 3.1.0
  952. *
  953. * @global wpdb $wpdb WordPress database abstraction object.
  954. *
  955. * @param string $string
  956. * @param array $cols
  957. * @return string
  958. */
  959. protected function get_search_sql( $string, $cols ) {
  960. global $wpdb;
  961. $like = '%' . $wpdb->esc_like( $string ) . '%';
  962. $searches = array();
  963. foreach ( $cols as $col ) {
  964. $searches[] = $wpdb->prepare( "$col LIKE %s", $like );
  965. }
  966. return ' AND (' . implode( ' OR ', $searches ) . ')';
  967. }
  968. /**
  969. * Parse and sanitize 'orderby' keys passed to the comment query.
  970. *
  971. * @since 4.2.0
  972. *
  973. * @global wpdb $wpdb WordPress database abstraction object.
  974. *
  975. * @param string $orderby Alias for the field to order by.
  976. * @return string|false Value to used in the ORDER clause. False otherwise.
  977. */
  978. protected function parse_orderby( $orderby ) {
  979. global $wpdb;
  980. $allowed_keys = array(
  981. 'comment_agent',
  982. 'comment_approved',
  983. 'comment_author',
  984. 'comment_author_email',
  985. 'comment_author_IP',
  986. 'comment_author_url',
  987. 'comment_content',
  988. 'comment_date',
  989. 'comment_date_gmt',
  990. 'comment_ID',
  991. 'comment_karma',
  992. 'comment_parent',
  993. 'comment_post_ID',
  994. 'comment_type',
  995. 'user_id',
  996. );
  997. if ( ! empty( $this->query_vars['meta_key'] ) ) {
  998. $allowed_keys[] = $this->query_vars['meta_key'];
  999. $allowed_keys[] = 'meta_value';
  1000. $allowed_keys[] = 'meta_value_num';
  1001. }
  1002. $meta_query_clauses = $this->meta_query->get_clauses();
  1003. if ( $meta_query_clauses ) {
  1004. $allowed_keys = array_merge( $allowed_keys, array_keys( $meta_query_clauses ) );
  1005. }
  1006. $parsed = false;
  1007. if ( $this->query_vars['meta_key'] === $orderby || 'meta_value' === $orderby ) {
  1008. $parsed = "$wpdb->commentmeta.meta_value";
  1009. } elseif ( 'meta_value_num' === $orderby ) {
  1010. $parsed = "$wpdb->commentmeta.meta_value+0";
  1011. } elseif ( 'comment__in' === $orderby ) {
  1012. $comment__in = implode( ',', array_map( 'absint', $this->query_vars['comment__in'] ) );
  1013. $parsed = "FIELD( {$wpdb->comments}.comment_ID, $comment__in )";
  1014. } elseif ( in_array( $orderby, $allowed_keys, true ) ) {
  1015. if ( isset( $meta_query_clauses[ $orderby ] ) ) {
  1016. $meta_clause = $meta_query_clauses[ $orderby ];
  1017. $parsed = sprintf( 'CAST(%s.meta_value AS %s)', esc_sql( $meta_clause['alias'] ), esc_sql( $meta_clause['cast'] ) );
  1018. } else {
  1019. $parsed = "$wpdb->comments.$orderby";
  1020. }
  1021. }
  1022. return $parsed;
  1023. }
  1024. /**
  1025. * Parse an 'order' query variable and cast it to ASC or DESC as necessary.
  1026. *
  1027. * @since 4.2.0
  1028. *
  1029. * @param string $order The 'order' query variable.
  1030. * @return string The sanitized 'order' query variable.
  1031. */
  1032. protected function parse_order( $order ) {
  1033. if ( ! is_string( $order ) || empty( $order ) ) {
  1034. return 'DESC';
  1035. }
  1036. if ( 'ASC' === strtoupper( $order ) ) {
  1037. return 'ASC';
  1038. } else {
  1039. return 'DESC';
  1040. }
  1041. }
  1042. }