| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: Billingo Official for WooCommerce |
| 4 |
* Version: 4.3.3 |
| 5 |
* Requires at least: 6.8 |
| 6 |
* Requires PHP: 8.1 |
| 7 |
* License: GPL v2 or later |
| 8 |
* Description: Fontos tudnivaló a frissítés előtt: A 4.0-s verzió új működésre áll át – a meglévő beállítások nem kerülnek át automatikusan. Frissítés után az összes pluginbeállítás újra konfigurálást igényel. Ha frissítés történik, a számlázás csak akkor folytatható, ha a beállításokat újra végigviszed. Érdemes előtte egy képernyőfotót készíteni a jelenlegi beállításokról. |
| 9 |
* Author: Billingo Zrt. <hello@billingo.hu> |
| 10 |
* Author URI: https://billingo.hu |
| 11 |
* Text Domain: billingo |
| 12 |
|
| 13 |
*/ |
| 14 |
|
| 15 |
if (version_compare(PHP_VERSION, '8.1', '<')) { |
| 16 |
wp_die('A Billingo új 4.0-as verziójú modul használatához legalább PHP 8.1 verzió szükséges.'); |
| 17 |
} |
| 18 |
|
| 19 |
// Exit if accessed directly |
| 20 |
if ( ! defined( 'ABSPATH' ) ) { |
| 21 |
exit; |
| 22 |
} |
| 23 |
|
| 24 |
define('BILLINGO__PLUGIN_URL', plugin_dir_url(__FILE__)); |
| 25 |
define('BILLINGO__PLUGIN_DIR', plugin_dir_path(__FILE__)); |
| 26 |
|
| 27 |
require_once BILLINGO__PLUGIN_DIR . 'vendor/autoload.php'; |
| 28 |
|
| 29 |
use App\Billingo\WooCommerce\Helpers\WC_Billingo_Admin_Helper; |
| 30 |
use App\Billingo\WooCommerce\Helpers\WC_Billingo_Helper; |
| 31 |
use App\Billingo\WooCommerce\Repositories\Billingo_Repositroy; |
| 32 |
|
| 33 |
register_activation_hook(__FILE__, [Billingo_Repositroy::class, 'install']); |
| 34 |
register_activation_hook(__FILE__, 'billingo_plugin_activated'); |
| 35 |
|
| 36 |
// Hook for plugin updates |
| 37 |
add_action('upgrader_process_complete', 'billingo_plugin_updated', 10, 2); |
| 38 |
|
| 39 |
// Function to handle plugin activation |
| 40 |
function billingo_plugin_activated() { |
| 41 |
// Set flag to show settings notification |
| 42 |
update_option('wc_billingo_show_settings_notification', true); |
| 43 |
} |
| 44 |
|
| 45 |
// Function to handle plugin updates |
| 46 |
function billingo_plugin_updated($upgrader_object, $options) { |
| 47 |
// Check if our plugin was updated |
| 48 |
if ($options['action'] == 'update' && $options['type'] == 'plugin') { |
| 49 |
if (isset($options['plugins'])) { |
| 50 |
foreach ($options['plugins'] as $plugin) { |
| 51 |
if ($plugin == plugin_basename(__FILE__)) { |
| 52 |
// Run database upgrade to ensure all new fields are created |
| 53 |
Billingo_Repositroy::validateAndAddMissingColumns(); |
| 54 |
|
| 55 |
// Set flag to show settings notification |
| 56 |
update_option('wc_billingo_show_settings_notification', true); |
| 57 |
break; |
| 58 |
} |
| 59 |
} |
| 60 |
} |
| 61 |
} |
| 62 |
} |
| 63 |
|
| 64 |
add_action('init', [WC_Billingo_Helper::class, 'init']); |
| 65 |
|
| 66 |
if (is_admin()) { |
| 67 |
add_action('init', [WC_Billingo_Admin_Helper::class, 'init']); |
| 68 |
} |