PluginProbe
Timetics – Appointment Booking Calendar & Scheduling / trunk
Timetics – Appointment Booking Calendar & Scheduling vtrunk
1.0.61 1.0.60 1.0.59 1.0.58 1.0.57 1.0.56 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.19 1.0.2 1.0.20 1.0.21 1.0.22 1.0.23 1.0.24 All 62 releases
timetics / core / settings / settings.php

settings.php in Timetics – Appointment Booking Calendar & Scheduling trunk, at core/settings/settings.php

144 lines 3.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Global settings for timetics
4 *
5 * @package Timetics
6 */
7
8 // Exit if accessed directly
9 defined( 'ABSPATH' ) || exit;
10
11 if ( ! function_exists( 'timetics_get_option' ) ) {
12 /**
13 * Get option for timetics
14 *
15 * @since 1.0.0
16 * @return mixed
17 */
18 function timetics_get_option( $key = '', $default = false ) {
19 $options = get_option( 'timetics_settings' );
20 $value = $default;
21
22 if ( isset( $options[$key] ) ) {
23 $value = ! empty( $options[$key] ) ? $options[$key] : $default;
24 }
25
26 return $value;
27 }
28 }
29
30 if ( ! function_exists( 'timetics_update_option' ) ) {
31
32 /**
33 * Update option
34 *
35 * @param string $key
36 *
37 * @since 1.0.0
38 *
39 * @return boolean
40 */
41 function timetics_update_option( $key = '', $value = false ) {
42 if ( ! $key ) {
43 return false;
44 }
45
46 // Get the current settings.
47 $options = get_option( 'timetics_settings', [] );
48
49 // Set new settings value.
50 $options[$key] = $value;
51
52 // Update the settings.
53 $did_update = update_option( 'timetics_settings', $options );
54
55 return $did_update;
56 }
57 }
58
59 if ( ! function_exists( 'timetics_get_settings' ) ) {
60
61 /**
62 * Get settings
63 *
64 * Retrieve all plugin settings
65 *
66 * @since 1.0.0
67 *
68 * @return array Timetics Settings
69 */
70 function timetics_get_settings() {
71 // Get the option key.
72 $settings = get_option( 'timetics_settings' );
73
74 return apply_filters( 'timetics_get_settings', $settings );
75 }
76 }
77
78 if ( ! function_exists( 'timetics_get_busyness' ) ) {
79 /**
80 * Get selected busynsess
81 *
82 * @param string $category
83 *
84 * @return mixed
85 */
86 function timetics_get_busyness( $category ) {
87 $busyness = [
88 'doctor' => [
89 'customer' => __( 'Patients', 'timetics' ),
90 'staff' => __( 'Doctors', 'timetics' ),
91 ],
92 'education' => [
93 'customer' => __( 'Students', 'timetics' ),
94 'staff' => __( 'Teachers', 'timetics' ),
95 ],
96 ];
97
98 $busyness = apply_filters( 'timetics_busyness', $busyness );
99
100 $selected = ! empty( $busyness[$category] ) ? $busyness[$category] : '';
101
102 return $selected;
103 }
104 }
105
106 if ( ! function_exists( 'timetics_get_busyness_categories' ) ) {
107
108 /**
109 * Get busyness categories
110 *
111 * @return array
112 */
113 function timetics_get_busyness_categories() {
114 $busyness_categories = [
115 [
116 'id' => 'doctor',
117 'name' => __( 'Doctors/Health clinic', 'timetics' ),
118 ],
119 [
120 'id' => 'education',
121 'name' => __( 'Tutor and education center', 'timetics' ),
122 ],
123 [
124 'id' => 'others',
125 'name' => __( 'Others', 'timetics' ),
126 ],
127 ];
128
129 return apply_filters( 'timetics_busyness_categories', $busyness_categories );
130 }
131 }
132
133 if ( ! function_exists( 'timetics_get_busyness_category' ) ) {
134
135 /**
136 * Get busyness categories
137 *
138 * @return array
139 */
140 function timetics_get_busyness_category() {
141 return timetics_get_option( 'busyness_category' );
142 }
143 }
144