/* Plugin Name: SASBoss WooCommerce Integration Description: A plugin to integrate WooCommerce with SASBoss API. Version: 0.7.1 Author: 13VoIP Pty Ltd License: Commercial License */ if (!defined("ABSPATH")) { exit(); } // Define plugin constants define("SASBOSS_PLUGIN_VERSION", "0.7.1"); define("SASBOSS_PLUGIN_DIR", plugin_dir_path(__FILE__)); define("SASBOSS_PLUGIN_URL", plugin_dir_url(__FILE__)); define("SASBOSS_REPO_URL", "https://dev.azure.com/13VoIP/43846730-84a7-443b-94f3-8867387f3829/_apis/git/repositories/5b1f7dc9-a01f-4ae7-b22c-974daeb973f0/items?path=/&resolveLfs=true&%24format=zip&api-version=5.0&download=true"); // URL to download updates function sasboss_plugin_init() { require_once SASBOSS_PLUGIN_DIR . "admin/class-sasboss-admin.php"; require_once SASBOSS_PLUGIN_DIR . "admin/class-sasboss-api.php"; } add_action("plugins_loaded", "sasboss_plugin_init"); // Add custom action links for settings and check for updates add_filter('plugin_action_links_' . plugin_basename(__FILE__), 'sasboss_add_action_links'); function sasboss_add_action_links($links) { $settings_link = '' . __('Settings', 'sasboss') . ''; $update_link = '' . __('Check for Updates', 'sasboss') . ''; return array_merge($links, array($settings_link, $update_link)); } function sasboss_activate() { // Minimum version requirements $min_php = "7.2"; // Minimum version of PHP required for the plugin $min_wp = "5.0"; // Minimum version of WordPress required for the plugin // Check PHP Version if (version_compare(PHP_VERSION, $min_php, "<")) { deactivate_plugins(plugin_basename(__FILE__)); wp_die(__("This plugin requires PHP version $min_php or higher.", "sasboss"), "Plugin dependency check", [ "back_link" => true, ]); } // Check WordPress Version if (version_compare(get_bloginfo("version"), $min_wp, "<")) { deactivate_plugins(plugin_basename(__FILE__)); wp_die(__("This plugin requires WordPress version $min_wp or higher.", "sasboss"), "Plugin dependency check", [ "back_link" => true, ]); } // Include the plugin.php file for is_plugin_active() function availability include_once ABSPATH . "wp-admin/includes/plugin.php"; // Check if WooCommerce is active if (!is_plugin_active("woocommerce/woocommerce.php")) { deactivate_plugins(plugin_basename(__FILE__)); // Deactivate your plugin wp_die(__("This plugin requires WooCommerce to be active.", "sasboss"), "Plugin dependency check", [ "back_link" => true, ]); } // Create database tables sasboss_create_database_tables(); // Schedule a daily event to check for updates if (!wp_next_scheduled("sasboss_daily_update_check")) { wp_schedule_event(time(), "daily", "sasboss_daily_update_check"); } } register_activation_hook(__FILE__, "sasboss_activate"); // Hook for plugin deactivation register_deactivation_hook(__FILE__, "sasboss_deactivate"); function sasboss_deactivate() { // Clean up any options or transient data if needed sasboss_cleanup(); // Clear scheduled update checks wp_clear_scheduled_hook("sasboss_daily_update_check"); } // Create database tables function sasboss_create_database_tables() { global $wpdb; $settings_table = $wpdb->prefix . "sasboss_settings"; $enterprises_table = $wpdb->prefix . "sasboss_enterprises"; $dashboard_table = $wpdb->prefix . "sasboss_dashboard"; $billing_table = $wpdb->prefix . "sasboss_billing"; $services_table = $wpdb->prefix . "sasboss_services"; $dids_table = $wpdb->prefix . "sasboss_dids"; $sales_table = $wpdb->prefix . "sasboss_sales"; $charset_collate = $wpdb->get_charset_collate(); $sql_settings = "CREATE TABLE IF NOT EXISTS $settings_table ( id MEDIUMINT(9) NOT NULL AUTO_INCREMENT, api_url VARCHAR(255) DEFAULT '' NOT NULL, api_user VARCHAR(255) DEFAULT '' NOT NULL, api_password VARCHAR(255) DEFAULT '' NOT NULL, api_role VARCHAR(255) DEFAULT '' NOT NULL, reseller_id VARCHAR(255) DEFAULT '' NOT NULL, PRIMARY KEY (id) ) $charset_collate;"; $sql_enterprises = "CREATE TABLE IF NOT EXISTS $enterprises_table ( id MEDIUMINT(9) NOT NULL AUTO_INCREMENT, reseller_id VARCHAR(255) NOT NULL, enterprise_name VARCHAR(255) NOT NULL, enterprise_short_name VARCHAR(255) NOT NULL, default_domain VARCHAR(255) NOT NULL, imp_domain VARCHAR(255) NOT NULL, industry VARCHAR(255) NOT NULL, disable_retail_billing VARCHAR(5) NOT NULL, portal_password VARCHAR(255) NOT NULL, address TEXT NOT NULL, contact TEXT NOT NULL, PRIMARY KEY (id) ) $charset_collate;"; $sql_dashboard = "CREATE TABLE IF NOT EXISTS $dashboard_table ( id MEDIUMINT(9) NOT NULL AUTO_INCREMENT, data_key VARCHAR(255) NOT NULL, data_value LONGTEXT NOT NULL, PRIMARY KEY (id) ) $charset_collate;"; $sql_billing = "CREATE TABLE IF NOT EXISTS $billing_table ( id MEDIUMINT(9) NOT NULL AUTO_INCREMENT, enterprise_id MEDIUMINT(9) NOT NULL, invoice_id VARCHAR(255) NOT NULL, invoice_data LONGTEXT NOT NULL, PRIMARY KEY (id), FOREIGN KEY (enterprise_id) REFERENCES $enterprises_table(id) ON DELETE CASCADE ) $charset_collate;"; $sql_services = "CREATE TABLE IF NOT EXISTS $services_table ( id MEDIUMINT(9) NOT NULL AUTO_INCREMENT, service_name VARCHAR(255) NOT NULL, service_description TEXT NOT NULL, service_price DECIMAL(10, 2) NOT NULL, PRIMARY KEY (id) ) $charset_collate;"; $sql_dids = "CREATE TABLE IF NOT EXISTS $dids_table ( id MEDIUMINT(9) NOT NULL AUTO_INCREMENT, did_number VARCHAR(255) NOT NULL, did_description TEXT NOT NULL, PRIMARY KEY (id) ) $charset_collate;"; $sql_sales = "CREATE TABLE IF NOT EXISTS $sales_table ( id MEDIUMINT(9) NOT NULL AUTO_INCREMENT, sale_amount DECIMAL(10, 2) NOT NULL, sale_date DATETIME NOT NULL, enterprise_id MEDIUMINT(9) NOT NULL, PRIMARY KEY (id), FOREIGN KEY (enterprise_id) REFERENCES $enterprises_table(id) ON DELETE CASCADE ) $charset_collate;"; require_once ABSPATH . "wp-admin/includes/upgrade.php"; dbDelta($sql_settings); dbDelta($sql_enterprises); dbDelta($sql_dashboard); dbDelta($sql_billing); dbDelta($sql_services); dbDelta($sql_dids); dbDelta($sql_sales); // Insert default settings row if not exists $exists = $wpdb->get_var("SELECT COUNT(*) FROM $settings_table"); if ($exists == 0) { $wpdb->insert($settings_table, [ "api_url" => "", "api_user" => "", "api_password" => "", "api_role" => "", "reseller_id" => "", ]); } } // Clean up on deactivation function sasboss_cleanup() { global $wpdb; $table_name = $wpdb->prefix . "sasboss_settings"; if (get_option("sasboss_delete_data_on_deactivation") === "yes") { $wpdb->query("DROP TABLE IF EXISTS $table_name"); delete_option("sasboss_plugin_version"); delete_option("sasboss_delete_data_on_deactivation"); } } // Enqueue scripts and styles function sasboss_enqueue_admin_scripts($hook) { if (strpos($hook, "sasboss") === false) { return; } wp_enqueue_style("sasboss-admin-style", SASBOSS_PLUGIN_URL . "admin/css/admin-style.css"); wp_enqueue_script( "sasboss-admin-script", SASBOSS_PLUGIN_URL . "admin/js/admin-script.js", ["jquery"], SASBOSS_PLUGIN_VERSION, true ); } add_action("admin_enqueue_scripts", "sasboss_enqueue_admin_scripts"); // Check for updates function sasboss_check_for_updates() { $latest_version_info = sasboss_get_latest_version_info(); if (!$latest_version_info || is_wp_error($latest_version_info)) { return; } if (!isset($latest_version_info['version'])) { return; } $latest_version = $latest_version_info['version']; $zip_url = $latest_version_info['zip_url']; if (version_compare($latest_version, SASBOSS_PLUGIN_VERSION, ">")) { // Notify about the update $transient->response[plugin_basename(__FILE__)] = (object) [ 'new_version' => $latest_version, 'package' => $zip_url, 'slug' => plugin_basename(__FILE__), 'plugin' => plugin_basename(__FILE__), 'url' => SASBOSS_REPO_URL, ]; } } function sasboss_get_plugin_version() { $plugin_data = get_file_data(__FILE__, array('Version' => 'Version'), false); return $plugin_data['Version']; } function sasboss_get_latest_version_info() { // Azure DevOps API URL to get the VERSION file content $url = "https://dev.azure.com/13VoIP/43846730-84a7-443b-94f3-8867387f3829/_apis/git/repositories/5b1f7dc9-a01f-4ae7-b22c-974daeb973f0/items?path=/VERSION&api-version=5.0"; $response = wp_remote_get($url); if (is_wp_error($response)) { return [ 'success' => false, 'message' => $response->get_error_message(), 'zip_url' => '' ]; } $body = wp_remote_retrieve_body($response); $version = trim($body); if (empty($version)) { return [ 'success' => false, 'message' => __('Version file not found or empty.', 'sasboss'), 'zip_url' => '' ]; } $zip_url = SASBOSS_REPO_URL; return [ 'success' => true, 'message' => __('Latest version info retrieved successfully.', 'sasboss'), 'version' => $version, 'zip_url' => $zip_url ]; } // Download and install update function sasboss_download_and_install_update($version, $zip_url) { $zip_file = download_url($zip_url); if (is_wp_error($zip_file)) { return; } // Rename the zip file $new_zip_file = dirname($zip_file) . '/sasboss plugin.zip'; rename($zip_file, $new_zip_file); // Define a temporary directory to unzip the file $temp_dir = wp_tempnam() . '-sasboss-update'; if (!mkdir($temp_dir) && !is_dir($temp_dir)) { return; } // Unzip the file to the temporary directory $result = unzip_file($new_zip_file, $temp_dir); // Delete the zip file after extracting unlink($new_zip_file); if (is_wp_error($result)) { return; } // Identify the correct source directory $unzipped_files = scandir($temp_dir); $source = $temp_dir; // Check if there's only one subdirectory and use it as the source $sub_dirs = array_values(array_diff($unzipped_files, ['.', '..'])); if (count($sub_dirs) === 1 && is_dir($temp_dir . '/' . $sub_dirs[0])) { $source = $temp_dir . '/' . $sub_dirs[0]; } // Ensure the correct plugin directory name $destination = WP_PLUGIN_DIR . "/sasboss plugin"; rename($source, $destination); // Clean up the temporary directory sasboss_remove_dir($temp_dir); // Update the plugin version update_option("sasboss_plugin_version", $version); } // Helper function to remove directory recursively function sasboss_remove_dir($dir) { if (is_dir($dir)) { $objects = scandir($dir); foreach ($objects as $object) { if ($object != "." && $object != "..") { if (is_dir($dir . "/" . $object)) { sasboss_remove_dir($dir . "/" . $object); } else { unlink($dir . "/" . $object); } } } rmdir($dir); } } // Add manual update check to settings page add_action("admin_init", "sasboss_manual_check_for_updates"); function sasboss_manual_check_for_updates() { if (isset($_GET["check_for_updates"])) { $latest_version_info = sasboss_get_latest_version_info(); if (!$latest_version_info['success']) { $_SESSION['update_message'] = $latest_version_info['message']; $_SESSION['update_success'] = false; $_SESSION['zip_url'] = $latest_version_info['zip_url']; } else { $_SESSION['update_message'] = __('Update check completed successfully.', 'sasboss'); $_SESSION['update_success'] = true; $_SESSION['zip_url'] = $latest_version_info['zip_url']; } // Redirect to the appropriate page if (isset($_GET["page"]) && $_GET["page"] === "sasboss-settings") { wp_redirect(admin_url("admin.php?page=sasboss-settings&update_checked=1")); } else { wp_redirect(admin_url("plugins.php?plugin_status=all&update_checked=1")); } exit(); } } function sasboss_admin_hooks() { if (!current_user_can("manage_options")) { wp_die(__("You do not have sufficient permissions to access this page.", "sasboss")); } add_action("admin_menu", "sasboss_add_admin_menu"); } add_action("admin_init", "sasboss_admin_hooks"); function sasboss_add_admin_menu() { $admin = new SASBoss_Admin(); } function sasboss_display_warning_message() { echo '
'; echo '

