/** * Constructor. */ public function __construct() { // Load l10n for fixtures creating. load_plugin_textdomain('bookly', false, dirname(plugin_basename(__FILE__)) . '/languages'); /* * Notifications mail & sms. */ $this->notifications = array(array('gateway' => 'email', 'type' => 'client_new_appointment', 'subject' => __('Your appointment information', 'bookly'), 'message' => wpautop(__("Dear [[CLIENT_NAME]].\n\nThis is confirmation that you have booked [[SERVICE_NAME]].\n\nWe are waiting you at [[COMPANY_ADDRESS]] on [[APPOINTMENT_DATE]] at [[APPOINTMENT_TIME]].\n\nThank you for choosing our company.\n\n[[COMPANY_NAME]]\n[[COMPANY_PHONE]]\n[[COMPANY_WEBSITE]]", 'bookly')), 'active' => 1), array('gateway' => 'email', 'type' => 'staff_new_appointment', 'subject' => __('New booking information', 'bookly'), 'message' => wpautop(__("Hello.\n\nYou have new booking.\n\nService: [[SERVICE_NAME]]\nDate: [[APPOINTMENT_DATE]]\nTime: [[APPOINTMENT_TIME]]\nClient name: [[CLIENT_NAME]]\nClient phone: [[CLIENT_PHONE]]\nClient email: [[CLIENT_EMAIL]]", 'bookly')), 'active' => 0), array('gateway' => 'email', 'type' => 'client_reminder', 'subject' => __('Your appointment at [[COMPANY_NAME]]', 'bookly'), 'message' => wpautop(__("Dear [[CLIENT_NAME]].\n\nWe would like to remind you that you have booked [[SERVICE_NAME]] tomorrow on [[APPOINTMENT_TIME]]. We are waiting you at [[COMPANY_ADDRESS]].\n\nThank you for choosing our company.\n\n[[COMPANY_NAME]]\n[[COMPANY_PHONE]]\n[[COMPANY_WEBSITE]]", 'bookly')), 'active' => 0), array('gateway' => 'email', 'type' => 'client_follow_up', 'subject' => __('Your visit to [[COMPANY_NAME]]', 'bookly'), 'message' => wpautop(__("Dear [[CLIENT_NAME]].\n\nThank you for choosing [[COMPANY_NAME]]. We hope you were satisfied with your [[SERVICE_NAME]].\n\nThank you and we look forward to seeing you again soon.\n\n[[COMPANY_NAME]]\n[[COMPANY_PHONE]]\n[[COMPANY_WEBSITE]]", 'bookly')), 'active' => 0), array('gateway' => 'email', 'type' => 'staff_agenda', 'subject' => __('Your agenda for [[TOMORROW_DATE]]', 'bookly'), 'message' => wpautop(__("Hello.\n\nYour agenda for tomorrow is:\n\n[[NEXT_DAY_AGENDA]]", 'bookly')), 'active' => 0), array('gateway' => 'email', 'type' => 'staff_cancelled_appointment', 'subject' => __('Booking cancellation', 'bookly'), 'message' => wpautop(__("Hello.\n\nThe following booking has been cancelled.\n\nService: [[SERVICE_NAME]]\nDate: [[APPOINTMENT_DATE]]\nTime: [[APPOINTMENT_TIME]]\nClient name: [[CLIENT_NAME]]\nClient phone: [[CLIENT_PHONE]]\nClient email: [[CLIENT_EMAIL]]", 'bookly')), 'active' => 0), array('gateway' => 'email', 'type' => 'client_new_wp_user', 'subject' => __('New customer', 'bookly'), 'message' => wpautop(__("Hello.\n\nAn account was created for you at [[SITE_ADDRESS]]\n\nYour user details:\nuser: [[NEW_USERNAME]]\npassword: [[NEW_PASSWORD]]\n\nThanks.", 'bookly')), 'active' => 1), array('gateway' => 'sms', 'type' => 'client_new_appointment', 'subject' => '', 'message' => __("Dear [[CLIENT_NAME]].\nThis is confirmation that you have booked [[SERVICE_NAME]].\nWe are waiting you at [[COMPANY_ADDRESS]] on [[APPOINTMENT_DATE]] at [[APPOINTMENT_TIME]].\nThank you for choosing our company.\n[[COMPANY_NAME]]\n[[COMPANY_PHONE]]\n[[COMPANY_WEBSITE]]", 'bookly'), 'active' => 1), array('gateway' => 'sms', 'type' => 'staff_new_appointment', 'subject' => '', 'message' => __("Hello.\nYou have new booking.\nService: [[SERVICE_NAME]]\nDate: [[APPOINTMENT_DATE]]\nTime: [[APPOINTMENT_TIME]]\nClient name: [[CLIENT_NAME]]\nClient phone: [[CLIENT_PHONE]]\nClient email: [[CLIENT_EMAIL]]", 'bookly'), 'active' => 0), array('gateway' => 'sms', 'type' => 'client_reminder', 'subject' => '', 'message' => __("Dear [[CLIENT_NAME]].\nWe would like to remind you that you have booked [[SERVICE_NAME]] tomorrow on [[APPOINTMENT_TIME]]. We are waiting you at [[COMPANY_ADDRESS]].\nThank you for choosing our company.\n[[COMPANY_NAME]]\n[[COMPANY_PHONE]]\n[[COMPANY_WEBSITE]]", 'bookly'), 'active' => 0), array('gateway' => 'sms', 'type' => 'client_follow_up', 'subject' => '', 'message' => __("Dear [[CLIENT_NAME]].\nThank you for choosing [[COMPANY_NAME]]. We hope you were satisfied with your [[SERVICE_NAME]].\nThank you and we look forward to seeing you again soon.\n[[COMPANY_NAME]]\n[[COMPANY_PHONE]]\n[[COMPANY_WEBSITE]]", 'bookly'), 'active' => 0), array('gateway' => 'sms', 'type' => 'staff_agenda', 'subject' => '', 'message' => __("Hello.\nYour agenda for tomorrow is:\n[[NEXT_DAY_AGENDA]]", 'bookly'), 'active' => 0), array('gateway' => 'sms', 'type' => 'staff_cancelled_appointment', 'subject' => '', 'message' => __("Hello.\nThe following booking has been cancelled.\nService: [[SERVICE_NAME]]\nDate: [[APPOINTMENT_DATE]]\nTime: [[APPOINTMENT_TIME]]\nClient name: [[CLIENT_NAME]]\nClient phone: [[CLIENT_PHONE]]\nClient email: [[CLIENT_EMAIL]]", 'bookly'), 'active' => 0), array('gateway' => 'sms', 'type' => 'client_new_wp_user', 'subject' => '', 'message' => __("Hello.\nAn account was created for you at [[SITE_ADDRESS]]\nYour user details:\nuser: [[NEW_USERNAME]]\npassword: [[NEW_PASSWORD]]\n\nThanks.", 'bookly'), 'active' => 1)); /** * Options. */ $this->options = array('ab_data_loaded' => '0', 'ab_db_version' => bookly_plugin_get_version(), 'ab_installation_time' => time(), 'ab_settings_company_name' => '', 'ab_settings_company_logo' => '', 'ab_settings_company_logo_path' => '', 'ab_settings_company_logo_url' => '', 'ab_settings_company_address' => '', 'ab_settings_company_phone' => '', 'ab_settings_company_website' => '', 'ab_settings_pay_locally' => '1', 'ab_settings_sender_name' => get_option('blogname'), 'ab_settings_sender_email' => get_option('admin_email'), 'ab_settings_time_slot_length' => '15', 'ab_settings_minimum_time_prior_booking' => '0', 'ab_settings_maximum_available_days_for_booking' => '365', 'ab_settings_use_client_time_zone' => '0', 'ab_settings_create_account' => '0', 'ab_settings_coupons' => '0', 'ab_settings_google_client_id' => '', 'ab_settings_google_client_secret' => '', 'ab_settings_google_two_way_sync' => 1, 'ab_settings_google_limit_events' => 50, 'ab_settings_google_event_title' => '[[SERVICE_NAME]]', 'ab_settings_final_step_url' => '', 'ab_settings_allow_staff_members_edit_profile' => 1, 'ab_settings_link_assets_method' => 'enqueue', 'ab_settings_phone_default_country' => 'auto', 'ab_settings_monday_start' => '08:00', 'ab_settings_monday_end' => '18:00', 'ab_settings_tuesday_start' => '08:00', 'ab_settings_tuesday_end' => '18:00', 'ab_settings_wednesday_start' => '08:00', 'ab_settings_wednesday_end' => '18:00', 'ab_settings_thursday_start' => '08:00', 'ab_settings_thursday_end' => '18:00', 'ab_settings_friday_start' => '08:00', 'ab_settings_friday_end' => '18:00', 'ab_settings_saturday_start' => '', 'ab_settings_saturday_end' => '', 'ab_settings_sunday_start' => '', 'ab_settings_sunday_end' => '', 'ab_settings_cancel_page_url' => home_url(), 'ab_appearance_text_info_first_step' => __('Please select service: ', 'bookly'), 'ab_appearance_text_info_second_step' => __("Below you can find a list of available time slots for [[SERVICE_NAME]] by [[STAFF_NAME]].\nClick on a time slot to proceed with booking.", 'bookly'), 'ab_appearance_text_info_third_step' => __("You selected a booking for [[SERVICE_NAME]] by [[STAFF_NAME]] at [[SERVICE_TIME]] on [[SERVICE_DATE]]. The price for the service is [[SERVICE_PRICE]].\nPlease provide your details in the form below to proceed with booking.", 'bookly'), 'ab_appearance_text_info_third_step_guest' => '', 'ab_appearance_text_info_fourth_step' => __('Please tell us how you would like to pay: ', 'bookly'), 'ab_appearance_text_info_fifth_step' => __('Thank you! Your booking is complete. An email with details of your booking has been sent to you.', 'bookly'), 'ab_appearance_text_info_coupon' => __('The price for the service is [[SERVICE_PRICE]].', 'bookly'), 'ab_appearance_color' => '#f4662f', 'ab_appearance_text_step_service' => __('Service', 'bookly'), 'ab_appearance_text_step_time' => __('Time', 'bookly'), 'ab_appearance_text_step_details' => __('Details', 'bookly'), 'ab_appearance_text_step_payment' => __('Payment', 'bookly'), 'ab_appearance_text_step_done' => __('Done', 'bookly'), 'ab_appearance_text_label_category' => __('Category', 'bookly'), 'ab_appearance_text_label_service' => __('Service', 'bookly'), 'ab_appearance_text_label_employee' => __('Employee', 'bookly'), 'ab_appearance_text_label_select_date' => __('I\'m available on or after', 'bookly'), 'ab_appearance_text_label_start_from' => __('Start from', 'bookly'), 'ab_appearance_text_label_finish_by' => __('Finish by', 'bookly'), 'ab_appearance_text_label_name' => __('Name', 'bookly'), 'ab_appearance_text_label_phone' => __('Phone', 'bookly'), 'ab_appearance_text_label_email' => __('Email', 'bookly'), 'ab_appearance_text_label_coupon' => __('Coupon', 'bookly'), 'ab_appearance_text_label_pay_locally' => __('I will pay locally', 'bookly'), 'ab_appearance_text_label_number_of_persons' => __('Number of persons', 'bookly'), 'ab_appearance_text_option_service' => __('Select service', 'bookly'), 'ab_appearance_text_option_category' => __('Select category', 'bookly'), 'ab_appearance_text_option_employee' => __('Any', 'bookly'), 'ab_appearance_show_progress_tracker' => '1', 'ab_appearance_show_blocked_timeslots' => '0', 'ab_appearance_show_day_one_column' => '0', 'ab_appearance_show_calendar' => '0', 'ab_envato_purchase_code' => '', 'ab_paypal_api_username' => '', 'ab_paypal_api_password' => '', 'ab_paypal_api_signature' => '', 'ab_paypal_ec_mode' => '', 'ab_paypal_type' => 'disabled', 'ab_paypal_id' => '', 'ab_paypal_currency' => 'USD', 'ab_authorizenet_api_login_id' => '', 'ab_authorizenet_transaction_key' => '', 'ab_authorizenet_sandbox' => 0, 'ab_authorizenet_type' => 'disabled', 'ab_stripe' => '0', 'ab_stripe_secret_key' => '', 'ab_custom_fields' => '[{"type":"textarea","label":' . json_encode(__('Notes', 'bookly')) . ',"required":false,"id":1}]', 'ab_woocommerce' => '0', 'ab_woocommerce_product' => '', 'ab_woocommerce_cart_info_name' => __('Appointment', 'bookly'), 'ab_woocommerce_cart_info_value' => __('Date', 'bookly') . ": [[APPOINTMENT_DATE]]\n" . __('Time', 'bookly') . ": [[APPOINTMENT_TIME]]\n" . __('Service', 'bookly') . ": [[SERVICE_NAME]]", 'ab_sms_token' => '', 'ab_sms_username' => '', 'ab_sms_administrator_phone' => '', 'ab_sms_default_country_code' => ''); }
function bookly_plugin_update_db() { $db_version = get_option('ab_db_version'); $plugin_version = bookly_plugin_get_version(); $update_class = new AB_Updates(); if ($plugin_version > $db_version) { $db_version_underscored = 'update_' . str_replace('.', '_', $db_version); $plugin_version_underscored = 'update_' . str_replace('.', '_', $plugin_version); // sort the update methods ascending $updates = array_filter(get_class_methods($update_class), function ($method) { return strstr($method, 'update_'); }); usort($updates, 'strnatcmp'); foreach ($updates as $method) { if ($method > $db_version_underscored && $method <= $plugin_version_underscored) { call_user_func(array($update_class, $method)); } } update_option('ab_db_version', $plugin_version); } }