Helper = Helpers::getInstance(); // plugin activation hook register_activation_hook(ADQS_DIRECTORY_FILE, array($this, 'plugin_activate')); $this->update_setting(); // when plugin loaded add_action('plugins_loaded', array($this, 'init_plugin')); add_action('init', array($this, 'permalinks_flushed')); add_action('init', array($this, 'blocks_init'), 10090); } /** * Method blocks_init * * @return void */ public function blocks_init() { $this->load_translation(); if (!get_option('adqs_admin_settings')) { $adqs_settings_array = Setting::get_settings_fields(); $admin_setting = array(); if (is_array($adqs_settings_array)) { foreach ($adqs_settings_array as $single_setting) { if (isset($single_setting['option_name'])) { $admin_setting[$single_setting['option_name']] = isset($single_setting['value']) ? $single_setting['value'] : ''; } } update_option('adqs_admin_settings', $admin_setting); } update_option('adqs_admin_settings', $admin_setting); } $checkHasTerms = (term_exists('general', 'adqs_listing_types') || get_option('adqs_term_builder_default')) ? true : false; if (!$checkHasTerms) { $id = wp_insert_term('General', 'adqs_listing_types'); $deafult_fields = array( array( 'sectiontitle' => esc_html__('General Section', 'adirectory'), 'id' => '02652d5f-7374-43b5-be3d-8ad92345c11d', 'fields' => array( array( 'fieldid' => '9c206ad8-8110-495b-82f8-40ff45bb92c5', 'input_type' => 'pricing', 'label' => esc_html__('Pricing', 'adirectory'), 'name' => esc_html__('Pricing', 'adirectory'), 'placeholder' => esc_html__('Pricing placeholder', 'adirectory'), 'is_required' => 1, ), array( 'fieldid' => '90641e6c-d62d-4e36-af4c-77ecc34193f4', 'input_type' => 'view_count', 'label' => esc_html__('View Count', 'adirectory'), 'name' => esc_html__('View Count', 'adirectory'), 'placeholder' => esc_html__('view count placeholder', 'adirectory'), 'is_required' => 1, ), ), ), array( 'sectiontitle' => esc_html__('Contact Section', 'adirectory'), 'id' => '80dc2f81-fbe6-4b55-ad6c-7a9c04e1e639', 'fields' => array( array( 'fieldid' => '607f0712-44a5-4379-92e6-598fb932c9af', 'input_type' => 'phone', 'label' => esc_html__('Phone', 'adirectory'), 'name' => esc_html__('Phone', 'adirectory'), 'placeholder' => esc_html__('Enter phone number', 'adirectory'), 'is_required' => 1, ), array( 'fieldid' => 'e0b3572d-a708-4461-af7c-cc4386d43866', 'input_type' => 'zip', 'label' => esc_html__('Zip Code', 'adirectory'), 'name' => esc_html__('Zip Code', 'adirectory'), 'placeholder' => esc_html__('Enter zip code', 'adirectory'), ), array( 'fieldid' => 'a66f663a-2465-4d42-a0ca-77463173fd41', 'input_type' => 'website', 'label' => esc_html__('Website', 'adirectory'), 'name' => esc_html__('Website', 'adirectory'), 'placeholder' => esc_html__('Enter website url', 'adirectory'), ), ), ), array( 'sectiontitle' => esc_html__('Map and Address', 'adirectory'), 'id' => 'ac1f4d3a-bca0-41fd-be1c-e6caf65649e7', 'fields' => array( array( 'fieldid' => 'f45b3f63-1a9e-4143-b0a1-e9c8a3009988', 'input_type' => 'address', 'label' => esc_html__('Address', 'adirectory'), 'name' => esc_html__('Address', 'adirectory'), 'placeholder' => esc_html__('Enter address', 'adirectory'), 'is_required' => 1, ), array( 'fieldid' => '4c50f6ff-cdc4-4b29-96df-50468aee20ef', 'input_type' => 'map', 'label' => esc_html__('Map', 'adirectory'), 'name' => esc_html__('Map', 'adirectory'), 'placeholder' => esc_html__('Enter map', 'adirectory'), 'is_required' => 1, ), ), ), array( 'sectiontitle' => esc_html__('Images & Video', 'adirectory'), 'id' => '98d51901-c1a2-4a44-b9c6-51ad84e2a494', 'fields' => array( array( 'fieldid' => '9d3c1b4e-29f0-42ed-8d2c-30cddaec8a77', 'input_type' => 'video', 'label' => esc_html__('Video', 'adirectory'), 'name' => esc_html__('Video', 'adirectory'), 'placeholder' => esc_html__('Enter video url', 'adirectory'), ), ), ), ); update_term_meta(absint($id['term_id']) ?? 0, 'adqs_metafields_types', $deafult_fields); update_term_meta(absint($id['term_id']) ?? 0, 'adqs_term_icon', 'fas fa-map'); update_term_meta(absint($id['term_id']) ?? 0, 'adqs_term_default_expiry', '15'); update_option('adqs_term_builder_default', 1); } } /** * Method plugin activate * * @return void */ public function plugin_activate() { update_option('adqs_permalinks_flushed', 0); $this->adqs_onborading_pages(); } public function update_setting() { $option = get_option('adqs_admin_settings', array()); $adqs_email_templates = array( 'admin' => array( 'new_user_reg' => array( 'subject' => "A new user has registered", 'html_body' => "
A new user has just registered on your website.
Username: {user_name}
Email: {user_email}
Please review their details and take the necessary actions.
This is an automated message, please do not reply.
A new listing has been submitted on your website.
Listing Title: {listing_title}
Submitted By: {user_name}
Please review the listing for approval.
This is an automated message, please do not reply.
A listing has been updated on your website.
Listing Title: {listing_title}
Updated By: {user_name}
Please review the changes.
This is an automated message, please do not reply.
A new order has been placed on your website.
Order ID: {order_id}
Customer: {customer_name}
Please process the order as soon as possible.
This is an automated message, please do not reply.
An order has been completed on your website.
Order ID: {order_id}
Customer: {customer_name}
Thank you for using our service.
This is an automated message, please do not reply.
Thank you for registering on our website.
We are excited to have you with us. You can now start exploring and make the most of our services.
If you have any questions, feel free to reach out to our support team.
This is an automated message, please do not reply.
Thank you, {user_name}, for submitting your listing on our website.
Listing Title: {listing_title}
Your listing is now under review. You will be notified once it is approved.
This is an automated message, please do not reply.
Your listing titled '{listing_title}' has been approved.
It is now live on our website. We hope it brings you great success.
This is an automated message, please do not reply.
Dear {user_name}, your listing titled '{listing_title}' is about to expire.
Please renew your listing to continue its visibility on our website.
This is an automated message, please do not reply.
Dear {user_name}, your listing titled '{listing_title}' has expired.
If you would like to renew your listing, please visit your account dashboard.
This is an automated message, please do not reply.
Dear {customer_name}, your order has been received successfully.
Order ID: {order_id}
We are processing your order and will notify you once it is completed.
This is an automated message, please do not reply.
Dear {customer_name}, your order has been completed successfully.
Order ID: {order_id}
Thank you for your purchase. We hope you enjoy your product.
This is an automated message, please do not reply.