Files
2026-04-28 15:13:50 +02:00

129 lines
4.3 KiB
PHP

<?php
/**
* The plugin bootstrap file
*
* This file is read by WordPress to generate the plugin information in the plugin
* admin area. This file also includes all of the dependencies used by the plugin,
* registers the activation and deactivation functions, and defines a function
* that starts the plugin.
*
* @link https://polkurier.pl
* @since 1.0.0
* @package Polkurier
*
* @wordpress-plugin
* Plugin Name: Polkurier
* Plugin URI: https://www.polkurier.pl/baza-wiedzy/artykul/integracja-z-woocommerce
* Description: Rozszerzenie WooCommerce do integracji z platformą Polkurier
* Version: 1.24.1
* Author: Polkurier
* Author URI: https://polkurier.pl/
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* Text Domain: polkurier
* Domain Path: /languages
*/
// If this file is called directly, abort.
if (!defined('WPINC')) {
die;
}
if (PHP_VERSION_ID < 50600) {
add_action('admin_notices', function () {
echo '<div class="error"><p><strong>Polkurier</strong> wymaga do działania PHP w wersji minimum 5.6</p></div>';
});
return;
}
if (isset($wp_version) && version_compare($wp_version, '4.7', '<')) {
add_action('admin_notices', function () {
echo '<div class="error"><p><strong>Polkurier</strong> wymaga do działania Wordpress w wersji minimum 4.7</p></div>';
});
return;
}
// Autoload
spl_autoload_register(static function ($className) {
if (strpos($className, 'Polkurier\\') === 0) {
$classesDir = realpath(plugin_dir_path(__FILE__)) . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR;
$classFile = str_replace(['_', '\\'], DIRECTORY_SEPARATOR, $className) . '.php';
include_once $classesDir . $classFile;
}
});
/**
* Currently plugin version.
* Start at version 1.0.0 and use SemVer - https://semver.org
* Rename this for your plugin and update it as you release new versions.
*/
define('POLKURIER_PLUGIN_VERSION', '1.24.1');
/**
* The code that runs during plugin activation.
* This action is documented in includes/class-polkurier-activator.php
*/
function activate_polkurier()
{
require_once plugin_dir_path(__FILE__) . 'includes/class-polkurier-activator.php';
Polkurier_Activator::activate();
}
/**
* The code that runs during plugin deactivation.
* This action is documented in includes/class-polkurier-deactivator.php
*/
function deactivate_polkurier()
{
require_once plugin_dir_path(__FILE__) . 'includes/class-polkurier-deactivator.php';
Polkurier_Deactivator::deactivate();
}
register_activation_hook(__FILE__, 'activate_polkurier');
register_deactivation_hook(__FILE__, 'deactivate_polkurier');
/**
* The core plugin class that is used to define internationalization,
* admin-specific hooks, and public-facing site hooks.
*/
require plugin_dir_path(__FILE__) . 'includes/class-polkurier.php';
/**
* Begins execution of the plugin.
*
* Since everything within the plugin is registered via hooks,
* then kicking off the plugin from this point in the file does
* not affect the page life cycle.
*
* @since 1.0.0
*/
function run_polkurier()
{
$plugin = Polkurier::instance();
$plugin->run();
}
add_action('admin_notices', function () {
if ((int)get_option('pk-update-notice-1.10.0') === 1) {
if ($_GET['page'] === 'wc-settings' && $_GET['tab'] === 'shipping') {
delete_option('pk-update-notice-1.10.0');
return;
}
echo '
<div class="notice notice-warning inline is-dismissible" data-dismissible="polkurier-update-1100-notice">
<h3>Polkurier</h3>
<p>
<strong>Uwaga!</strong> od wersji <strong>1.10.0</strong> zmienił się sposób konfiguracji metod wysyłki.<br>
Przejdź do zakładki <a href="admin.php?page=wc-settings&tab=shipping">"WooCommerce" &rarr; "Ustawienia" &rarr; "Wysyłka"</a> i zweryfikuj czy ustawienia zostały zaimportowane poprawnie.
<br>
<br>
Więcej informacji znajdziesz w zakładce "Integracje" oraz bazie wiedzy na stronie <a href="https://polkurier.pl">Polkurier.pl</a>
</p>
</div>
';
}
});
run_polkurier();