-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfleet.php
More file actions
124 lines (114 loc) · 3.16 KB
/
Copy pathfleet.php
File metadata and controls
124 lines (114 loc) · 3.16 KB
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
<?php
/**
* PLUGIN_TITLE
*
* @package PLUGIN_NAME
* @author AUTHOR_NAME
* @copyright 2017-PLUGIN_TILL_YEAR Marcin Pietrzak
* @license GPL-2.0-or-later
*
* @wordpress-plugin
* Plugin Name: Development Fleet Manager
* Plugin URI: PLUGIN_URI
* Description: PLUGIN_DESCRIPTION
* Version: PLUGIN_VERSION
* Requires at least: PLUGIN_REQUIRES_WORDPRESS
* Requires PHP: PLUGIN_REQUIRES_PHP
* Author: AUTHOR_NAME
* Author URI: AUTHOR_URI
* Text Domain: fleet
* License: GPL v2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
*/
if ( ! defined( 'WPINC' ) ) {
die;
}
/**
* static options
*/
define( 'IWORKS_FLEET_VERSION', 'PLUGIN_VERSION' );
define( 'IWORKS_FLEET_PREFIX', 'iworks_fleet_' );
$base = __DIR__;
$includes = $base . '/includes';
/**
* require: Iworksfleet Class
*/
if ( ! class_exists( 'iworks_fleet' ) ) {
require_once $includes . '/iworks/class-iworks-fleet.php';
}
/**
* configuration
*/
require_once $base . '/etc/options.php';
/**
* require: IworksOptions Class
*/
if ( ! class_exists( 'iworks_options' ) ) {
require_once $includes . '/iworks/options/options.php';
}
/**
* load options
*/
global $iworks_fleet_options;
$iworks_fleet_options = null;
/**
* Initialize and get plugin options
* This function creates and returns the options object
*
* @return iworks_options The plugin options object
*/
function iworks_fleet_get_options_object() {
// Use global variable to store options object
global $iworks_fleet_options;
// Return existing options object if it exists
if ( is_object( $iworks_fleet_options ) ) {
return $iworks_fleet_options;
}
// Create new options object if it doesn't exist
$iworks_fleet_options = new iworks_options();
// Set the function name for options
$iworks_fleet_options->set_option_function_name( 'iworks_fleet_options' );
// Set the option prefix for all plugin options
$iworks_fleet_options->set_option_prefix( IWORKS_FLEET_PREFIX );
// Set the plugin file name if the method exists
if ( method_exists( $iworks_fleet_options, 'set_plugin' ) ) {
$iworks_fleet_options->set_plugin( basename( __FILE__ ) );
}
// Initialize the options
$iworks_fleet_options->options_init();
// Return the options object
return $iworks_fleet_options;
}
function iworks_fleet_activate() {
$iworks_fleet_options = iworks_fleet_get_options_object();
$iworks_fleet_options->activate();
/**
* install tables
*/
$iworks_fleet = new iworks_fleet();
$iworks_fleet->db_install();
}
function iworks_fleet_deactivate() {
$iworks_fleet_options = iworks_fleet_get_options_object();
$iworks_fleet_options->deactivate();
}
global $iworks_fleet;
$iworks_fleet = new iworks_fleet();
/**
* install & uninstall
*/
register_activation_hook( __FILE__, 'iworks_fleet_activate' );
register_deactivation_hook( __FILE__, 'iworks_fleet_deactivate' );
/**
* Ask for vote
*/
require_once $includes . '/iworks/rate/rate.php';
add_action( 'init', 'iworks_fleet_init_rate' );
function iworks_fleet_init_rate() {
do_action(
'iworks-register-plugin',
plugin_basename( __FILE__ ),
__( 'Fleet Manager', 'fleet' ),
'fleet'
);
}