Version Description
Download this release
Release Info
Developer | tareq1988 |
Plugin | WP User Frontend – Membership, Profile, Registration & Post Submission Plugin for WordPress |
Version | 3.5.5 |
Comparing to | |
See all releases |
Code changes from version 3.5.4 to 3.5.5
- changelog.txt +3 -0
- languages/wp-user-frontend.pot +77 -77
- readme.txt +4 -1
- wpuf-functions.php +416 -717
- wpuf.php +2 -2
changelog.txt
CHANGED
@@ -1,3 +1,6 @@
|
|
|
|
|
|
|
|
1 |
= v3.5.4 (11 November, 2020) =
|
2 |
* Fix - Get appropriate user id when role based conditions are present
|
3 |
* Fix - Show Invalid subscription message if wrong pack id passed
|
1 |
+
= v3.5.5 (12 November, 2020) =
|
2 |
+
* Fix - Dashboard page broken and couldn't render [wpuf_account], [wpuf_sub_pack], [wpuf_dashboard] shortcodes
|
3 |
+
|
4 |
= v3.5.4 (11 November, 2020) =
|
5 |
* Fix - Get appropriate user id when role based conditions are present
|
6 |
* Fix - Show Invalid subscription message if wrong pack id passed
|
languages/wp-user-frontend.pot
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
# This file is distributed under the GPL2 or later.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: WP User Frontend 3.5.
|
6 |
"Report-Msgid-Bugs-To: https://wedevs.com/contact/\n"
|
7 |
-
"POT-Creation-Date: 2020-11-
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
@@ -364,7 +364,7 @@ msgstr ""
|
|
364 |
|
365 |
#: admin/class-tools.php:43 admin/class-tools.php:106
|
366 |
#: admin/post-forms-list-table.php:43 class/transactions-list-table.php:87
|
367 |
-
#: includes/class-list-table-subscribers.php:136 wpuf-functions.php:
|
368 |
msgid "All"
|
369 |
msgstr ""
|
370 |
|
@@ -2603,7 +2603,7 @@ msgid "Congratulations!"
|
|
2603 |
msgstr ""
|
2604 |
|
2605 |
#: admin/installer.php:84 admin/settings-options.php:24
|
2606 |
-
#: includes/free/admin/shortcode-button.php:79 wpuf-functions.php:
|
2607 |
msgid "Dashboard"
|
2608 |
msgstr ""
|
2609 |
|
@@ -2619,7 +2619,7 @@ msgstr ""
|
|
2619 |
#: admin/installer.php:95 class/subscription.php:381 class/subscription.php:401
|
2620 |
#: class/subscription.php:402 class/subscription.php:403
|
2621 |
#: includes/free/admin/shortcode-button.php:99
|
2622 |
-
#: templates/dashboard/dashboard.php:19 wpuf-functions.php:
|
2623 |
msgid "Subscription"
|
2624 |
msgstr ""
|
2625 |
|
@@ -3835,7 +3835,7 @@ msgstr ""
|
|
3835 |
#: class/upload.php:264 includes/fields/class-field-recaptcha.php:147
|
3836 |
#: includes/fields/class-field-sectionbreak.php:55
|
3837 |
#: templates/dashboard/posts.php:89 templates/dashboard.php:104
|
3838 |
-
#: wpuf-functions.php:
|
3839 |
msgid "Title"
|
3840 |
msgstr ""
|
3841 |
|
@@ -3852,7 +3852,7 @@ msgid "Enter the meta value"
|
|
3852 |
msgstr ""
|
3853 |
|
3854 |
#: admin/template.php:583 class/upload.php:266
|
3855 |
-
#: includes/fields/class-field-sectionbreak.php:63 wpuf-functions.php:
|
3856 |
msgid "Description"
|
3857 |
msgstr ""
|
3858 |
|
@@ -4039,7 +4039,7 @@ msgid "You already have activated a free package previously."
|
|
4039 |
msgstr ""
|
4040 |
|
4041 |
#: class/payment.php:146 includes/class-customizer.php:56
|
4042 |
-
#: wpuf-functions.php:
|
4043 |
msgid "Billing Address"
|
4044 |
msgstr ""
|
4045 |
|
@@ -4221,7 +4221,7 @@ msgid "Strength indicator"
|
|
4221 |
msgstr ""
|
4222 |
|
4223 |
#: class/render-form.php:1401 includes/fields/class-field-post-taxonomy.php:127
|
4224 |
-
#: wpuf-functions.php:
|
4225 |
msgid "-- Select --"
|
4226 |
msgstr ""
|
4227 |
|
@@ -4435,7 +4435,7 @@ msgstr ""
|
|
4435 |
msgid "No transactions found."
|
4436 |
msgstr ""
|
4437 |
|
4438 |
-
#: class/upload.php:265 wpuf-functions.php:
|
4439 |
msgid "Caption"
|
4440 |
msgstr ""
|
4441 |
|
@@ -4572,7 +4572,7 @@ msgstr ""
|
|
4572 |
|
4573 |
#: includes/class-dokan-integration.php:34
|
4574 |
#: includes/class-wc-vendors-integration.php:108
|
4575 |
-
#: templates/dashboard/dashboard.php:15 wpuf-functions.php:
|
4576 |
msgid "Posts"
|
4577 |
msgstr ""
|
4578 |
|
@@ -6556,263 +6556,263 @@ msgstr ""
|
|
6556 |
msgid "Private"
|
6557 |
msgstr ""
|
6558 |
|
6559 |
-
#: wpuf-functions.php:210 wpuf-functions.php:
|
6560 |
msgid "-- select --"
|
6561 |
msgstr ""
|
6562 |
|
6563 |
-
#: wpuf-functions.php:
|
6564 |
msgid "Images"
|
6565 |
msgstr ""
|
6566 |
|
6567 |
-
#: wpuf-functions.php:
|
6568 |
msgid "Audio"
|
6569 |
msgstr ""
|
6570 |
|
6571 |
-
#: wpuf-functions.php:
|
6572 |
msgid "Videos"
|
6573 |
msgstr ""
|
6574 |
|
6575 |
-
#: wpuf-functions.php:
|
6576 |
msgid "PDF"
|
6577 |
msgstr ""
|
6578 |
|
6579 |
-
#: wpuf-functions.php:
|
6580 |
msgid "Office Documents"
|
6581 |
msgstr ""
|
6582 |
|
6583 |
-
#: wpuf-functions.php:
|
6584 |
msgid "Zip Archives"
|
6585 |
msgstr ""
|
6586 |
|
6587 |
-
#: wpuf-functions.php:
|
6588 |
msgid "Executable Files"
|
6589 |
msgstr ""
|
6590 |
|
6591 |
-
#: wpuf-functions.php:
|
6592 |
msgid "CSV"
|
6593 |
msgstr ""
|
6594 |
|
6595 |
-
#: wpuf-functions.php:
|
6596 |
msgid "Directions »"
|
6597 |
msgstr ""
|
6598 |
|
6599 |
-
#: wpuf-functions.php:
|
6600 |
msgid "Edit Profile"
|
6601 |
msgstr ""
|
6602 |
|
6603 |
-
#: wpuf-functions.php:
|
6604 |
msgid "United Arab Emirates Dirham"
|
6605 |
msgstr ""
|
6606 |
|
6607 |
-
#: wpuf-functions.php:
|
6608 |
msgid "Australian Dollars"
|
6609 |
msgstr ""
|
6610 |
|
6611 |
-
#: wpuf-functions.php:
|
6612 |
msgid "Argentine Peso"
|
6613 |
msgstr ""
|
6614 |
|
6615 |
-
#: wpuf-functions.php:
|
6616 |
msgid "Bangladeshi Taka"
|
6617 |
msgstr ""
|
6618 |
|
6619 |
-
#: wpuf-functions.php:
|
6620 |
msgid "Brazilian Real"
|
6621 |
msgstr ""
|
6622 |
|
6623 |
-
#: wpuf-functions.php:
|
6624 |
msgid "Bulgarian Lev"
|
6625 |
msgstr ""
|
6626 |
|
6627 |
-
#: wpuf-functions.php:
|
6628 |
msgid "Canadian Dollars"
|
6629 |
msgstr ""
|
6630 |
|
6631 |
-
#: wpuf-functions.php:
|
6632 |
msgid "Chilean Peso"
|
6633 |
msgstr ""
|
6634 |
|
6635 |
-
#: wpuf-functions.php:
|
6636 |
msgid "Chinese Yuan"
|
6637 |
msgstr ""
|
6638 |
|
6639 |
-
#: wpuf-functions.php:
|
6640 |
msgid "Colombian Peso"
|
6641 |
msgstr ""
|
6642 |
|
6643 |
-
#: wpuf-functions.php:
|
6644 |
msgid "Czech Koruna"
|
6645 |
msgstr ""
|
6646 |
|
6647 |
-
#: wpuf-functions.php:
|
6648 |
msgid "Danish Krone"
|
6649 |
msgstr ""
|
6650 |
|
6651 |
-
#: wpuf-functions.php:
|
6652 |
msgid "Dominican Peso"
|
6653 |
msgstr ""
|
6654 |
|
6655 |
-
#: wpuf-functions.php:
|
6656 |
msgid "Algerian Dinar"
|
6657 |
msgstr ""
|
6658 |
|
6659 |
-
#: wpuf-functions.php:
|
6660 |
msgid "Euros"
|
6661 |
msgstr ""
|
6662 |
|
6663 |
-
#: wpuf-functions.php:
|
6664 |
msgid "Hong Kong Dollar"
|
6665 |
msgstr ""
|
6666 |
|
6667 |
-
#: wpuf-functions.php:
|
6668 |
msgid "Croatia kuna"
|
6669 |
msgstr ""
|
6670 |
|
6671 |
-
#: wpuf-functions.php:
|
6672 |
msgid "Hungarian Forint"
|
6673 |
msgstr ""
|
6674 |
|
6675 |
-
#: wpuf-functions.php:
|
6676 |
msgid "Icelandic krona"
|
6677 |
msgstr ""
|
6678 |
|
6679 |
-
#: wpuf-functions.php:
|
6680 |
msgid "Indonesia Rupiah"
|
6681 |
msgstr ""
|
6682 |
|
6683 |
-
#: wpuf-functions.php:
|
6684 |
msgid "Indian Rupee"
|
6685 |
msgstr ""
|
6686 |
|
6687 |
-
#: wpuf-functions.php:
|
6688 |
msgid "Nepali Rupee"
|
6689 |
msgstr ""
|
6690 |
|
6691 |
-
#: wpuf-functions.php:
|
6692 |
msgid "Israeli Shekel"
|
6693 |
msgstr ""
|
6694 |
|
6695 |
-
#: wpuf-functions.php:
|
6696 |
msgid "Japanese Yen"
|
6697 |
msgstr ""
|
6698 |
|
6699 |
-
#: wpuf-functions.php:
|
6700 |
msgid "Lao Kip"
|
6701 |
msgstr ""
|
6702 |
|
6703 |
-
#: wpuf-functions.php:
|
6704 |
msgid "South Korean Won"
|
6705 |
msgstr ""
|
6706 |
|
6707 |
-
#: wpuf-functions.php:
|
6708 |
msgid "Malaysian Ringgits"
|
6709 |
msgstr ""
|
6710 |
|
6711 |
-
#: wpuf-functions.php:
|
6712 |
msgid "Mexican Peso"
|
6713 |
msgstr ""
|
6714 |
|
6715 |
-
#: wpuf-functions.php:
|
6716 |
msgid "Nigerian Naira"
|
6717 |
msgstr ""
|
6718 |
|
6719 |
-
#: wpuf-functions.php:
|
6720 |
msgid "Norwegian Krone"
|
6721 |
msgstr ""
|
6722 |
|
6723 |
-
#: wpuf-functions.php:
|
6724 |
msgid "New Zealand Dollar"
|
6725 |
msgstr ""
|
6726 |
|
6727 |
-
#: wpuf-functions.php:
|
6728 |
msgid "Namibian dollar"
|
6729 |
msgstr ""
|
6730 |
|
6731 |
-
#: wpuf-functions.php:
|
6732 |
msgid "Omani Rial"
|
6733 |
msgstr ""
|
6734 |
|
6735 |
-
#: wpuf-functions.php:
|
6736 |
msgid "Iranian Rial"
|
6737 |
msgstr ""
|
6738 |
|
6739 |
-
#: wpuf-functions.php:
|
6740 |
msgid "Pakistani Rupee"
|
6741 |
msgstr ""
|
6742 |
|
6743 |
-
#: wpuf-functions.php:
|
6744 |
msgid "Paraguayan Guaraní"
|
6745 |
msgstr ""
|
6746 |
|
6747 |
-
#: wpuf-functions.php:
|
6748 |
msgid "Philippine Pesos"
|
6749 |
msgstr ""
|
6750 |
|
6751 |
-
#: wpuf-functions.php:
|
6752 |
msgid "Polish Zloty"
|
6753 |
msgstr ""
|
6754 |
|
6755 |
-
#: wpuf-functions.php:
|
6756 |
msgid "Pounds Sterling"
|
6757 |
msgstr ""
|
6758 |
|
6759 |
-
#: wpuf-functions.php:
|
6760 |
msgid "Romanian Leu"
|
6761 |
msgstr ""
|
6762 |
|
6763 |
-
#: wpuf-functions.php:
|
6764 |
msgid "Russian Ruble"
|
6765 |
msgstr ""
|
6766 |
|
6767 |
-
#: wpuf-functions.php:
|
6768 |
msgid "Saudi Riyal"
|
6769 |
msgstr ""
|
6770 |
|
6771 |
-
#: wpuf-functions.php:
|
6772 |
msgid "Singapore Dollar"
|
6773 |
msgstr ""
|
6774 |
|
6775 |
-
#: wpuf-functions.php:
|
6776 |
msgid "South African rand"
|
6777 |
msgstr ""
|
6778 |
|
6779 |
-
#: wpuf-functions.php:
|
6780 |
msgid "Swedish Krona"
|
6781 |
msgstr ""
|
6782 |
|
6783 |
-
#: wpuf-functions.php:
|
6784 |
msgid "Swiss Franc"
|
6785 |
msgstr ""
|
6786 |
|
6787 |
-
#: wpuf-functions.php:
|
6788 |
msgid "Taiwan New Dollars"
|
6789 |
msgstr ""
|
6790 |
|
6791 |
-
#: wpuf-functions.php:
|
6792 |
msgid "Thai Baht"
|
6793 |
msgstr ""
|
6794 |
|
6795 |
-
#: wpuf-functions.php:
|
6796 |
msgid "Turkish Lira"
|
6797 |
msgstr ""
|
6798 |
|
6799 |
-
#: wpuf-functions.php:
|
6800 |
msgid "US Dollar"
|
6801 |
msgstr ""
|
6802 |
|
6803 |
-
#: wpuf-functions.php:
|
6804 |
msgid "Vietnamese Dong"
|
6805 |
msgstr ""
|
6806 |
|
6807 |
-
#: wpuf-functions.php:
|
6808 |
msgid "Egyptian Pound"
|
6809 |
msgstr ""
|
6810 |
|
6811 |
-
#: wpuf-functions.php:
|
6812 |
msgid "Jordanian dinar"
|
6813 |
msgstr ""
|
6814 |
|
6815 |
-
#: wpuf-functions.php:
|
6816 |
msgid "None"
|
6817 |
msgstr ""
|
6818 |
|
@@ -6939,7 +6939,7 @@ msgctxt "enhanced select"
|
|
6939 |
msgid "Searching…"
|
6940 |
msgstr ""
|
6941 |
|
6942 |
-
#: wpuf-functions.php:
|
6943 |
msgctxt "tag delimiter"
|
6944 |
msgid ","
|
6945 |
msgstr ""
|
2 |
# This file is distributed under the GPL2 or later.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: WP User Frontend 3.5.5\n"
|
6 |
"Report-Msgid-Bugs-To: https://wedevs.com/contact/\n"
|
7 |
+
"POT-Creation-Date: 2020-11-12 02:59:28+00:00\n"
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
364 |
|
365 |
#: admin/class-tools.php:43 admin/class-tools.php:106
|
366 |
#: admin/post-forms-list-table.php:43 class/transactions-list-table.php:87
|
367 |
+
#: includes/class-list-table-subscribers.php:136 wpuf-functions.php:3016
|
368 |
msgid "All"
|
369 |
msgstr ""
|
370 |
|
2603 |
msgstr ""
|
2604 |
|
2605 |
#: admin/installer.php:84 admin/settings-options.php:24
|
2606 |
+
#: includes/free/admin/shortcode-button.php:79 wpuf-functions.php:1961
|
2607 |
msgid "Dashboard"
|
2608 |
msgstr ""
|
2609 |
|
2619 |
#: admin/installer.php:95 class/subscription.php:381 class/subscription.php:401
|
2620 |
#: class/subscription.php:402 class/subscription.php:403
|
2621 |
#: includes/free/admin/shortcode-button.php:99
|
2622 |
+
#: templates/dashboard/dashboard.php:19 wpuf-functions.php:1964
|
2623 |
msgid "Subscription"
|
2624 |
msgstr ""
|
2625 |
|
3835 |
#: class/upload.php:264 includes/fields/class-field-recaptcha.php:147
|
3836 |
#: includes/fields/class-field-sectionbreak.php:55
|
3837 |
#: templates/dashboard/posts.php:89 templates/dashboard.php:104
|
3838 |
+
#: wpuf-functions.php:986
|
3839 |
msgid "Title"
|
3840 |
msgstr ""
|
3841 |
|
3852 |
msgstr ""
|
3853 |
|
3854 |
#: admin/template.php:583 class/upload.php:266
|
3855 |
+
#: includes/fields/class-field-sectionbreak.php:63 wpuf-functions.php:994
|
3856 |
msgid "Description"
|
3857 |
msgstr ""
|
3858 |
|
4039 |
msgstr ""
|
4040 |
|
4041 |
#: class/payment.php:146 includes/class-customizer.php:56
|
4042 |
+
#: wpuf-functions.php:1965
|
4043 |
msgid "Billing Address"
|
4044 |
msgstr ""
|
4045 |
|
4221 |
msgstr ""
|
4222 |
|
4223 |
#: class/render-form.php:1401 includes/fields/class-field-post-taxonomy.php:127
|
4224 |
+
#: wpuf-functions.php:1749
|
4225 |
msgid "-- Select --"
|
4226 |
msgstr ""
|
4227 |
|
4435 |
msgid "No transactions found."
|
4436 |
msgstr ""
|
4437 |
|
4438 |
+
#: class/upload.php:265 wpuf-functions.php:990
|
4439 |
msgid "Caption"
|
4440 |
msgstr ""
|
4441 |
|
4572 |
|
4573 |
#: includes/class-dokan-integration.php:34
|
4574 |
#: includes/class-wc-vendors-integration.php:108
|
4575 |
+
#: templates/dashboard/dashboard.php:15 wpuf-functions.php:1962
|
4576 |
msgid "Posts"
|
4577 |
msgstr ""
|
4578 |
|
6556 |
msgid "Private"
|
6557 |
msgstr ""
|
6558 |
|
6559 |
+
#: wpuf-functions.php:210 wpuf-functions.php:1980
|
6560 |
msgid "-- select --"
|
6561 |
msgstr ""
|
6562 |
|
6563 |
+
#: wpuf-functions.php:495
|
6564 |
msgid "Images"
|
6565 |
msgstr ""
|
6566 |
|
6567 |
+
#: wpuf-functions.php:496
|
6568 |
msgid "Audio"
|
6569 |
msgstr ""
|
6570 |
|
6571 |
+
#: wpuf-functions.php:497
|
6572 |
msgid "Videos"
|
6573 |
msgstr ""
|
6574 |
|
6575 |
+
#: wpuf-functions.php:498
|
6576 |
msgid "PDF"
|
6577 |
msgstr ""
|
6578 |
|
6579 |
+
#: wpuf-functions.php:499
|
6580 |
msgid "Office Documents"
|
6581 |
msgstr ""
|
6582 |
|
6583 |
+
#: wpuf-functions.php:500
|
6584 |
msgid "Zip Archives"
|
6585 |
msgstr ""
|
6586 |
|
6587 |
+
#: wpuf-functions.php:501
|
6588 |
msgid "Executable Files"
|
6589 |
msgstr ""
|
6590 |
|
6591 |
+
#: wpuf-functions.php:502
|
6592 |
msgid "CSV"
|
6593 |
msgstr ""
|
6594 |
|
6595 |
+
#: wpuf-functions.php:1013
|
6596 |
msgid "Directions »"
|
6597 |
msgstr ""
|
6598 |
|
6599 |
+
#: wpuf-functions.php:1963
|
6600 |
msgid "Edit Profile"
|
6601 |
msgstr ""
|
6602 |
|
6603 |
+
#: wpuf-functions.php:2092
|
6604 |
msgid "United Arab Emirates Dirham"
|
6605 |
msgstr ""
|
6606 |
|
6607 |
+
#: wpuf-functions.php:2093
|
6608 |
msgid "Australian Dollars"
|
6609 |
msgstr ""
|
6610 |
|
6611 |
+
#: wpuf-functions.php:2094
|
6612 |
msgid "Argentine Peso"
|
6613 |
msgstr ""
|
6614 |
|
6615 |
+
#: wpuf-functions.php:2095
|
6616 |
msgid "Bangladeshi Taka"
|
6617 |
msgstr ""
|
6618 |
|
6619 |
+
#: wpuf-functions.php:2096
|
6620 |
msgid "Brazilian Real"
|
6621 |
msgstr ""
|
6622 |
|
6623 |
+
#: wpuf-functions.php:2097
|
6624 |
msgid "Bulgarian Lev"
|
6625 |
msgstr ""
|
6626 |
|
6627 |
+
#: wpuf-functions.php:2098
|
6628 |
msgid "Canadian Dollars"
|
6629 |
msgstr ""
|
6630 |
|
6631 |
+
#: wpuf-functions.php:2099
|
6632 |
msgid "Chilean Peso"
|
6633 |
msgstr ""
|
6634 |
|
6635 |
+
#: wpuf-functions.php:2100
|
6636 |
msgid "Chinese Yuan"
|
6637 |
msgstr ""
|
6638 |
|
6639 |
+
#: wpuf-functions.php:2101
|
6640 |
msgid "Colombian Peso"
|
6641 |
msgstr ""
|
6642 |
|
6643 |
+
#: wpuf-functions.php:2102
|
6644 |
msgid "Czech Koruna"
|
6645 |
msgstr ""
|
6646 |
|
6647 |
+
#: wpuf-functions.php:2103
|
6648 |
msgid "Danish Krone"
|
6649 |
msgstr ""
|
6650 |
|
6651 |
+
#: wpuf-functions.php:2104
|
6652 |
msgid "Dominican Peso"
|
6653 |
msgstr ""
|
6654 |
|
6655 |
+
#: wpuf-functions.php:2105
|
6656 |
msgid "Algerian Dinar"
|
6657 |
msgstr ""
|
6658 |
|
6659 |
+
#: wpuf-functions.php:2106
|
6660 |
msgid "Euros"
|
6661 |
msgstr ""
|
6662 |
|
6663 |
+
#: wpuf-functions.php:2107
|
6664 |
msgid "Hong Kong Dollar"
|
6665 |
msgstr ""
|
6666 |
|
6667 |
+
#: wpuf-functions.php:2108
|
6668 |
msgid "Croatia kuna"
|
6669 |
msgstr ""
|
6670 |
|
6671 |
+
#: wpuf-functions.php:2109
|
6672 |
msgid "Hungarian Forint"
|
6673 |
msgstr ""
|
6674 |
|
6675 |
+
#: wpuf-functions.php:2110
|
6676 |
msgid "Icelandic krona"
|
6677 |
msgstr ""
|
6678 |
|
6679 |
+
#: wpuf-functions.php:2111
|
6680 |
msgid "Indonesia Rupiah"
|
6681 |
msgstr ""
|
6682 |
|
6683 |
+
#: wpuf-functions.php:2112
|
6684 |
msgid "Indian Rupee"
|
6685 |
msgstr ""
|
6686 |
|
6687 |
+
#: wpuf-functions.php:2113
|
6688 |
msgid "Nepali Rupee"
|
6689 |
msgstr ""
|
6690 |
|
6691 |
+
#: wpuf-functions.php:2114
|
6692 |
msgid "Israeli Shekel"
|
6693 |
msgstr ""
|
6694 |
|
6695 |
+
#: wpuf-functions.php:2115
|
6696 |
msgid "Japanese Yen"
|
6697 |
msgstr ""
|
6698 |
|
6699 |
+
#: wpuf-functions.php:2116
|
6700 |
msgid "Lao Kip"
|
6701 |
msgstr ""
|
6702 |
|
6703 |
+
#: wpuf-functions.php:2117
|
6704 |
msgid "South Korean Won"
|
6705 |
msgstr ""
|
6706 |
|
6707 |
+
#: wpuf-functions.php:2118
|
6708 |
msgid "Malaysian Ringgits"
|
6709 |
msgstr ""
|
6710 |
|
6711 |
+
#: wpuf-functions.php:2119
|
6712 |
msgid "Mexican Peso"
|
6713 |
msgstr ""
|
6714 |
|
6715 |
+
#: wpuf-functions.php:2120
|
6716 |
msgid "Nigerian Naira"
|
6717 |
msgstr ""
|
6718 |
|
6719 |
+
#: wpuf-functions.php:2121
|
6720 |
msgid "Norwegian Krone"
|
6721 |
msgstr ""
|
6722 |
|
6723 |
+
#: wpuf-functions.php:2122
|
6724 |
msgid "New Zealand Dollar"
|
6725 |
msgstr ""
|
6726 |
|
6727 |
+
#: wpuf-functions.php:2123
|
6728 |
msgid "Namibian dollar"
|
6729 |
msgstr ""
|
6730 |
|
6731 |
+
#: wpuf-functions.php:2124
|
6732 |
msgid "Omani Rial"
|
6733 |
msgstr ""
|
6734 |
|
6735 |
+
#: wpuf-functions.php:2125
|
6736 |
msgid "Iranian Rial"
|
6737 |
msgstr ""
|
6738 |
|
6739 |
+
#: wpuf-functions.php:2126
|
6740 |
msgid "Pakistani Rupee"
|
6741 |
msgstr ""
|
6742 |
|
6743 |
+
#: wpuf-functions.php:2127
|
6744 |
msgid "Paraguayan Guaraní"
|
6745 |
msgstr ""
|
6746 |
|
6747 |
+
#: wpuf-functions.php:2128
|
6748 |
msgid "Philippine Pesos"
|
6749 |
msgstr ""
|
6750 |
|
6751 |
+
#: wpuf-functions.php:2129
|
6752 |
msgid "Polish Zloty"
|
6753 |
msgstr ""
|
6754 |
|
6755 |
+
#: wpuf-functions.php:2130
|
6756 |
msgid "Pounds Sterling"
|
6757 |
msgstr ""
|
6758 |
|
6759 |
+
#: wpuf-functions.php:2131
|
6760 |
msgid "Romanian Leu"
|
6761 |
msgstr ""
|
6762 |
|
6763 |
+
#: wpuf-functions.php:2132
|
6764 |
msgid "Russian Ruble"
|
6765 |
msgstr ""
|
6766 |
|
6767 |
+
#: wpuf-functions.php:2133
|
6768 |
msgid "Saudi Riyal"
|
6769 |
msgstr ""
|
6770 |
|
6771 |
+
#: wpuf-functions.php:2134
|
6772 |
msgid "Singapore Dollar"
|
6773 |
msgstr ""
|
6774 |
|
6775 |
+
#: wpuf-functions.php:2135
|
6776 |
msgid "South African rand"
|
6777 |
msgstr ""
|
6778 |
|
6779 |
+
#: wpuf-functions.php:2136
|
6780 |
msgid "Swedish Krona"
|
6781 |
msgstr ""
|
6782 |
|
6783 |
+
#: wpuf-functions.php:2137
|
6784 |
msgid "Swiss Franc"
|
6785 |
msgstr ""
|
6786 |
|
6787 |
+
#: wpuf-functions.php:2138
|
6788 |
msgid "Taiwan New Dollars"
|
6789 |
msgstr ""
|
6790 |
|
6791 |
+
#: wpuf-functions.php:2139
|
6792 |
msgid "Thai Baht"
|
6793 |
msgstr ""
|
6794 |
|
6795 |
+
#: wpuf-functions.php:2140
|
6796 |
msgid "Turkish Lira"
|
6797 |
msgstr ""
|
6798 |
|
6799 |
+
#: wpuf-functions.php:2141
|
6800 |
msgid "US Dollar"
|
6801 |
msgstr ""
|
6802 |
|
6803 |
+
#: wpuf-functions.php:2142
|
6804 |
msgid "Vietnamese Dong"
|
6805 |
msgstr ""
|
6806 |
|
6807 |
+
#: wpuf-functions.php:2143
|
6808 |
msgid "Egyptian Pound"
|
6809 |
msgstr ""
|
6810 |
|
6811 |
+
#: wpuf-functions.php:2144
|
6812 |
msgid "Jordanian dinar"
|
6813 |
msgstr ""
|
6814 |
|
6815 |
+
#: wpuf-functions.php:3017
|
6816 |
msgid "None"
|
6817 |
msgstr ""
|
6818 |
|
6939 |
msgid "Searching…"
|
6940 |
msgstr ""
|
6941 |
|
6942 |
+
#: wpuf-functions.php:1460
|
6943 |
msgctxt "tag delimiter"
|
6944 |
msgid ","
|
6945 |
msgstr ""
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: Forms, registration, profile-builder, login, membership, frontend-post
|
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 5.5.3
|
7 |
Requires PHP: 5.6
|
8 |
-
Stable tag: 3.5.
|
9 |
License: GPLv2
|
10 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -263,6 +263,9 @@ redirected to the edit page with that post id. Then you'll see the edit post for
|
|
263 |
|
264 |
== Changelog ==
|
265 |
|
|
|
|
|
|
|
266 |
= v3.5.4 (11 November, 2020) =
|
267 |
* Fix - Get appropriate user id when role based conditions are present
|
268 |
* Fix - Show Invalid subscription message if wrong pack id passed
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 5.5.3
|
7 |
Requires PHP: 5.6
|
8 |
+
Stable tag: 3.5.5
|
9 |
License: GPLv2
|
10 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
263 |
|
264 |
== Changelog ==
|
265 |
|
266 |
+
= v3.5.5 (12 November, 2020) =
|
267 |
+
* Fix - Dashboard page broken and couldn't render [wpuf_account], [wpuf_sub_pack], [wpuf_dashboard] shortcodes
|
268 |
+
|
269 |
= v3.5.4 (11 November, 2020) =
|
270 |
* Fix - Get appropriate user id when role based conditions are present
|
271 |
* Fix - Show Invalid subscription message if wrong pack id passed
|
wpuf-functions.php
CHANGED
@@ -23,19 +23,19 @@ add_action( 'init', 'wpuf_buffer_start' );
|
|
23 |
* @author Tareq Hasan
|
24 |
*/
|
25 |
function wpuf_show_post_status( $status ) {
|
26 |
-
if ( 'publish'
|
27 |
$title = __( 'Live', 'wp-user-frontend' );
|
28 |
$fontcolor = '#33CC33';
|
29 |
-
} elseif ( 'draft'
|
30 |
$title = __( 'Offline', 'wp-user-frontend' );
|
31 |
$fontcolor = '#bbbbbb';
|
32 |
-
} elseif ( 'pending'
|
33 |
$title = __( 'Awaiting Approval', 'wp-user-frontend' );
|
34 |
$fontcolor = '#C00202';
|
35 |
-
} elseif ( 'future'
|
36 |
$title = __( 'Scheduled', 'wp-user-frontend' );
|
37 |
$fontcolor = '#bbbbbb';
|
38 |
-
} elseif ( 'private'
|
39 |
$title = __( 'Private', 'wp-user-frontend' );
|
40 |
$fontcolor = '#bbbbbb';
|
41 |
}
|
@@ -54,16 +54,16 @@ function wpuf_show_post_status( $status ) {
|
|
54 |
* @author Tareq Hasan
|
55 |
*/
|
56 |
function wpuf_admin_post_status( $status ) {
|
57 |
-
if ( 'publish'
|
58 |
$title = __( 'Published', 'wp-user-frontend' );
|
59 |
$fontcolor = '#009200';
|
60 |
-
} elseif ( 'draft'
|
61 |
$title = __( 'Draft', 'wp-user-frontend' );
|
62 |
$fontcolor = '#bbbbbb';
|
63 |
-
} elseif ( 'pending'
|
64 |
$title = __( 'Pending', 'wp-user-frontend' );
|
65 |
$fontcolor = '#C00202';
|
66 |
-
} elseif ( 'future'
|
67 |
$title = __( 'Scheduled', 'wp-user-frontend' );
|
68 |
$fontcolor = '#bbbbbb';
|
69 |
}
|
@@ -77,25 +77,27 @@ function wpuf_admin_post_status( $status ) {
|
|
77 |
* @param <type> $post_id
|
78 |
*/
|
79 |
function wpuf_upload_attachment( $post_id ) {
|
80 |
-
if ( !
|
81 |
return false;
|
82 |
}
|
83 |
|
|
|
|
|
84 |
$fields = (int) wpuf_get_option( 'attachment_num' );
|
85 |
|
86 |
$wpuf_post_attachments = isset( $_FILES['wpuf_post_attachments'] ) ? array_map( 'sanitize_text_field', wp_unslash( $_FILES['wpuf_post_attachments'] ) ) : [];
|
87 |
|
88 |
for ( $i = 0; $i < $fields; $i++ ) {
|
89 |
-
$file_name = basename( $wpuf_post_attachments['name'][
|
90 |
|
91 |
if ( $file_name ) {
|
92 |
if ( $file_name ) {
|
93 |
$upload = [
|
94 |
-
'name' => $wpuf_post_attachments['name'][
|
95 |
-
'type' => $wpuf_post_attachments['type'][
|
96 |
-
'tmp_name' => $wpuf_post_attachments['tmp_name'][
|
97 |
-
'error' => $wpuf_post_attachments['error'][
|
98 |
-
'size' => $wpuf_post_attachments['size'][
|
99 |
];
|
100 |
|
101 |
wp_handle_upload( $upload );
|
@@ -143,7 +145,7 @@ function wpfu_get_attachments( $post_id ) {
|
|
143 |
* @author Tareq Hasan
|
144 |
*/
|
145 |
function wpuf_unset_media_tab( $list ) {
|
146 |
-
if ( !
|
147 |
unset( $list['library'] );
|
148 |
unset( $list['gallery'] );
|
149 |
}
|
@@ -166,14 +168,12 @@ function wpuf_get_post_types( $args = [] ) {
|
|
166 |
$post_types = get_post_types( $args );
|
167 |
|
168 |
$ignore_post_types = [
|
169 |
-
'attachment',
|
170 |
-
'revision',
|
171 |
-
'nav_menu_item',
|
172 |
];
|
173 |
|
174 |
foreach ( $post_types as $key => $val ) {
|
175 |
-
if ( in_array( $val, $ignore_post_types
|
176 |
-
unset( $post_types[
|
177 |
}
|
178 |
}
|
179 |
|
@@ -194,7 +194,7 @@ function wpuf_list_users() {
|
|
194 |
|
195 |
if ( $users ) {
|
196 |
foreach ( $users as $user ) {
|
197 |
-
$list[
|
198 |
}
|
199 |
}
|
200 |
|
@@ -208,15 +208,12 @@ function wpuf_list_users() {
|
|
208 |
*/
|
209 |
function wpuf_get_pages( $post_type = 'page' ) {
|
210 |
$array = [ '' => __( '-- select --', 'wp-user-frontend' ) ];
|
211 |
-
$pages = get_posts(
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
'update_post_term_cache' => false,
|
218 |
-
]
|
219 |
-
);
|
220 |
|
221 |
if ( $pages ) {
|
222 |
foreach ( $pages as $page ) {
|
@@ -244,10 +241,10 @@ function wpuf_override_admin_edit_link( $url, $post_id ) {
|
|
244 |
|
245 |
$override = wpuf_get_option( 'override_editlink', 'wpuf_general', 'no' );
|
246 |
|
247 |
-
if ( $override
|
248 |
$url = '';
|
249 |
|
250 |
-
if (
|
251 |
$edit_page = (int) wpuf_get_option( 'edit_page_id', 'wpuf_frontend_posting' );
|
252 |
$url = get_permalink( $edit_page );
|
253 |
|
@@ -281,10 +278,7 @@ class WPUF_Walker_Category_Multi extends Walker {
|
|
281 |
*
|
282 |
* @var array
|
283 |
*/
|
284 |
-
public $db_fields = [
|
285 |
-
'parent' => 'parent',
|
286 |
-
'id' => 'term_id',
|
287 |
-
];
|
288 |
|
289 |
/**
|
290 |
* @see Walker::start_el()
|
@@ -300,7 +294,7 @@ class WPUF_Walker_Category_Multi extends Walker {
|
|
300 |
$cat_name = apply_filters( 'list_cats', $category->name, $category );
|
301 |
$output .= "\t<option class=\"level-$depth\" value=\"" . $category->term_id . '"';
|
302 |
|
303 |
-
if ( in_array( $category->term_id, $args['selected']
|
304 |
$output .= ' selected="selected"';
|
305 |
}
|
306 |
|
@@ -323,10 +317,7 @@ class WPUF_Walker_Category_Multi extends Walker {
|
|
323 |
class WPUF_Walker_Category_Checklist extends Walker {
|
324 |
public $tree_type = 'category';
|
325 |
|
326 |
-
public $db_fields = [
|
327 |
-
'parent' => 'parent',
|
328 |
-
'id' => 'term_id',
|
329 |
-
]; //TODO: decouple this
|
330 |
|
331 |
public function start_lvl( &$output, $depth = 0, $args = [] ) {
|
332 |
$indent = str_repeat( "\t", $depth );
|
@@ -339,13 +330,13 @@ class WPUF_Walker_Category_Checklist extends Walker {
|
|
339 |
}
|
340 |
|
341 |
public function start_el( &$output, $category, $depth = 0, $args = [], $current_object_id = 0 ) {
|
342 |
-
|
343 |
|
344 |
if ( empty( $taxonomy ) ) {
|
345 |
$taxonomy = 'category';
|
346 |
}
|
347 |
|
348 |
-
if ( 'category'
|
349 |
$name = 'category';
|
350 |
} else {
|
351 |
$name = $taxonomy;
|
@@ -358,7 +349,7 @@ class WPUF_Walker_Category_Checklist extends Walker {
|
|
358 |
}
|
359 |
|
360 |
$class = isset( $args['class'] ) ? $args['class'] : '';
|
361 |
-
$output .= "\n<li class='" . $inline_class . "' id='{$taxonomy}-{$category->term_id}'>" . '<label class="selectit"><input class="' . $class . '" value="' . $category->term_id . '" type="checkbox" name="' . $name . '[]" id="in-' . $taxonomy . '-' . $category->term_id . '"' . checked( in_array( $category->term_id, $args['selected_cats']
|
362 |
}
|
363 |
|
364 |
public function end_el( &$output, $category, $depth = 0, $args = [] ) {
|
@@ -373,6 +364,7 @@ class WPUF_Walker_Category_Checklist extends Walker {
|
|
373 |
* @param array $selected_cats
|
374 |
*
|
375 |
* @since 0.8
|
|
|
376 |
*/
|
377 |
function wpuf_category_checklist( $post_id = 0, $selected_cats = false, $attr = [], $class = null ) {
|
378 |
require_once ABSPATH . '/wp-admin/includes/template.php';
|
@@ -404,7 +396,7 @@ function wpuf_category_checklist( $post_id = 0, $selected_cats = false, $attr =
|
|
404 |
$tax_args = [
|
405 |
'taxonomy' => $tax,
|
406 |
'hide_empty' => false,
|
407 |
-
$exclude['type'] => ( 'child_of'
|
408 |
'orderby' => isset( $attr['orderby'] ) ? $attr['orderby'] : 'name',
|
409 |
'order' => isset( $attr['order'] ) ? $attr['order'] : 'ASC',
|
410 |
];
|
@@ -414,27 +406,25 @@ function wpuf_category_checklist( $post_id = 0, $selected_cats = false, $attr =
|
|
414 |
|
415 |
echo wp_kses_post( '<ul class="wpuf-category-checklist">' );
|
416 |
printf( '<input type="hidden" name="%s" value="0" />', esc_attr( $tax ) );
|
417 |
-
echo wp_kses(
|
418 |
-
|
419 |
-
'
|
420 |
-
|
421 |
-
|
422 |
-
'
|
423 |
-
|
424 |
-
|
425 |
-
'
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
'
|
434 |
-
'class' => [],
|
435 |
-
],
|
436 |
]
|
437 |
-
);
|
438 |
echo wp_kses_post( '</ul>' );
|
439 |
}
|
440 |
|
@@ -452,15 +442,12 @@ function wpuf_get_field_settings_excludes( $field_settings, $exclude_type ) {
|
|
452 |
$attributes = $field_settings['exclude'];
|
453 |
$child_ids = [];
|
454 |
|
455 |
-
if ( !
|
456 |
foreach ( $attributes as $attr ) {
|
457 |
-
$terms = get_terms(
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
'parent' => $attr,
|
462 |
-
)
|
463 |
-
);
|
464 |
|
465 |
foreach ( $terms as $term ) {
|
466 |
array_push( $child_ids, $term->term_id );
|
@@ -473,8 +460,8 @@ function wpuf_get_field_settings_excludes( $field_settings, $exclude_type ) {
|
|
473 |
}
|
474 |
|
475 |
$excludes = [
|
476 |
-
'type' =>
|
477 |
-
'childs' =>
|
478 |
];
|
479 |
|
480 |
return $excludes;
|
@@ -497,7 +484,7 @@ function wpuf_get_image_sizes() {
|
|
497 |
$image_sizes = [];
|
498 |
|
499 |
foreach ( $image_sizes_orig as $size ) {
|
500 |
-
$image_sizes[
|
501 |
}
|
502 |
|
503 |
return $image_sizes;
|
@@ -505,38 +492,14 @@ function wpuf_get_image_sizes() {
|
|
505 |
|
506 |
function wpuf_allowed_extensions() {
|
507 |
$extesions = [
|
508 |
-
'images' => [
|
509 |
-
|
510 |
-
|
511 |
-
],
|
512 |
-
'
|
513 |
-
|
514 |
-
|
515 |
-
],
|
516 |
-
'video' => [
|
517 |
-
'ext' => 'avi,divx,flv,mov,ogv,mkv,mp4,m4v,divx,mpg,mpeg,mpe',
|
518 |
-
'label' => __( 'Videos', 'wp-user-frontend' ),
|
519 |
-
],
|
520 |
-
'pdf' => [
|
521 |
-
'ext' => 'pdf',
|
522 |
-
'label' => __( 'PDF', 'wp-user-frontend' ),
|
523 |
-
],
|
524 |
-
'office' => [
|
525 |
-
'ext' => 'doc,ppt,pps,xls,mdb,docx,xlsx,pptx,odt,odp,ods,odg,odc,odb,odf,rtf,txt',
|
526 |
-
'label' => __( 'Office Documents', 'wp-user-frontend' ),
|
527 |
-
],
|
528 |
-
'zip' => [
|
529 |
-
'ext' => 'zip,gz,gzip,rar,7z',
|
530 |
-
'label' => __( 'Zip Archives', 'wp-user-frontend' ),
|
531 |
-
],
|
532 |
-
'exe' => [
|
533 |
-
'ext' => 'exe',
|
534 |
-
'label' => __( 'Executable Files', 'wp-user-frontend' ),
|
535 |
-
],
|
536 |
-
'csv' => [
|
537 |
-
'ext' => 'csv',
|
538 |
-
'label' => __( 'CSV', 'wp-user-frontend' ),
|
539 |
-
],
|
540 |
];
|
541 |
|
542 |
return apply_filters( 'wpuf_allowed_extensions', $extesions );
|
@@ -553,9 +516,9 @@ function wpuf_addpost_notice( $text ) {
|
|
553 |
$user = wp_get_current_user();
|
554 |
|
555 |
if ( is_user_logged_in() ) {
|
556 |
-
$lock = (
|
557 |
|
558 |
-
if ( 'yes'
|
559 |
return $user->wpuf_lock_cause;
|
560 |
}
|
561 |
}
|
@@ -590,7 +553,7 @@ function wpuf_associate_attachment( $attachment_id, $post_id ) {
|
|
590 |
* @param array args
|
591 |
*/
|
592 |
function wpuf_update_post( $args ) {
|
593 |
-
if ( !
|
594 |
// unhook this function so it doesn't loop infinitely
|
595 |
remove_action( 'save_post', [ WPUF_Admin_Posting::init(), 'save_meta' ], 1 );
|
596 |
|
@@ -612,11 +575,10 @@ function wpuf_update_post( $args ) {
|
|
612 |
* @return array
|
613 |
*/
|
614 |
function wpuf_get_user_roles() {
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
$wp_roles = wp_roles();
|
620 |
}
|
621 |
|
622 |
return $wp_roles->get_names();
|
@@ -699,7 +661,7 @@ function wpuf_get_avatar( $avatar, $id_or_email, $size, $default, $alt, $args )
|
|
699 |
if ( is_numeric( $id_or_email ) ) {
|
700 |
$user = get_user_by( 'id', $id_or_email );
|
701 |
} elseif ( is_object( $id_or_email ) ) {
|
702 |
-
if ( $id_or_email->user_id
|
703 |
$user = get_user_by( 'id', $id_or_email->user_id );
|
704 |
} else {
|
705 |
return $avatar;
|
@@ -775,7 +737,7 @@ function wpuf_update_avatar( $user_id, $attachment_id ) {
|
|
775 |
|
776 |
$editor = wp_get_image_editor( $file_path );
|
777 |
|
778 |
-
if ( !
|
779 |
$avatar_size = wpuf_get_option( 'avatar_size', 'wpuf_profile', '100x100' );
|
780 |
$avatar_size = explode( 'x', $avatar_size );
|
781 |
$avatar_width = $avatar_size[0];
|
@@ -794,7 +756,7 @@ function wpuf_update_avatar( $user_id, $attachment_id ) {
|
|
794 |
// delete any previous avatar
|
795 |
$prev_avatar = get_user_meta( $user_id, 'user_avatar', true );
|
796 |
|
797 |
-
if ( !
|
798 |
$prev_avatar_path = str_replace( $upload_dir['baseurl'], $upload_dir['basedir'], $prev_avatar );
|
799 |
|
800 |
if ( file_exists( $prev_avatar_path ) ) {
|
@@ -820,10 +782,10 @@ function wpuf_get_gateways( $context = 'admin' ) {
|
|
820 |
$return = [];
|
821 |
|
822 |
foreach ( $gateways as $id => $gate ) {
|
823 |
-
if ( 'admin'
|
824 |
-
$return[
|
825 |
} else {
|
826 |
-
$return[
|
827 |
'label' => $gate['checkout_label'],
|
828 |
'icon' => isset( $gate['icon'] ) ? $gate['icon'] : '',
|
829 |
];
|
@@ -850,9 +812,9 @@ function wpuf_get_gateways( $context = 'admin' ) {
|
|
850 |
function wpuf_show_custom_fields( $content ) {
|
851 |
global $post;
|
852 |
|
853 |
-
$show_custom
|
854 |
|
855 |
-
if ( 'on'
|
856 |
return $content;
|
857 |
}
|
858 |
|
@@ -860,7 +822,7 @@ function wpuf_show_custom_fields( $content ) {
|
|
860 |
$form_id = get_post_meta( $post->ID, '_wpuf_form_id', true );
|
861 |
$form_settings = wpuf_get_form_settings( $form_id );
|
862 |
|
863 |
-
if (
|
864 |
return $content;
|
865 |
}
|
866 |
|
@@ -872,14 +834,14 @@ function wpuf_show_custom_fields( $content ) {
|
|
872 |
if ( $form_vars ) {
|
873 |
foreach ( $form_vars as $attr ) {
|
874 |
// get column field input fields
|
875 |
-
if (
|
876 |
$inner_fields = $attr['inner_fields'];
|
877 |
|
878 |
foreach ( $inner_fields as $column_key => $column_fields ) {
|
879 |
-
if ( !
|
880 |
// ignore section break and HTML input type
|
881 |
foreach ( $column_fields as $column_field_key => $column_field ) {
|
882 |
-
if ( isset( $column_field['show_in_post'] ) &&
|
883 |
$meta[] = $column_field;
|
884 |
}
|
885 |
}
|
@@ -888,19 +850,19 @@ function wpuf_show_custom_fields( $content ) {
|
|
888 |
continue;
|
889 |
}
|
890 |
|
891 |
-
if ( isset( $attr['show_in_post'] ) &&
|
892 |
$meta[] = $attr;
|
893 |
}
|
894 |
}
|
895 |
|
896 |
-
if (
|
897 |
return $content;
|
898 |
}
|
899 |
|
900 |
foreach ( $meta as $attr ) {
|
901 |
$wpuf_field = wpuf()->fields->get_field( $attr['template'] );
|
902 |
|
903 |
-
if ( !
|
904 |
$attr['name'] = $attr['input_type'];
|
905 |
}
|
906 |
|
@@ -909,7 +871,7 @@ function wpuf_show_custom_fields( $content ) {
|
|
909 |
|
910 |
$return_for_no_cond = 0;
|
911 |
|
912 |
-
if ( isset( $attr['wpuf_cond']['condition_status'] ) &&
|
913 |
foreach ( $attr['wpuf_cond']['cond_field'] as $field_key => $cond_field_name ) {
|
914 |
|
915 |
//check if the conditional field is a taxonomy
|
@@ -922,16 +884,16 @@ function wpuf_show_custom_fields( $content ) {
|
|
922 |
$cond_field_value[] = $term_array->term_id;
|
923 |
}
|
924 |
}
|
925 |
-
$cond_field_value = isset(
|
926 |
} else {
|
927 |
$cond_field_value = get_post_meta( $post->ID, $cond_field_name, 'true' );
|
928 |
}
|
929 |
|
930 |
-
if ( isset( $attr['wpuf_cond']['cond_option'][
|
931 |
if ( is_array( $cond_field_value ) ) {
|
932 |
continue;
|
933 |
} else {
|
934 |
-
if (
|
935 |
$return_for_no_cond = 1;
|
936 |
} else {
|
937 |
$return_for_no_cond = 0;
|
@@ -942,15 +904,15 @@ function wpuf_show_custom_fields( $content ) {
|
|
942 |
}
|
943 |
}
|
944 |
|
945 |
-
if ( $return_for_no_cond
|
946 |
continue;
|
947 |
}
|
948 |
|
949 |
-
if ( !
|
950 |
continue;
|
951 |
}
|
952 |
|
953 |
-
if (
|
954 |
continue;
|
955 |
}
|
956 |
|
@@ -962,9 +924,9 @@ function wpuf_show_custom_fields( $content ) {
|
|
962 |
switch ( $attr['input_type'] ) {
|
963 |
case 'image_upload':
|
964 |
case 'file_upload':
|
965 |
-
$image_html
|
966 |
|
967 |
-
if ( 'no'
|
968 |
$image_html .= '<label>' . $attr['label'] . ':</label> ';
|
969 |
}
|
970 |
|
@@ -978,7 +940,7 @@ function wpuf_show_custom_fields( $content ) {
|
|
978 |
}
|
979 |
|
980 |
foreach ( $field_value as $attachment_id ) {
|
981 |
-
if (
|
982 |
$image_size = wpuf_get_option( 'insert_photo_size', 'wpuf_frontend_posting', 'thumbnail' );
|
983 |
$thumb = wp_get_attachment_image( $attachment_id, $image_size );
|
984 |
} else {
|
@@ -996,9 +958,9 @@ function wpuf_show_custom_fields( $content ) {
|
|
996 |
$allowed_video_extensions = explode( ',', $wpuf_allowed_extensions['video']['ext'] );
|
997 |
$allowed_extenstions = array_merge( $allowed_audio_extensions, $allowed_video_extensions );
|
998 |
|
999 |
-
if ( 'yes'
|
1000 |
-
$is_video = in_array( $extension, $allowed_video_extensions
|
1001 |
-
$is_audio = in_array( $extension, $allowed_audio_extensions
|
1002 |
$preview_width = isset( $attr['preview_width'] ) ? $attr['preview_width'] : '123';
|
1003 |
$preview_height = isset( $attr['preview_height'] ) ? $attr['preview_height'] : '456';
|
1004 |
|
@@ -1017,18 +979,18 @@ function wpuf_show_custom_fields( $content ) {
|
|
1017 |
$image_html .= sprintf( '<a href="%s">%s</a> ', $full_size, $thumb );
|
1018 |
}
|
1019 |
|
1020 |
-
if ( 'on'
|
1021 |
$post_detail = get_post( $attachment_id );
|
1022 |
|
1023 |
-
if ( !
|
1024 |
$image_html .= '<br /><label>' . __( 'Title', 'wp-user-frontend' ) . ':</label> <span class="image_title">' . esc_html( $post_detail->post_title ) . '</span>';
|
1025 |
}
|
1026 |
|
1027 |
-
if ( !
|
1028 |
$image_html .= '<br /><label>' . __( 'Caption', 'wp-user-frontend' ) . ':</label> <span class="image_caption">' . esc_html( $post_detail->post_excerpt ) . '</span>';
|
1029 |
}
|
1030 |
|
1031 |
-
if ( !
|
1032 |
$image_html .= '<br /><label>' . __( 'Description', 'wp-user-frontend' ) . ':</label> <span class="image_description">' . esc_html( $post_detail->post_content ) . '</span>';
|
1033 |
}
|
1034 |
}
|
@@ -1050,7 +1012,7 @@ function wpuf_show_custom_fields( $content ) {
|
|
1050 |
<div>
|
1051 |
<a class="btn btn-brand btn-sm" href="https://www.google.com/maps/dir/?api=1&destination=<?php echo esc_attr( $def_lat ); ?>,<?php echo esc_attr( $def_long ); ?>" target="_blank" rel="nofollow external"><?php esc_html_e( 'Directions »', 'wp-user-frontend' ); ?></a>
|
1052 |
</div>
|
1053 |
-
|
1054 |
}
|
1055 |
|
1056 |
$html .= ob_get_clean();
|
@@ -1063,16 +1025,16 @@ function wpuf_show_custom_fields( $content ) {
|
|
1063 |
|
1064 |
if ( isset( $field_value[0] ) && is_array( $field_value[0] ) ) {
|
1065 |
foreach ( $field_value[0] as $field_key => $value ) {
|
1066 |
-
if ( 'country_select'
|
1067 |
-
if ( isset( $countries[
|
1068 |
-
$value = $countries[
|
1069 |
}
|
1070 |
}
|
1071 |
|
1072 |
$address_html .= '<li>';
|
1073 |
|
1074 |
-
if ( 'no'
|
1075 |
-
$address_html .= '<label>' . $attr['address'][
|
1076 |
}
|
1077 |
|
1078 |
$address_html .= ' ' . $value . '</li>';
|
@@ -1097,7 +1059,7 @@ function wpuf_show_custom_fields( $content ) {
|
|
1097 |
if ( $new ) {
|
1098 |
$html .= '<li>';
|
1099 |
|
1100 |
-
if ( 'no'
|
1101 |
$html .= '<label>' . $attr['label'] . ': </label>';
|
1102 |
}
|
1103 |
|
@@ -1112,16 +1074,16 @@ function wpuf_show_custom_fields( $content ) {
|
|
1112 |
break;
|
1113 |
}
|
1114 |
|
1115 |
-
if (
|
1116 |
global $wp_embed;
|
1117 |
|
1118 |
$preview_width = isset( $attr['preview_width'] ) ? $attr['preview_width'] : '123';
|
1119 |
$preview_height = isset( $attr['preview_height'] ) ? $attr['preview_height'] : '456';
|
1120 |
$shortcode = '[embed width="' . $preview_width . '" height="' . $preview_height . '"]' . $value . '[/embed]';
|
1121 |
|
1122 |
-
$preview
|
1123 |
|
1124 |
-
if ( 'no'
|
1125 |
$preview .= sprintf( '<label>%s: </label>', $attr['label'] );
|
1126 |
}
|
1127 |
|
@@ -1134,11 +1096,11 @@ function wpuf_show_custom_fields( $content ) {
|
|
1134 |
break;
|
1135 |
}
|
1136 |
|
1137 |
-
$open_in =
|
1138 |
|
1139 |
-
$link
|
1140 |
|
1141 |
-
if ( 'no'
|
1142 |
$link .= '<label>' . $attr['label'] . ':</label>';
|
1143 |
}
|
1144 |
|
@@ -1152,7 +1114,7 @@ function wpuf_show_custom_fields( $content ) {
|
|
1152 |
|
1153 |
$html .= '<li>';
|
1154 |
|
1155 |
-
if ( 'no'
|
1156 |
$html .= '<label>' . $attr['label'] . ':</label>';
|
1157 |
}
|
1158 |
|
@@ -1170,7 +1132,7 @@ function wpuf_show_custom_fields( $content ) {
|
|
1170 |
|
1171 |
$html .= '<li>';
|
1172 |
|
1173 |
-
if ( 'no'
|
1174 |
$html .= '<label>' . $attr['label'] . ':</label>';
|
1175 |
}
|
1176 |
|
@@ -1182,7 +1144,7 @@ function wpuf_show_custom_fields( $content ) {
|
|
1182 |
$filter_html = apply_filters( 'wpuf_custom_field_render', '', $value, $attr, $form_settings );
|
1183 |
$separator = ' | ';
|
1184 |
|
1185 |
-
if ( !
|
1186 |
$html .= $filter_html;
|
1187 |
} elseif ( is_serialized( $value[0] ) ) {
|
1188 |
$new = maybe_unserialize( $value[0] );
|
@@ -1191,20 +1153,20 @@ function wpuf_show_custom_fields( $content ) {
|
|
1191 |
if ( $modified_value ) {
|
1192 |
$html .= '<li>';
|
1193 |
|
1194 |
-
if ( 'no'
|
1195 |
$html .= '<label>' . $attr['label'] . ':</label>';
|
1196 |
}
|
1197 |
|
1198 |
$html .= sprintf( ' %s</li>', make_clickable( $modified_value ) );
|
1199 |
}
|
1200 |
-
} elseif ( (
|
1201 |
-
if ( !
|
1202 |
$modified_value = implode( $separator, $value[0] );
|
1203 |
|
1204 |
if ( $modified_value ) {
|
1205 |
$html .= '<li>';
|
1206 |
|
1207 |
-
if ( 'no'
|
1208 |
$html .= '<label>' . $attr['label'] . ':</label>';
|
1209 |
}
|
1210 |
|
@@ -1217,7 +1179,7 @@ function wpuf_show_custom_fields( $content ) {
|
|
1217 |
if ( $new ) {
|
1218 |
$html .= '<li>';
|
1219 |
|
1220 |
-
if ( 'no'
|
1221 |
$html .= '<label>' . $attr['label'] . ':</label>';
|
1222 |
}
|
1223 |
|
@@ -1245,7 +1207,7 @@ add_filter( 'the_content', 'wpuf_show_custom_fields', 10 );
|
|
1245 |
* @param array $args
|
1246 |
*/
|
1247 |
function wpuf_shortcode_map( $location, $post_id = null, $args = [], $meta_key = '' ) {
|
1248 |
-
if ( !
|
1249 |
return;
|
1250 |
}
|
1251 |
|
@@ -1258,11 +1220,7 @@ function wpuf_shortcode_map( $location, $post_id = null, $args = [], $meta_key =
|
|
1258 |
return;
|
1259 |
}
|
1260 |
|
1261 |
-
$default = [
|
1262 |
-
'width' => 450,
|
1263 |
-
'height' => 250,
|
1264 |
-
'zoom' => 12,
|
1265 |
-
];
|
1266 |
$args = wp_parse_args( $args, $default );
|
1267 |
|
1268 |
if ( is_array( $location ) ) {
|
@@ -1274,8 +1232,7 @@ function wpuf_shortcode_map( $location, $post_id = null, $args = [], $meta_key =
|
|
1274 |
list( $def_lat, $def_long ) = explode( ',', $location );
|
1275 |
$def_lat = $def_lat ? $def_lat : 0;
|
1276 |
$def_long = $def_long ? $def_long : 0;
|
1277 |
-
}
|
1278 |
-
?>
|
1279 |
|
1280 |
<div class="google-map" style="margin: 10px 0; height: <?php echo esc_attr( $args['height'] ); ?>px; width: <?php echo esc_attr( $args['width'] ); ?>px;" id="wpuf-map-<?php echo esc_attr( $meta_key . $post->ID ); ?>"></div>
|
1281 |
|
@@ -1324,7 +1281,7 @@ function wpuf_shortcode_map_user( $meta_key, $user_id = null, $args = [] ) {
|
|
1324 |
function wpuf_shortcode_map_post( $meta_key, $post_id = null, $args = [] ) {
|
1325 |
global $post;
|
1326 |
|
1327 |
-
if (
|
1328 |
$post_id = $post->ID;
|
1329 |
}
|
1330 |
|
@@ -1335,29 +1292,20 @@ function wpuf_shortcode_map_post( $meta_key, $post_id = null, $args = [] ) {
|
|
1335 |
function wpuf_meta_shortcode( $atts ) {
|
1336 |
global $post;
|
1337 |
|
1338 |
-
|
1339 |
-
|
1340 |
-
|
1341 |
-
|
1342 |
-
|
1343 |
-
|
1344 |
-
|
1345 |
-
|
1346 |
-
], $atts
|
1347 |
-
);
|
1348 |
-
|
1349 |
-
$name = $attrs['name'];
|
1350 |
-
$type = $attrs['type'];
|
1351 |
-
$size = $attrs['size'];
|
1352 |
-
$width = $attrs['width'];
|
1353 |
-
$height = $attrs['height'];
|
1354 |
-
$zoom = $attrs['zoom'];
|
1355 |
|
1356 |
if ( empty( $name ) ) {
|
1357 |
return;
|
1358 |
}
|
1359 |
|
1360 |
-
if ( 'image'
|
1361 |
$images = get_post_meta( $post->ID, $name, true );
|
1362 |
|
1363 |
if ( ! is_array( $images ) ) {
|
@@ -1368,7 +1316,7 @@ function wpuf_meta_shortcode( $atts ) {
|
|
1368 |
$html = '';
|
1369 |
|
1370 |
foreach ( $images as $attachment_id ) {
|
1371 |
-
if ( 'image'
|
1372 |
$thumb = wp_get_attachment_image( $attachment_id, $size );
|
1373 |
} else {
|
1374 |
$thumb = get_post_field( 'post_title', $attachment_id );
|
@@ -1380,20 +1328,14 @@ function wpuf_meta_shortcode( $atts ) {
|
|
1380 |
|
1381 |
return $html;
|
1382 |
}
|
1383 |
-
} elseif ( 'map'
|
1384 |
ob_start();
|
1385 |
-
wpuf_shortcode_map(
|
1386 |
-
$name, $post->ID, [
|
1387 |
-
'width' => $width,
|
1388 |
-
'height' => $height,
|
1389 |
-
'zoom' => $zoom,
|
1390 |
-
]
|
1391 |
-
);
|
1392 |
|
1393 |
return ob_get_clean();
|
1394 |
-
} elseif ( 'repeat'
|
1395 |
return implode( '; ', get_post_meta( $post->ID, $name ) );
|
1396 |
-
} elseif ( 'normal'
|
1397 |
return implode( ', ', get_post_meta( $post->ID, $name ) );
|
1398 |
} else {
|
1399 |
return make_clickable( implode( ', ', get_post_meta( $post->ID, $name ) ) );
|
@@ -1414,15 +1356,15 @@ add_shortcode( 'wpuf-meta', 'wpuf_meta_shortcode' );
|
|
1414 |
function wpuf_get_option( $option, $section, $default = '' ) {
|
1415 |
$options = get_option( $section );
|
1416 |
|
1417 |
-
if ( isset( $options[
|
1418 |
-
return $options[
|
1419 |
}
|
1420 |
|
1421 |
return $default;
|
1422 |
}
|
1423 |
|
1424 |
/**
|
1425 |
-
*
|
1426 |
*
|
1427 |
* @see http://wp.tutsplus.com/articles/quick-tip-improving-shortcodes-with-the-has_shortcode-function/
|
1428 |
*
|
@@ -1431,9 +1373,9 @@ function wpuf_get_option( $option, $section, $default = '' ) {
|
|
1431 |
* @return bool
|
1432 |
*/
|
1433 |
function wpuf_has_shortcode( $shortcode = '', $post_id = false ) {
|
1434 |
-
$post_to_check = (
|
1435 |
|
1436 |
-
if (
|
1437 |
return false;
|
1438 |
}
|
1439 |
|
@@ -1441,7 +1383,7 @@ function wpuf_has_shortcode( $shortcode = '', $post_id = false ) {
|
|
1441 |
$found = false;
|
1442 |
|
1443 |
// if no short code was provided, return false
|
1444 |
-
if (
|
1445 |
return $found;
|
1446 |
}
|
1447 |
|
@@ -1472,7 +1414,7 @@ function wpuf_get_attachment_id_from_url( $attachment_url = '' ) {
|
|
1472 |
$attachment_id = false;
|
1473 |
|
1474 |
// If there is no url, return.
|
1475 |
-
if ( ''
|
1476 |
return;
|
1477 |
}
|
1478 |
|
@@ -1489,7 +1431,7 @@ function wpuf_get_attachment_id_from_url( $attachment_url = '' ) {
|
|
1489 |
$attachment_url = str_replace( $upload_dir_paths['baseurl'] . '/', '', $attachment_url );
|
1490 |
|
1491 |
// Finally, run a custom database query to get the attachment ID from the modified attachment URL
|
1492 |
-
$attachment_id = $wpdb->get_var( $wpdb->prepare( "SELECT wposts.ID FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta WHERE wposts.ID = wpostmeta.post_id AND wpostmeta.meta_key = '_wp_attached_file' AND wpostmeta.meta_value = %s AND wposts.post_type = 'attachment'", $attachment_url ) );
|
1493 |
}
|
1494 |
|
1495 |
return $attachment_id;
|
@@ -1506,10 +1448,10 @@ function wpufe_ajax_tag_search() {
|
|
1506 |
global $wpdb;
|
1507 |
|
1508 |
$taxonomy = isset( $_GET['tax'] ) ? sanitize_text_field( wp_unslash( $_GET['tax'] ) ) : '';
|
1509 |
-
$term_ids = isset( $_GET['term_ids'] ) ? sanitize_text_field(
|
1510 |
$tax = get_taxonomy( $taxonomy );
|
1511 |
|
1512 |
-
if (
|
1513 |
wp_die( 0 );
|
1514 |
}
|
1515 |
|
@@ -1523,7 +1465,7 @@ function wpufe_ajax_tag_search() {
|
|
1523 |
|
1524 |
if ( false !== strpos( $s, ',' ) ) {
|
1525 |
$s = explode( ',', $s );
|
1526 |
-
$s = $s[
|
1527 |
}
|
1528 |
|
1529 |
$s = trim( $s );
|
@@ -1532,12 +1474,15 @@ function wpufe_ajax_tag_search() {
|
|
1532 |
wp_die();
|
1533 |
} // require 2 chars for matching
|
1534 |
|
|
|
|
|
1535 |
if ( ! empty( $term_ids ) ) {
|
1536 |
-
//phpcs:disable
|
1537 |
$results = $wpdb->get_col( $wpdb->prepare( "SELECT t.name FROM $wpdb->term_taxonomy AS tt INNER JOIN $wpdb->terms AS t ON tt.term_id = t.term_id WHERE tt.taxonomy = %s AND t.term_id IN ($term_ids) AND t.name LIKE (%s)", $taxonomy, '%' . $wpdb->esc_like( $s ) . '%' ) );
|
1538 |
} else {
|
1539 |
$results = $wpdb->get_col( $wpdb->prepare( "SELECT t.name FROM $wpdb->term_taxonomy AS tt INNER JOIN $wpdb->terms AS t ON tt.term_id = t.term_id WHERE tt.taxonomy = %s AND t.name LIKE (%s)", $taxonomy, '%' . $wpdb->esc_like( $s ) . '%' ) );
|
1540 |
}
|
|
|
|
|
1541 |
echo esc_html( join( $results, "\n" ) );
|
1542 |
wp_die();
|
1543 |
}
|
@@ -1574,6 +1519,10 @@ function wpuf_dropdown_helper( $options, $selected = '' ) {
|
|
1574 |
* @param string $file file name or path to file
|
1575 |
*/
|
1576 |
function wpuf_load_template( $file, $args = [] ) {
|
|
|
|
|
|
|
|
|
1577 |
$child_theme_dir = get_stylesheet_directory() . '/wpuf/';
|
1578 |
$parent_theme_dir = get_template_directory() . '/wpuf/';
|
1579 |
$wpuf_dir = WPUF_ROOT . '/templates/';
|
@@ -1598,6 +1547,10 @@ function wpuf_load_template( $file, $args = [] ) {
|
|
1598 |
* @param string $file file name or path to file
|
1599 |
*/
|
1600 |
function wpuf_load_pro_template( $file, $args = [] ) {
|
|
|
|
|
|
|
|
|
1601 |
if ( wpuf()->is_pro() ) {
|
1602 |
$child_theme_dir = get_stylesheet_directory() . '/wpuf/';
|
1603 |
$parent_theme_dir = get_template_directory() . '/wpuf/';
|
@@ -1674,16 +1627,14 @@ function wpuf_date2mysql( $date, $gmt = 0 ) {
|
|
1674 |
* @return array
|
1675 |
*/
|
1676 |
function wpuf_get_form_fields( $form_id ) {
|
1677 |
-
$fields = get_children(
|
1678 |
-
|
1679 |
-
|
1680 |
-
|
1681 |
-
|
1682 |
-
|
1683 |
-
|
1684 |
-
|
1685 |
-
]
|
1686 |
-
);
|
1687 |
|
1688 |
$form_fields = [];
|
1689 |
|
@@ -1695,8 +1646,8 @@ function wpuf_get_form_fields( $form_id ) {
|
|
1695 |
// Add inline property for radio and checkbox fields
|
1696 |
$inline_supported_fields = [ 'radio', 'checkbox' ];
|
1697 |
|
1698 |
-
if ( in_array( $field['input_type'], $inline_supported_fields
|
1699 |
-
if ( !
|
1700 |
$field['inline'] = 'no';
|
1701 |
}
|
1702 |
}
|
@@ -1704,8 +1655,8 @@ function wpuf_get_form_fields( $form_id ) {
|
|
1704 |
// Add 'selected' property
|
1705 |
$option_based_fields = [ 'select', 'multiselect', 'radio', 'checkbox' ];
|
1706 |
|
1707 |
-
if ( in_array( $field['input_type'], $option_based_fields
|
1708 |
-
if ( !
|
1709 |
if ( 'select' === $field['input_type'] || 'radio' === $field['input_type'] ) {
|
1710 |
$field['selected'] = '';
|
1711 |
} else {
|
@@ -1715,7 +1666,7 @@ function wpuf_get_form_fields( $form_id ) {
|
|
1715 |
}
|
1716 |
|
1717 |
// Add 'multiple' key for input_type:repeat
|
1718 |
-
if ( 'repeat' === $field['input_type'] && !
|
1719 |
$field['multiple'] = '';
|
1720 |
}
|
1721 |
|
@@ -1737,38 +1688,40 @@ add_action( 'wp_ajax_nopriv_wpuf_get_child_cat', 'wpuf_get_child_cats' );
|
|
1737 |
* Returns child category dropdown on ajax request
|
1738 |
*/
|
1739 |
function wpuf_get_child_cats() {
|
|
|
1740 |
$nonce = isset( $_REQUEST['_wpnonce'] ) ? sanitize_key( wp_unslash( $_REQUEST['_wpnonce'] ) ) : '';
|
1741 |
|
1742 |
-
$
|
1743 |
-
$field_attr = isset( $_POST['field_attr'] ) ? array_map(
|
1744 |
|
1745 |
-
|
1746 |
|
|
|
1747 |
$allowed_tags = wp_kses_allowed_html( 'post' );
|
1748 |
|
1749 |
-
|
|
|
1750 |
|
1751 |
$terms = null;
|
1752 |
$result = '';
|
1753 |
|
1754 |
-
if ( $
|
1755 |
die( wp_kses( $result, $allowed_tags ) );
|
1756 |
}
|
1757 |
|
1758 |
-
$terms = get_categories( 'taxonomy=' . $taxonomy . '&child_of=' . $
|
1759 |
-
|
1760 |
-
if ( $terms ) {
|
1761 |
-
$field_attr['parent_cat'] = $parent_cat;
|
1762 |
|
1763 |
if ( is_array( $terms ) ) {
|
1764 |
foreach ( $terms as $key => $term ) {
|
1765 |
-
$terms[
|
1766 |
}
|
1767 |
}
|
1768 |
|
1769 |
-
$field_attr['form_id'] = isset( $_POST['form_id'] ) ? absint( $_POST['form_id'] ) : 0;
|
1770 |
|
1771 |
$result .= taxnomy_select( '', $field_attr );
|
|
|
1772 |
} else {
|
1773 |
die( '' );
|
1774 |
}
|
@@ -1782,17 +1735,17 @@ function taxnomy_select( $terms, $attr ) {
|
|
1782 |
$exclude_type = isset( $attr['exclude_type'] ) ? $attr['exclude_type'] : 'exclude';
|
1783 |
$exclude = isset( $attr['exclude'] ) ? $attr['exclude'] : '';
|
1784 |
|
1785 |
-
$dataset
|
1786 |
'data-required="%s" data-type="select" data-form-id="%d"',
|
1787 |
$attr['required'],
|
1788 |
$attr['form_id']
|
1789 |
-
|
1790 |
|
1791 |
-
if ( 'child_of'
|
1792 |
$exclude = $exclude[0];
|
1793 |
}
|
1794 |
|
1795 |
-
$tax_args
|
1796 |
'show_option_none' => __( '-- Select --', 'wp-user-frontend' ),
|
1797 |
'hierarchical' => 1,
|
1798 |
'hide_empty' => 0,
|
@@ -1824,8 +1777,7 @@ function taxnomy_select( $terms, $attr ) {
|
|
1824 |
//'last_term_id' => isset( $attr['parent_cat'] ) ? $attr['parent_cat'] : '',
|
1825 |
//'term_id' => $selected
|
1826 |
];
|
1827 |
-
$attr = apply_filters( 'wpuf_taxonomy_checklist_args', $attr );
|
1828 |
-
?>
|
1829 |
<span data-taxonomy=<?php echo json_encode( $attr ); ?>></span>
|
1830 |
<?php
|
1831 |
}
|
@@ -1852,9 +1804,9 @@ function wpuf_get_form_settings( $form_id, $status = true ) {
|
|
1852 |
* @return array
|
1853 |
*/
|
1854 |
function wpuf_get_form_notifications( $form_id ) {
|
1855 |
-
$notifications =
|
1856 |
|
1857 |
-
if (
|
1858 |
return [];
|
1859 |
}
|
1860 |
|
@@ -1871,9 +1823,9 @@ function wpuf_get_form_notifications( $form_id ) {
|
|
1871 |
* @return array
|
1872 |
*/
|
1873 |
function wpuf_get_form_integrations( $form_id ) {
|
1874 |
-
$integrations =
|
1875 |
|
1876 |
-
if (
|
1877 |
return [];
|
1878 |
}
|
1879 |
|
@@ -1893,12 +1845,12 @@ function wpuf_get_form_integrations( $form_id ) {
|
|
1893 |
function wpuf_is_integration_active( $form_id, $integration_id ) {
|
1894 |
$integrations = wpuf_get_form_integrations( $form_id );
|
1895 |
|
1896 |
-
if (
|
1897 |
return false;
|
1898 |
}
|
1899 |
|
1900 |
foreach ( $integrations as $id => $integration ) {
|
1901 |
-
if ( $integration_id
|
1902 |
return $integration;
|
1903 |
}
|
1904 |
}
|
@@ -1920,7 +1872,7 @@ function wpuf_get_subscription_page_url() {
|
|
1920 |
/**
|
1921 |
* Clear the buffer
|
1922 |
*
|
1923 |
-
*
|
1924 |
*
|
1925 |
* @return void
|
1926 |
*/
|
@@ -1938,14 +1890,14 @@ function wpuf_clear_buffer() {
|
|
1938 |
function wpuf_is_license_expired() {
|
1939 |
$remote_addr = isset( $_SERVER['REMOTE_ADDR'] ) ? sanitize_text_field( wp_unslash( $_SERVER['REMOTE_ADDR'] ) ) : '';
|
1940 |
|
1941 |
-
if ( in_array( $remote_addr, [ '127.0.0.1', '::1' ]
|
1942 |
return false;
|
1943 |
}
|
1944 |
|
1945 |
$license_status = get_option( 'wpuf_license_status' );
|
1946 |
|
1947 |
// seems like this wasn't activated at all
|
1948 |
-
if ( !
|
1949 |
return false;
|
1950 |
}
|
1951 |
|
@@ -1990,7 +1942,7 @@ function wpuf_get_post_form_templates() {
|
|
1990 |
function wpuf_get_countries( $type = 'array' ) {
|
1991 |
$countries = include __DIR__ . '/includes/countries-formated.php';
|
1992 |
|
1993 |
-
if ( 'json'
|
1994 |
$countries = json_encode( $countries );
|
1995 |
}
|
1996 |
|
@@ -2006,26 +1958,11 @@ function wpuf_get_countries( $type = 'array' ) {
|
|
2006 |
*/
|
2007 |
function wpuf_get_account_sections() {
|
2008 |
$account_sections = [
|
2009 |
-
[
|
2010 |
-
|
2011 |
-
|
2012 |
-
],
|
2013 |
-
[
|
2014 |
-
'slug' => 'posts',
|
2015 |
-
'label' => __( 'Posts', 'wp-user-frontend' ),
|
2016 |
-
],
|
2017 |
-
[
|
2018 |
-
'slug' => 'edit-profile',
|
2019 |
-
'label' => __( 'Edit Profile', 'wp-user-frontend' ),
|
2020 |
-
],
|
2021 |
-
[
|
2022 |
-
'slug' => 'subscription',
|
2023 |
-
'label' => __( 'Subscription', 'wp-user-frontend' ),
|
2024 |
-
],
|
2025 |
-
[
|
2026 |
-
'slug' => 'billing-address',
|
2027 |
-
'label' => __( 'Billing Address', 'wp-user-frontend' ),
|
2028 |
-
],
|
2029 |
];
|
2030 |
|
2031 |
return apply_filters( 'wpuf_account_sections', $account_sections );
|
@@ -2044,7 +1981,7 @@ function wpuf_get_account_sections_list( $post_type = 'page' ) {
|
|
2044 |
|
2045 |
if ( $sections ) {
|
2046 |
foreach ( $sections as $section ) {
|
2047 |
-
$array[
|
2048 |
}
|
2049 |
}
|
2050 |
|
@@ -2073,7 +2010,7 @@ function wpuf_get_transactions( $args = [] ) {
|
|
2073 |
if ( $args['count'] ) {
|
2074 |
return $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->prefix}wpuf_transaction" );
|
2075 |
}
|
2076 |
-
|
2077 |
$result = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}wpuf_transaction ORDER BY `{$args['orderby']}` {$args['order']} LIMIT {$args['offset']}, {$args['number']}", OBJECT );
|
2078 |
|
2079 |
return $result;
|
@@ -2127,12 +2064,12 @@ function wpuf_get_pending_transactions( $args = [] ) {
|
|
2127 |
'status' => 'pending',
|
2128 |
'cost' => $info['price'],
|
2129 |
'tax' => isset( $info['tax'] ) ? $info['tax'] : 0,
|
2130 |
-
'post_id' => ( $info['type']
|
2131 |
-
'pack_id' => ( $info['type']
|
2132 |
'payer_first_name' => $info['user_info']['first_name'],
|
2133 |
'payer_last_name' => $info['user_info']['last_name'],
|
2134 |
'payer_email' => $info['user_info']['email'],
|
2135 |
-
'payment_type' => ( $info['post_data']['wpuf_payment_method']
|
2136 |
'transaction_id' => 0,
|
2137 |
'created' => $info['date'],
|
2138 |
];
|
@@ -2152,271 +2089,59 @@ function wpuf_get_pending_transactions( $args = [] ) {
|
|
2152 |
*/
|
2153 |
function wpuf_get_currencies() {
|
2154 |
$currencies = [
|
2155 |
-
[
|
2156 |
-
|
2157 |
-
|
2158 |
-
|
2159 |
-
],
|
2160 |
-
[
|
2161 |
-
|
2162 |
-
|
2163 |
-
|
2164 |
-
],
|
2165 |
-
[
|
2166 |
-
|
2167 |
-
|
2168 |
-
|
2169 |
-
],
|
2170 |
-
[
|
2171 |
-
|
2172 |
-
|
2173 |
-
|
2174 |
-
],
|
2175 |
-
[
|
2176 |
-
|
2177 |
-
|
2178 |
-
|
2179 |
-
],
|
2180 |
-
[
|
2181 |
-
|
2182 |
-
|
2183 |
-
|
2184 |
-
],
|
2185 |
-
[
|
2186 |
-
|
2187 |
-
|
2188 |
-
|
2189 |
-
],
|
2190 |
-
[
|
2191 |
-
|
2192 |
-
|
2193 |
-
|
2194 |
-
],
|
2195 |
-
[
|
2196 |
-
|
2197 |
-
|
2198 |
-
|
2199 |
-
],
|
2200 |
-
[
|
2201 |
-
|
2202 |
-
|
2203 |
-
|
2204 |
-
],
|
2205 |
-
[
|
2206 |
-
|
2207 |
-
|
2208 |
-
'symbol' => 'Kč',
|
2209 |
-
],
|
2210 |
-
[
|
2211 |
-
'currency' => 'DKK',
|
2212 |
-
'label' => __( 'Danish Krone', 'wp-user-frontend' ),
|
2213 |
-
'symbol' => 'kr.',
|
2214 |
-
],
|
2215 |
-
[
|
2216 |
-
'currency' => 'DOP',
|
2217 |
-
'label' => __( 'Dominican Peso', 'wp-user-frontend' ),
|
2218 |
-
'symbol' => 'RD$',
|
2219 |
-
],
|
2220 |
-
[
|
2221 |
-
'currency' => 'DZD',
|
2222 |
-
'label' => __( 'Algerian Dinar', 'wp-user-frontend' ),
|
2223 |
-
'symbol' => 'DA;',
|
2224 |
-
],
|
2225 |
-
[
|
2226 |
-
'currency' => 'EUR',
|
2227 |
-
'label' => __( 'Euros', 'wp-user-frontend' ),
|
2228 |
-
'symbol' => '€',
|
2229 |
-
],
|
2230 |
-
[
|
2231 |
-
'currency' => 'HKD',
|
2232 |
-
'label' => __( 'Hong Kong Dollar', 'wp-user-frontend' ),
|
2233 |
-
'symbol' => '$',
|
2234 |
-
],
|
2235 |
-
[
|
2236 |
-
'currency' => 'HRK',
|
2237 |
-
'label' => __( 'Croatia kuna', 'wp-user-frontend' ),
|
2238 |
-
'symbol' => 'Kn',
|
2239 |
-
],
|
2240 |
-
[
|
2241 |
-
'currency' => 'HUF',
|
2242 |
-
'label' => __( 'Hungarian Forint', 'wp-user-frontend' ),
|
2243 |
-
'symbol' => 'Ft',
|
2244 |
-
],
|
2245 |
-
[
|
2246 |
-
'currency' => 'ISK',
|
2247 |
-
'label' => __( 'Icelandic krona', 'wp-user-frontend' ),
|
2248 |
-
'symbol' => 'Kr.',
|
2249 |
-
],
|
2250 |
-
[
|
2251 |
-
'currency' => 'IDR',
|
2252 |
-
'label' => __( 'Indonesia Rupiah', 'wp-user-frontend' ),
|
2253 |
-
'symbol' => 'Rp',
|
2254 |
-
],
|
2255 |
-
[
|
2256 |
-
'currency' => 'INR',
|
2257 |
-
'label' => __( 'Indian Rupee', 'wp-user-frontend' ),
|
2258 |
-
'symbol' => '₹',
|
2259 |
-
],
|
2260 |
-
[
|
2261 |
-
'currency' => 'NPR',
|
2262 |
-
'label' => __( 'Nepali Rupee', 'wp-user-frontend' ),
|
2263 |
-
'symbol' => 'Rs.',
|
2264 |
-
],
|
2265 |
-
[
|
2266 |
-
'currency' => 'ILS',
|
2267 |
-
'label' => __( 'Israeli Shekel', 'wp-user-frontend' ),
|
2268 |
-
'symbol' => '₪',
|
2269 |
-
],
|
2270 |
-
[
|
2271 |
-
'currency' => 'JPY',
|
2272 |
-
'label' => __( 'Japanese Yen', 'wp-user-frontend' ),
|
2273 |
-
'symbol' => '¥',
|
2274 |
-
],
|
2275 |
-
[
|
2276 |
-
'currency' => 'KIP',
|
2277 |
-
'label' => __( 'Lao Kip', 'wp-user-frontend' ),
|
2278 |
-
'symbol' => '₭',
|
2279 |
-
],
|
2280 |
-
[
|
2281 |
-
'currency' => 'KRW',
|
2282 |
-
'label' => __( 'South Korean Won', 'wp-user-frontend' ),
|
2283 |
-
'symbol' => '₩',
|
2284 |
-
],
|
2285 |
-
[
|
2286 |
-
'currency' => 'MYR',
|
2287 |
-
'label' => __( 'Malaysian Ringgits', 'wp-user-frontend' ),
|
2288 |
-
'symbol' => 'RM',
|
2289 |
-
],
|
2290 |
-
[
|
2291 |
-
'currency' => 'MXN',
|
2292 |
-
'label' => __( 'Mexican Peso', 'wp-user-frontend' ),
|
2293 |
-
'symbol' => '$',
|
2294 |
-
],
|
2295 |
-
[
|
2296 |
-
'currency' => 'NGN',
|
2297 |
-
'label' => __( 'Nigerian Naira', 'wp-user-frontend' ),
|
2298 |
-
'symbol' => '₦',
|
2299 |
-
],
|
2300 |
-
[
|
2301 |
-
'currency' => 'NOK',
|
2302 |
-
'label' => __( 'Norwegian Krone', 'wp-user-frontend' ),
|
2303 |
-
'symbol' => 'kr',
|
2304 |
-
],
|
2305 |
-
[
|
2306 |
-
'currency' => 'NZD',
|
2307 |
-
'label' => __( 'New Zealand Dollar', 'wp-user-frontend' ),
|
2308 |
-
'symbol' => '$',
|
2309 |
-
],
|
2310 |
-
[
|
2311 |
-
'currency' => 'NAD',
|
2312 |
-
'label' => __( 'Namibian dollar', 'wp-user-frontend' ),
|
2313 |
-
'symbol' => 'N$',
|
2314 |
-
],
|
2315 |
-
[
|
2316 |
-
'currency' => 'OMR',
|
2317 |
-
'label' => __( 'Omani Rial', 'wp-user-frontend' ),
|
2318 |
-
'symbol' => 'ر.ع.',
|
2319 |
-
],
|
2320 |
-
[
|
2321 |
-
'currency' => 'IRR',
|
2322 |
-
'label' => __( 'Iranian Rial', 'wp-user-frontend' ),
|
2323 |
-
'symbol' => '﷼',
|
2324 |
-
],
|
2325 |
-
[
|
2326 |
-
'currency' => 'PKR',
|
2327 |
-
'label' => __( 'Pakistani Rupee', 'wp-user-frontend' ),
|
2328 |
-
'symbol' => 'Rs',
|
2329 |
-
],
|
2330 |
-
[
|
2331 |
-
'currency' => 'PYG',
|
2332 |
-
'label' => __( 'Paraguayan Guaraní', 'wp-user-frontend' ),
|
2333 |
-
'symbol' => '₲',
|
2334 |
-
],
|
2335 |
-
[
|
2336 |
-
'currency' => 'PHP',
|
2337 |
-
'label' => __( 'Philippine Pesos', 'wp-user-frontend' ),
|
2338 |
-
'symbol' => '₱',
|
2339 |
-
],
|
2340 |
-
[
|
2341 |
-
'currency' => 'PLN',
|
2342 |
-
'label' => __( 'Polish Zloty', 'wp-user-frontend' ),
|
2343 |
-
'symbol' => 'zł',
|
2344 |
-
],
|
2345 |
-
[
|
2346 |
-
'currency' => 'GBP',
|
2347 |
-
'label' => __( 'Pounds Sterling', 'wp-user-frontend' ),
|
2348 |
-
'symbol' => '£',
|
2349 |
-
],
|
2350 |
-
[
|
2351 |
-
'currency' => 'RON',
|
2352 |
-
'label' => __( 'Romanian Leu', 'wp-user-frontend' ),
|
2353 |
-
'symbol' => 'lei',
|
2354 |
-
],
|
2355 |
-
[
|
2356 |
-
'currency' => 'RUB',
|
2357 |
-
'label' => __( 'Russian Ruble', 'wp-user-frontend' ),
|
2358 |
-
'symbol' => 'руб.',
|
2359 |
-
],
|
2360 |
-
[
|
2361 |
-
'currency' => 'SR',
|
2362 |
-
'label' => __( 'Saudi Riyal', 'wp-user-frontend' ),
|
2363 |
-
'symbol' => 'SR',
|
2364 |
-
],
|
2365 |
-
[
|
2366 |
-
'currency' => 'SGD',
|
2367 |
-
'label' => __( 'Singapore Dollar', 'wp-user-frontend' ),
|
2368 |
-
'symbol' => '$',
|
2369 |
-
],
|
2370 |
-
[
|
2371 |
-
'currency' => 'ZAR',
|
2372 |
-
'label' => __( 'South African rand', 'wp-user-frontend' ),
|
2373 |
-
'symbol' => 'R',
|
2374 |
-
],
|
2375 |
-
[
|
2376 |
-
'currency' => 'SEK',
|
2377 |
-
'label' => __( 'Swedish Krona', 'wp-user-frontend' ),
|
2378 |
-
'symbol' => 'kr',
|
2379 |
-
],
|
2380 |
-
[
|
2381 |
-
'currency' => 'CHF',
|
2382 |
-
'label' => __( 'Swiss Franc', 'wp-user-frontend' ),
|
2383 |
-
'symbol' => 'CHF',
|
2384 |
-
],
|
2385 |
-
[
|
2386 |
-
'currency' => 'TWD',
|
2387 |
-
'label' => __( 'Taiwan New Dollars', 'wp-user-frontend' ),
|
2388 |
-
'symbol' => 'NT$',
|
2389 |
-
],
|
2390 |
-
[
|
2391 |
-
'currency' => 'THB',
|
2392 |
-
'label' => __( 'Thai Baht', 'wp-user-frontend' ),
|
2393 |
-
'symbol' => '฿',
|
2394 |
-
],
|
2395 |
-
[
|
2396 |
-
'currency' => 'TRY',
|
2397 |
-
'label' => __( 'Turkish Lira', 'wp-user-frontend' ),
|
2398 |
-
'symbol' => '₺',
|
2399 |
-
],
|
2400 |
-
[
|
2401 |
-
'currency' => 'USD',
|
2402 |
-
'label' => __( 'US Dollar', 'wp-user-frontend' ),
|
2403 |
-
'symbol' => '$',
|
2404 |
-
],
|
2405 |
-
[
|
2406 |
-
'currency' => 'VND',
|
2407 |
-
'label' => __( 'Vietnamese Dong', 'wp-user-frontend' ),
|
2408 |
-
'symbol' => '₫',
|
2409 |
-
],
|
2410 |
-
[
|
2411 |
-
'currency' => 'EGP',
|
2412 |
-
'label' => __( 'Egyptian Pound', 'wp-user-frontend' ),
|
2413 |
-
'symbol' => 'EGP',
|
2414 |
-
],
|
2415 |
-
[
|
2416 |
-
'currency' => 'JOD',
|
2417 |
-
'label' => __( 'Jordanian dinar', 'wp-user-frontend' ),
|
2418 |
-
'symbol' => 'د.أ',
|
2419 |
-
],
|
2420 |
];
|
2421 |
|
2422 |
return apply_filters( 'wpuf_currencies', $currencies );
|
@@ -2434,15 +2159,15 @@ function wpuf_get_currencies() {
|
|
2434 |
function wpuf_get_currency( $type = '' ) {
|
2435 |
$currency_code = wpuf_get_option( 'currency', 'wpuf_payment', 'USD' );
|
2436 |
|
2437 |
-
if ( 'code'
|
2438 |
return $currency_code;
|
2439 |
}
|
2440 |
|
2441 |
$currencies = wpuf_get_currencies();
|
2442 |
-
$index = array_search( $currency_code, array_column( $currencies, 'currency' )
|
2443 |
$currency = $currencies[ $index ];
|
2444 |
|
2445 |
-
if ( 'symbol'
|
2446 |
return $currency['symbol'];
|
2447 |
}
|
2448 |
|
@@ -2461,19 +2186,19 @@ function get_wpuf_price_format() {
|
|
2461 |
switch ( $currency_pos ) {
|
2462 |
case 'left':
|
2463 |
$format = '%1$s%2$s';
|
2464 |
-
|
2465 |
|
2466 |
case 'right':
|
2467 |
$format = '%2$s%1$s';
|
2468 |
-
|
2469 |
|
2470 |
case 'left_space':
|
2471 |
$format = '%1$s %2$s';
|
2472 |
-
|
2473 |
|
2474 |
case 'right_space':
|
2475 |
$format = '%2$s %1$s';
|
2476 |
-
|
2477 |
}
|
2478 |
|
2479 |
return apply_filters( 'wpuf_price_format', $format, $currency_pos );
|
@@ -2538,24 +2263,14 @@ function wpuf_trim_zeros( $price ) {
|
|
2538 |
* @return mixed
|
2539 |
*/
|
2540 |
function wpuf_format_price( $price, $formated = true, $args = [] ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2541 |
|
2542 |
-
$price_args = apply_filters(
|
2543 |
-
'wpuf_price_args', wp_parse_args(
|
2544 |
-
$args, [
|
2545 |
-
'currency' => $formated ? wpuf_get_currency( 'symbol' ) : '',
|
2546 |
-
'decimal_separator' => wpuf_get_price_decimal_separator(),
|
2547 |
-
'thousand_separator' => $formated ? wpuf_get_price_thousand_separator() : '',
|
2548 |
-
'decimals' => wpuf_get_price_decimals(),
|
2549 |
-
'price_format' => get_wpuf_price_format(),
|
2550 |
-
]
|
2551 |
-
)
|
2552 |
-
);
|
2553 |
-
|
2554 |
-
$currency = $price_args['currency'];
|
2555 |
-
$decimal_separator = $price_args['decimal_separator'];
|
2556 |
-
$thousand_separator = $price_args['thousand_separator'];
|
2557 |
-
$decimals = $price_args['decimals'];
|
2558 |
-
$price_format = $price_args['price_format'];
|
2559 |
$negative = $price < 0;
|
2560 |
$price = apply_filters( 'wpuf_raw_price', floatval( $negative ? $price * -1 : $price ) );
|
2561 |
$price = apply_filters( 'wpuf_formatted_price', number_format( $price, $decimals, $decimal_separator, $thousand_separator ), $price, $decimals, $decimal_separator, $thousand_separator );
|
@@ -2574,7 +2289,7 @@ function wpuf_format_price( $price, $formated = true, $args = [] ) {
|
|
2574 |
*
|
2575 |
* @since 2.4.3
|
2576 |
*/
|
2577 |
-
if ( !
|
2578 |
function array_column( $input, $column_key, $index_key = null ) {
|
2579 |
$result = [];
|
2580 |
|
@@ -2598,7 +2313,7 @@ if ( ! function_exists( 'array_column' ) ) {
|
|
2598 |
function wpuf_duplicate_form( $post_id ) {
|
2599 |
$post = get_post( $post_id );
|
2600 |
|
2601 |
-
if (
|
2602 |
return;
|
2603 |
}
|
2604 |
|
@@ -2617,12 +2332,10 @@ function wpuf_duplicate_form( $post_id ) {
|
|
2617 |
}
|
2618 |
|
2619 |
// update the post title to remove confusion
|
2620 |
-
wp_update_post(
|
2621 |
-
|
2622 |
-
|
2623 |
-
|
2624 |
-
]
|
2625 |
-
);
|
2626 |
|
2627 |
if ( $form_id ) {
|
2628 |
$form_settings = wpuf_get_form_settings( $post_id );
|
@@ -2681,17 +2394,15 @@ function wpuf_insert_form_field( $form_id, $field = [], $field_id = null, $order
|
|
2681 |
* @return int
|
2682 |
*/
|
2683 |
function wpuf_create_sample_form( $post_title = 'Sample Form', $post_type = 'wpuf_forms', $blank = false ) {
|
2684 |
-
$form_id = wp_insert_post(
|
2685 |
-
|
2686 |
-
|
2687 |
-
|
2688 |
-
|
2689 |
-
|
2690 |
-
|
2691 |
-
|
2692 |
-
)
|
2693 |
-
|
2694 |
-
if ( ! $form_id ) {
|
2695 |
return false;
|
2696 |
}
|
2697 |
|
@@ -2713,7 +2424,7 @@ function wpuf_create_sample_form( $post_title = 'Sample Form', $post_type = 'wpu
|
|
2713 |
'placeholder' => '',
|
2714 |
'default' => '',
|
2715 |
'size' => '40',
|
2716 |
-
'wpuf_cond' => [],
|
2717 |
],
|
2718 |
[
|
2719 |
'input_type' => 'textarea',
|
@@ -2730,7 +2441,7 @@ function wpuf_create_sample_form( $post_title = 'Sample Form', $post_type = 'wpu
|
|
2730 |
'default' => '',
|
2731 |
'rich' => 'teeny',
|
2732 |
'insert_image' => 'yes',
|
2733 |
-
'wpuf_cond' => [],
|
2734 |
],
|
2735 |
];
|
2736 |
|
@@ -2832,13 +2543,13 @@ function wpuf_create_sample_form( $post_title = 'Sample Form', $post_type = 'wpu
|
|
2832 |
];
|
2833 |
}
|
2834 |
|
2835 |
-
if ( !
|
2836 |
foreach ( $form_fields as $order => $field ) {
|
2837 |
wpuf_insert_form_field( $form_id, $field, false, $order );
|
2838 |
}
|
2839 |
}
|
2840 |
|
2841 |
-
if ( !
|
2842 |
update_post_meta( $form_id, 'wpuf_form_settings', $settings );
|
2843 |
}
|
2844 |
|
@@ -2893,13 +2604,12 @@ function wpuf_delete_form( $form_id, $force = true ) {
|
|
2893 |
wp_delete_post( $form_id, $force );
|
2894 |
|
2895 |
// delete form inputs as WP doesn't know the relationship
|
2896 |
-
$wpdb->delete(
|
2897 |
-
$wpdb->posts,
|
2898 |
[
|
2899 |
'post_parent' => $form_id,
|
2900 |
'post_type' => 'wpuf_input',
|
2901 |
]
|
2902 |
-
|
2903 |
}
|
2904 |
|
2905 |
/**
|
@@ -2912,10 +2622,11 @@ function wpuf_delete_form( $form_id, $force = true ) {
|
|
2912 |
* @return string $post_status
|
2913 |
*/
|
2914 |
function wpuf_get_draft_post_status( $form_settings ) {
|
|
|
2915 |
$noce = isset( $_REQUEST['_wpnonce'] ) ? sanitize_key( wp_unslash( $_REQUEST['_wpnonce'] ) ) : '';
|
2916 |
|
2917 |
if ( isset( $nonce ) && ! wp_verify_nonce( $noce, 'wpuf_form_add' ) ) {
|
2918 |
-
return;
|
2919 |
}
|
2920 |
|
2921 |
$post_status = 'draft';
|
@@ -2923,8 +2634,8 @@ function wpuf_get_draft_post_status( $form_settings ) {
|
|
2923 |
$charging_enabled = $current_user->subscription()->current_pack_id();
|
2924 |
$user_wpuf_subscription_pack = get_user_meta( get_current_user_id(), '_wpuf_subscription_pack', true );
|
2925 |
|
2926 |
-
if ( $charging_enabled && !
|
2927 |
-
if ( !
|
2928 |
if ( $current_user->subscription()->expired() ) {
|
2929 |
$post_status = 'pending';
|
2930 |
}
|
@@ -2945,7 +2656,7 @@ function wpuf_get_draft_post_status( $form_settings ) {
|
|
2945 |
* @return array
|
2946 |
*/
|
2947 |
function wpuf_admin_page_states( $state, $post ) {
|
2948 |
-
if ( 'page'
|
2949 |
return $state;
|
2950 |
}
|
2951 |
|
@@ -2954,19 +2665,19 @@ function wpuf_admin_page_states( $state, $post ) {
|
|
2954 |
preg_match_all( $pattern, $post->post_content, $matches );
|
2955 |
$matches = array_unique( $matches[0] );
|
2956 |
|
2957 |
-
if ( !
|
2958 |
$page = '';
|
2959 |
$shortcode = $matches[0];
|
2960 |
|
2961 |
-
if ( '[wpuf_account]'
|
2962 |
$page = 'WPUF Account Page';
|
2963 |
-
} elseif ( '[wpuf_edit]'
|
2964 |
$page = 'WPUF Post Edit Page';
|
2965 |
-
} elseif ( '[wpuf-login]'
|
2966 |
$page = 'WPUF Login Page';
|
2967 |
-
} elseif ( '[wpuf_sub_pack]'
|
2968 |
$page = 'WPUF Subscription Page';
|
2969 |
-
} elseif ( '[wpuf_editprofile]'
|
2970 |
$page = 'WPUF Profile Edit Page';
|
2971 |
} elseif ( stristr( $shortcode, '[wpuf_dashboard' ) ) {
|
2972 |
$page = 'WPUF Dashboard Page';
|
@@ -2978,7 +2689,7 @@ function wpuf_admin_page_states( $state, $post ) {
|
|
2978 |
$page = 'WPUF Form Page';
|
2979 |
}
|
2980 |
|
2981 |
-
if ( !
|
2982 |
$state['wpuf'] = $page;
|
2983 |
}
|
2984 |
}
|
@@ -3054,7 +2765,7 @@ function wpuf_send_mail_to_guest( $post_id_encoded, $form_id_encoded, $charging_
|
|
3054 |
'post_msg' => 'verified',
|
3055 |
'f' => 2,
|
3056 |
], get_home_url()
|
3057 |
-
|
3058 |
} else {
|
3059 |
$encoded_guest_url = add_query_arg(
|
3060 |
[
|
@@ -3063,16 +2774,16 @@ function wpuf_send_mail_to_guest( $post_id_encoded, $form_id_encoded, $charging_
|
|
3063 |
'post_msg' => 'verified',
|
3064 |
'f' => 1,
|
3065 |
], get_home_url()
|
3066 |
-
|
3067 |
}
|
3068 |
|
3069 |
-
$default_body = 'Hey There, <br> <br> We just received your guest post and now we want you to confirm your email so that we can verify the content and move on to the publishing process. <br> <br> Please click the link below to verify: <br> <br> <a href="' . $encoded_guest_url . '">Publish Post</a> <br> <br> Regards, <br> <br>' . bloginfo( 'name' );
|
3070 |
$to = isset( $_POST['guest_email'] ) ? sanitize_email( wp_unslash( $_POST['guest_email'] ) ) : '';
|
3071 |
$guest_email_sub = wpuf_get_option( 'guest_email_subject', 'wpuf_mails', 'Please Confirm Your Email to Get the Post Published!' );
|
3072 |
$subject = $guest_email_sub;
|
3073 |
$guest_email_body = wpuf_get_option( 'guest_email_body', 'wpuf_mails', $default_body );
|
3074 |
|
3075 |
-
if ( !
|
3076 |
$blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
|
3077 |
$field_search = [ '{activation_link}', '{sitename}' ];
|
3078 |
|
@@ -3086,7 +2797,7 @@ function wpuf_send_mail_to_guest( $post_id_encoded, $form_id_encoded, $charging_
|
|
3086 |
$body = $default_body;
|
3087 |
}
|
3088 |
|
3089 |
-
$body
|
3090 |
|
3091 |
wp_mail( $to, $subject, $body );
|
3092 |
}
|
@@ -3101,7 +2812,7 @@ function wpuf_send_mail_to_guest( $post_id_encoded, $form_id_encoded, $charging_
|
|
3101 |
function is_wpuf_post_form_builder() {
|
3102 |
$page = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : '';
|
3103 |
|
3104 |
-
return 'wpuf-post-forms'
|
3105 |
}
|
3106 |
|
3107 |
/**
|
@@ -3114,7 +2825,7 @@ function is_wpuf_post_form_builder() {
|
|
3114 |
function is_wpuf_profile_form_builder() {
|
3115 |
$page = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : '';
|
3116 |
|
3117 |
-
return 'wpuf-profile-forms'
|
3118 |
}
|
3119 |
|
3120 |
/**
|
@@ -3127,7 +2838,7 @@ function is_wpuf_profile_form_builder() {
|
|
3127 |
* @return \WPUF_User
|
3128 |
*/
|
3129 |
function wpuf_get_user( $user = null ) {
|
3130 |
-
if (
|
3131 |
$user = wp_get_current_user();
|
3132 |
}
|
3133 |
|
@@ -3147,18 +2858,14 @@ function wpuf_set_all_terms_as_allowed() {
|
|
3147 |
$allowed_term = [];
|
3148 |
|
3149 |
foreach ( $subscriptions as $pack ) {
|
3150 |
-
if ( !
|
3151 |
-
$cts = get_taxonomies( [
|
3152 |
-
|
3153 |
-
<?php
|
3154 |
-
foreach ( $cts as $ct ) {
|
3155 |
if ( is_taxonomy_hierarchical( $ct->name ) ) {
|
3156 |
-
$tax_terms = get_terms(
|
3157 |
-
|
3158 |
-
|
3159 |
-
|
3160 |
-
]
|
3161 |
-
);
|
3162 |
|
3163 |
foreach ( $tax_terms as $tax_term ) {
|
3164 |
$allowed_term[] = $tax_term->term_id;
|
@@ -3166,17 +2873,13 @@ function wpuf_set_all_terms_as_allowed() {
|
|
3166 |
}
|
3167 |
}
|
3168 |
|
3169 |
-
$cts = get_taxonomies( [
|
3170 |
-
|
3171 |
-
<?php
|
3172 |
-
foreach ( $cts as $ct ) {
|
3173 |
if ( is_taxonomy_hierarchical( $ct->name ) ) {
|
3174 |
-
$tax_terms = get_terms(
|
3175 |
-
|
3176 |
-
|
3177 |
-
|
3178 |
-
]
|
3179 |
-
);
|
3180 |
|
3181 |
foreach ( $tax_terms as $tax_term ) {
|
3182 |
$allowed_term[] = $tax_term->term_id;
|
@@ -3191,7 +2894,7 @@ function wpuf_set_all_terms_as_allowed() {
|
|
3191 |
}
|
3192 |
|
3193 |
/**
|
3194 |
-
*
|
3195 |
*
|
3196 |
* @since 2.8
|
3197 |
*
|
@@ -3200,7 +2903,7 @@ function wpuf_set_all_terms_as_allowed() {
|
|
3200 |
* @return List of WP_Post objects
|
3201 |
*/
|
3202 |
function wpuf_posts_submitted_by( $form_id ) {
|
3203 |
-
$settings
|
3204 |
$settings['post_type'];
|
3205 |
$args = [
|
3206 |
'meta_key' => '_wpuf_form_id',
|
@@ -3214,7 +2917,7 @@ function wpuf_posts_submitted_by( $form_id ) {
|
|
3214 |
}
|
3215 |
|
3216 |
/**
|
3217 |
-
*
|
3218 |
*
|
3219 |
* @since 2.8
|
3220 |
*
|
@@ -3247,7 +2950,7 @@ function get_formatted_mail_body( $message, $subject ) {
|
|
3247 |
wpuf_load_pro_template(
|
3248 |
'email/header.php',
|
3249 |
[ 'subject' => $subject ]
|
3250 |
-
|
3251 |
|
3252 |
$header = ob_get_clean();
|
3253 |
}
|
@@ -3258,7 +2961,7 @@ function get_formatted_mail_body( $message, $subject ) {
|
|
3258 |
wpuf_load_pro_template(
|
3259 |
'email/footer.php',
|
3260 |
[]
|
3261 |
-
|
3262 |
|
3263 |
$footer = ob_get_clean();
|
3264 |
}
|
@@ -3268,13 +2971,13 @@ function get_formatted_mail_body( $message, $subject ) {
|
|
3268 |
wpuf_load_pro_template(
|
3269 |
'email/style.php',
|
3270 |
[]
|
3271 |
-
|
3272 |
|
3273 |
$css = apply_filters( 'wpuf_email_style', ob_get_clean() );
|
3274 |
|
3275 |
$content = $header . '<pre>' . $message . '</pre>' . $footer;
|
3276 |
|
3277 |
-
if ( !
|
3278 |
require_once WPUF_PRO_INCLUDES . '/libs/Emogrifier.php';
|
3279 |
}
|
3280 |
|
@@ -3310,8 +3013,8 @@ function wpuf_select( $args = [] ) {
|
|
3310 |
'chosen' => false,
|
3311 |
'placeholder' => null,
|
3312 |
'multiple' => false,
|
3313 |
-
'show_option_all' => __( 'All', 'wp-user-frontend' ),
|
3314 |
-
'show_option_none' => __( 'None', 'wp-user-frontend' ),
|
3315 |
'data' => [],
|
3316 |
'readonly' => false,
|
3317 |
'disabled' => false,
|
@@ -3361,24 +3064,24 @@ function wpuf_select( $args = [] ) {
|
|
3361 |
$class = implode( ' ', array_map( 'sanitize_html_class', explode( ' ', $args['class'] ) ) );
|
3362 |
$output = '<select' . $disabled . $readonly . ' name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( str_replace( '-', '_', $args['id'] ) ) . '" class="wpuf-select ' . $class . '"' . $multiple . ' data-placeholder="' . $placeholder . '"' . $data_elements . '>';
|
3363 |
|
3364 |
-
if ( !
|
3365 |
$selected = '';
|
3366 |
}
|
3367 |
|
3368 |
if ( $args['show_option_all'] ) {
|
3369 |
-
if ( $args['multiple'] && !
|
3370 |
-
$selected = selected( true, in_array( 0, $args['selected']
|
3371 |
} else {
|
3372 |
$selected = selected( $args['selected'], 0, false );
|
3373 |
}
|
3374 |
$output .= '<option value="all"' . $selected . '>' . esc_html( $args['show_option_all'] ) . '</option>';
|
3375 |
}
|
3376 |
|
3377 |
-
if ( !
|
3378 |
if ( $args['show_option_none'] ) {
|
3379 |
if ( $args['multiple'] ) {
|
3380 |
-
$selected = selected( true, in_array( -1, $args['selected']
|
3381 |
-
} elseif ( isset( $args['selected'] ) && !
|
3382 |
$selected = selected( $args['selected'], -1, false );
|
3383 |
}
|
3384 |
$output .= '<option value="-1"' . $selected . '>' . esc_html( $args['show_option_none'] ) . '</option>';
|
@@ -3386,8 +3089,8 @@ function wpuf_select( $args = [] ) {
|
|
3386 |
|
3387 |
foreach ( $args['options'] as $key => $option ) {
|
3388 |
if ( $args['multiple'] && is_array( $args['selected'] ) ) {
|
3389 |
-
$selected = selected( true, in_array( (string) $key, $args['selected']
|
3390 |
-
} elseif ( isset( $args['selected'] ) && !
|
3391 |
$selected = selected( $args['selected'], $key, false );
|
3392 |
}
|
3393 |
|
@@ -3432,7 +3135,7 @@ function wpuf_text( $args = [] ) {
|
|
3432 |
|
3433 |
$data = '';
|
3434 |
|
3435 |
-
if ( !
|
3436 |
foreach ( $args['data'] as $key => $value ) {
|
3437 |
$data .= 'data-' . $key . '="' . esc_attr( $value ) . '" ';
|
3438 |
}
|
@@ -3440,11 +3143,11 @@ function wpuf_text( $args = [] ) {
|
|
3440 |
|
3441 |
$output = '<span id="wpuf-' . $args['name'] . '-wrap">';
|
3442 |
|
3443 |
-
if ( !
|
3444 |
$output .= '<label class="wpuf-label" for="' . $args['id'] . '">' . esc_html( $args['label'] ) . '</label>';
|
3445 |
}
|
3446 |
|
3447 |
-
if ( !
|
3448 |
$output .= '<span class="wpuf-description">' . wp_kses_post( $args['desc'] ) . '</span>';
|
3449 |
}
|
3450 |
|
@@ -3482,7 +3185,7 @@ function wpuf_update_option( $option, $section, $value ) {
|
|
3482 |
$options = array();
|
3483 |
}
|
3484 |
|
3485 |
-
$options[
|
3486 |
|
3487 |
update_option( $section, $options );
|
3488 |
}
|
@@ -3499,15 +3202,14 @@ function wpuf_update_option( $option, $section, $value ) {
|
|
3499 |
function wpuf_get_terms( $taxonomy = 'category' ) {
|
3500 |
$items = [];
|
3501 |
|
3502 |
-
$terms = get_terms(
|
3503 |
-
[
|
3504 |
'taxonomy' => $taxonomy,
|
3505 |
'hide_empty' => false,
|
3506 |
]
|
3507 |
-
|
3508 |
|
3509 |
foreach ( $terms as $key => $term ) {
|
3510 |
-
$items[
|
3511 |
}
|
3512 |
|
3513 |
return $items;
|
@@ -3524,9 +3226,9 @@ function wpuf_ajax_get_states_field() {
|
|
3524 |
$country = isset( $_POST['country'] ) ? sanitize_text_field( wp_unslash( $_POST['country'] ) ) : '';
|
3525 |
$cs = new CountryState();
|
3526 |
$countries = $cs->countries();
|
3527 |
-
$states = $cs->getStates( $countries[
|
3528 |
|
3529 |
-
if ( !
|
3530 |
$args = [
|
3531 |
'name' => isset( $_POST['field_name'] ) ? sanitize_text_field( wp_unslash( $_POST['field_name'] ) ) : '',
|
3532 |
'id' => isset( $_POST['field_name'] ) ? sanitize_text_field( wp_unslash( $_POST['field_name'] ) ) : '',
|
@@ -3541,7 +3243,8 @@ function wpuf_ajax_get_states_field() {
|
|
3541 |
$response = 'nostates';
|
3542 |
}
|
3543 |
|
3544 |
-
wp_send_json( $response ); // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
|
|
3545 |
}
|
3546 |
add_action( 'wp_ajax_wpuf-ajax-address', 'wpuf_ajax_get_states_field' );
|
3547 |
add_action( 'wp_ajax_nopriv_wpuf-ajax-address', 'wpuf_ajax_get_states_field' );
|
@@ -3552,19 +3255,23 @@ add_action( 'wp_ajax_nopriv_wpuf-ajax-address', 'wpuf_ajax_get_states_field' );
|
|
3552 |
* @return void
|
3553 |
*/
|
3554 |
function wpuf_update_billing_address() {
|
3555 |
-
|
|
|
|
|
|
|
|
|
3556 |
|
3557 |
ob_start();
|
3558 |
|
3559 |
$user_id = get_current_user_id();
|
3560 |
-
$add_line_1 =
|
3561 |
-
$add_line_2 =
|
3562 |
-
$city =
|
3563 |
-
$state =
|
3564 |
-
$zip =
|
3565 |
-
$country =
|
3566 |
-
$type =
|
3567 |
-
$id =
|
3568 |
|
3569 |
$address_fields = [
|
3570 |
'add_line_1' => $add_line_1,
|
@@ -3618,10 +3325,10 @@ function wpuf_get_user_address( $user_id = 0 ) {
|
|
3618 |
$countries_obj = new WC_Countries();
|
3619 |
$countries_array = $countries_obj->get_countries();
|
3620 |
$country_states_array = $countries_obj->get_states();
|
3621 |
-
$woo_address['state'] = isset( $country_states_array[
|
3622 |
$woo_address['state'] = strtolower( str_replace( ' ', '', $woo_address['state'] ) );
|
3623 |
|
3624 |
-
if ( !
|
3625 |
$address_fields = [
|
3626 |
'add_line_1' => $woo_address['address_1'],
|
3627 |
'add_line_2' => $woo_address['address_2'],
|
@@ -3646,32 +3353,30 @@ function wpuf_settings_multiselect( $args ) {
|
|
3646 |
$settings = new WeDevs_Settings_API();
|
3647 |
$value = $settings->get_option( $args['id'], $args['section'], $args['std'] );
|
3648 |
$value = is_array( $value ) ? (array) $value : [];
|
3649 |
-
$size = isset( $args['size'] ) && !
|
3650 |
$html = sprintf( '<select multiple="multiple" class="%1$s" name="%2$s[%3$s][]" id="%2$s[%3$s]">', $size, $args['section'], $args['id'] );
|
3651 |
|
3652 |
foreach ( $args['options'] as $key => $label ) {
|
3653 |
-
$checked = in_array( $key, $value
|
3654 |
$html .= sprintf( '<option value="%s"%s>%s</option>', $key, selected( $checked, $key, false ), $label );
|
3655 |
}
|
3656 |
|
3657 |
$html .= sprintf( '</select>' );
|
3658 |
$html .= $settings->get_field_description( $args );
|
3659 |
|
3660 |
-
echo wp_kses(
|
3661 |
-
|
3662 |
-
|
3663 |
-
'
|
3664 |
-
|
3665 |
-
|
3666 |
-
|
3667 |
-
|
3668 |
-
|
3669 |
-
'
|
3670 |
-
|
3671 |
-
'selected' => [],
|
3672 |
-
],
|
3673 |
]
|
3674 |
-
);
|
3675 |
}
|
3676 |
|
3677 |
/**
|
@@ -3683,11 +3388,11 @@ function wpuf_settings_multiselect( $args ) {
|
|
3683 |
*/
|
3684 |
function wpuf_show_form_schedule_message( $form_id ) {
|
3685 |
$form_settings = wpuf_get_form_settings( $form_id );
|
3686 |
-
$is_scheduled = ( isset( $form_settings['schedule_form'] ) && $form_settings['schedule_form']
|
3687 |
|
3688 |
if ( $is_scheduled ) {
|
3689 |
-
$start_time = !
|
3690 |
-
$end_time = !
|
3691 |
$current_time = current_time( 'timestamp' );
|
3692 |
|
3693 |
if ( $current_time >= $start_time && $current_time <= $end_time ) {
|
@@ -3699,8 +3404,7 @@ function wpuf_show_form_schedule_message( $form_id ) {
|
|
3699 |
echo wp_kses_post( '<div class="wpuf-message">' . $form_settings['form_pending_message'] . '</div>' );
|
3700 |
} elseif ( $current_time > $end_time ) {
|
3701 |
echo wp_kses_post( '<div class="wpuf-message">' . $form_settings['form_expired_message'] . '</div>' );
|
3702 |
-
}
|
3703 |
-
?>
|
3704 |
<script>
|
3705 |
jQuery( function($) {
|
3706 |
$(".wpuf-submit-button").attr("disabled", "disabled");
|
@@ -3721,21 +3425,21 @@ add_action( 'wpuf_before_form_render', 'wpuf_show_form_schedule_message' );
|
|
3721 |
*/
|
3722 |
function wpuf_show_form_limit_message( $form_id ) {
|
3723 |
$form_settings = wpuf_get_form_settings( $form_id );
|
3724 |
-
$has_limit = ( isset( $form_settings['limit_entries'] ) && $form_settings['limit_entries']
|
3725 |
-
$post_to_check =
|
3726 |
$is_edit_page = false;
|
3727 |
|
3728 |
-
if ( stripos( $post_to_check->post_content, '[wpuf_edit' ) !== false ) {
|
3729 |
$is_edit_page = true;
|
3730 |
}
|
3731 |
|
3732 |
-
if ( $has_limit &&
|
3733 |
-
$limit = (int) !
|
3734 |
$form_entries = wpuf_form_posts_count( $form_id );
|
3735 |
|
3736 |
if ( $limit && $limit <= $form_entries ) {
|
3737 |
$info = $form_settings['limit_message'];
|
3738 |
-
echo wp_kses_post( '<div class="wpuf-info">' . $info . '</div>'
|
3739 |
?>
|
3740 |
<script>
|
3741 |
jQuery( function($) {
|
@@ -3751,7 +3455,7 @@ function wpuf_show_form_limit_message( $form_id ) {
|
|
3751 |
add_action( 'wpuf_before_form_render', 'wpuf_show_form_limit_message' );
|
3752 |
|
3753 |
/**
|
3754 |
-
*
|
3755 |
*
|
3756 |
* @param int $post_id
|
3757 |
* @param array $form_settings
|
@@ -3762,12 +3466,7 @@ function wpuf_frontend_post_revision( $post_id, $form_settings ) {
|
|
3762 |
$post = get_post( $post_id );
|
3763 |
|
3764 |
if ( post_type_supports( $form_settings['post_type'], 'revisions' ) ) {
|
3765 |
-
$revisions = wp_get_post_revisions(
|
3766 |
-
$post_id, [
|
3767 |
-
'order' => 'ASC',
|
3768 |
-
'posts_per_page' => 1,
|
3769 |
-
]
|
3770 |
-
);
|
3771 |
$revision = current( $revisions );
|
3772 |
|
3773 |
_wp_upgrade_revisions_of_post( $post, wp_get_post_revisions( $post_id ) );
|
@@ -3795,7 +3494,7 @@ function wpuf_ini_get_byte( $val ) {
|
|
3795 |
$byte = absint( $val );
|
3796 |
$char = strtolower( str_replace( $byte, '', $val ) );
|
3797 |
|
3798 |
-
switch
|
3799 |
case 'g':
|
3800 |
$byte *= GB_IN_BYTES;
|
3801 |
break;
|
23 |
* @author Tareq Hasan
|
24 |
*/
|
25 |
function wpuf_show_post_status( $status ) {
|
26 |
+
if ( $status == 'publish' ) {
|
27 |
$title = __( 'Live', 'wp-user-frontend' );
|
28 |
$fontcolor = '#33CC33';
|
29 |
+
} elseif ( $status == 'draft' ) {
|
30 |
$title = __( 'Offline', 'wp-user-frontend' );
|
31 |
$fontcolor = '#bbbbbb';
|
32 |
+
} elseif ( $status == 'pending' ) {
|
33 |
$title = __( 'Awaiting Approval', 'wp-user-frontend' );
|
34 |
$fontcolor = '#C00202';
|
35 |
+
} elseif ( $status == 'future' ) {
|
36 |
$title = __( 'Scheduled', 'wp-user-frontend' );
|
37 |
$fontcolor = '#bbbbbb';
|
38 |
+
} elseif ( $status == 'private' ) {
|
39 |
$title = __( 'Private', 'wp-user-frontend' );
|
40 |
$fontcolor = '#bbbbbb';
|
41 |
}
|
54 |
* @author Tareq Hasan
|
55 |
*/
|
56 |
function wpuf_admin_post_status( $status ) {
|
57 |
+
if ( $status == 'publish' ) {
|
58 |
$title = __( 'Published', 'wp-user-frontend' );
|
59 |
$fontcolor = '#009200';
|
60 |
+
} elseif ( $status == 'draft' || $status == 'private' ) {
|
61 |
$title = __( 'Draft', 'wp-user-frontend' );
|
62 |
$fontcolor = '#bbbbbb';
|
63 |
+
} elseif ( $status == 'pending' ) {
|
64 |
$title = __( 'Pending', 'wp-user-frontend' );
|
65 |
$fontcolor = '#C00202';
|
66 |
+
} elseif ( $status == 'future' ) {
|
67 |
$title = __( 'Scheduled', 'wp-user-frontend' );
|
68 |
$fontcolor = '#bbbbbb';
|
69 |
}
|
77 |
* @param <type> $post_id
|
78 |
*/
|
79 |
function wpuf_upload_attachment( $post_id ) {
|
80 |
+
if ( !isset( $_FILES['wpuf_post_attachments'] ) ) {
|
81 |
return false;
|
82 |
}
|
83 |
|
84 |
+
|
85 |
+
|
86 |
$fields = (int) wpuf_get_option( 'attachment_num' );
|
87 |
|
88 |
$wpuf_post_attachments = isset( $_FILES['wpuf_post_attachments'] ) ? array_map( 'sanitize_text_field', wp_unslash( $_FILES['wpuf_post_attachments'] ) ) : [];
|
89 |
|
90 |
for ( $i = 0; $i < $fields; $i++ ) {
|
91 |
+
$file_name = basename( $wpuf_post_attachments['name'][$i] );
|
92 |
|
93 |
if ( $file_name ) {
|
94 |
if ( $file_name ) {
|
95 |
$upload = [
|
96 |
+
'name' => $wpuf_post_attachments['name'][$i],
|
97 |
+
'type' => $wpuf_post_attachments['type'][$i],
|
98 |
+
'tmp_name' => $wpuf_post_attachments['tmp_name'][$i],
|
99 |
+
'error' => $wpuf_post_attachments['error'][$i],
|
100 |
+
'size' => $wpuf_post_attachments['size'][$i],
|
101 |
];
|
102 |
|
103 |
wp_handle_upload( $upload );
|
145 |
* @author Tareq Hasan
|
146 |
*/
|
147 |
function wpuf_unset_media_tab( $list ) {
|
148 |
+
if ( !current_user_can( 'edit_posts' ) ) {
|
149 |
unset( $list['library'] );
|
150 |
unset( $list['gallery'] );
|
151 |
}
|
168 |
$post_types = get_post_types( $args );
|
169 |
|
170 |
$ignore_post_types = [
|
171 |
+
'attachment', 'revision', 'nav_menu_item',
|
|
|
|
|
172 |
];
|
173 |
|
174 |
foreach ( $post_types as $key => $val ) {
|
175 |
+
if ( in_array( $val, $ignore_post_types ) ) {
|
176 |
+
unset( $post_types[$key] );
|
177 |
}
|
178 |
}
|
179 |
|
194 |
|
195 |
if ( $users ) {
|
196 |
foreach ( $users as $user ) {
|
197 |
+
$list[$user->ID] = $user->user_login;
|
198 |
}
|
199 |
}
|
200 |
|
208 |
*/
|
209 |
function wpuf_get_pages( $post_type = 'page' ) {
|
210 |
$array = [ '' => __( '-- select --', 'wp-user-frontend' ) ];
|
211 |
+
$pages = get_posts( [ 'post_type' => $post_type,
|
212 |
+
'numberposts' => - 1,
|
213 |
+
'no_found_rows' => true,
|
214 |
+
'update_post_meta_cache' => false,
|
215 |
+
'update_post_term_cache' => false
|
216 |
+
] );
|
|
|
|
|
|
|
217 |
|
218 |
if ( $pages ) {
|
219 |
foreach ( $pages as $page ) {
|
241 |
|
242 |
$override = wpuf_get_option( 'override_editlink', 'wpuf_general', 'no' );
|
243 |
|
244 |
+
if ( $override == 'yes' ) {
|
245 |
$url = '';
|
246 |
|
247 |
+
if ( wpuf_get_option( 'enable_post_edit', 'wpuf_dashboard', 'yes' ) == 'yes' ) {
|
248 |
$edit_page = (int) wpuf_get_option( 'edit_page_id', 'wpuf_frontend_posting' );
|
249 |
$url = get_permalink( $edit_page );
|
250 |
|
278 |
*
|
279 |
* @var array
|
280 |
*/
|
281 |
+
public $db_fields = ['parent' => 'parent', 'id' => 'term_id'];
|
|
|
|
|
|
|
282 |
|
283 |
/**
|
284 |
* @see Walker::start_el()
|
294 |
$cat_name = apply_filters( 'list_cats', $category->name, $category );
|
295 |
$output .= "\t<option class=\"level-$depth\" value=\"" . $category->term_id . '"';
|
296 |
|
297 |
+
if ( in_array( $category->term_id, $args['selected'] ) ) {
|
298 |
$output .= ' selected="selected"';
|
299 |
}
|
300 |
|
317 |
class WPUF_Walker_Category_Checklist extends Walker {
|
318 |
public $tree_type = 'category';
|
319 |
|
320 |
+
public $db_fields = ['parent' => 'parent', 'id' => 'term_id']; //TODO: decouple this
|
|
|
|
|
|
|
321 |
|
322 |
public function start_lvl( &$output, $depth = 0, $args = [] ) {
|
323 |
$indent = str_repeat( "\t", $depth );
|
330 |
}
|
331 |
|
332 |
public function start_el( &$output, $category, $depth = 0, $args = [], $current_object_id = 0 ) {
|
333 |
+
extract( $args );
|
334 |
|
335 |
if ( empty( $taxonomy ) ) {
|
336 |
$taxonomy = 'category';
|
337 |
}
|
338 |
|
339 |
+
if ( $taxonomy == 'category' ) {
|
340 |
$name = 'category';
|
341 |
} else {
|
342 |
$name = $taxonomy;
|
349 |
}
|
350 |
|
351 |
$class = isset( $args['class'] ) ? $args['class'] : '';
|
352 |
+
$output .= "\n<li class='" . $inline_class . "' id='{$taxonomy}-{$category->term_id}'>" . '<label class="selectit"><input class="' . $class . '" value="' . $category->term_id . '" type="checkbox" name="' . $name . '[]" id="in-' . $taxonomy . '-' . $category->term_id . '"' . checked( in_array( $category->term_id, $args['selected_cats'] ), true, false ) . disabled( empty( $args['disabled'] ), false, false ) . ' /> ' . esc_html( apply_filters( 'the_category', $category->name ) ) . '</label>';
|
353 |
}
|
354 |
|
355 |
public function end_el( &$output, $category, $depth = 0, $args = [] ) {
|
364 |
* @param array $selected_cats
|
365 |
*
|
366 |
* @since 0.8
|
367 |
+
*
|
368 |
*/
|
369 |
function wpuf_category_checklist( $post_id = 0, $selected_cats = false, $attr = [], $class = null ) {
|
370 |
require_once ABSPATH . '/wp-admin/includes/template.php';
|
396 |
$tax_args = [
|
397 |
'taxonomy' => $tax,
|
398 |
'hide_empty' => false,
|
399 |
+
$exclude['type'] => ( $exclude_type == 'child_of' ) ? $exclude['childs'] : $attr['exclude'],
|
400 |
'orderby' => isset( $attr['orderby'] ) ? $attr['orderby'] : 'name',
|
401 |
'order' => isset( $attr['order'] ) ? $attr['order'] : 'ASC',
|
402 |
];
|
406 |
|
407 |
echo wp_kses_post( '<ul class="wpuf-category-checklist">' );
|
408 |
printf( '<input type="hidden" name="%s" value="0" />', esc_attr( $tax ) );
|
409 |
+
echo wp_kses( call_user_func_array( [ &$walker, 'walk' ], [ $categories, 0, $args ] ), [
|
410 |
+
'li' => [
|
411 |
+
'class' => []
|
412 |
+
],
|
413 |
+
'label' => [
|
414 |
+
'class' => []
|
415 |
+
],
|
416 |
+
'input' => [
|
417 |
+
'class' => [],
|
418 |
+
'type' => [],
|
419 |
+
'value' => [],
|
420 |
+
'name' => [],
|
421 |
+
'id' => [],
|
422 |
+
'checked' => [],
|
423 |
+
],
|
424 |
+
'ul' => [
|
425 |
+
'class' => []
|
|
|
|
|
426 |
]
|
427 |
+
] );
|
428 |
echo wp_kses_post( '</ul>' );
|
429 |
}
|
430 |
|
442 |
$attributes = $field_settings['exclude'];
|
443 |
$child_ids = [];
|
444 |
|
445 |
+
if ( !empty( $attributes ) ) {
|
446 |
foreach ( $attributes as $attr ) {
|
447 |
+
$terms = get_terms( 'category', array(
|
448 |
+
'hide_empty' => false,
|
449 |
+
'parent' => $attr
|
450 |
+
) );
|
|
|
|
|
|
|
451 |
|
452 |
foreach ( $terms as $term ) {
|
453 |
array_push( $child_ids, $term->term_id );
|
460 |
}
|
461 |
|
462 |
$excludes = [
|
463 |
+
'type' => $exclude_type,
|
464 |
+
'childs' => $child_ids
|
465 |
];
|
466 |
|
467 |
return $excludes;
|
484 |
$image_sizes = [];
|
485 |
|
486 |
foreach ( $image_sizes_orig as $size ) {
|
487 |
+
$image_sizes[$size] = $size;
|
488 |
}
|
489 |
|
490 |
return $image_sizes;
|
492 |
|
493 |
function wpuf_allowed_extensions() {
|
494 |
$extesions = [
|
495 |
+
'images' => ['ext' => 'jpg,jpeg,gif,png,bmp', 'label' => __( 'Images', 'wp-user-frontend' )],
|
496 |
+
'audio' => ['ext' => 'mp3,wav,ogg,wma,mka,m4a,ra,mid,midi', 'label' => __( 'Audio', 'wp-user-frontend' )],
|
497 |
+
'video' => ['ext' => 'avi,divx,flv,mov,ogv,mkv,mp4,m4v,divx,mpg,mpeg,mpe', 'label' => __( 'Videos', 'wp-user-frontend' )],
|
498 |
+
'pdf' => ['ext' => 'pdf', 'label' => __( 'PDF', 'wp-user-frontend' )],
|
499 |
+
'office' => ['ext' => 'doc,ppt,pps,xls,mdb,docx,xlsx,pptx,odt,odp,ods,odg,odc,odb,odf,rtf,txt', 'label' => __( 'Office Documents', 'wp-user-frontend' )],
|
500 |
+
'zip' => ['ext' => 'zip,gz,gzip,rar,7z', 'label' => __( 'Zip Archives', 'wp-user-frontend' )],
|
501 |
+
'exe' => ['ext' => 'exe', 'label' => __( 'Executable Files', 'wp-user-frontend' )],
|
502 |
+
'csv' => ['ext' => 'csv', 'label' => __( 'CSV', 'wp-user-frontend' )],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
503 |
];
|
504 |
|
505 |
return apply_filters( 'wpuf_allowed_extensions', $extesions );
|
516 |
$user = wp_get_current_user();
|
517 |
|
518 |
if ( is_user_logged_in() ) {
|
519 |
+
$lock = ( $user->wpuf_postlock == 'yes' ) ? 'yes' : 'no';
|
520 |
|
521 |
+
if ( $lock == 'yes' ) {
|
522 |
return $user->wpuf_lock_cause;
|
523 |
}
|
524 |
}
|
553 |
* @param array args
|
554 |
*/
|
555 |
function wpuf_update_post( $args ) {
|
556 |
+
if ( !wp_is_post_revision( $args['ID'] ) ) {
|
557 |
// unhook this function so it doesn't loop infinitely
|
558 |
remove_action( 'save_post', [ WPUF_Admin_Posting::init(), 'save_meta' ], 1 );
|
559 |
|
575 |
* @return array
|
576 |
*/
|
577 |
function wpuf_get_user_roles() {
|
578 |
+
global $wp_roles;
|
579 |
+
|
580 |
+
if ( !isset( $wp_roles ) ) {
|
581 |
+
$wp_roles = new WP_Roles();
|
|
|
582 |
}
|
583 |
|
584 |
return $wp_roles->get_names();
|
661 |
if ( is_numeric( $id_or_email ) ) {
|
662 |
$user = get_user_by( 'id', $id_or_email );
|
663 |
} elseif ( is_object( $id_or_email ) ) {
|
664 |
+
if ( $id_or_email->user_id != '0' ) {
|
665 |
$user = get_user_by( 'id', $id_or_email->user_id );
|
666 |
} else {
|
667 |
return $avatar;
|
737 |
|
738 |
$editor = wp_get_image_editor( $file_path );
|
739 |
|
740 |
+
if ( !is_wp_error( $editor ) ) {
|
741 |
$avatar_size = wpuf_get_option( 'avatar_size', 'wpuf_profile', '100x100' );
|
742 |
$avatar_size = explode( 'x', $avatar_size );
|
743 |
$avatar_width = $avatar_size[0];
|
756 |
// delete any previous avatar
|
757 |
$prev_avatar = get_user_meta( $user_id, 'user_avatar', true );
|
758 |
|
759 |
+
if ( !empty( $prev_avatar ) ) {
|
760 |
$prev_avatar_path = str_replace( $upload_dir['baseurl'], $upload_dir['basedir'], $prev_avatar );
|
761 |
|
762 |
if ( file_exists( $prev_avatar_path ) ) {
|
782 |
$return = [];
|
783 |
|
784 |
foreach ( $gateways as $id => $gate ) {
|
785 |
+
if ( $context == 'admin' ) {
|
786 |
+
$return[$id] = $gate['admin_label'];
|
787 |
} else {
|
788 |
+
$return[$id] = [
|
789 |
'label' => $gate['checkout_label'],
|
790 |
'icon' => isset( $gate['icon'] ) ? $gate['icon'] : '',
|
791 |
];
|
812 |
function wpuf_show_custom_fields( $content ) {
|
813 |
global $post;
|
814 |
|
815 |
+
$show_custom = wpuf_get_option( 'cf_show_front', 'wpuf_frontend_posting' );
|
816 |
|
817 |
+
if ( $show_custom != 'on' ) {
|
818 |
return $content;
|
819 |
}
|
820 |
|
822 |
$form_id = get_post_meta( $post->ID, '_wpuf_form_id', true );
|
823 |
$form_settings = wpuf_get_form_settings( $form_id );
|
824 |
|
825 |
+
if ( !$form_id ) {
|
826 |
return $content;
|
827 |
}
|
828 |
|
834 |
if ( $form_vars ) {
|
835 |
foreach ( $form_vars as $attr ) {
|
836 |
// get column field input fields
|
837 |
+
if ( $attr['input_type'] == 'column_field' ) {
|
838 |
$inner_fields = $attr['inner_fields'];
|
839 |
|
840 |
foreach ( $inner_fields as $column_key => $column_fields ) {
|
841 |
+
if ( !empty( $column_fields ) ) {
|
842 |
// ignore section break and HTML input type
|
843 |
foreach ( $column_fields as $column_field_key => $column_field ) {
|
844 |
+
if ( isset( $column_field['show_in_post'] ) && $column_field['show_in_post'] == 'yes' ) {
|
845 |
$meta[] = $column_field;
|
846 |
}
|
847 |
}
|
850 |
continue;
|
851 |
}
|
852 |
|
853 |
+
if ( isset( $attr['show_in_post'] ) && $attr['show_in_post'] == 'yes' ) {
|
854 |
$meta[] = $attr;
|
855 |
}
|
856 |
}
|
857 |
|
858 |
+
if ( !$meta ) {
|
859 |
return $content;
|
860 |
}
|
861 |
|
862 |
foreach ( $meta as $attr ) {
|
863 |
$wpuf_field = wpuf()->fields->get_field( $attr['template'] );
|
864 |
|
865 |
+
if ( !isset( $attr['name'] ) ) {
|
866 |
$attr['name'] = $attr['input_type'];
|
867 |
}
|
868 |
|
871 |
|
872 |
$return_for_no_cond = 0;
|
873 |
|
874 |
+
if ( isset( $attr['wpuf_cond']['condition_status'] ) && $attr['wpuf_cond']['condition_status'] == 'yes' ) {
|
875 |
foreach ( $attr['wpuf_cond']['cond_field'] as $field_key => $cond_field_name ) {
|
876 |
|
877 |
//check if the conditional field is a taxonomy
|
884 |
$cond_field_value[] = $term_array->term_id;
|
885 |
}
|
886 |
}
|
887 |
+
$cond_field_value = isset($post_terms[0]) ? $post_terms[0]->term_id : '';
|
888 |
} else {
|
889 |
$cond_field_value = get_post_meta( $post->ID, $cond_field_name, 'true' );
|
890 |
}
|
891 |
|
892 |
+
if ( isset( $attr['wpuf_cond']['cond_option'][$field_key] ) ) {
|
893 |
if ( is_array( $cond_field_value ) ) {
|
894 |
continue;
|
895 |
} else {
|
896 |
+
if ( $attr['wpuf_cond']['cond_option'][$field_key] != $cond_field_value ) {
|
897 |
$return_for_no_cond = 1;
|
898 |
} else {
|
899 |
$return_for_no_cond = 0;
|
904 |
}
|
905 |
}
|
906 |
|
907 |
+
if ( $return_for_no_cond == 1 ) {
|
908 |
continue;
|
909 |
}
|
910 |
|
911 |
+
if ( !count( $field_value ) ) {
|
912 |
continue;
|
913 |
}
|
914 |
|
915 |
+
if ( $attr['input_type'] == 'hidden' ) {
|
916 |
continue;
|
917 |
}
|
918 |
|
924 |
switch ( $attr['input_type'] ) {
|
925 |
case 'image_upload':
|
926 |
case 'file_upload':
|
927 |
+
$image_html = '<li style="list-style-type:none;">';
|
928 |
|
929 |
+
if ( $hide_label == 'no' ) {
|
930 |
$image_html .= '<label>' . $attr['label'] . ':</label> ';
|
931 |
}
|
932 |
|
940 |
}
|
941 |
|
942 |
foreach ( $field_value as $attachment_id ) {
|
943 |
+
if ( $attr['input_type'] == 'image_upload' ) {
|
944 |
$image_size = wpuf_get_option( 'insert_photo_size', 'wpuf_frontend_posting', 'thumbnail' );
|
945 |
$thumb = wp_get_attachment_image( $attachment_id, $image_size );
|
946 |
} else {
|
958 |
$allowed_video_extensions = explode( ',', $wpuf_allowed_extensions['video']['ext'] );
|
959 |
$allowed_extenstions = array_merge( $allowed_audio_extensions, $allowed_video_extensions );
|
960 |
|
961 |
+
if ( $playable == 'yes' && in_array( $extension, $allowed_extenstions ) ) {
|
962 |
+
$is_video = in_array( $extension, $allowed_video_extensions );
|
963 |
+
$is_audio = in_array( $extension, $allowed_audio_extensions );
|
964 |
$preview_width = isset( $attr['preview_width'] ) ? $attr['preview_width'] : '123';
|
965 |
$preview_height = isset( $attr['preview_height'] ) ? $attr['preview_height'] : '456';
|
966 |
|
979 |
$image_html .= sprintf( '<a href="%s">%s</a> ', $full_size, $thumb );
|
980 |
}
|
981 |
|
982 |
+
if ( $show_caption == 'on' ) {
|
983 |
$post_detail = get_post( $attachment_id );
|
984 |
|
985 |
+
if ( !empty( $post_detail->post_title ) ) {
|
986 |
$image_html .= '<br /><label>' . __( 'Title', 'wp-user-frontend' ) . ':</label> <span class="image_title">' . esc_html( $post_detail->post_title ) . '</span>';
|
987 |
}
|
988 |
|
989 |
+
if ( !empty( $post_detail->post_excerpt ) ) {
|
990 |
$image_html .= '<br /><label>' . __( 'Caption', 'wp-user-frontend' ) . ':</label> <span class="image_caption">' . esc_html( $post_detail->post_excerpt ) . '</span>';
|
991 |
}
|
992 |
|
993 |
+
if ( !empty( $post_detail->post_content ) ) {
|
994 |
$image_html .= '<br /><label>' . __( 'Description', 'wp-user-frontend' ) . ':</label> <span class="image_description">' . esc_html( $post_detail->post_content ) . '</span>';
|
995 |
}
|
996 |
}
|
1012 |
<div>
|
1013 |
<a class="btn btn-brand btn-sm" href="https://www.google.com/maps/dir/?api=1&destination=<?php echo esc_attr( $def_lat ); ?>,<?php echo esc_attr( $def_long ); ?>" target="_blank" rel="nofollow external"><?php esc_html_e( 'Directions »', 'wp-user-frontend' ); ?></a>
|
1014 |
</div>
|
1015 |
+
<?php
|
1016 |
}
|
1017 |
|
1018 |
$html .= ob_get_clean();
|
1025 |
|
1026 |
if ( isset( $field_value[0] ) && is_array( $field_value[0] ) ) {
|
1027 |
foreach ( $field_value[0] as $field_key => $value ) {
|
1028 |
+
if ( $field_key == 'country_select' ) {
|
1029 |
+
if ( isset( $countries[$value] ) ) {
|
1030 |
+
$value = $countries[$value];
|
1031 |
}
|
1032 |
}
|
1033 |
|
1034 |
$address_html .= '<li>';
|
1035 |
|
1036 |
+
if ( $hide_label == 'no' ) {
|
1037 |
+
$address_html .= '<label>' . $attr['address'][$field_key]['label'] . ': </label> ';
|
1038 |
}
|
1039 |
|
1040 |
$address_html .= ' ' . $value . '</li>';
|
1059 |
if ( $new ) {
|
1060 |
$html .= '<li>';
|
1061 |
|
1062 |
+
if ( $hide_label == 'no' ) {
|
1063 |
$html .= '<label>' . $attr['label'] . ': </label>';
|
1064 |
}
|
1065 |
|
1074 |
break;
|
1075 |
}
|
1076 |
|
1077 |
+
if ( $attr['template'] == 'embed' ) {
|
1078 |
global $wp_embed;
|
1079 |
|
1080 |
$preview_width = isset( $attr['preview_width'] ) ? $attr['preview_width'] : '123';
|
1081 |
$preview_height = isset( $attr['preview_height'] ) ? $attr['preview_height'] : '456';
|
1082 |
$shortcode = '[embed width="' . $preview_width . '" height="' . $preview_height . '"]' . $value . '[/embed]';
|
1083 |
|
1084 |
+
$preview = '<li>';
|
1085 |
|
1086 |
+
if ( $hide_label == 'no' ) {
|
1087 |
$preview .= sprintf( '<label>%s: </label>', $attr['label'] );
|
1088 |
}
|
1089 |
|
1096 |
break;
|
1097 |
}
|
1098 |
|
1099 |
+
$open_in = $attr['open_window'] == 'same' ? '' : '_blank';
|
1100 |
|
1101 |
+
$link = '<li>';
|
1102 |
|
1103 |
+
if ( $hide_label == 'no' ) {
|
1104 |
$link .= '<label>' . $attr['label'] . ':</label>';
|
1105 |
}
|
1106 |
|
1114 |
|
1115 |
$html .= '<li>';
|
1116 |
|
1117 |
+
if ( $hide_label == 'no' ) {
|
1118 |
$html .= '<label>' . $attr['label'] . ':</label>';
|
1119 |
}
|
1120 |
|
1132 |
|
1133 |
$html .= '<li>';
|
1134 |
|
1135 |
+
if ( $hide_label == 'no' ) {
|
1136 |
$html .= '<label>' . $attr['label'] . ':</label>';
|
1137 |
}
|
1138 |
|
1144 |
$filter_html = apply_filters( 'wpuf_custom_field_render', '', $value, $attr, $form_settings );
|
1145 |
$separator = ' | ';
|
1146 |
|
1147 |
+
if ( !empty( $filter_html ) ) {
|
1148 |
$html .= $filter_html;
|
1149 |
} elseif ( is_serialized( $value[0] ) ) {
|
1150 |
$new = maybe_unserialize( $value[0] );
|
1153 |
if ( $modified_value ) {
|
1154 |
$html .= '<li>';
|
1155 |
|
1156 |
+
if ( $hide_label == 'no' ) {
|
1157 |
$html .= '<label>' . $attr['label'] . ':</label>';
|
1158 |
}
|
1159 |
|
1160 |
$html .= sprintf( ' %s</li>', make_clickable( $modified_value ) );
|
1161 |
}
|
1162 |
+
} elseif ( ( $attr['input_type'] == 'checkbox' || $attr['input_type'] == 'multiselect' ) && is_array( $value[0] ) ) {
|
1163 |
+
if ( !empty( $value[0] ) ) {
|
1164 |
$modified_value = implode( $separator, $value[0] );
|
1165 |
|
1166 |
if ( $modified_value ) {
|
1167 |
$html .= '<li>';
|
1168 |
|
1169 |
+
if ( $hide_label == 'no' ) {
|
1170 |
$html .= '<label>' . $attr['label'] . ':</label>';
|
1171 |
}
|
1172 |
|
1179 |
if ( $new ) {
|
1180 |
$html .= '<li>';
|
1181 |
|
1182 |
+
if ( $hide_label == 'no' ) {
|
1183 |
$html .= '<label>' . $attr['label'] . ':</label>';
|
1184 |
}
|
1185 |
|
1207 |
* @param array $args
|
1208 |
*/
|
1209 |
function wpuf_shortcode_map( $location, $post_id = null, $args = [], $meta_key = '' ) {
|
1210 |
+
if ( !wpuf()->is_pro() || !$location ) {
|
1211 |
return;
|
1212 |
}
|
1213 |
|
1220 |
return;
|
1221 |
}
|
1222 |
|
1223 |
+
$default = ['width' => 450, 'height' => 250, 'zoom' => 12];
|
|
|
|
|
|
|
|
|
1224 |
$args = wp_parse_args( $args, $default );
|
1225 |
|
1226 |
if ( is_array( $location ) ) {
|
1232 |
list( $def_lat, $def_long ) = explode( ',', $location );
|
1233 |
$def_lat = $def_lat ? $def_lat : 0;
|
1234 |
$def_long = $def_long ? $def_long : 0;
|
1235 |
+
} ?>
|
|
|
1236 |
|
1237 |
<div class="google-map" style="margin: 10px 0; height: <?php echo esc_attr( $args['height'] ); ?>px; width: <?php echo esc_attr( $args['width'] ); ?>px;" id="wpuf-map-<?php echo esc_attr( $meta_key . $post->ID ); ?>"></div>
|
1238 |
|
1281 |
function wpuf_shortcode_map_post( $meta_key, $post_id = null, $args = [] ) {
|
1282 |
global $post;
|
1283 |
|
1284 |
+
if ( !$post_id ) {
|
1285 |
$post_id = $post->ID;
|
1286 |
}
|
1287 |
|
1292 |
function wpuf_meta_shortcode( $atts ) {
|
1293 |
global $post;
|
1294 |
|
1295 |
+
extract( shortcode_atts( [
|
1296 |
+
'name' => '',
|
1297 |
+
'type' => 'normal',
|
1298 |
+
'size' => 'thumbnail',
|
1299 |
+
'height' => 250,
|
1300 |
+
'width' => 450,
|
1301 |
+
'zoom' => 12,
|
1302 |
+
], $atts ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1303 |
|
1304 |
if ( empty( $name ) ) {
|
1305 |
return;
|
1306 |
}
|
1307 |
|
1308 |
+
if ( $type == 'image' || $type == 'file' ) {
|
1309 |
$images = get_post_meta( $post->ID, $name, true );
|
1310 |
|
1311 |
if ( ! is_array( $images ) ) {
|
1316 |
$html = '';
|
1317 |
|
1318 |
foreach ( $images as $attachment_id ) {
|
1319 |
+
if ( $type == 'image' ) {
|
1320 |
$thumb = wp_get_attachment_image( $attachment_id, $size );
|
1321 |
} else {
|
1322 |
$thumb = get_post_field( 'post_title', $attachment_id );
|
1328 |
|
1329 |
return $html;
|
1330 |
}
|
1331 |
+
} elseif ( $type == 'map' ) {
|
1332 |
ob_start();
|
1333 |
+
wpuf_shortcode_map( $name, $post->ID, ['width' => $width, 'height' => $height, 'zoom' => $zoom ] );
|
|
|
|
|
|
|
|
|
|
|
|
|
1334 |
|
1335 |
return ob_get_clean();
|
1336 |
+
} elseif ( $type == 'repeat' ) {
|
1337 |
return implode( '; ', get_post_meta( $post->ID, $name ) );
|
1338 |
+
} elseif ( $type == 'normal' ) {
|
1339 |
return implode( ', ', get_post_meta( $post->ID, $name ) );
|
1340 |
} else {
|
1341 |
return make_clickable( implode( ', ', get_post_meta( $post->ID, $name ) ) );
|
1356 |
function wpuf_get_option( $option, $section, $default = '' ) {
|
1357 |
$options = get_option( $section );
|
1358 |
|
1359 |
+
if ( isset( $options[$option] ) ) {
|
1360 |
+
return $options[$option];
|
1361 |
}
|
1362 |
|
1363 |
return $default;
|
1364 |
}
|
1365 |
|
1366 |
/**
|
1367 |
+
* check the current post for the existence of a short code
|
1368 |
*
|
1369 |
* @see http://wp.tutsplus.com/articles/quick-tip-improving-shortcodes-with-the-has_shortcode-function/
|
1370 |
*
|
1373 |
* @return bool
|
1374 |
*/
|
1375 |
function wpuf_has_shortcode( $shortcode = '', $post_id = false ) {
|
1376 |
+
$post_to_check = ( $post_id == false ) ? get_post( get_the_ID() ) : get_post( $post_id );
|
1377 |
|
1378 |
+
if ( !$post_to_check ) {
|
1379 |
return false;
|
1380 |
}
|
1381 |
|
1383 |
$found = false;
|
1384 |
|
1385 |
// if no short code was provided, return false
|
1386 |
+
if ( !$shortcode ) {
|
1387 |
return $found;
|
1388 |
}
|
1389 |
|
1414 |
$attachment_id = false;
|
1415 |
|
1416 |
// If there is no url, return.
|
1417 |
+
if ( '' == $attachment_url ) {
|
1418 |
return;
|
1419 |
}
|
1420 |
|
1431 |
$attachment_url = str_replace( $upload_dir_paths['baseurl'] . '/', '', $attachment_url );
|
1432 |
|
1433 |
// Finally, run a custom database query to get the attachment ID from the modified attachment URL
|
1434 |
+
$attachment_id = $wpdb->get_var( $wpdb->prepare( "SELECT wposts.ID FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta WHERE wposts.ID = wpostmeta.post_id AND wpostmeta.meta_key = '_wp_attached_file' AND wpostmeta.meta_value = '%s' AND wposts.post_type = 'attachment'", $attachment_url ) );
|
1435 |
}
|
1436 |
|
1437 |
return $attachment_id;
|
1448 |
global $wpdb;
|
1449 |
|
1450 |
$taxonomy = isset( $_GET['tax'] ) ? sanitize_text_field( wp_unslash( $_GET['tax'] ) ) : '';
|
1451 |
+
$term_ids = isset( $_GET['term_ids'] ) ? sanitize_text_field( $_GET['term_ids'] ) : '';
|
1452 |
$tax = get_taxonomy( $taxonomy );
|
1453 |
|
1454 |
+
if ( !$tax ) {
|
1455 |
wp_die( 0 );
|
1456 |
}
|
1457 |
|
1465 |
|
1466 |
if ( false !== strpos( $s, ',' ) ) {
|
1467 |
$s = explode( ',', $s );
|
1468 |
+
$s = $s[count( $s ) - 1];
|
1469 |
}
|
1470 |
|
1471 |
$s = trim( $s );
|
1474 |
wp_die();
|
1475 |
} // require 2 chars for matching
|
1476 |
|
1477 |
+
|
1478 |
+
|
1479 |
if ( ! empty( $term_ids ) ) {
|
|
|
1480 |
$results = $wpdb->get_col( $wpdb->prepare( "SELECT t.name FROM $wpdb->term_taxonomy AS tt INNER JOIN $wpdb->terms AS t ON tt.term_id = t.term_id WHERE tt.taxonomy = %s AND t.term_id IN ($term_ids) AND t.name LIKE (%s)", $taxonomy, '%' . $wpdb->esc_like( $s ) . '%' ) );
|
1481 |
} else {
|
1482 |
$results = $wpdb->get_col( $wpdb->prepare( "SELECT t.name FROM $wpdb->term_taxonomy AS tt INNER JOIN $wpdb->terms AS t ON tt.term_id = t.term_id WHERE tt.taxonomy = %s AND t.name LIKE (%s)", $taxonomy, '%' . $wpdb->esc_like( $s ) . '%' ) );
|
1483 |
}
|
1484 |
+
|
1485 |
+
|
1486 |
echo esc_html( join( $results, "\n" ) );
|
1487 |
wp_die();
|
1488 |
}
|
1519 |
* @param string $file file name or path to file
|
1520 |
*/
|
1521 |
function wpuf_load_template( $file, $args = [] ) {
|
1522 |
+
if ( $args && is_array( $args ) ) {
|
1523 |
+
extract( $args );
|
1524 |
+
}
|
1525 |
+
|
1526 |
$child_theme_dir = get_stylesheet_directory() . '/wpuf/';
|
1527 |
$parent_theme_dir = get_template_directory() . '/wpuf/';
|
1528 |
$wpuf_dir = WPUF_ROOT . '/templates/';
|
1547 |
* @param string $file file name or path to file
|
1548 |
*/
|
1549 |
function wpuf_load_pro_template( $file, $args = [] ) {
|
1550 |
+
if ( $args && is_array( $args ) ) {
|
1551 |
+
extract( $args );
|
1552 |
+
}
|
1553 |
+
|
1554 |
if ( wpuf()->is_pro() ) {
|
1555 |
$child_theme_dir = get_stylesheet_directory() . '/wpuf/';
|
1556 |
$parent_theme_dir = get_template_directory() . '/wpuf/';
|
1627 |
* @return array
|
1628 |
*/
|
1629 |
function wpuf_get_form_fields( $form_id ) {
|
1630 |
+
$fields = get_children( [
|
1631 |
+
'post_parent' => $form_id,
|
1632 |
+
'post_status' => 'publish',
|
1633 |
+
'post_type' => 'wpuf_input',
|
1634 |
+
'numberposts' => '-1',
|
1635 |
+
'orderby' => 'menu_order',
|
1636 |
+
'order' => 'ASC',
|
1637 |
+
] );
|
|
|
|
|
1638 |
|
1639 |
$form_fields = [];
|
1640 |
|
1646 |
// Add inline property for radio and checkbox fields
|
1647 |
$inline_supported_fields = [ 'radio', 'checkbox' ];
|
1648 |
|
1649 |
+
if ( in_array( $field['input_type'], $inline_supported_fields ) ) {
|
1650 |
+
if ( !isset( $field['inline'] ) ) {
|
1651 |
$field['inline'] = 'no';
|
1652 |
}
|
1653 |
}
|
1655 |
// Add 'selected' property
|
1656 |
$option_based_fields = [ 'select', 'multiselect', 'radio', 'checkbox' ];
|
1657 |
|
1658 |
+
if ( in_array( $field['input_type'], $option_based_fields ) ) {
|
1659 |
+
if ( !isset( $field['selected'] ) ) {
|
1660 |
if ( 'select' === $field['input_type'] || 'radio' === $field['input_type'] ) {
|
1661 |
$field['selected'] = '';
|
1662 |
} else {
|
1666 |
}
|
1667 |
|
1668 |
// Add 'multiple' key for input_type:repeat
|
1669 |
+
if ( 'repeat' === $field['input_type'] && !isset( $field['multiple'] ) ) {
|
1670 |
$field['multiple'] = '';
|
1671 |
}
|
1672 |
|
1688 |
* Returns child category dropdown on ajax request
|
1689 |
*/
|
1690 |
function wpuf_get_child_cats() {
|
1691 |
+
|
1692 |
$nonce = isset( $_REQUEST['_wpnonce'] ) ? sanitize_key( wp_unslash( $_REQUEST['_wpnonce'] ) ) : '';
|
1693 |
|
1694 |
+
$parentCat = isset( $_POST['catID'] ) ? sanitize_text_field( wp_unslash( $_POST['catID'] ) ) : '';
|
1695 |
+
$field_attr = isset( $_POST['field_attr'] ) ? array_map('sanitize_text_field', wp_unslash( $_POST['field_attr'] ) ) : [];
|
1696 |
|
1697 |
+
if ( isset( $nonce ) && ! wp_verify_nonce( $nonce, 'wpuf_nonce' ) ) {
|
1698 |
|
1699 |
+
}
|
1700 |
$allowed_tags = wp_kses_allowed_html( 'post' );
|
1701 |
|
1702 |
+
|
1703 |
+
$taxonomy = $field_attr['name'];
|
1704 |
|
1705 |
$terms = null;
|
1706 |
$result = '';
|
1707 |
|
1708 |
+
if ( $parentCat < 1 ) {
|
1709 |
die( wp_kses( $result, $allowed_tags ) );
|
1710 |
}
|
1711 |
|
1712 |
+
if ( $terms = get_categories( 'taxonomy=' . $taxonomy . '&child_of=' . $parentCat . '&hide_empty=0' ) ) {
|
1713 |
+
$field_attr['parent_cat'] = $parentCat;
|
|
|
|
|
1714 |
|
1715 |
if ( is_array( $terms ) ) {
|
1716 |
foreach ( $terms as $key => $term ) {
|
1717 |
+
$terms[$key] = (array) $term;
|
1718 |
}
|
1719 |
}
|
1720 |
|
1721 |
+
$field_attr[ 'form_id' ] = isset( $_POST['form_id'] ) ? absint( $_POST['form_id'] ) : 0;
|
1722 |
|
1723 |
$result .= taxnomy_select( '', $field_attr );
|
1724 |
+
|
1725 |
} else {
|
1726 |
die( '' );
|
1727 |
}
|
1735 |
$exclude_type = isset( $attr['exclude_type'] ) ? $attr['exclude_type'] : 'exclude';
|
1736 |
$exclude = isset( $attr['exclude'] ) ? $attr['exclude'] : '';
|
1737 |
|
1738 |
+
$dataset = sprintf(
|
1739 |
'data-required="%s" data-type="select" data-form-id="%d"',
|
1740 |
$attr['required'],
|
1741 |
$attr['form_id']
|
1742 |
+
);
|
1743 |
|
1744 |
+
if ( $exclude_type == 'child_of' && !empty( $exclude ) ) {
|
1745 |
$exclude = $exclude[0];
|
1746 |
}
|
1747 |
|
1748 |
+
$tax_args = [
|
1749 |
'show_option_none' => __( '-- Select --', 'wp-user-frontend' ),
|
1750 |
'hierarchical' => 1,
|
1751 |
'hide_empty' => 0,
|
1777 |
//'last_term_id' => isset( $attr['parent_cat'] ) ? $attr['parent_cat'] : '',
|
1778 |
//'term_id' => $selected
|
1779 |
];
|
1780 |
+
$attr = apply_filters( 'wpuf_taxonomy_checklist_args', $attr ); ?>
|
|
|
1781 |
<span data-taxonomy=<?php echo json_encode( $attr ); ?>></span>
|
1782 |
<?php
|
1783 |
}
|
1804 |
* @return array
|
1805 |
*/
|
1806 |
function wpuf_get_form_notifications( $form_id ) {
|
1807 |
+
$notifications = get_post_meta( $form_id, 'notifications', true );
|
1808 |
|
1809 |
+
if ( !$notifications ) {
|
1810 |
return [];
|
1811 |
}
|
1812 |
|
1823 |
* @return array
|
1824 |
*/
|
1825 |
function wpuf_get_form_integrations( $form_id ) {
|
1826 |
+
$integrations = get_post_meta( $form_id, 'integrations', true );
|
1827 |
|
1828 |
+
if ( !$integrations ) {
|
1829 |
return [];
|
1830 |
}
|
1831 |
|
1845 |
function wpuf_is_integration_active( $form_id, $integration_id ) {
|
1846 |
$integrations = wpuf_get_form_integrations( $form_id );
|
1847 |
|
1848 |
+
if ( !$integrations ) {
|
1849 |
return false;
|
1850 |
}
|
1851 |
|
1852 |
foreach ( $integrations as $id => $integration ) {
|
1853 |
+
if ( $integration_id == $id && $integration->enabled == true ) {
|
1854 |
return $integration;
|
1855 |
}
|
1856 |
}
|
1872 |
/**
|
1873 |
* Clear the buffer
|
1874 |
*
|
1875 |
+
* prevents ajax breakage and endless loading icon. A LIFE SAVER!!!
|
1876 |
*
|
1877 |
* @return void
|
1878 |
*/
|
1890 |
function wpuf_is_license_expired() {
|
1891 |
$remote_addr = isset( $_SERVER['REMOTE_ADDR'] ) ? sanitize_text_field( wp_unslash( $_SERVER['REMOTE_ADDR'] ) ) : '';
|
1892 |
|
1893 |
+
if ( in_array( $remote_addr, [ '127.0.0.1', '::1' ] ) ) {
|
1894 |
return false;
|
1895 |
}
|
1896 |
|
1897 |
$license_status = get_option( 'wpuf_license_status' );
|
1898 |
|
1899 |
// seems like this wasn't activated at all
|
1900 |
+
if ( !isset( $license_status->update ) ) {
|
1901 |
return false;
|
1902 |
}
|
1903 |
|
1942 |
function wpuf_get_countries( $type = 'array' ) {
|
1943 |
$countries = include __DIR__ . '/includes/countries-formated.php';
|
1944 |
|
1945 |
+
if ( $type == 'json' ) {
|
1946 |
$countries = json_encode( $countries );
|
1947 |
}
|
1948 |
|
1958 |
*/
|
1959 |
function wpuf_get_account_sections() {
|
1960 |
$account_sections = [
|
1961 |
+
[ 'slug' => 'dashboard', 'label' => __( 'Dashboard', 'wp-user-frontend' ) ],
|
1962 |
+
[ 'slug' => 'posts', 'label' => __( 'Posts', 'wp-user-frontend' ) ],
|
1963 |
+
[ 'slug' => 'edit-profile', 'label' => __( 'Edit Profile', 'wp-user-frontend' ) ],
|
1964 |
+
[ 'slug' => 'subscription', 'label' => __( 'Subscription', 'wp-user-frontend' ) ],
|
1965 |
+
[ 'slug' => 'billing-address', 'label' => __( 'Billing Address', 'wp-user-frontend' ) ],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1966 |
];
|
1967 |
|
1968 |
return apply_filters( 'wpuf_account_sections', $account_sections );
|
1981 |
|
1982 |
if ( $sections ) {
|
1983 |
foreach ( $sections as $section ) {
|
1984 |
+
$array[$section['slug']] = esc_attr( $section['label'] );
|
1985 |
}
|
1986 |
}
|
1987 |
|
2010 |
if ( $args['count'] ) {
|
2011 |
return $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->prefix}wpuf_transaction" );
|
2012 |
}
|
2013 |
+
|
2014 |
$result = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}wpuf_transaction ORDER BY `{$args['orderby']}` {$args['order']} LIMIT {$args['offset']}, {$args['number']}", OBJECT );
|
2015 |
|
2016 |
return $result;
|
2064 |
'status' => 'pending',
|
2065 |
'cost' => $info['price'],
|
2066 |
'tax' => isset( $info['tax'] ) ? $info['tax'] : 0,
|
2067 |
+
'post_id' => ( $info['type'] == 'post' ) ? $info['item_number'] : 0,
|
2068 |
+
'pack_id' => ( $info['type'] == 'pack' ) ? $info['item_number'] : 0,
|
2069 |
'payer_first_name' => $info['user_info']['first_name'],
|
2070 |
'payer_last_name' => $info['user_info']['last_name'],
|
2071 |
'payer_email' => $info['user_info']['email'],
|
2072 |
+
'payment_type' => ( $info['post_data']['wpuf_payment_method'] == 'bank' ) ? 'Bank/Manual' : ucwords( $info['post_data']['wpuf_payment_method'] ),
|
2073 |
'transaction_id' => 0,
|
2074 |
'created' => $info['date'],
|
2075 |
];
|
2089 |
*/
|
2090 |
function wpuf_get_currencies() {
|
2091 |
$currencies = [
|
2092 |
+
[ 'currency' => 'AED', 'label' => __( 'United Arab Emirates Dirham', 'wp-user-frontend' ), 'symbol' => 'د.إ' ],
|
2093 |
+
[ 'currency' => 'AUD', 'label' => __( 'Australian Dollars', 'wp-user-frontend' ), 'symbol' => '$' ],
|
2094 |
+
[ 'currency' => 'AZD', 'label' => __( 'Argentine Peso', 'wp-user-frontend' ), 'symbol' => '$' ],
|
2095 |
+
[ 'currency' => 'BDT', 'label' => __( 'Bangladeshi Taka', 'wp-user-frontend' ), 'symbol' => '৳' ],
|
2096 |
+
[ 'currency' => 'BRL', 'label' => __( 'Brazilian Real', 'wp-user-frontend' ), 'symbol' => 'R$' ],
|
2097 |
+
[ 'currency' => 'BGN', 'label' => __( 'Bulgarian Lev', 'wp-user-frontend' ), 'symbol' => 'лв.' ],
|
2098 |
+
[ 'currency' => 'CAD', 'label' => __( 'Canadian Dollars', 'wp-user-frontend' ), 'symbol' => '$' ],
|
2099 |
+
[ 'currency' => 'CLP', 'label' => __( 'Chilean Peso', 'wp-user-frontend' ), 'symbol' => '$' ],
|
2100 |
+
[ 'currency' => 'CNY', 'label' => __( 'Chinese Yuan', 'wp-user-frontend' ), 'symbol' => '¥' ],
|
2101 |
+
[ 'currency' => 'COP', 'label' => __( 'Colombian Peso', 'wp-user-frontend' ), 'symbol' => '$' ],
|
2102 |
+
[ 'currency' => 'CZK', 'label' => __( 'Czech Koruna', 'wp-user-frontend' ), 'symbol' => 'Kč' ],
|
2103 |
+
[ 'currency' => 'DKK', 'label' => __( 'Danish Krone', 'wp-user-frontend' ), 'symbol' => 'kr.' ],
|
2104 |
+
[ 'currency' => 'DOP', 'label' => __( 'Dominican Peso', 'wp-user-frontend' ), 'symbol' => 'RD$' ],
|
2105 |
+
[ 'currency' => 'DZD', 'label' => __( 'Algerian Dinar', 'wp-user-frontend' ), 'symbol' => 'DA;' ],
|
2106 |
+
[ 'currency' => 'EUR', 'label' => __( 'Euros', 'wp-user-frontend' ), 'symbol' => '€' ],
|
2107 |
+
[ 'currency' => 'HKD', 'label' => __( 'Hong Kong Dollar', 'wp-user-frontend' ), 'symbol' => '$' ],
|
2108 |
+
[ 'currency' => 'HRK', 'label' => __( 'Croatia kuna', 'wp-user-frontend' ), 'symbol' => 'Kn' ],
|
2109 |
+
[ 'currency' => 'HUF', 'label' => __( 'Hungarian Forint', 'wp-user-frontend' ), 'symbol' => 'Ft' ],
|
2110 |
+
[ 'currency' => 'ISK', 'label' => __( 'Icelandic krona', 'wp-user-frontend' ), 'symbol' => 'Kr.' ],
|
2111 |
+
[ 'currency' => 'IDR', 'label' => __( 'Indonesia Rupiah', 'wp-user-frontend' ), 'symbol' => 'Rp' ],
|
2112 |
+
[ 'currency' => 'INR', 'label' => __( 'Indian Rupee', 'wp-user-frontend' ), 'symbol' => '₹' ],
|
2113 |
+
[ 'currency' => 'NPR', 'label' => __( 'Nepali Rupee', 'wp-user-frontend' ), 'symbol' => 'Rs.' ],
|
2114 |
+
[ 'currency' => 'ILS', 'label' => __( 'Israeli Shekel', 'wp-user-frontend' ), 'symbol' => '₪' ],
|
2115 |
+
[ 'currency' => 'JPY', 'label' => __( 'Japanese Yen', 'wp-user-frontend' ), 'symbol' => '¥' ],
|
2116 |
+
[ 'currency' => 'KIP', 'label' => __( 'Lao Kip', 'wp-user-frontend' ), 'symbol' => '₭' ],
|
2117 |
+
[ 'currency' => 'KRW', 'label' => __( 'South Korean Won', 'wp-user-frontend' ), 'symbol' => '₩' ],
|
2118 |
+
[ 'currency' => 'MYR', 'label' => __( 'Malaysian Ringgits', 'wp-user-frontend' ), 'symbol' => 'RM' ],
|
2119 |
+
[ 'currency' => 'MXN', 'label' => __( 'Mexican Peso', 'wp-user-frontend' ), 'symbol' => '$' ],
|
2120 |
+
[ 'currency' => 'NGN', 'label' => __( 'Nigerian Naira', 'wp-user-frontend' ), 'symbol' => '₦' ],
|
2121 |
+
[ 'currency' => 'NOK', 'label' => __( 'Norwegian Krone', 'wp-user-frontend' ), 'symbol' => 'kr' ],
|
2122 |
+
[ 'currency' => 'NZD', 'label' => __( 'New Zealand Dollar', 'wp-user-frontend' ), 'symbol' => '$' ],
|
2123 |
+
[ 'currency' => 'NAD', 'label' => __( 'Namibian dollar', 'wp-user-frontend' ), 'symbol' => 'N$' ],
|
2124 |
+
[ 'currency' => 'OMR', 'label' => __( 'Omani Rial', 'wp-user-frontend' ), 'symbol' => 'ر.ع.' ],
|
2125 |
+
[ 'currency' => 'IRR', 'label' => __( 'Iranian Rial', 'wp-user-frontend' ), 'symbol' => '﷼' ],
|
2126 |
+
[ 'currency' => 'PKR', 'label' => __( 'Pakistani Rupee', 'wp-user-frontend' ), 'symbol' => 'Rs' ],
|
2127 |
+
[ 'currency' => 'PYG', 'label' => __( 'Paraguayan Guaraní', 'wp-user-frontend' ), 'symbol' => '₲' ],
|
2128 |
+
[ 'currency' => 'PHP', 'label' => __( 'Philippine Pesos', 'wp-user-frontend' ), 'symbol' => '₱' ],
|
2129 |
+
[ 'currency' => 'PLN', 'label' => __( 'Polish Zloty', 'wp-user-frontend' ), 'symbol' => 'zł' ],
|
2130 |
+
[ 'currency' => 'GBP', 'label' => __( 'Pounds Sterling', 'wp-user-frontend' ), 'symbol' => '£' ],
|
2131 |
+
[ 'currency' => 'RON', 'label' => __( 'Romanian Leu', 'wp-user-frontend' ), 'symbol' => 'lei' ],
|
2132 |
+
[ 'currency' => 'RUB', 'label' => __( 'Russian Ruble', 'wp-user-frontend' ), 'symbol' => 'руб.' ],
|
2133 |
+
[ 'currency' => 'SR', 'label' => __( 'Saudi Riyal', 'wp-user-frontend' ), 'symbol' => 'SR' ],
|
2134 |
+
[ 'currency' => 'SGD', 'label' => __( 'Singapore Dollar', 'wp-user-frontend' ), 'symbol' => '$' ],
|
2135 |
+
[ 'currency' => 'ZAR', 'label' => __( 'South African rand', 'wp-user-frontend' ), 'symbol' => 'R' ],
|
2136 |
+
[ 'currency' => 'SEK', 'label' => __( 'Swedish Krona', 'wp-user-frontend' ), 'symbol' => 'kr' ],
|
2137 |
+
[ 'currency' => 'CHF', 'label' => __( 'Swiss Franc', 'wp-user-frontend' ), 'symbol' => 'CHF' ],
|
2138 |
+
[ 'currency' => 'TWD', 'label' => __( 'Taiwan New Dollars', 'wp-user-frontend' ), 'symbol' => 'NT$' ],
|
2139 |
+
[ 'currency' => 'THB', 'label' => __( 'Thai Baht', 'wp-user-frontend' ), 'symbol' => '฿' ],
|
2140 |
+
[ 'currency' => 'TRY', 'label' => __( 'Turkish Lira', 'wp-user-frontend' ), 'symbol' => '₺' ],
|
2141 |
+
[ 'currency' => 'USD', 'label' => __( 'US Dollar', 'wp-user-frontend' ), 'symbol' => '$' ],
|
2142 |
+
[ 'currency' => 'VND', 'label' => __( 'Vietnamese Dong', 'wp-user-frontend' ), 'symbol' => '₫' ],
|
2143 |
+
[ 'currency' => 'EGP', 'label' => __( 'Egyptian Pound', 'wp-user-frontend' ), 'symbol' => 'EGP' ],
|
2144 |
+
[ 'currency' => 'JOD', 'label' => __( 'Jordanian dinar', 'wp-user-frontend' ), 'symbol' => 'د.أ' ],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2145 |
];
|
2146 |
|
2147 |
return apply_filters( 'wpuf_currencies', $currencies );
|
2159 |
function wpuf_get_currency( $type = '' ) {
|
2160 |
$currency_code = wpuf_get_option( 'currency', 'wpuf_payment', 'USD' );
|
2161 |
|
2162 |
+
if ( $type == 'code' ) {
|
2163 |
return $currency_code;
|
2164 |
}
|
2165 |
|
2166 |
$currencies = wpuf_get_currencies();
|
2167 |
+
$index = array_search( $currency_code, array_column( $currencies, 'currency' ) );
|
2168 |
$currency = $currencies[ $index ];
|
2169 |
|
2170 |
+
if ( $type == 'symbol' ) {
|
2171 |
return $currency['symbol'];
|
2172 |
}
|
2173 |
|
2186 |
switch ( $currency_pos ) {
|
2187 |
case 'left':
|
2188 |
$format = '%1$s%2$s';
|
2189 |
+
break;
|
2190 |
|
2191 |
case 'right':
|
2192 |
$format = '%2$s%1$s';
|
2193 |
+
break;
|
2194 |
|
2195 |
case 'left_space':
|
2196 |
$format = '%1$s %2$s';
|
2197 |
+
break;
|
2198 |
|
2199 |
case 'right_space':
|
2200 |
$format = '%2$s %1$s';
|
2201 |
+
break;
|
2202 |
}
|
2203 |
|
2204 |
return apply_filters( 'wpuf_price_format', $format, $currency_pos );
|
2263 |
* @return mixed
|
2264 |
*/
|
2265 |
function wpuf_format_price( $price, $formated = true, $args = [] ) {
|
2266 |
+
extract( apply_filters( 'wpuf_price_args', wp_parse_args( $args, [
|
2267 |
+
'currency' => $formated ? wpuf_get_currency( 'symbol' ) : '',
|
2268 |
+
'decimal_separator' => wpuf_get_price_decimal_separator(),
|
2269 |
+
'thousand_separator' => $formated ? wpuf_get_price_thousand_separator() : '',
|
2270 |
+
'decimals' => wpuf_get_price_decimals(),
|
2271 |
+
'price_format' => get_wpuf_price_format(),
|
2272 |
+
] ) ) );
|
2273 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2274 |
$negative = $price < 0;
|
2275 |
$price = apply_filters( 'wpuf_raw_price', floatval( $negative ? $price * -1 : $price ) );
|
2276 |
$price = apply_filters( 'wpuf_formatted_price', number_format( $price, $decimals, $decimal_separator, $thousand_separator ), $price, $decimals, $decimal_separator, $thousand_separator );
|
2289 |
*
|
2290 |
* @since 2.4.3
|
2291 |
*/
|
2292 |
+
if ( !function_exists( 'array_column' ) ) {
|
2293 |
function array_column( $input, $column_key, $index_key = null ) {
|
2294 |
$result = [];
|
2295 |
|
2313 |
function wpuf_duplicate_form( $post_id ) {
|
2314 |
$post = get_post( $post_id );
|
2315 |
|
2316 |
+
if ( !$post ) {
|
2317 |
return;
|
2318 |
}
|
2319 |
|
2332 |
}
|
2333 |
|
2334 |
// update the post title to remove confusion
|
2335 |
+
wp_update_post( [
|
2336 |
+
'ID' => $form_id,
|
2337 |
+
'post_title' => $post->post_title . ' (#' . $form_id . ')',
|
2338 |
+
] );
|
|
|
|
|
2339 |
|
2340 |
if ( $form_id ) {
|
2341 |
$form_settings = wpuf_get_form_settings( $post_id );
|
2394 |
* @return int
|
2395 |
*/
|
2396 |
function wpuf_create_sample_form( $post_title = 'Sample Form', $post_type = 'wpuf_forms', $blank = false ) {
|
2397 |
+
$form_id = wp_insert_post( [
|
2398 |
+
'post_title' => $post_title,
|
2399 |
+
'post_type' => $post_type,
|
2400 |
+
'post_status' => 'publish',
|
2401 |
+
'comment_status' => 'closed',
|
2402 |
+
'post_content' => '',
|
2403 |
+
] );
|
2404 |
+
|
2405 |
+
if ( !$form_id ) {
|
|
|
|
|
2406 |
return false;
|
2407 |
}
|
2408 |
|
2424 |
'placeholder' => '',
|
2425 |
'default' => '',
|
2426 |
'size' => '40',
|
2427 |
+
'wpuf_cond' => [ ],
|
2428 |
],
|
2429 |
[
|
2430 |
'input_type' => 'textarea',
|
2441 |
'default' => '',
|
2442 |
'rich' => 'teeny',
|
2443 |
'insert_image' => 'yes',
|
2444 |
+
'wpuf_cond' => [ ],
|
2445 |
],
|
2446 |
];
|
2447 |
|
2543 |
];
|
2544 |
}
|
2545 |
|
2546 |
+
if ( !empty( $form_fields ) && !$blank ) {
|
2547 |
foreach ( $form_fields as $order => $field ) {
|
2548 |
wpuf_insert_form_field( $form_id, $field, false, $order );
|
2549 |
}
|
2550 |
}
|
2551 |
|
2552 |
+
if ( !empty( $settings ) ) {
|
2553 |
update_post_meta( $form_id, 'wpuf_form_settings', $settings );
|
2554 |
}
|
2555 |
|
2604 |
wp_delete_post( $form_id, $force );
|
2605 |
|
2606 |
// delete form inputs as WP doesn't know the relationship
|
2607 |
+
$wpdb->delete( $wpdb->posts,
|
|
|
2608 |
[
|
2609 |
'post_parent' => $form_id,
|
2610 |
'post_type' => 'wpuf_input',
|
2611 |
]
|
2612 |
+
);
|
2613 |
}
|
2614 |
|
2615 |
/**
|
2622 |
* @return string $post_status
|
2623 |
*/
|
2624 |
function wpuf_get_draft_post_status( $form_settings ) {
|
2625 |
+
|
2626 |
$noce = isset( $_REQUEST['_wpnonce'] ) ? sanitize_key( wp_unslash( $_REQUEST['_wpnonce'] ) ) : '';
|
2627 |
|
2628 |
if ( isset( $nonce ) && ! wp_verify_nonce( $noce, 'wpuf_form_add' ) ) {
|
2629 |
+
return ;
|
2630 |
}
|
2631 |
|
2632 |
$post_status = 'draft';
|
2634 |
$charging_enabled = $current_user->subscription()->current_pack_id();
|
2635 |
$user_wpuf_subscription_pack = get_user_meta( get_current_user_id(), '_wpuf_subscription_pack', true );
|
2636 |
|
2637 |
+
if ( $charging_enabled && !isset( $_POST['post_id'] ) ) {
|
2638 |
+
if ( !empty( $user_wpuf_subscription_pack ) ) {
|
2639 |
if ( $current_user->subscription()->expired() ) {
|
2640 |
$post_status = 'pending';
|
2641 |
}
|
2656 |
* @return array
|
2657 |
*/
|
2658 |
function wpuf_admin_page_states( $state, $post ) {
|
2659 |
+
if ( 'page' != $post->post_type ) {
|
2660 |
return $state;
|
2661 |
}
|
2662 |
|
2665 |
preg_match_all( $pattern, $post->post_content, $matches );
|
2666 |
$matches = array_unique( $matches[0] );
|
2667 |
|
2668 |
+
if ( !empty( $matches ) ) {
|
2669 |
$page = '';
|
2670 |
$shortcode = $matches[0];
|
2671 |
|
2672 |
+
if ( '[wpuf_account]' == $shortcode ) {
|
2673 |
$page = 'WPUF Account Page';
|
2674 |
+
} elseif ( '[wpuf_edit]' == $shortcode ) {
|
2675 |
$page = 'WPUF Post Edit Page';
|
2676 |
+
} elseif ( '[wpuf-login]' == $shortcode ) {
|
2677 |
$page = 'WPUF Login Page';
|
2678 |
+
} elseif ( '[wpuf_sub_pack]' == $shortcode ) {
|
2679 |
$page = 'WPUF Subscription Page';
|
2680 |
+
} elseif ( '[wpuf_editprofile]' == $shortcode ) {
|
2681 |
$page = 'WPUF Profile Edit Page';
|
2682 |
} elseif ( stristr( $shortcode, '[wpuf_dashboard' ) ) {
|
2683 |
$page = 'WPUF Dashboard Page';
|
2689 |
$page = 'WPUF Form Page';
|
2690 |
}
|
2691 |
|
2692 |
+
if ( !empty( $page ) ) {
|
2693 |
$state['wpuf'] = $page;
|
2694 |
}
|
2695 |
}
|
2765 |
'post_msg' => 'verified',
|
2766 |
'f' => 2,
|
2767 |
], get_home_url()
|
2768 |
+
);
|
2769 |
} else {
|
2770 |
$encoded_guest_url = add_query_arg(
|
2771 |
[
|
2774 |
'post_msg' => 'verified',
|
2775 |
'f' => 1,
|
2776 |
], get_home_url()
|
2777 |
+
);
|
2778 |
}
|
2779 |
|
2780 |
+
$default_body = 'Hey There,' . '<br>' . '<br>' . 'We just received your guest post and now we want you to confirm your email so that we can verify the content and move on to the publishing process.' . '<br>' . '<br>' . 'Please click the link below to verify:' . '<br>' . '<br>' . '<a href="' . $encoded_guest_url . '">Publish Post</a>' . '<br>' . '<br>' . 'Regards,' . '<br>' . '<br>' . bloginfo( 'name' );
|
2781 |
$to = isset( $_POST['guest_email'] ) ? sanitize_email( wp_unslash( $_POST['guest_email'] ) ) : '';
|
2782 |
$guest_email_sub = wpuf_get_option( 'guest_email_subject', 'wpuf_mails', 'Please Confirm Your Email to Get the Post Published!' );
|
2783 |
$subject = $guest_email_sub;
|
2784 |
$guest_email_body = wpuf_get_option( 'guest_email_body', 'wpuf_mails', $default_body );
|
2785 |
|
2786 |
+
if ( !empty( $guest_email_body ) ) {
|
2787 |
$blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
|
2788 |
$field_search = [ '{activation_link}', '{sitename}' ];
|
2789 |
|
2797 |
$body = $default_body;
|
2798 |
}
|
2799 |
|
2800 |
+
$body = get_formatted_mail_body( $body, $subject );
|
2801 |
|
2802 |
wp_mail( $to, $subject, $body );
|
2803 |
}
|
2812 |
function is_wpuf_post_form_builder() {
|
2813 |
$page = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : '';
|
2814 |
|
2815 |
+
return $page == 'wpuf-post-forms' ? true : false;
|
2816 |
}
|
2817 |
|
2818 |
/**
|
2825 |
function is_wpuf_profile_form_builder() {
|
2826 |
$page = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : '';
|
2827 |
|
2828 |
+
return $page == 'wpuf-profile-forms' ? true : false;
|
2829 |
}
|
2830 |
|
2831 |
/**
|
2838 |
* @return \WPUF_User
|
2839 |
*/
|
2840 |
function wpuf_get_user( $user = null ) {
|
2841 |
+
if ( !$user ) {
|
2842 |
$user = wp_get_current_user();
|
2843 |
}
|
2844 |
|
2858 |
$allowed_term = [];
|
2859 |
|
2860 |
foreach ( $subscriptions as $pack ) {
|
2861 |
+
if ( !metadata_exists( 'post', $pack->ID, '_sub_allowed_term_ids' ) ) {
|
2862 |
+
$cts = get_taxonomies( ['_builtin'=>true], 'objects' ); ?>
|
2863 |
+
<?php foreach ( $cts as $ct ) {
|
|
|
|
|
2864 |
if ( is_taxonomy_hierarchical( $ct->name ) ) {
|
2865 |
+
$tax_terms = get_terms( [
|
2866 |
+
'taxonomy' => $ct->name,
|
2867 |
+
'hide_empty' => false,
|
2868 |
+
] );
|
|
|
|
|
2869 |
|
2870 |
foreach ( $tax_terms as $tax_term ) {
|
2871 |
$allowed_term[] = $tax_term->term_id;
|
2873 |
}
|
2874 |
}
|
2875 |
|
2876 |
+
$cts = get_taxonomies( ['_builtin'=>false], 'objects' ); ?>
|
2877 |
+
<?php foreach ( $cts as $ct ) {
|
|
|
|
|
2878 |
if ( is_taxonomy_hierarchical( $ct->name ) ) {
|
2879 |
+
$tax_terms = get_terms( [
|
2880 |
+
'taxonomy' => $ct->name,
|
2881 |
+
'hide_empty' => false,
|
2882 |
+
] );
|
|
|
|
|
2883 |
|
2884 |
foreach ( $tax_terms as $tax_term ) {
|
2885 |
$allowed_term[] = $tax_term->term_id;
|
2894 |
}
|
2895 |
|
2896 |
/**
|
2897 |
+
* post submitted by form
|
2898 |
*
|
2899 |
* @since 2.8
|
2900 |
*
|
2903 |
* @return List of WP_Post objects
|
2904 |
*/
|
2905 |
function wpuf_posts_submitted_by( $form_id ) {
|
2906 |
+
$settings = wpuf_get_form_settings( $form_id );
|
2907 |
$settings['post_type'];
|
2908 |
$args = [
|
2909 |
'meta_key' => '_wpuf_form_id',
|
2917 |
}
|
2918 |
|
2919 |
/**
|
2920 |
+
* count post submitted by form
|
2921 |
*
|
2922 |
* @since 2.8
|
2923 |
*
|
2950 |
wpuf_load_pro_template(
|
2951 |
'email/header.php',
|
2952 |
[ 'subject' => $subject ]
|
2953 |
+
);
|
2954 |
|
2955 |
$header = ob_get_clean();
|
2956 |
}
|
2961 |
wpuf_load_pro_template(
|
2962 |
'email/footer.php',
|
2963 |
[]
|
2964 |
+
);
|
2965 |
|
2966 |
$footer = ob_get_clean();
|
2967 |
}
|
2971 |
wpuf_load_pro_template(
|
2972 |
'email/style.php',
|
2973 |
[]
|
2974 |
+
);
|
2975 |
|
2976 |
$css = apply_filters( 'wpuf_email_style', ob_get_clean() );
|
2977 |
|
2978 |
$content = $header . '<pre>' . $message . '</pre>' . $footer;
|
2979 |
|
2980 |
+
if ( !class_exists( 'Emogrifier' ) ) {
|
2981 |
require_once WPUF_PRO_INCLUDES . '/libs/Emogrifier.php';
|
2982 |
}
|
2983 |
|
3013 |
'chosen' => false,
|
3014 |
'placeholder' => null,
|
3015 |
'multiple' => false,
|
3016 |
+
'show_option_all' => __( 'All', 'wp-user-frontend', 'wp-user-frontend' ),
|
3017 |
+
'show_option_none' => __( 'None', 'wp-user-frontend', 'wp-user-frontend' ),
|
3018 |
'data' => [],
|
3019 |
'readonly' => false,
|
3020 |
'disabled' => false,
|
3064 |
$class = implode( ' ', array_map( 'sanitize_html_class', explode( ' ', $args['class'] ) ) );
|
3065 |
$output = '<select' . $disabled . $readonly . ' name="' . esc_attr( $args['name'] ) . '" id="' . esc_attr( str_replace( '-', '_', $args['id'] ) ) . '" class="wpuf-select ' . $class . '"' . $multiple . ' data-placeholder="' . $placeholder . '"' . $data_elements . '>';
|
3066 |
|
3067 |
+
if ( !isset( $args['selected'] ) || ( is_array( $args['selected'] ) && empty( $args['selected'] ) ) || !$args['selected'] ) {
|
3068 |
$selected = '';
|
3069 |
}
|
3070 |
|
3071 |
if ( $args['show_option_all'] ) {
|
3072 |
+
if ( $args['multiple'] && !empty( $args['selected'] ) ) {
|
3073 |
+
$selected = selected( true, in_array( 0, $args['selected'] ), false );
|
3074 |
} else {
|
3075 |
$selected = selected( $args['selected'], 0, false );
|
3076 |
}
|
3077 |
$output .= '<option value="all"' . $selected . '>' . esc_html( $args['show_option_all'] ) . '</option>';
|
3078 |
}
|
3079 |
|
3080 |
+
if ( !empty( $args['options'] ) ) {
|
3081 |
if ( $args['show_option_none'] ) {
|
3082 |
if ( $args['multiple'] ) {
|
3083 |
+
$selected = selected( true, in_array( -1, $args['selected'] ), false );
|
3084 |
+
} elseif ( isset( $args['selected'] ) && !is_array( $args['selected'] ) && !empty( $args['selected'] ) ) {
|
3085 |
$selected = selected( $args['selected'], -1, false );
|
3086 |
}
|
3087 |
$output .= '<option value="-1"' . $selected . '>' . esc_html( $args['show_option_none'] ) . '</option>';
|
3089 |
|
3090 |
foreach ( $args['options'] as $key => $option ) {
|
3091 |
if ( $args['multiple'] && is_array( $args['selected'] ) ) {
|
3092 |
+
$selected = selected( true, in_array( (string) $key, $args['selected'] ), false );
|
3093 |
+
} elseif ( isset( $args['selected'] ) && !is_array( $args['selected'] ) ) {
|
3094 |
$selected = selected( $args['selected'], $key, false );
|
3095 |
}
|
3096 |
|
3135 |
|
3136 |
$data = '';
|
3137 |
|
3138 |
+
if ( !empty( $args['data'] ) ) {
|
3139 |
foreach ( $args['data'] as $key => $value ) {
|
3140 |
$data .= 'data-' . $key . '="' . esc_attr( $value ) . '" ';
|
3141 |
}
|
3143 |
|
3144 |
$output = '<span id="wpuf-' . $args['name'] . '-wrap">';
|
3145 |
|
3146 |
+
if ( !empty( $args['label'] ) ) {
|
3147 |
$output .= '<label class="wpuf-label" for="' . $args['id'] . '">' . esc_html( $args['label'] ) . '</label>';
|
3148 |
}
|
3149 |
|
3150 |
+
if ( !empty( $args['desc'] ) ) {
|
3151 |
$output .= '<span class="wpuf-description">' . wp_kses_post( $args['desc'] ) . '</span>';
|
3152 |
}
|
3153 |
|
3185 |
$options = array();
|
3186 |
}
|
3187 |
|
3188 |
+
$options[$option] = $value;
|
3189 |
|
3190 |
update_option( $section, $options );
|
3191 |
}
|
3202 |
function wpuf_get_terms( $taxonomy = 'category' ) {
|
3203 |
$items = [];
|
3204 |
|
3205 |
+
$terms = get_terms( [
|
|
|
3206 |
'taxonomy' => $taxonomy,
|
3207 |
'hide_empty' => false,
|
3208 |
]
|
3209 |
+
);
|
3210 |
|
3211 |
foreach ( $terms as $key => $term ) {
|
3212 |
+
$items[$term->term_id] = $term->name;
|
3213 |
}
|
3214 |
|
3215 |
return $items;
|
3226 |
$country = isset( $_POST['country'] ) ? sanitize_text_field( wp_unslash( $_POST['country'] ) ) : '';
|
3227 |
$cs = new CountryState();
|
3228 |
$countries = $cs->countries();
|
3229 |
+
$states = $cs->getStates( $countries[$country] );
|
3230 |
|
3231 |
+
if ( !empty( $states ) ) {
|
3232 |
$args = [
|
3233 |
'name' => isset( $_POST['field_name'] ) ? sanitize_text_field( wp_unslash( $_POST['field_name'] ) ) : '',
|
3234 |
'id' => isset( $_POST['field_name'] ) ? sanitize_text_field( wp_unslash( $_POST['field_name'] ) ) : '',
|
3243 |
$response = 'nostates';
|
3244 |
}
|
3245 |
|
3246 |
+
wp_send_json( $response ) ; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped
|
3247 |
+
|
3248 |
}
|
3249 |
add_action( 'wp_ajax_wpuf-ajax-address', 'wpuf_ajax_get_states_field' );
|
3250 |
add_action( 'wp_ajax_nopriv_wpuf-ajax-address', 'wpuf_ajax_get_states_field' );
|
3255 |
* @return void
|
3256 |
*/
|
3257 |
function wpuf_update_billing_address() {
|
3258 |
+
$nonce = isset( $_POST['_wpnonce'] ) ? sanitize_text_field( wp_unslash( $_POST['_wpnonce'] ) ) : '';
|
3259 |
+
|
3260 |
+
if ( ! wp_verify_nonce( $nonce, 'wpuf-ajax-address' ) ) {
|
3261 |
+
return ;
|
3262 |
+
}
|
3263 |
|
3264 |
ob_start();
|
3265 |
|
3266 |
$user_id = get_current_user_id();
|
3267 |
+
$add_line_1 = isset( $_POST['billing_add_line1'] ) ? sanitize_text_field( wp_unslash( $_POST['billing_add_line1'] ) ) : '';
|
3268 |
+
$add_line_2 = isset( $_POST['billing_add_line2'] ) ? sanitize_text_field( wp_unslash( $_POST['billing_add_line2'] ) ) : '';
|
3269 |
+
$city = isset( $_POST['billing_city'] ) ? sanitize_text_field( wp_unslash( $_POST['billing_city'] ) ) : '';
|
3270 |
+
$state = isset( $_POST['billing_state'] ) ? sanitize_text_field( wp_unslash( $_POST['billing_state'] ) ) : '';
|
3271 |
+
$zip = isset( $_POST['billing_zip'] ) ? sanitize_text_field( wp_unslash( $_POST['billing_zip'] ) ) : '';
|
3272 |
+
$country = isset( $_POST['billing_country'] ) ? sanitize_text_field( wp_unslash( $_POST['billing_country'] ) ) : '';
|
3273 |
+
$type = isset( $_POST['type'] ) ? sanitize_text_field( wp_unslash( $_POST['type'] ) ) : '';
|
3274 |
+
$id = isset( $_POST['id'] ) ? sanitize_text_field( wp_unslash( $_POST['id'] ) ) : '';
|
3275 |
|
3276 |
$address_fields = [
|
3277 |
'add_line_1' => $add_line_1,
|
3325 |
$countries_obj = new WC_Countries();
|
3326 |
$countries_array = $countries_obj->get_countries();
|
3327 |
$country_states_array = $countries_obj->get_states();
|
3328 |
+
$woo_address['state'] = isset( $country_states_array[$woo_address['country']][$woo_address['state']] ) ? $country_states_array[$woo_address['country']][$woo_address['state']] : '';
|
3329 |
$woo_address['state'] = strtolower( str_replace( ' ', '', $woo_address['state'] ) );
|
3330 |
|
3331 |
+
if ( !empty( $woo_address ) ) {
|
3332 |
$address_fields = [
|
3333 |
'add_line_1' => $woo_address['address_1'],
|
3334 |
'add_line_2' => $woo_address['address_2'],
|
3353 |
$settings = new WeDevs_Settings_API();
|
3354 |
$value = $settings->get_option( $args['id'], $args['section'], $args['std'] );
|
3355 |
$value = is_array( $value ) ? (array) $value : [];
|
3356 |
+
$size = isset( $args['size'] ) && !is_null( $args['size'] ) ? $args['size'] : 'regular';
|
3357 |
$html = sprintf( '<select multiple="multiple" class="%1$s" name="%2$s[%3$s][]" id="%2$s[%3$s]">', $size, $args['section'], $args['id'] );
|
3358 |
|
3359 |
foreach ( $args['options'] as $key => $label ) {
|
3360 |
+
$checked = in_array( $key, $value ) ? $key : '0';
|
3361 |
$html .= sprintf( '<option value="%s"%s>%s</option>', $key, selected( $checked, $key, false ), $label );
|
3362 |
}
|
3363 |
|
3364 |
$html .= sprintf( '</select>' );
|
3365 |
$html .= $settings->get_field_description( $args );
|
3366 |
|
3367 |
+
echo wp_kses( $html, [
|
3368 |
+
'p' => [],
|
3369 |
+
'select' => [
|
3370 |
+
'multiple' => [],
|
3371 |
+
'class' => [],
|
3372 |
+
'name' => [],
|
3373 |
+
'id' => [],
|
3374 |
+
],
|
3375 |
+
'option' => [
|
3376 |
+
'value' => [],
|
3377 |
+
'selected' => []
|
|
|
|
|
3378 |
]
|
3379 |
+
] );
|
3380 |
}
|
3381 |
|
3382 |
/**
|
3388 |
*/
|
3389 |
function wpuf_show_form_schedule_message( $form_id ) {
|
3390 |
$form_settings = wpuf_get_form_settings( $form_id );
|
3391 |
+
$is_scheduled = ( isset( $form_settings['schedule_form'] ) && $form_settings['schedule_form'] == 'true' ) ? true : false;
|
3392 |
|
3393 |
if ( $is_scheduled ) {
|
3394 |
+
$start_time = !empty( $form_settings['schedule_start'] ) ? strtotime( $form_settings['schedule_start'] ) : 0;
|
3395 |
+
$end_time = !empty( $form_settings['schedule_end'] ) ? strtotime( $form_settings['schedule_end'] ) : 0;
|
3396 |
$current_time = current_time( 'timestamp' );
|
3397 |
|
3398 |
if ( $current_time >= $start_time && $current_time <= $end_time ) {
|
3404 |
echo wp_kses_post( '<div class="wpuf-message">' . $form_settings['form_pending_message'] . '</div>' );
|
3405 |
} elseif ( $current_time > $end_time ) {
|
3406 |
echo wp_kses_post( '<div class="wpuf-message">' . $form_settings['form_expired_message'] . '</div>' );
|
3407 |
+
} ?>
|
|
|
3408 |
<script>
|
3409 |
jQuery( function($) {
|
3410 |
$(".wpuf-submit-button").attr("disabled", "disabled");
|
3425 |
*/
|
3426 |
function wpuf_show_form_limit_message( $form_id ) {
|
3427 |
$form_settings = wpuf_get_form_settings( $form_id );
|
3428 |
+
$has_limit = ( isset( $form_settings['limit_entries'] ) && $form_settings['limit_entries'] == 'true' ) ? true : false;
|
3429 |
+
$post_to_check = get_post( get_the_ID() );
|
3430 |
$is_edit_page = false;
|
3431 |
|
3432 |
+
if ( stripos( $post_to_check->post_content, '[' . 'wpuf_edit' ) !== false ) {
|
3433 |
$is_edit_page = true;
|
3434 |
}
|
3435 |
|
3436 |
+
if ( $has_limit && !$is_edit_page ) {
|
3437 |
+
$limit = (int) !empty( $form_settings['limit_number'] ) ? $form_settings['limit_number'] : 0;
|
3438 |
$form_entries = wpuf_form_posts_count( $form_id );
|
3439 |
|
3440 |
if ( $limit && $limit <= $form_entries ) {
|
3441 |
$info = $form_settings['limit_message'];
|
3442 |
+
echo wp_kses_post( '<div class="wpuf-info">' . $info . '</div>');
|
3443 |
?>
|
3444 |
<script>
|
3445 |
jQuery( function($) {
|
3455 |
add_action( 'wpuf_before_form_render', 'wpuf_show_form_limit_message' );
|
3456 |
|
3457 |
/**
|
3458 |
+
* save frontend post revision
|
3459 |
*
|
3460 |
* @param int $post_id
|
3461 |
* @param array $form_settings
|
3466 |
$post = get_post( $post_id );
|
3467 |
|
3468 |
if ( post_type_supports( $form_settings['post_type'], 'revisions' ) ) {
|
3469 |
+
$revisions = wp_get_post_revisions( $post_id, [ 'order' => 'ASC', 'posts_per_page' => 1 ] );
|
|
|
|
|
|
|
|
|
|
|
3470 |
$revision = current( $revisions );
|
3471 |
|
3472 |
_wp_upgrade_revisions_of_post( $post, wp_get_post_revisions( $post_id ) );
|
3494 |
$byte = absint( $val );
|
3495 |
$char = strtolower( str_replace( $byte, '', $val ) );
|
3496 |
|
3497 |
+
switch( $char ) {
|
3498 |
case 'g':
|
3499 |
$byte *= GB_IN_BYTES;
|
3500 |
break;
|
wpuf.php
CHANGED
@@ -4,7 +4,7 @@ Plugin Name: WP User Frontend
|
|
4 |
Plugin URI: https://wordpress.org/plugins/wp-user-frontend/
|
5 |
Description: Create, edit, delete, manages your post, pages or custom post types from frontend. Create registration forms, frontend profile and more...
|
6 |
Author: weDevs
|
7 |
-
Version: 3.5.
|
8 |
Author URI: https://wedevs.com/?utm_source=WPUF_Author_URI
|
9 |
License: GPL2 or later
|
10 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
@@ -12,7 +12,7 @@ Text Domain: wp-user-frontend
|
|
12 |
Domain Path: /languages
|
13 |
*/
|
14 |
|
15 |
-
define( 'WPUF_VERSION', '3.5.
|
16 |
define( 'WPUF_FILE', __FILE__ );
|
17 |
define( 'WPUF_ROOT', __DIR__ );
|
18 |
define( 'WPUF_ROOT_URI', plugins_url( '', __FILE__ ) );
|
4 |
Plugin URI: https://wordpress.org/plugins/wp-user-frontend/
|
5 |
Description: Create, edit, delete, manages your post, pages or custom post types from frontend. Create registration forms, frontend profile and more...
|
6 |
Author: weDevs
|
7 |
+
Version: 3.5.5
|
8 |
Author URI: https://wedevs.com/?utm_source=WPUF_Author_URI
|
9 |
License: GPL2 or later
|
10 |
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
12 |
Domain Path: /languages
|
13 |
*/
|
14 |
|
15 |
+
define( 'WPUF_VERSION', '3.5.5' );
|
16 |
define( 'WPUF_FILE', __FILE__ );
|
17 |
define( 'WPUF_ROOT', __DIR__ );
|
18 |
define( 'WPUF_ROOT_URI', plugins_url( '', __FILE__ ) );
|