' . __("Note: Data may be up to 10 minutes old. We are working towards realtime data feeds in later versions.", "sasboss") . '

'; echo '
'; } add_action('woocommerce_account_dashboard', 'sasboss_display_warning_message'); // Check for plugin updates and show message on plugins page add_filter('pre_set_site_transient_update_plugins', 'sasboss_check_for_plugin_updates'); function sasboss_check_for_plugin_updates($transient) { if (empty($transient->checked)) { return $transient; } // Get the plugin data $plugin_version = SASBOSS_PLUGIN_VERSION; // Check for updates $latest_version_info = sasboss_get_latest_version_info(); if (!$latest_version_info || is_wp_error($latest_version_info)) { return $transient; } $latest_version = $latest_version_info['version']; $zip_url = $latest_version_info['zip_url']; if (version_compare($plugin_version, $latest_version, '<')) { $plugin_slug = plugin_basename(__FILE__); $transient->response[$plugin_slug] = (object) [ 'slug' => $plugin_slug, 'new_version' => $latest_version, 'url' => SASBOSS_REPO_URL, 'package' => $zip_url, ]; } return $transient; } ?>
Warning: Cannot modify header information - headers already sent by (output started at /home/site/wwwroot/wp-content/plugins/sasboss plugin/sasboss.php:1) in /home/site/wwwroot/wp-content/plugins/wp-seopress/inc/functions/options-advanced.php on line 102

