PluginProbe ʕ •ᴥ•ʔ
VikAppointments Services Booking Calendar / 1.2.21
VikAppointments Services Booking Calendar v1.2.21
1.2.21 1.2.20 trunk 1.2.17 1.2.18 1.2.19
vikappointments / site / layouts / blocks / login / wordpress.php
vikappointments / site / layouts / blocks / login Last commit date
index.html 5 days ago wordpress.php 5 days ago
wordpress.php
120 lines
1 <?php
2 /**
3 * @package VikAppointments
4 * @subpackage core
5 * @author E4J s.r.l.
6 * @copyright Copyright (C) 2021 E4J s.r.l. All Rights Reserved.
7 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
8 * @link https://vikwp.com
9 */
10
11 // No direct access
12 defined('ABSPATH') or die('No script kiddies please!');
13
14 $returnUrl = isset($displayData['return']) ? $displayData['return'] : null;
15 $remember = isset($displayData['remember']) ? $displayData['remember'] : false;
16 $footerLinks = isset($displayData['footer']) ? $displayData['footer'] : true;
17 $formId = isset($displayData['form']) ? ltrim($displayData['form'], '#') : null;
18
19 $vik = VAPApplication::getInstance();
20
21 // create login URL for Wordpress
22 $url = wp_login_url();
23 // append action=login
24 $url .= (strpos($url, '?') !== false ? '&' : '?') . 'action=login&referer=vikappointments';
25
26 $app = JFactory::getApplication();
27 ?>
28
29 <script>
30 (function($) {
31 'use strict';
32
33 $(function() {
34 <?php if ($formId): ?>
35 // if we are already inside a form, update the action of the form when the login button gets clicked
36 $('#vap-wp-login-submit').on('click', () => {
37 $('.vap-login-form').closest('form').attr('action', '<?php echo $url; ?>');
38 });
39 <?php else: ?>
40 // update the default URL specified by WordPress with our custom one
41 $('#loginform').attr('action', '<?php echo $url; ?>');
42 <?php endif; ?>
43 });
44 })(jQuery);
45 </script>
46
47 <?php
48 if ($formId)
49 {
50 // the login is already contained within a parent form
51 ?>
52 <div class="vap-login-form">
53 <?php
54 }
55 ?>
56 <h3><?php echo JText::translate('VAPLOGINTITLE'); ?></h3>
57
58 <?php
59 /**
60 * In case the login failed, retrieve the error messages from the system queue and show them here.
61 *
62 * @since 1.2.18
63 */
64 if ($app->input->getBool('login_failed')): ?>
65 <?php foreach ($app->getMessagesQueue() as $msg): ?>
66 <p class="vapinvalid"><?php echo $msg->message ?? ''; ?></p>
67 <?php endforeach; ?>
68 <?php endif; ?>
69
70 <div class="vaploginfieldsdiv">
71
72 <?php
73 /**
74 * Display the login form through the native WordPress function.
75 *
76 * @since 1.2
77 */
78 wp_login_form(array(
79 'echo' => true,
80 'redirect' => $returnUrl ? $vik->routeForExternalUse($returnUrl) : null,
81 'form_id' => 'loginform',
82 'label_username' => __('Username or Email Address'),
83 'label_password' => __('Password' ),
84 'label_remember' => __('Remember Me' ),
85 'label_log_in' => __('Log In'),
86 'id_username' => 'user_login',
87 'id_password' => 'user_pass',
88 'id_remember' => 'rememberme',
89 'id_submit' => 'vap-wp-login-submit',
90 'remember' => true,
91 'value_username' => '',
92 'value_remember' => $remember,
93 ));
94 ?>
95
96 </div>
97
98 <?php
99 if ($footerLinks)
100 {
101 ?>
102 <div class="vap-login-footer-links">
103 <div>
104 <a href="<?php echo wp_lostpassword_url(); ?>" target="_blank">
105 <?php echo JText::translate('COM_USERS_LOGIN_RESET'); ?>
106 </a>
107 </div>
108 </div>
109 <?php
110 }
111 ?>
112
113 <?php echo JHtml::fetch('form.token'); ?>
114
115 <?php
116 if ($formId)
117 {
118 ?></div><?php
119 }
120