WordPress Online Booking and Scheduling Plugin – Bookly - Version 18.2

Version Description

Download this release

Release Info

Developer Ladela
Plugin Icon 128x128 WordPress Online Booking and Scheduling Plugin – Bookly
Version 18.2
Comparing to
See all releases

Code changes from version 18.1 to 18.2

backend/components/dialogs/appointment/delete/Ajax.php CHANGED
@@ -14,7 +14,7 @@ class Ajax extends Lib\Base\Ajax
14
*/
15
protected static function permissions()
16
{
17
- return array( '_default' => 'user' );
18
}
19
20
/**
14
*/
15
protected static function permissions()
16
{
17
+ return array( '_default' => array( 'staff', 'supervisor' ) );
18
}
19
20
/**
backend/components/dialogs/appointment/edit/Ajax.php CHANGED
@@ -13,11 +13,11 @@ use Bookly\Lib\Utils\Common;
13
class Ajax extends Lib\Base\Ajax
14
{
15
/**
16
- * @inheritdoc
17
*/
18
protected static function permissions()
19
{
20
- return array( '_default' => 'user' );
21
}
22
23
/**
13
class Ajax extends Lib\Base\Ajax
14
{
15
/**
16
+ * @inheritDoc
17
*/
18
protected static function permissions()
19
{
20
+ return array( '_default' => array( 'staff', 'supervisor' ) );
21
}
22
23
/**
backend/components/dialogs/customer/delete/Ajax.php CHANGED
@@ -10,11 +10,11 @@ use Bookly\Lib;
10
class Ajax extends Lib\Base\Ajax
11
{
12
/**
13
- * @inheritdoc
14
*/
15
protected static function permissions()
16
{
17
- return array( '_default' => 'user' );
18
}
19
20
/**
@@ -109,28 +109,4 @@ class Ajax extends Lib\Base\Ajax
109
) );
110
}
111
112
- /**
113
- * Check if the current user has access to the action.
114
- *
115
- * @param string $action
116
- * @return bool
117
- */
118
- protected static function hasAccess( $action )
119
- {
120
- if ( parent::hasAccess( $action ) ) {
121
- if ( ! Lib\Utils\Common::isCurrentUserSupervisor() ) {
122
- switch ( $action ) {
123
- case 'deleteCustomers':
124
- case 'checkCustomers':
125
- return Lib\Entities\Staff::query()
126
- ->where( 'wp_user_id', get_current_user_id() )
127
- ->count() > 0;
128
- }
129
- } else {
130
- return true;
131
- }
132
- }
133
-
134
- return false;
135
- }
136
}
10
class Ajax extends Lib\Base\Ajax
11
{
12
/**
13
+ * @inheritDoc
14
*/
15
protected static function permissions()
16
{
17
+ return array( '_default' => 'supervisor' );
18
}
19
20
/**
109
) );
110
}
111
112
}
backend/components/dialogs/customer/edit/Ajax.php CHANGED
@@ -14,7 +14,7 @@ class Ajax extends Lib\Base\Ajax
14
*/
15
protected static function permissions()
16
{
17
- return array( '_default' => 'user' );
18
}
19
20
/**
@@ -78,28 +78,4 @@ class Ajax extends Lib\Base\Ajax
78
79
wp_send_json( $response );
80
}
81
-
82
- /**
83
- * Check if the current user has access to the action.
84
- *
85
- * @param string $action
86
- * @return bool
87
- */
88
- protected static function hasAccess( $action )
89
- {
90
- if ( parent::hasAccess( $action ) ) {
91
- if ( ! Lib\Utils\Common::isCurrentUserSupervisor() ) {
92
- switch ( $action ) {
93
- case 'saveCustomer':
94
- return Lib\Entities\Staff::query()
95
- ->where( 'wp_user_id', get_current_user_id() )
96
- ->count() > 0;
97
- }
98
- } else {
99
- return true;
100
- }
101
- }
102
-
103
- return false;
104
- }
105
}
14
*/
15
protected static function permissions()
16
{
17
+ return array( 'saveCustomer' => array( 'staff', 'supervisor' ) );
18
}
19
20
/**
78
79
wp_send_json( $response );
80
}
81
}
backend/components/dialogs/payment/Ajax.php CHANGED
@@ -10,14 +10,14 @@ use Bookly\Lib;
10
class Ajax extends Lib\Base\Ajax
11
{
12
/**
13
- * @inheritdoc
14
*/
15
protected static function permissions()
16
{
17
return array(
18
- 'completePayment' => 'user',
19
- 'getPaymentDetails' => 'user',
20
- 'getPaymentInfo' => 'user',
21
);
22
}
23
@@ -102,25 +102,4 @@ class Ajax extends Lib\Base\Ajax
102
wp_send_json_success( array( 'payment_title' => $payment_title, 'payment_type' => $payment->getPaid() == $payment->getTotal() ? 'full' : 'partial' ) );
103
}
104
}
105
-
106
- /**
107
- * Extend parent method to control access on staff member level.
108
- *
109
- * @param string $action
110
- * @return bool
111
- */
112
- protected static function hasAccess( $action )
113
- {
114
- if ( parent::hasAccess( $action ) ) {
115
- if ( ! Lib\Utils\Common::isCurrentUserAdmin() && $action === 'completePayment' ) {
116
- $staff = new Lib\Entities\Staff();
117
-
118
- return $staff->loadBy( array( 'wp_user_id' => get_current_user_id() ) );
119
- }
120
-
121
- return true;
122
- }
123
-
124
- return false;
125
- }
126
}
10
class Ajax extends Lib\Base\Ajax
11
{
12
/**
13
+ * @inheritDoc
14
*/
15
protected static function permissions()
16
{
17
return array(
18
+ 'completePayment' => array( 'staff', 'supervisor' ),
19
+ 'getPaymentDetails' => array( 'staff', 'supervisor' ),
20
+ 'getPaymentInfo' => array( 'staff', 'supervisor' ),
21
);
22
}
23
102
wp_send_json_success( array( 'payment_title' => $payment_title, 'payment_type' => $payment->getPaid() == $payment->getTotal() ? 'full' : 'partial' ) );
103
}
104
}
105
}
backend/components/dialogs/service/order/resources/js/service-order-dialog.js CHANGED
@@ -13,14 +13,8 @@ jQuery(function ($) {
13
})
14
.on('service.deleted', {},
15
function (event, services) {
16
- BooklyServiceOrderDialogL10n.services.forEach(function(service, index) {
17
- if (services.includes(String(service.id))) {
18
- delete BooklyServiceOrderDialogL10n.services[index];
19
- }
20
- });
21
- // Remove undefined values
22
- BooklyServiceOrderDialogL10n.services.filter(function (el) {
23
- return el != undefined;
24
})
25
});
26
13
})
14
.on('service.deleted', {},
15
function (event, services) {
16
+ BooklyServiceOrderDialogL10n.services = BooklyServiceOrderDialogL10n.services.filter(function (el) {
17
+ return !services.includes(String(el.id));
18
})
19
});
20
backend/components/dialogs/sms/Ajax.php CHANGED
@@ -9,14 +9,6 @@ use Bookly\Lib;
9
*/
10
class Ajax extends Lib\Base\Ajax
11
{
12
- /**
13
- * @inheritdoc
14
- */
15
- protected static function permissions()
16
- {
17
- return array( '_default' => 'user' );
18
- }
19
-
20
/**
21
* Save notification.
22
*/
9
*/
10
class Ajax extends Lib\Base\Ajax
11
{
12
/**
13
* Save notification.
14
*/
backend/components/dialogs/staff/edit/Ajax.php CHANGED
@@ -20,9 +20,11 @@ class Ajax extends Lib\Base\Ajax
20
*/
21
protected static function permissions()
22
{
23
- $permissions = get_option( 'bookly_gen_allow_staff_edit_profile' ) ? array( '_default' => 'user' ) : array();
24
if ( Lib\Config::staffCabinetActive() ) {
25
- $permissions = array( '_default' => 'user' );
26
}
27
28
return $permissions;
@@ -371,7 +373,7 @@ class Ajax extends Lib\Base\Ajax
371
if ( parent::hasAccess( $action ) ) {
372
self::$staff = new Lib\Entities\Staff();
373
if ( ! Lib\Utils\Common::isCurrentUserAdmin() ) {
374
- self::$staff->loadBy( array( 'wp_user_id' => get_current_user_id() ) );
375
switch ( $action ) {
376
case 'getStaffData':
377
case 'updateStaff':
@@ -387,7 +389,6 @@ class Ajax extends Lib\Base\Ajax
387
$res_schedule->load( self::parameter( 'ss_id' ) );
388
return self::$staff->isLoaded()
389
&& ( self::$staff->getId() == $res_schedule->getStaffId() );
390
- break;
391
case 'deleteStaffScheduleBreak':
392
$break = new Lib\Entities\ScheduleItemBreak();
393
$break->load( self::parameter( 'id' ) );
@@ -395,7 +396,6 @@ class Ajax extends Lib\Base\Ajax
395
$res_schedule->load( $break->getStaffScheduleItemId() );
396
return self::$staff->isLoaded()
397
&& ( self::$staff->getId() == $res_schedule->getStaffId() );
398
- break;
399
case 'staffScheduleUpdate':
400
if ( self::hasParameter( 'ssi' ) ) {
401
foreach ( self::parameter( 'ssi' ) as $id => $day_index ) {
@@ -409,7 +409,6 @@ class Ajax extends Lib\Base\Ajax
409
}
410
}
411
return true;
412
- break;
413
default:
414
return false;
415
}
20
*/
21
protected static function permissions()
22
{
23
+ $permissions = get_option( 'bookly_gen_allow_staff_edit_profile' )
24
+ ? array( '_default' => 'staff' )
25
+ : array();
26
if ( Lib\Config::staffCabinetActive() ) {
27
+ $permissions = array( '_default' => 'staff' );
28
}
29
30
return $permissions;
373
if ( parent::hasAccess( $action ) ) {
374
self::$staff = new Lib\Entities\Staff();
375
if ( ! Lib\Utils\Common::isCurrentUserAdmin() ) {
376
+ self::$staff = Lib\Entities\Staff::query()->where( 'wp_user_id', get_current_user_id() )->findOne();
377
switch ( $action ) {
378
case 'getStaffData':
379
case 'updateStaff':
389
$res_schedule->load( self::parameter( 'ss_id' ) );
390
return self::$staff->isLoaded()
391
&& ( self::$staff->getId() == $res_schedule->getStaffId() );
392
case 'deleteStaffScheduleBreak':
393
$break = new Lib\Entities\ScheduleItemBreak();
394
$break->load( self::parameter( 'id' ) );
396
$res_schedule->load( $break->getStaffScheduleItemId() );
397
return self::$staff->isLoaded()
398
&& ( self::$staff->getId() == $res_schedule->getStaffId() );
399
case 'staffScheduleUpdate':
400
if ( self::hasParameter( 'ssi' ) ) {
401
foreach ( self::parameter( 'ssi' ) as $id => $day_index ) {
409
}
410
}
411
return true;
412
default:
413
return false;
414
}
backend/components/dialogs/table_settings/Ajax.php CHANGED
@@ -35,7 +35,7 @@ class Ajax extends Lib\Base\Ajax
35
*/
36
protected static function permissions()
37
{
38
- return array( '_default' => 'user' );
39
}
40
41
/**
35
*/
36
protected static function permissions()
37
{
38
+ return array( '_default' => array( 'staff', 'supervisor' ) );
39
}
40
41
/**
backend/components/info/rate/Ajax.php CHANGED
@@ -14,7 +14,7 @@ class Ajax extends Lib\Base\Ajax
14
*/
15
protected static function permissions()
16
{
17
- return array( '_default' => 'user' );
18
}
19
20
/**
14
*/
15
protected static function permissions()
16
{
17
+ return array( '_default' => array( 'staff', 'supervisor' ) );
18
}
19
20
/**
backend/components/support/ButtonsAjax.php CHANGED
@@ -15,7 +15,7 @@ class ButtonsAjax extends Lib\Base\Ajax
15
*/
16
protected static function permissions()
17
{
18
- return array( '_default' => 'user' );
19
}
20
21
/**
15
*/
16
protected static function permissions()
17
{
18
+ return array( '_default' => array( 'staff', 'supervisor' ) );
19
}
20
21
/**
backend/components/support/templates/buttons.php CHANGED
@@ -66,32 +66,32 @@ use Bookly\Lib\Utils;
66
<i class="fas fa-fw fa-certificate"></i><span class="d-none d-lg-inline ml-2"><?php esc_html_e( 'View this page at Bookly Pro Demo', 'bookly' ) ?></span>
67
</a>
68
<?php if ( ! $dismiss ) : ?>
69
- <div id="bookly-demo-site-info-modal" class="bookly-modal bookly-fade text-left" tabindex=-1>
70
- <div class="modal-dialog">
71
- <div class="modal-content">
72
- <div class="modal-header">
73
- <h5 class="modal-title"><?php esc_html_e( 'Visit demo', 'bookly' ) ?></h5>
74
- <button type="button" class="close" data-dismiss="bookly-modal" aria-label="Close"><span>&times;</span></button>
75
- </div>
76
- <div class="modal-body">
77
- <p>
78
- <?php esc_html_e( 'The demo is a version of Bookly Pro with all installed add-ons so that you can try all the features and capabilities of the system and then choose the most suitable configuration according to your business needs.', 'bookly' ) ?>
79
- </p>
80
81
- <div class="custom-control custom-checkbox">
82
- <input class="custom-control-input form-check-input" id="bookly-js-dont-show-again-demo" type="checkbox"/>
83
- <label class="custom-control-label" for="bookly-js-dont-show-again-demo"><?php esc_html_e( 'don\'t show this notification again', 'bookly' ) ?></label>
84
- </div>
85
- </div>
86
- <div class="modal-footer">
87
- <?php Buttons::renderSubmit( null, 'bookly-js-proceed-to-demo', __( 'Proceed to demo', 'bookly' ), array( 'data-target' => $target ) ) ?>
88
- <?php Buttons::renderCancel() ?>
89
</div>
90
</div>
91
</div>
92
</div>
93
</div>
94
<?php endif ?>
95
<?php endif ?>
96
97
<?php
66
<i class="fas fa-fw fa-certificate"></i><span class="d-none d-lg-inline ml-2"><?php esc_html_e( 'View this page at Bookly Pro Demo', 'bookly' ) ?></span>
67
</a>
68
<?php if ( ! $dismiss ) : ?>
69
+ <div id="bookly-demo-site-info-modal" class="bookly-modal bookly-fade text-left" tabindex=-1>
70
+ <div class="modal-dialog">
71
+ <div class="modal-content">
72
+ <div class="modal-header">
73
+ <h5 class="modal-title"><?php esc_html_e( 'Visit demo', 'bookly' ) ?></h5>
74
+ <button type="button" class="close" data-dismiss="bookly-modal" aria-label="Close"><span>&times;</span></button>
75
+ </div>
76
+ <div class="modal-body">
77
+ <p>
78
+ <?php esc_html_e( 'The demo is a version of Bookly Pro with all installed add-ons so that you can try all the features and capabilities of the system and then choose the most suitable configuration according to your business needs.', 'bookly' ) ?>
79
+ </p>
80
81
+ <div class="custom-control custom-checkbox">
82
+ <input class="custom-control-input form-check-input" id="bookly-js-dont-show-again-demo" type="checkbox"/>
83
+ <label class="custom-control-label" for="bookly-js-dont-show-again-demo"><?php esc_html_e( 'don\'t show this notification again', 'bookly' ) ?></label>
84
</div>
85
</div>
86
+ <div class="modal-footer">
87
+ <?php Buttons::renderSubmit( null, 'bookly-js-proceed-to-demo', __( 'Proceed to demo', 'bookly' ), array( 'data-target' => $target ) ) ?>
88
+ <?php Buttons::renderCancel() ?>
89
+ </div>
90
</div>
91
</div>
92
</div>
93
<?php endif ?>
94
+ </div>
95
<?php endif ?>
96
97
<?php
backend/modules/calendar/Ajax.php CHANGED
@@ -10,11 +10,11 @@ use Bookly\Lib;
10
class Ajax extends Page
11
{
12
/**
13
- * @inheritdoc
14
*/
15
protected static function permissions()
16
{
17
- return array( '_default' => 'user' );
18
}
19
20
/**
10
class Ajax extends Page
11
{
12
/**
13
+ * @inheritDoc
14
*/
15
protected static function permissions()
16
{
17
+ return array( '_default' => array( 'staff', 'supervisor' ) );
18
}
19
20
/**
backend/modules/customers/Ajax.php CHANGED
@@ -14,7 +14,7 @@ class Ajax extends Lib\Base\Ajax
14
*/
15
protected static function permissions()
16
{
17
- return array( '_default' => 'user' );
18
}
19
20
/**
@@ -253,29 +253,4 @@ class Ajax extends Lib\Base\Ajax
253
254
wp_send_json_success();
255
}
256
-
257
- /**
258
- * Check if the current user has access to the action.
259
- *
260
- * @param string $action
261
- * @return bool
262
- */
263
- protected static function hasAccess( $action )
264
- {
265
- if ( parent::hasAccess( $action ) ) {
266
- if ( ! Lib\Utils\Common::isCurrentUserSupervisor() ) {
267
- switch ( $action ) {
268
- case 'getCustomers':
269
- case 'getCustomersList':
270
- return Lib\Entities\Staff::query()
271
- ->where( 'wp_user_id', get_current_user_id() )
272
- ->count() > 0;
273
- }
274
- } else {
275
- return true;
276
- }
277
- }
278
-
279
- return false;
280
- }
281
}
14
*/
15
protected static function permissions()
16
{
17
+ return array( '_default' => 'supervisor', );
18
}
19
20
/**
253
254
wp_send_json_success();
255
}
256
}
backend/modules/payments/Ajax.php CHANGED
@@ -14,7 +14,7 @@ class Ajax extends Lib\Base\Ajax
14
*/
15
protected static function permissions()
16
{
17
- return array( '_default' => 'user' );
18
}
19
20
/**
14
*/
15
protected static function permissions()
16
{
17
+ return array( '_default' => 'supervisor' );
18
}
19
20
/**
backend/modules/sms/Ajax.php CHANGED
@@ -14,15 +14,9 @@ class Ajax extends Lib\Base\Ajax
14
*/
15
protected static function permissions()
16
{
17
- $permissions = get_option( 'bookly_gen_allow_staff_edit_profile' ) ? 'user' : null;
18
- if ( Lib\Config::staffCabinetActive() ) {
19
- $permissions = 'user';
20
- }
21
-
22
return array(
23
- '_default' => $permissions,
24
- 'sendQueue' => 'user',
25
- 'clearAttachments' => 'user',
26
);
27
}
28
14
*/
15
protected static function permissions()
16
{
17
return array(
18
+ 'sendQueue' => array( 'supervisor', 'staff' ),
19
+ 'clearAttachments' => array( 'supervisor', 'staff' ),
20
);
21
}
22
backend/modules/staff/Ajax.php CHANGED
@@ -14,9 +14,9 @@ class Ajax extends Lib\Base\Ajax
14
*/
15
protected static function permissions()
16
{
17
- $permissions = get_option( 'bookly_gen_allow_staff_edit_profile' ) ? array( '_default' => 'user' ) : array();
18
if ( Lib\Config::staffCabinetActive() ) {
19
- $permissions = array( '_default' => 'user' );
20
}
21
22
return $permissions;
14
*/
15
protected static function permissions()
16
{
17
+ $permissions = get_option( 'bookly_gen_allow_staff_edit_profile' ) ? array( '_default' => 'staff' ) : array();
18
if ( Lib\Config::staffCabinetActive() ) {
19
+ $permissions = array( '_default' => 'staff' );
20
}
21
22
return $permissions;
languages/bookly.pot CHANGED
@@ -3573,40 +3573,6 @@ msgstr ""
3573
msgid "Insert Appointment Booking Form"
3574
msgstr ""
3575
3576
- msgid ""
3577
- "Could you please do me a BIG favor and give it a 5-star rating on WordPress?"
3578
- msgstr ""
3579
-
3580
- msgid "Just to help us spread the word and boost our motivation."
3581
- msgstr ""
3582
-
3583
- msgid "Ok, you deserve it"
3584
- msgstr ""
3585
-
3586
- msgid "Nope, maybe later"
3587
- msgstr ""
3588
-
3589
- msgid "Thank you for the {star} star rating!!!"
3590
- msgstr ""
3591
-
3592
- msgid "You asked to remind you"
3593
- msgstr ""
3594
-
3595
- msgid "Congratulations!!!"
3596
- msgstr ""
3597
-
3598
- msgid "You just made the <b>10th Sale</b> using Bookly Plugin!"
3599
- msgstr ""
3600
-
3601
- msgid "You just made the <b>100th Sale</b> using Bookly Plugin!"
3602
- msgstr ""
3603
-
3604
- msgid "You just made the <b>1000th Sale</b> using Bookly Plugin!"
3605
- msgstr ""
3606
-
3607
- msgid "You just made the <b>10000th Sale</b> using Bookly Plugin!"
3608
- msgstr ""
3609
-
3610
msgid "Send tax information"
3611
msgstr ""
3612
@@ -3953,6 +3919,40 @@ msgstr ""
3953
msgid "total price of booking"
3954
msgstr ""
3955
3956
msgid ""
3957
"To help us improve Bookly, the plugin anonymously collects usage "
3958
"information. You can opt out of sharing the information in Settings > "
3573
msgid "Insert Appointment Booking Form"
3574
msgstr ""
3575
3576
msgid "Send tax information"
3577
msgstr ""
3578
3919
msgid "total price of booking"
3920
msgstr ""
3921
3922
+ msgid ""
3923
+ "Could you please do me a BIG favor and give it a 5-star rating on WordPress?"
3924
+ msgstr ""
3925
+
3926
+ msgid "Just to help us spread the word and boost our motivation."
3927
+ msgstr ""
3928
+
3929
+ msgid "Ok, you deserve it"
3930
+ msgstr ""
3931
+
3932
+ msgid "Nope, maybe later"
3933
+ msgstr ""
3934
+
3935
+ msgid "Thank you for the {star} star rating!!!"
3936
+ msgstr ""
3937
+
3938
+ msgid "You asked to remind you"
3939
+ msgstr ""
3940
+
3941
+ msgid "Congratulations!!!"
3942
+ msgstr ""
3943
+
3944
+ msgid "You just made the <b>10th Sale</b> using Bookly Plugin!"
3945
+ msgstr ""
3946
+
3947
+ msgid "You just made the <b>100th Sale</b> using Bookly Plugin!"
3948
+ msgstr ""
3949
+
3950
+ msgid "You just made the <b>1000th Sale</b> using Bookly Plugin!"
3951
+ msgstr ""
3952
+
3953
+ msgid "You just made the <b>10000th Sale</b> using Bookly Plugin!"
3954
+ msgstr ""
3955
+
3956
msgid ""
3957
"To help us improve Bookly, the plugin anonymously collects usage "
3958
"information. You can opt out of sharing the information in Settings > "
lib/base/Ajax.php CHANGED
@@ -74,26 +74,36 @@ abstract class Ajax extends Component
74
75
if ( is_null( $security ) ) {
76
// Check if default permission is set.
77
- $security = isset ( $permissions['_default'] ) ? $permissions['_default'] : 'admin';
78
}
79
80
- switch ( $security ) {
81
- case 'admin' : return Lib\Utils\Common::isCurrentUserAdmin();
82
- case 'supervisor' : return Lib\Utils\Common::isCurrentUserSupervisor();
83
- case 'user' : return is_user_logged_in();
84
- case 'anonymous' : return true;
85
}
86
87
- return false;
88
}
89
90
/**
91
* Get access permissions for child controller methods.
92
* Array structure:
93
- * [
94
- * <method_name> => Access for specific action
95
- * _default => Default access for controller actions
96
- * ]
97
*
98
* @return array
99
*/
74
75
if ( is_null( $security ) ) {
76
// Check if default permission is set.
77
+ $security = isset ( $permissions['_default'] ) ? $permissions['_default'] : array( 'admin' );
78
}
79
80
+ $permitted = false;
81
+ foreach ( (array) $security as $access_type ) {
82
+ switch ( $access_type ) {
83
+ case 'admin': $permitted = Lib\Utils\Common::isCurrentUserAdmin(); break;
84
+ case 'supervisor': $permitted = Lib\Utils\Common::isCurrentUserSupervisor(); break;
85
+ case 'staff': $permitted = Lib\Utils\Common::isCurrentUserStaff(); break;
86
+ case 'customer': $permitted = Lib\Utils\Common::isCurrentUserCustomer(); break;
87
+ case 'user': $permitted = is_user_logged_in(); break;
88
+ case 'anonymous': $permitted = true; break;
89
+ }
90
+ if ( $permitted ) {
91
+ return true;
92
+ }
93
}
94
95
+ return $permitted;
96
}
97
98
/**
99
* Get access permissions for child controller methods.
100
* Array structure:
101
+ * [ action_name => array|string access_type ]
102
+ * where:
103
+ * action_name => action's name or _default;
104
+ * _default - for all actions which have no explicit value of access_type indicated
105
+ *
106
+ * access_type => array or string, for array it is enough that at least one of the access_type is available
107
*
108
* @return array
109
*/
lib/utils/Common.php CHANGED
@@ -164,7 +164,30 @@ abstract class Common
164
*/
165
public static function isCurrentUserSupervisor()
166
{
167
- return current_user_can( 'manage_options' ) || current_user_can( 'manage_bookly' ) || current_user_can( 'manage_bookly_appointments' );
168
}
169
170
/**
164
*/
165
public static function isCurrentUserSupervisor()
166
{
167
+ return self::isCurrentUserAdmin() || current_user_can( 'manage_bookly_appointments' );
168
+ }
169
+
170
+ /**
171
+ * Check whether the current user is staff or not.
172
+ *
173
+ * @return bool
174
+ */
175
+ public static function isCurrentUserStaff()
176
+ {
177
+ return self::isCurrentUserAdmin()
178
+ || Lib\Entities\Staff::query()->where( 'wp_user_id', get_current_user_id() )->count() > 0;
179
+ }
180
+
181
+ /**
182
+ * Check whether the current user is customer or not.
183
+ *
184
+ * @return bool
185
+ */
186
+ public static function isCurrentUserCustomer()
187
+ {
188
+ return self::isCurrentUserSupervisor()
189
+ || Lib\Entities\Customer::query()->where( 'wp_user_id', get_current_user_id() )->count() > 0
190
+ || self::isCurrentUserStaff();
191
}
192
193
/**
main.php CHANGED
@@ -3,7 +3,7 @@
3
Plugin Name: Bookly
4
Plugin URI: https://www.booking-wp-plugin.com/?utm_source=bookly_admin&utm_medium=plugins_page&utm_campaign=plugins_page
5
Description: Bookly Plugin – is a great easy-to-use and easy-to-manage booking tool for service providers who think about their customers. The plugin supports a wide range of services provided by business and individuals who offer reservations through websites. Set up any reservation quickly, pleasantly and easily with Bookly!
6
- Version: 18.1
7
Author: Bookly
8
Author URI: https://www.booking-wp-plugin.com/?utm_source=bookly_admin&utm_medium=plugins_page&utm_campaign=plugins_page
9
Text Domain: bookly
3
Plugin Name: Bookly
4
Plugin URI: https://www.booking-wp-plugin.com/?utm_source=bookly_admin&utm_medium=plugins_page&utm_campaign=plugins_page
5
Description: Bookly Plugin – is a great easy-to-use and easy-to-manage booking tool for service providers who think about their customers. The plugin supports a wide range of services provided by business and individuals who offer reservations through websites. Set up any reservation quickly, pleasantly and easily with Bookly!
6
+ Version: 18.2
7
Author: Bookly
8
Author URI: https://www.booking-wp-plugin.com/?utm_source=bookly_admin&utm_medium=plugins_page&utm_campaign=plugins_page
9
Text Domain: bookly
readme.txt CHANGED
@@ -3,9 +3,9 @@ Contributors: Ladela
3
Tags: Booking, booking system, appointment booking, Booking calendar, reservation calendar, appointment scheduler, appointment calendar
4
Donate link: https://www.booking-wp-plugin.com/
5
Requires at least: 3.7
6
- Tested up to: 5.4
7
Requires PHP: 5.3.7
8
- Stable tag: 18.1
9
License: GPLv3
10
License URI: http://www.gnu.org/licenses/gpl-3.0.html
11
3
Tags: Booking, booking system, appointment booking, Booking calendar, reservation calendar, appointment scheduler, appointment calendar
4
Donate link: https://www.booking-wp-plugin.com/
5
Requires at least: 3.7
6
+ Tested up to: 5.4.1
7
Requires PHP: 5.3.7
8
+ Stable tag: 18.2
9
License: GPLv3
10
License URI: http://www.gnu.org/licenses/gpl-3.0.html
11