Warning: Cannot modify header information - headers already sent by (output started at /home/site/wwwroot/wp-content/plugins/sasboss plugin/sasboss.php:1) in /home/site/wwwroot/wp-content/plugins/wp-seopress/inc/functions/options-advanced.php on line 110

Deprecated: Creation of dynamic property RevsliderDiviModule::$icon_path is deprecated in /home/site/wwwroot/wp-content/themes/Divi/includes/builder/class-et-builder-element.php on line 1425
5 Reasons Why Your Business Should Invest in a VoIP Phone System | Cloud Business Phone System | 13VoIP

As businesses continue to evolve, the way they communicate with clients, customers, and staff is also rapidly changing. Traditional phone systems are now being replaced by VoIP (Voice over Internet Protocol) phone systems, which use internet connections to transmit voice calls. In this blog post, we’ll explore five compelling reasons why your business should invest in a VoIP phone system to enhance communication and stay ahead of the competition.

  1. Cost-Effectiveness:

One of the most attractive reasons to switch to a VoIP phone system is the significant cost savings. Traditional phone systems can have high upfront costs, hefty monthly fees, and long-distance call charges. VoIP systems, on the other hand, typically have lower setup costs, reduced monthly fees, and often offer unlimited long-distance calling at no extra charge. Additionally, since VoIP systems utilize your existing internet connection, you don’t need to maintain separate networks for voice and data.

  1. Scalability:

