-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathedd-jalali-report.php
137 lines (118 loc) · 3.51 KB
/
edd-jalali-report.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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<?php
/**
* Plugin Name: گزارش گیری شمسی در Easy Digital Downloads
* Plugin URI: http://www.siaeb.com
* Version: 1.0
* Description: با استفاده از این افزونه شما می توانید گزارش های پرداخت را با انتخاب تاریخ شمسی مشاهده کنید
* Author: سیاوش ابراهیمی
* Author URI: http://www.siaeb.com
*/
// Exit if accessed directly.
use siaeb\edd\persian_report\includes\Initializer;
use siaeb\edd\persian_report\includes\Jdf;
if ( ! class_exists( 'SIAEB_EDD_PERSIAN_REPORT' ) ) :
final class SIAEB_EDD_PERSIAN_REPORT {
/**
* @var SIAEB_EDD_PERSIAN_REPORT
*
* @since 1.0.0
*/
private static $instance;
/**
* @var Initializer
*/
public $initializer;
/**
* @var JDF
*/
public $jdf;
public static function instance() {
if ( is_null( self::$instance instanceof SIAEB_EDD_PERSIAN_REPORT ) || ! self::$instance ) {
self::$instance = new SIAEB_EDD_PERSIAN_REPORT();
self::$instance->constants();
self::$instance->includes();
self::$instance->init();
}
return self::$instance;
}
/**
* Throw error on object clone.
*
* The whole idea of the singleton design pattern is that there is a single
* object therefore, we don't want the object to be cloned.
*
* @return void
* @since 1.0
* @access protected
*/
public function _clone() {
_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'siaeb-edd-persian-report' ), '1.0.0' );
}
/**
* Disable unserializing of the class.
*
* @return void
* @since 1.0
* @access protected
*/
public function _wakeup() {
_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'siaeb-edd-persian-report' ), '1.0.0' );
}
/**
* Initialize application
*
* @since 1.0
*/
private function init() {
$this->jdf = new Jdf();
$this->initializer = new Initializer();
}
/**
* Setup plugin constants.
*
* @access private
* @return void
* @since 1.0
*/
private function constants() {
$this->defineConstant( 'SIAEB_EPR_PREFIX', 'siaeb_epr_' );
$this->defineConstant( 'SIAEB_EPR_VERSION', '1.0.0' );
$this->defineConstant( 'SIAEB_EPR_PLUGIN_DIR', trailingslashit( plugin_dir_path( __FILE__ ) ) );
$this->defineConstant( 'SIAEB_EPR_PLUGIN_URL', trailingslashit( plugin_dir_url( __FILE__ ) ) );
$this->defineConstant( 'SIAEB_EPR_PLUGIN_FILE', __FILE__ );
$this->defineConstant( 'SIAEB_EPR_INC_DIR', SIAEB_EPR_PLUGIN_DIR . 'includes/' );
$this->defineConstant( 'SIAEB_EPR_ASSETS_URL', SIAEB_EPR_PLUGIN_URL . 'assets/' );
$this->defineConstant( 'SIAEB_EPR_IMAGES_URL', SIAEB_EPR_ASSETS_URL . 'images/' );
$this->defineConstant( 'SIAEB_EPR_CSS_URL', SIAEB_EPR_ASSETS_URL . 'css/' );
$this->defineConstant( 'SIAEB_EPR_JS_URL', SIAEB_EPR_ASSETS_URL . 'js/' );
}
/**
* Define constant
*
* @since 1.0
*/
private function defineConstant( $name, $value ) {
if ( ! defined( $name ) ) {
define( $name, $value );
}
}
/**
* Include required files.
*
* @access private
* @return void
* @since 1.0
*/
private function includes() {
require_once SIAEB_EPR_INC_DIR . 'Actions.php';
require_once SIAEB_EPR_INC_DIR . 'AssetsLoader.php';
require_once SIAEB_EPR_INC_DIR . 'Filters.php';
require_once SIAEB_EPR_INC_DIR . 'Initializer.php';
require_once SIAEB_EPR_INC_DIR . 'Jdf.php';
}
}
endif;
function siaeb_edd_persian_report() {
return SIAEB_EDD_PERSIAN_REPORT::instance();
}
siaeb_edd_persian_report();