access-denied-redirect.php
1 year ago
admin-toolbar.php
1 year ago
api-route.php
1 year ago
backend-menu.php
1 year ago
capability.php
1 year ago
content.php
1 year ago
identity.php
1 year ago
jwt.php
5 months ago
login-redirect.php
1 year ago
logout-redirect.php
1 year ago
metabox.php
1 year ago
not-found-redirect.php
1 year ago
policy.php
1 year ago
url.php
1 year ago
welcome.php
1 year ago
widget.php
1 year ago
not-found-redirect.php
89 lines
| 1 | <?php /** @version 7.0.0 **/ ?> |
| 2 | |
| 3 | <?php if (defined('AAM_KEY')) { ?> |
| 4 | <?php |
| 5 | $access_level = AAM_Backend_AccessLevel::get_instance(); |
| 6 | $service = $access_level->not_found_redirect(); |
| 7 | $settings = $service->get_redirect(); |
| 8 | ?> |
| 9 | |
| 10 | <div class="aam-feature" id="404redirect-content"> |
| 11 | <div class="row"> |
| 12 | <div class="col-xs-12"> |
| 13 | <?php if (AAM::api()->config->get('core.settings.ui.tips')) { ?> |
| 14 | <p class="aam-info"> |
| 15 | <?php echo __('The "404 Redirect" service ensures seamless user experience by automatically managing 404 (Not Found) errors, redirecting users to relevant pages, URL or trigger a custom PHP callback function to maintain site engagement and reduce bounce rates.', 'advanced-access-manager'); ?> |
| 16 | </p> |
| 17 | <?php } ?> |
| 18 | |
| 19 | <div |
| 20 | class="aam-overwrite" |
| 21 | id="aam-404redirect-overwrite" |
| 22 | style="display: <?php echo ($service->is_customized() ? 'block' : 'none'); ?>" |
| 23 | > |
| 24 | <span><i class="icon-check"></i> <?php echo __('Settings are customized', 'advanced-access-manager'); ?></span> |
| 25 | <span><a href="#" id="404redirect-reset" class="btn btn-xs btn-primary"><?php echo __('Reset to default', 'advanced-access-manager'); ?></a></span> |
| 26 | </div> |
| 27 | |
| 28 | <?php $type = $settings['type'] ?> |
| 29 | |
| 30 | <div class="radio"> |
| 31 | <input type="radio" name="not_found_redirect_type" id="404redirect-default" data-action="#default-redirect-action" value="default" <?php echo ($type === 'default' ? ' checked' : ''); ?> /> |
| 32 | <label for="404redirect-default"><?php echo __('WordPress default behavior', 'advanced-access-manager'); ?></label> |
| 33 | </div> |
| 34 | <div class="radio"> |
| 35 | <input type="radio" name="not_found_redirect_type" id="404redirect-page" data-action="#page-404redirect-action" value="page_redirect" <?php echo ($type === 'page_redirect' ? ' checked' : ''); ?> /> |
| 36 | <label for="404redirect-page"><?php echo AAM_Backend_View_Helper::preparePhrase('Redirected to existing page [(select from the drop-down)]', 'small'); ?></label> |
| 37 | </div> |
| 38 | <div class="radio"> |
| 39 | <input type="radio" name="not_found_redirect_type" id="404redirect-url" data-action="#url-404redirect-action" value="url_redirect" <?php echo ($type === 'url_redirect' ? ' checked' : ''); ?> /> |
| 40 | <label for="404redirect-url"><?php echo AAM_Backend_View_Helper::preparePhrase('Redirected to the local URL [(enter full URL starting from http or https)]', 'small'); ?></label> |
| 41 | </div> |
| 42 | <?php if ($access_level->is_visitor()) { ?> |
| 43 | <div class="radio"> |
| 44 | <input type="radio" name="not_found_redirect_type" id="404-redirect-login" value="login_redirect" data-action="none" <?php echo ($type === 'login_redirect' ? ' checked' : ''); ?> /> |
| 45 | <label for="404-redirect-login"><?php echo AAM_Backend_View_Helper::preparePhrase('Redirect to the login page [(after login, user will be redirected back to the restricted page)]', 'small'); ?></label> |
| 46 | </div> |
| 47 | <?php } ?> |
| 48 | <div class="radio"> |
| 49 | <input type="radio" name="not_found_redirect_type" id="404redirect-callback" data-action="#callback-404redirect-action" value="trigger_callback" <?php echo ($type === 'trigger_callback' ? ' checked' : ''); ?> /> |
| 50 | <label for="404redirect-callback"><?php echo sprintf(AAM_Backend_View_Helper::preparePhrase('Trigger PHP callback function [(valid %sPHP callback%s is required)]', 'small'), '<a href="https://php.net/manual/en/language.types.callable.php" target="_blank">', '</a>'); ?></label> |
| 51 | </div> |
| 52 | |
| 53 | <div class="form-group 404redirect-action" id="page-404redirect-action" style="display: <?php echo ($type === 'page_redirect' ? 'block' : 'none'); ?>;"> |
| 54 | <label><?php echo __('Existing Page', 'advanced-access-manager'); ?></label> |
| 55 | <?php |
| 56 | wp_dropdown_pages(array( |
| 57 | 'depth' => 99, |
| 58 | 'selected' => isset($settings['redirect_page_id']) ? $settings['redirect_page_id'] : 0, |
| 59 | 'echo' => 1, |
| 60 | 'id' => '404redirect-page', |
| 61 | 'class' => 'form-control', |
| 62 | 'show_option_none' => __('-- Select Page --', 'advanced-access-manager') |
| 63 | )); |
| 64 | ?> |
| 65 | </div> |
| 66 | |
| 67 | <div class="form-group 404redirect-action" id="url-404redirect-action" style="display: <?php echo ($type === 'url_redirect' ? 'block' : 'none'); ?>;"> |
| 68 | <label><?php echo __('The URL', 'advanced-access-manager'); ?></label> |
| 69 | <input |
| 70 | type="text" |
| 71 | class="form-control" |
| 72 | placeholder="https://" |
| 73 | value="<?php echo stripslashes(esc_js(isset($settings['redirect_url']) ? $settings['redirect_url'] : '')); ?>" |
| 74 | /> |
| 75 | </div> |
| 76 | |
| 77 | <div class="form-group 404-redirect-action" id="callback-404redirect-action" style="display: <?php echo ($type === 'trigger_callback' ? 'block' : 'none'); ?>;"> |
| 78 | <label><?php echo __('PHP Callback Function', 'advanced-access-manager'); ?></label> |
| 79 | <input |
| 80 | type="text" |
| 81 | class="form-control" |
| 82 | placeholder="Enter valid callback" |
| 83 | value="<?php echo stripslashes(esc_js(isset($settings['callback']) ? $settings['callback'] : '')); ?>" |
| 84 | /> |
| 85 | </div> |
| 86 | </div> |
| 87 | </div> |
| 88 | </div> |
| 89 | <?php } |