-
Notifications
You must be signed in to change notification settings - Fork 26
/
jne-shipping-rate.php
118 lines (96 loc) · 3.88 KB
/
jne-shipping-rate.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?php
/*
Plugin Name: WooCommerce JNE Shipping Rate
Plugin URI: http://codex.wordpress.org
Description: Menampilkan daftar ongkos pengiriman JNE
Version: 2.2
Author: Dani Gojay
Author URI: http://gojayincode.com
License: GPL2
*/
error_reporting(E_ALL & ~E_NOTICE);
global $wp_version;
define( 'JNE_REQUIRED_WP_VERSION', '3.0' );
// define environment
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV',
(getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV')
: 'production'));
if( APPLICATION_ENV == 'production' ){
ini_set('display_errors','off');
}
/**
* set debug mode
* wp_debug_mode(true);
*/
/**
* Check minimum wordpress version required > 3.0
* if lastest wordpress version < 3.0, send message for updating wordpress version
*/
$exit_msg = 'Plugin JNE Shipping Rate requires WordPress '. JNE_REQUIRED_WP_VERSION .' or newer. <a href="http://codex.wordpress.org/Upgrading_WordPress">Please update!</a>';
if ( version_compare( $wp_version, JNE_REQUIRED_WP_VERSION, "<" ) ) {
exit($exit_msg);
}
/**
*
* Globals Define
*
* JNE_PLUGIN_BASENAME = plugin basename -> "webroot\wp-content\plugins"
* JNE_PLUGIN_NAME = plugin name -> "jne-shipping-rate"
* JNE_PLUGIN_DIR = plugin directory -> "webroot\wp-content\plugins\jne-shipping-rate"
* JNE_PLUGIN_URL = plugin URL -> "http://yoursite.com/wp-content/plugins/jne-shipping-rate"
* JNE_PLUGIN_ASSET_URL = Asset URL -> "http://yoursite.com/wp-content/plugins/jne-shipping-rate/assets"
* JNE_PLUGIN_ASSET_DIR = plugin directory assets -> "webroot\wp-content\plugins\jne-shipping-rate\assets"
* JNE_PLUGIN_DATA_DIR = plugin directory data -> "webroot\wp-content\plugins\jne-shipping-rate\data"
* JNE_PLUGIN_INC_DIR = plugin directory includes -> "webroot\wp-content\plugins\jne-shipping-rate\includes"
* JNE_PLUGIN_TPL_DIR = plugin directory templates -> "webroot\wp-content\plugins\jne-shipping-rate\templates"
*
*/
if ( ! defined( 'JNE_PLUGIN_BASENAME' ) )
define( 'JNE_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
if ( ! defined( 'JNE_PLUGIN_NAME' ) )
define( 'JNE_PLUGIN_NAME', trim( dirname( JNE_PLUGIN_BASENAME ), '/' ) );
if ( ! defined( 'JNE_PLUGIN_DIR' ) )
define( 'JNE_PLUGIN_DIR', WP_PLUGIN_DIR . '/' . JNE_PLUGIN_NAME );
if ( ! defined( 'JNE_PLUGIN_URL' ) )
define( 'JNE_PLUGIN_URL', WP_PLUGIN_URL . '/' . JNE_PLUGIN_NAME );
if ( ! defined( 'JNE_PLUGIN_ASSET_URL' ) )
define( 'JNE_PLUGIN_ASSET_URL', JNE_PLUGIN_URL . '/assets' );
if ( ! defined( 'JNE_PLUGIN_ASSET_DIR' ) )
define( 'JNE_PLUGIN_ASSET_DIR', JNE_PLUGIN_DIR . '/assets' );
if ( ! defined( 'JNE_PLUGIN_DATA_DIR' ) )
define( 'JNE_PLUGIN_DATA_DIR', JNE_PLUGIN_DIR . '/data' );
if ( ! defined( 'JNE_PLUGIN_INC_DIR' ) )
define( 'JNE_PLUGIN_INC_DIR', JNE_PLUGIN_DIR . '/includes' );
if ( ! defined( 'JNE_PLUGIN_TPL_DIR' ) )
define( 'JNE_PLUGIN_TPL_DIR', JNE_PLUGIN_DIR . '/templates' );
// WOOCOMMERCE
if ( ! defined( 'JNE_PLUGIN_WOO_DIR' ) )
define( 'JNE_PLUGIN_WOO_DIR', JNE_PLUGIN_DIR . '/woocommerce' );
if ( ! defined( 'JNE_PLUGIN_WOO_URL' ) )
define( 'JNE_PLUGIN_WOO_URL', JNE_PLUGIN_URL . '/woocommerce' );
include 'jne-shipping-rate-functions.php';
include 'jne-shipping-rate-init.php';
// include 'includes/class-parse-jne.php';
include 'includes/class-parse-jne-new.php';
if( class_exists('JNE_Shipping_Rate') )
{
$JNE = new JNE_Shipping_Rate();
/**
* register_activation_hook
* @param file
* @param callback
*/
register_activation_hook( __FILE__, array( &$JNE, 'install' ) );
}
/*
* add woocommerce shipping method
*/
include 'woocommerce/woocommerce-jne-shipping-new.php';
// Global variable jne
// $GLOBALS['jne'] = new Parse_JNE( 'Jakarta.xls' );
$Parse_JNE2 = new Parse_JNE2();
$Parse_JNE2->filename = '04-2013';
$Parse_JNE2->start = 5;
$Parse_JNE2->populate();
$GLOBALS['jne'] = $Parse_JNE2;