| @@ -6,9 +6,8 @@ | ||
| 6 | 6 | */ |
| 7 | 7 | namespace Timetics\Core\Admin; |
| 8 | 8 | use Timetics\Utils\Singleton; |
| 9 | 9 | |
| 10 | -use function Timetics\timetics; | |
| 11 | 10 | |
| 12 | 11 | class Hooks { |
| 13 | 12 | use Singleton; |
| 14 | 13 | |
| @@ -33,8 +32,12 @@ | ||
| 33 | 32 | add_action( 'set_user_role', [ $this, 'set_roles' ], 10, 2 ); |
| 34 | 33 | |
| 35 | 34 | add_filter( 'timetics_menu', [ $this, 'update_busyness_menu' ] ); |
| 36 | 35 | |
| 36 | + add_filter( 'timetics_settings', [ $this, 'set_google_auth_url' ] ); | |
| 37 | + | |
| 38 | + add_filter( 'timetics_get_settings', [ $this, 'set_email_default_content' ] ); | |
| 39 | + | |
| 37 | 40 | /** |
| 38 | 41 | * Added temporary for leagacy sass. It will remove in future. |
| 39 | 42 | */ |
| 40 | 43 | do_action('timetics_admin_init'); |
| @@ -133,9 +136,9 @@ | ||
| 133 | 136 | |
| 134 | 137 | update_option( 'timetics_onboard_setup', true ); |
| 135 | 138 | update_option( 'timetics_onboard_settings', false ); |
| 136 | 139 | |
| 137 | - exit( wp_redirect( admin_url('admin.php?page=timetics#/onboard') ) ); | |
| 140 | + exit( esc_url( wp_redirect( admin_url('admin.php?page=timetics#/onboard') ) ) ); | |
| 138 | 141 | } |
| 139 | 142 | |
| 140 | 143 | /** |
| 141 | 144 | * Update site admin roles whne new site created |
| @@ -201,6 +204,72 @@ | ||
| 201 | 204 | $new_menu_items[] = $menu; |
| 202 | 205 | } |
| 203 | 206 | |
| 204 | 207 | return $new_menu_items; |
| 208 | + } | |
| 209 | + | |
| 210 | + /** | |
| 211 | + * Set google auth url | |
| 212 | + * | |
| 213 | + * @param array $settings | |
| 214 | + * | |
| 215 | + * @return array | |
| 216 | + */ | |
| 217 | + public function set_google_auth_url( $settings ) { | |
| 218 | + $settings['google_auth_redirect_uri'] = timetics_get_auth_redirect_uri( 'google-auth' ); | |
| 219 | + | |
| 220 | + return $settings; | |
| 221 | + } | |
| 222 | + | |
| 223 | + /** | |
| 224 | + * Set default settings | |
| 225 | + * | |
| 226 | + * @param array $settings [$settings description] | |
| 227 | + * | |
| 228 | + * @return mixed | |
| 229 | + */ | |
| 230 | + public function set_email_default_content( $settings ) { | |
| 231 | + | |
| 232 | + | |
| 233 | + $admin_email = get_option( 'admin_email' ); | |
| 234 | + | |
| 235 | + $defaults = [ | |
| 236 | + | |
| 237 | + 'booking_created_customer_email_from' => $admin_email, | |
| 238 | + 'booking_created_customer_email_title' => sprintf('%s', __( 'New meeting scheduled!', 'timetics' )), | |
| 239 | + 'booking_created_customer_email_body' => sprintf('<p>%s</p><p>%s</p>', __( 'Hi {%customer_name%}', 'timetics' ), __( 'A new meeting has been scheduled.', 'timetics' )), | |
| 240 | + | |
| 241 | + 'booking_created_host_email_from' => $admin_email, | |
| 242 | + 'booking_created_host_email_title' => sprintf('%s', __( 'New meeting scheduled!', 'timetics' )), | |
| 243 | + 'booking_created_host_email_body' => sprintf('<p>%s</p><p>%s</p>', __( 'Hi {%host_name%}', 'timetics' ), __( 'A new meeting has been scheduled.', 'timetics' )), | |
| 244 | + | |
| 245 | + | |
| 246 | + 'booking_canceled_customer_email_from' => $admin_email, | |
| 247 | + 'booking_canceled_customer_email_title' => sprintf('%s', __( 'Meeting cancelled', 'timetics' )), | |
| 248 | + 'booking_canceled_customer_email_body' => sprintf('<p>%s</p><p>%s</p>', __( 'Hi {%customer_name%}', 'timetics' ), __( '{%meeting_title%} has been canceled.', 'timetics' )), | |
| 249 | + | |
| 250 | + 'booking_canceled_host_email_from' => $admin_email, | |
| 251 | + 'booking_canceled_host_email_title' => sprintf('%s', __( 'Meeting cancelled', 'timetics' )), | |
| 252 | + 'booking_canceled_host_email_body' => sprintf('<p>%s</p><p>%s</p>', __( 'Hi {%host_name%}', 'timetics' ), __( '{%meeting_title%} has been canceled.', 'timetics' )), | |
| 253 | + | |
| 254 | + 'booking_rescheduled_customer_email_from' => $admin_email, | |
| 255 | + 'booking_rescheduled_customer_email_title' => sprintf('%s', __( 'Meeting rescheduled!', 'timetics' )), | |
| 256 | + 'booking_rescheduled_customer_email_body' => sprintf('<p>%s</p><p>%s</p>', __( 'Hi {%host_name%}', 'timetics' ), __( '{%meeting_title%} has been rescheduled', 'timetics' )), | |
| 257 | + | |
| 258 | + 'booking_rescheduled_host_email_from' => $admin_email, | |
| 259 | + 'booking_rescheduled_host_email_title' => sprintf('%s', __('Meeting rescheduled!', 'timetics' )), | |
| 260 | + 'booking_rescheduled_host_email_body' => sprintf('<p>%s</p><p>%s</p>', __( 'Hi {%host_name%}', 'timetics' ), __( '{%meeting_title%} has been rescheduled', 'timetics' )), | |
| 261 | + | |
| 262 | + 'booking_reminder_customer_email_from' => $admin_email, | |
| 263 | + 'booking_reminder_customer_email_title' => sprintf('%s', __( 'Meeting time reminder', 'timetics' )), | |
| 264 | + 'booking_reminder_customer_email_body' => sprintf('<p>%s</p><p>%s</p>', __( 'Hi {%customer_name%}', 'timetics' ), __( '{%meeting_title%} at {%meeting_date%} {%meeting_time%}', 'timetics' )), | |
| 265 | + | |
| 266 | + 'booking_reminder_host_email_from' => $admin_email, | |
| 267 | + 'booking_reminder_host_email_title' => sprintf('%s', __( 'Meeting time reminder', 'timetics' )), | |
| 268 | + 'booking_reminder_host_email_body' => sprintf('<p>%s</p><p>%s</p>', __( 'Hi {%host_name%}', 'timetics' ), __( '{%meeting_title%} at {%meeting_date%} {%meeting_time%}', 'timetics' )), | |
| 269 | + ]; | |
| 270 | + | |
| 271 | + $settings = wp_parse_args( $settings, $defaults ); | |
| 272 | + | |
| 273 | + return $settings; | |
| 205 | 274 | } |
| 206 | 275 | } |