CouponsPage
1 year ago
CustomersPage
5 months ago
DashboardPage
1 year ago
DownloadLogsPage
1 year ago
ExportPage
5 months ago
GroupsPage
1 year ago
OrdersPage
1 year ago
PlansPage
2 months ago
SubscriptionsPage
3 months ago
TaxSettings
3 years ago
views
1 month ago
CheckListHeader.php
3 years ago
CheckoutFieldsManager.php
1 year ago
ContextualStateChangeHelper.php
3 years ago
FileDownloads.php
3 years ago
PaymentMethods.php
1 year ago
PaymentSettings.php
1 month ago
PlanIntegrationsMetabox.php
10 months ago
SettingsFieldsParser.php
1 year ago
index.php
3 years ago
CheckListHeader.php
195 lines
| 1 | <?php |
| 2 | |
| 3 | namespace ProfilePress\Core\Admin\SettingsPages\Membership; |
| 4 | |
| 5 | use ProfilePress\Core\Membership\PaymentMethods\PaymentMethods as PaymentGateways; |
| 6 | use ProfilePress\Core\Membership\Repositories\PlanRepository; |
| 7 | |
| 8 | if ( ! defined('ABSPATH')) { |
| 9 | exit; |
| 10 | } |
| 11 | |
| 12 | class CheckListHeader |
| 13 | { |
| 14 | public function __construct() |
| 15 | { |
| 16 | add_action('ppress_settings_page_header', [$this, 'checklist_header']); |
| 17 | } |
| 18 | |
| 19 | private function is_required_page_done() |
| 20 | { |
| 21 | $check = array_filter([ |
| 22 | ppress_settings_by_key('checkout_page_id', false, true), |
| 23 | ppress_settings_by_key('payment_success_page_id', false, true), |
| 24 | ppress_settings_by_key('payment_failure_page_id', false, true), |
| 25 | ppress_settings_by_key('edit_user_profile_url', false, true) |
| 26 | ]); |
| 27 | |
| 28 | return count($check) === 4; |
| 29 | } |
| 30 | |
| 31 | private function is_business_info_done() |
| 32 | { |
| 33 | $check = array_filter([ |
| 34 | ppress_settings_by_key('business_name', false, true), |
| 35 | ppress_settings_by_key('business_address', false, true), |
| 36 | ppress_settings_by_key('business_city', false, true), |
| 37 | ppress_settings_by_key('business_country', false, true), |
| 38 | ppress_settings_by_key('business_state', false, true), |
| 39 | ppress_settings_by_key('business_postal_code', false, true) |
| 40 | ]); |
| 41 | |
| 42 | return count($check) === 6; |
| 43 | } |
| 44 | |
| 45 | private function is_currency_set_done() |
| 46 | { |
| 47 | return ! empty(ppress_settings_by_key('payment_currency', false, true)); |
| 48 | } |
| 49 | |
| 50 | private function is_create_plan_done() |
| 51 | { |
| 52 | return ppress_is_any_active_plan(); |
| 53 | } |
| 54 | |
| 55 | private function is_payment_method_done() |
| 56 | { |
| 57 | return ppress_is_any_enabled_payment_method(); |
| 58 | } |
| 59 | |
| 60 | public function checklist_header() |
| 61 | { |
| 62 | if ( ! in_array(ppressGET_var('page'), [ |
| 63 | PPRESS_DASHBOARD_SETTINGS_SLUG, |
| 64 | PPRESS_MEMBERSHIP_PLANS_SETTINGS_SLUG, |
| 65 | PPRESS_MEMBERSHIP_ORDERS_SETTINGS_SLUG, |
| 66 | PPRESS_MEMBERSHIP_CUSTOMERS_SETTINGS_SLUG, |
| 67 | PPRESS_MEMBERSHIP_SUBSCRIPTIONS_SETTINGS_SLUG |
| 68 | ])) { |
| 69 | return; |
| 70 | } |
| 71 | |
| 72 | if ( |
| 73 | $this->is_create_plan_done() && |
| 74 | $this->is_currency_set_done() && |
| 75 | $this->is_business_info_done() && |
| 76 | $this->is_required_page_done() && |
| 77 | $this->is_payment_method_done()) { |
| 78 | return; |
| 79 | } |
| 80 | |
| 81 | $required_pages_url = PPRESS_SETTINGS_SETTING_GENERAL_PAGE . '#global_pages?checkout_page_id_row'; |
| 82 | $payment_method_url = add_query_arg(['view' => 'payments', 'section' => 'payment-methods'], PPRESS_SETTINGS_SETTING_PAGE); |
| 83 | $set_currency_url = add_query_arg(['view' => 'payments'], PPRESS_SETTINGS_SETTING_PAGE); |
| 84 | $business_info_url = PPRESS_SETTINGS_SETTING_GENERAL_PAGE . '#business_info'; |
| 85 | $plan_url = PPRESS_MEMBERSHIP_SUBSCRIPTION_PLANS_SETTINGS_PAGE; |
| 86 | ?> |
| 87 | <div class="ppress-checklist"> |
| 88 | <div> |
| 89 | <h2><span><?php esc_html_e('Get started with Paid Memberships', 'wp-user-avatar') ?></span></h2> |
| 90 | <p class="ppress-checklist-teaser"><?php esc_html_e('Follow the steps below to get your website ready for selling membership plans.', 'wp-user-avatar') ?></p> |
| 91 | </div> |
| 92 | |
| 93 | <div class="ppress-checklist-dashboard-steps"> |
| 94 | <ul> |
| 95 | <li<?php echo $this->is_required_page_done() ? ' class="ppress-checklist-done"' : '' ?>> |
| 96 | <a href="<?= $required_pages_url ?>"> |
| 97 | <svg version="1.1" viewBox="0 0 50 45" xmlns="http://www.w3.org/2000/svg"> |
| 98 | <g fill="none" fill-rule="evenodd"> |
| 99 | <g class="svg-color" transform="translate(-298 -394)" fill="#97A3B4" fill-rule="nonzero"> |
| 100 | <g transform="translate(298 394)"> |
| 101 | <polygon id="a" points="36 41.5 29.429 41.5 29.429 38 19.571 38 19.571 41.5 13 41.5 13 45 36 45"></polygon> |
| 102 | <path d="m48.333 0h-46.667c-0.92 0-1.6667 0.745-1.6667 1.6667v31.667c0 0.92167 0.74667 1.6667 1.6667 1.6667h46.667c0.92 0 1.6667-0.745 1.6667-1.6667v-31.667c0-0.92167-0.74667-1.6667-1.6667-1.6667zm-21.667 16.667v11.667h-3.3333v-11.667h-8.3333l10-10 10 10h-8.3333z"></path> |
| 103 | </g> |
| 104 | </g> |
| 105 | </g> |
| 106 | </svg> |
| 107 | <span><?php esc_html_e('Create the Required Pages', 'wp-user-avatar') ?></span> |
| 108 | </a> |
| 109 | </li> |
| 110 | <li<?php echo $this->is_payment_method_done() ? ' class="ppress-checklist-done"' : '' ?>> |
| 111 | <a href="<?= $payment_method_url ?>"> |
| 112 | <svg version="1.1" viewBox="0 0 50 47" xmlns="http://www.w3.org/2000/svg"> |
| 113 | <g fill-rule="evenodd"> |
| 114 | <g class="svg-color" transform="translate(-512 -392)" fill="#97A3B4" fill-rule="nonzero"> |
| 115 | <g transform="translate(512 392)"> |
| 116 | <rect x="6.25" y="26.562" width="14.062" height="3.125"></rect> |
| 117 | <path id="a" d="m43.75 31.25h-1.5625v-3.125c0-3.5047-2.7453-6.25-6.25-6.25s-6.25 2.7453-6.25 6.25v3.125h-1.5625c-0.86406 0-1.5625 0.7-1.5625 1.5625v12.5c0 0.8625 0.69844 1.5625 1.5625 1.5625h15.625c0.86406 0 1.5625-0.7 1.5625-1.5625v-12.5c0-0.8625-0.69844-1.5625-1.5625-1.5625zm-4.6875 0h-6.25v-3.125c0-1.7812 1.3422-3.125 3.125-3.125s3.125 1.3438 3.125 3.125v3.125z"></path> |
| 118 | <path d="m3.125 32.812v-14.062h43.75v9.375h3.125v-23.438c0-2.5844-2.1031-4.6875-4.6875-4.6875h-40.625c-2.5844 0-4.6875 2.1031-4.6875 4.6875v28.125c0 2.5844 2.1031 4.6875 4.6875 4.6875h18.75v-3.125h-18.75c-0.8625 0-1.5625-0.70156-1.5625-1.5625zm0-28.125c0-0.86094 0.7-1.5625 1.5625-1.5625h40.625c0.8625 0 1.5625 0.70156 1.5625 1.5625v4.6875h-43.75v-4.6875z"></path> |
| 119 | </g> |
| 120 | </g> |
| 121 | </g> |
| 122 | </svg> |
| 123 | <span><?php esc_html_e('Integrate a Payment Method', 'wp-user-avatar') ?></span> |
| 124 | </a> |
| 125 | </li> |
| 126 | <li<?php echo $this->is_business_info_done() ? ' class="ppress-checklist-done"' : '' ?>> |
| 127 | <a href="<?= $business_info_url ?>"> |
| 128 | <svg version="1.1" viewBox="0 0 50 47" xmlns="http://www.w3.org/2000/svg"> |
| 129 | <g fill="none" fill-rule="evenodd"> |
| 130 | <g class="svg-color" transform="translate(-719 -392)" fill="#97A3B4" fill-rule="nonzero"> |
| 131 | <g transform="translate(652 337)"> |
| 132 | <g transform="translate(67 55)"> |
| 133 | <path id="a" d="m41.406 25h-0.048438c-1.8807-0.030708-3.7278-0.50333-5.3922-1.3797-1.6887 0.90067-3.5721 1.3744-5.4859 1.3797-1.9108-0.021361-3.789-0.49695-5.4797-1.3875-3.4244 1.8503-7.5506 1.8503-10.975 0-1.6449 0.86813-3.4687 1.3431-5.3281 1.3875-0.82226-0.0027149-1.6421-0.089097-2.4469-0.25781v20.57c0 0.86294 0.69956 1.5625 1.5625 1.5625h12.5v-10.938h9.375v10.938h12.5c0.86294 0 1.5625-0.69956 1.5625-1.5625v-20.553c-0.77118 0.15874-1.5564 0.23936-2.3438 0.24062z"></path> |
| 134 | <path d="m49.647 13.125-9.3344-12.5c-0.29508-0.39345-0.75819-0.625-1.25-0.625h-28.125c-0.49181 0-0.95492 0.23155-1.25 0.625l-9.3344 12.5c-0.23661 0.31804-0.34432 0.71373-0.30156 1.1078 0.48623 4.3646 4.185 7.6604 8.5766 7.6422 1.978-0.043087 3.8844-0.74842 5.4141-2.0031 1.5426 1.2968 3.4941 2.0063 5.5094 2.0031 1.992-0.023866 3.9154-0.731 5.4484-2.0031 1.5396 1.2746 3.4702 1.9817 5.4688 2.0031 2.0043 9.522e-4 3.9446-0.7063 5.4781-1.9969 1.5401 1.2666 3.4656 1.9709 5.4594 1.9969 4.3779 7.418e-4 8.0566-3.2897 8.5422-7.6406 0.043165-0.3946-0.064568-0.79093-0.30156-1.1094z"></path> |
| 135 | </g> |
| 136 | </g> |
| 137 | </g> |
| 138 | </g> |
| 139 | </svg> |
| 140 | <span><?php esc_html_e('Add Your Business Information', 'wp-user-avatar') ?></span> |
| 141 | </a> |
| 142 | </li> |
| 143 | <li<?php echo $this->is_currency_set_done() ? ' class="ppress-checklist-done"' : '' ?>> |
| 144 | <a href="<?= $set_currency_url ?>"> |
| 145 | <svg version="1.1" viewBox="0 0 50 50" xmlns="http://www.w3.org/2000/svg"> |
| 146 | <g fill="none" fill-rule="evenodd"> |
| 147 | <g class="svg-color" transform="translate(-932 -389)" fill="#97A3B4" fill-rule="nonzero"> |
| 148 | <g transform="translate(866 337)"> |
| 149 | <g transform="translate(66 52)"> |
| 150 | <path id="Shape" d="m20.642 16.559c-0.84844 0.51562-1.2266 1.1875-1.2266 2.1781 0 2.0266 1.4875 3.0406 4.0219 3.9797v-6.9844c-1.0828 0.12344-2.0609 0.38125-2.7953 0.82656z"></path> |
| 151 | <path id="a" d="m29.189 33.191c0.89062-0.6375 1.3062-1.5359 1.3062-2.8281 0-1.5781-1.2812-2.3828-3.9328-3.3062v7.075c1.0344-0.15938 1.9453-0.45312 2.6266-0.94062z"></path> |
| 152 | <path d="m25 0c-13.784 0-25 11.216-25 25s11.216 25 25 25 25-11.216 25-25-11.216-25-25-25zm8.6203 30.364c0 2.2891-0.90312 4.1469-2.6125 5.3703-1.2109 0.86562-2.7578 1.3391-4.4453 1.5406v4.9125h-3.125v-4.85c-2.6078-0.14062-5.2938-0.71562-7.5109-1.4719l-1.4781-0.50469 1.0094-2.9578 1.4797 0.50469c1.9953 0.67969 4.3297 1.1844 6.5 1.3266v-8.1984c-3.4734-1.1531-7.1469-2.8344-7.1469-7.3016 0-2.0875 0.94375-3.7641 2.7297-4.8484 1.2344-0.74844 2.7828-1.1422 4.4172-1.2938v-4.7797h3.125v4.7609c2.8516 0.2 5.5531 0.92812 6.9703 1.6656l1.3875 0.72031-1.4406 2.7734-1.3875-0.72031c-1.1281-0.58594-3.2938-1.1266-5.5297-1.3062v8.05c3.3312 1.0672 7.0578 2.5438 7.0578 6.6078z"></path> |
| 153 | </g> |
| 154 | </g> |
| 155 | </g> |
| 156 | </g> |
| 157 | </svg> |
| 158 | <span><?php esc_html_e('Set Your Membership Currency', 'wp-user-avatar') ?></span> |
| 159 | </a> |
| 160 | </li> |
| 161 | <li<?php echo $this->is_create_plan_done() ? ' class="ppress-checklist-done"' : '' ?>> |
| 162 | <a href="<?= $plan_url ?>"> |
| 163 | <svg version="1.1" viewBox="0 0 50 47" xmlns="http://www.w3.org/2000/svg"> |
| 164 | <g fill="none" fill-rule="evenodd"> |
| 165 | <g class="svg-color" transform="translate(-1146 -392)" fill="#97A3B4" fill-rule="nonzero"> |
| 166 | <g transform="translate(1080 337)"> |
| 167 | <g transform="translate(66 55)"> |
| 168 | <path id="Shape" d="m49.738 13.195-6.25-9.375c-0.23438-0.35312-0.60312-0.59531-1.0203-0.67031l-17.188-3.125c-0.017188-0.003125-0.034375 0-0.05-0.003125-0.076562-0.009375-0.15312-0.009375-0.22969-0.009375s-0.15312 0-0.22812 0.010938c-0.017188 0.003125-0.034375-0.0015625-0.05 0.003125l-17.188 3.125c-0.41875 0.073438-0.7875 0.31719-1.0219 0.66875l-6.25 9.375c-0.31875 0.47969-0.35 1.0953-0.078125 1.6031s0.80156 0.82656 1.3781 0.82656h17.188c0.59219 0 1.1328-0.33438 1.3984-0.86406l4.8516-9.7047 4.8516 9.7047c0.26562 0.52969 0.80625 0.86406 1.3984 0.86406h17.188c0.57656 0 1.1062-0.31719 1.3781-0.825s0.24062-1.125-0.078125-1.6047z"></path> |
| 169 | <path id="a" d="m31.25 18.75c-1.7859 0-3.3906-0.99219-4.1922-2.5875l-0.49531-0.99219v31.148l16.272-7.3969c0.55781-0.25312 0.91562-0.80781 0.91562-1.4219v-18.75h-12.5z"></path> |
| 170 | <path d="m23.438 15.17-0.49375 0.98906c-0.80312 1.5984-2.4078 2.5906-4.1938 2.5906h-12.5v18.75c0 0.61406 0.35781 1.1688 0.91562 1.4219l16.272 7.3969v-31.148z"></path> |
| 171 | </g> |
| 172 | </g> |
| 173 | </g> |
| 174 | </g> |
| 175 | </svg> |
| 176 | <span><?php esc_html_e('Create a Membership Plan', 'wp-user-avatar') ?></span> |
| 177 | </a> |
| 178 | </li> |
| 179 | </ul> |
| 180 | </div> |
| 181 | </div> |
| 182 | <?php |
| 183 | } |
| 184 | |
| 185 | public static function get_instance() |
| 186 | { |
| 187 | static $instance = null; |
| 188 | |
| 189 | if (is_null($instance)) { |
| 190 | $instance = new self(); |
| 191 | } |
| 192 | |
| 193 | return $instance; |
| 194 | } |
| 195 | } |