PluginProbe
Posti Shipping / trunk
Posti Shipping vtrunk
3.10.13 trunk 1.0.2 3.1.1 3.1.2 3.1.2.1 3.10.0 3.10.1 3.10.10 3.10.11 3.10.12 3.10.2 3.10.3 3.10.4 3.10.5 3.10.6 3.10.7 3.10.8 3.10.9 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.4.0 All 41 releases
posti-shipping / posti-shipping.php

posti-shipping.php in Posti Shipping trunk, at posti-shipping.php

90 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: Posti Shipping
4 * Version: 3.10.13
5 * Plugin URI: https://github.com/PostiDigital/woocommerce-shipping-plugin
6 * Description: Posti shipping service for WooCommerce.
7 * Author: Posti
8 * Author URI: https://www.posti.fi/
9 * Text Domain: woo-posti_shipping
10 * Domain Path: /core/languages/
11 * License: GPL v3 or later
12 *
13 * Requires at least: 5.0
14 * Tested up to: 7.0
15 * WC requires at least: 4.7
16 * WC tested up to: 10.7.0
17 * Requires PHP: 7.1
18 *
19 * Copyright: © 2017-2019 Seravo Oy, 2020-2026 Posti Oy
20 * License: GNU General Public License v3.0
21 * License URI: http://www.gnu.org/licenses/gpl-3.0.html
22 */
23
24 // Prevent direct access to this script
25 if ( ! defined('ABSPATH') ) {
26 exit;
27 }
28
29 /**
30 * Autoloader loads nothing but Pakettikauppa libraries. The classname of the generated autoloader is not unique,
31 * posti_shipping forks use the same autoloader which results in a fatal error if the main plugin and a posti_shipping plugin
32 * co-exist.
33 */
34 if ( ! class_exists('\Pakettikauppa\Client') ) {
35 require_once __DIR__ . '/vendor/autoload.php';
36 }
37
38 require_once 'core/class-core.php';
39
40 class Woo_Posti_Shipping extends Woo_Pakettikauppa_Core\Core {
41 public $prefix = 'woo_posti_shipping';
42
43 public function __construct( $config = [] ) {
44 parent::__construct($config);
45 }
46
47 public function can_load() {
48 if ( class_exists('Wc_Pakettikauppa') ) {
49 add_action(
50 'admin_notices',
51 function() {
52 echo '<div class="notice notice-error">';
53 echo '<p>' . $this->text->activated_core_plugin_error() . '</p>';
54 echo '</div>';
55 }
56 );
57
58 return false;
59 }
60
61 return true;
62 }
63 }
64
65 $instance = new Woo_Posti_Shipping(
66 [
67 'root' => __FILE__,
68 'version' => get_file_data(__FILE__, array( 'Version' ), 'plugin')[0],
69 'shipping_method_name' => 'posti_shipping_method',
70 'vendor_name' => 'Posti',
71 'vendor_fullname' => 'Posti Shipping',
72 'vendor_url' => 'https://www.posti.fi/',
73 'vendor_logo' => 'assets/img/posti-logo.png',
74 'setup_background' => 'assets/img/posti-background.jpg',
75 'setup_page' => 'wcpk-setup',
76 'pakettikauppa_api_config' => [
77 'production' => [
78 'base_uri' => 'https://nextshipping.posti.fi',
79 'use_posti_auth' => true,
80 'posti_auth_url' => 'https://oauth2.posti.com',
81 ],
82 ], // Overrides defaults and UI settings
83 'tracking_base_url' => 'https://www.posti.fi/fi/seuranta#/lahetys/',
84 'order_pickup' => true, //enable or disable order pickup feature
85 'order_pickup_callback_url' => 'https://connect.posti.fi/transportation/v1/orders', // PROD
86 // 'pakettikauppa_api_comment' => 'From WooCommerce', // Overrides default
87 ]
88 );
89
90