As your business grows, it’s essential to have a phone system that can adapt to your changing needs. VoIP phone systems offer unmatched scalability, making it easy to add or remove lines and extensions as your business expands or contracts. This flexibility allows your communication system to evolve in tandem with your organization, ensuring you’re never paying for more lines than you need or struggling to accommodate new employees.

  1. Advanced Features:

VoIP phone systems boast an impressive array of advanced features that can boost productivity and improve your overall communication experience. Features such as call forwarding, voicemail to email, virtual receptionist, and conference calling are often included at no extra cost. Additionally, many VoIP providers offer integration with popular business applications like CRM systems, helping your team streamline their workflows and provide better customer service.

  1. Remote Work Compatibility:

The modern workforce is increasingly mobile and dispersed, with more employees working remotely than ever before. VoIP phone systems are ideally suited for remote work arrangements, as they allow employees to make and receive calls from any location with an internet connection. This flexibility not only empowers your team members to work from home, a coworking space, or even while traveling, but it also ensures your business can continue operating smoothly in the event of unforeseen disruptions, such as natural disasters or pandemics.

  1. Enhanced Call Quality:

One common misconception about VoIP phone systems is that call quality may be inferior to traditional phone lines. However, with advances in technology and high-speed internet connections, VoIP call quality has improved dramatically in recent years. Many users now report that VoIP calls are as clear or even clearer than traditional phone calls, providing a more professional and enjoyable communication experience for your clients and customers.


Investing in a VoIP phone system can revolutionize your business’s communication capabilities, saving you money, improving productivity, and providing flexibility in an ever-changing business landscape. By embracing VoIP technology, you can ensure your organization is well-equipped to thrive in the modern digital era.