wp-store-locator.php
3.89 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 Name: WP Store Locator
Description: An easy to use location management system that enables users to search for nearby physical stores
Author: Tijmen Smit
Author URI: https://wpstorelocator.co/
Version: 2.2.234
Text Domain: wpsl
Domain Path: /languages/
License: GPL v3
WP Store Locator
Copyright (C) 2013 Tijmen Smit - tijmen@wpstorelocator.co
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
@package WP_Store_locator
@category Core
@author Tijmen Smit
*/
if ( !class_exists( 'WP_Store_locator' ) ) {
class WP_Store_locator {
/**
* Class constructor
*/
function __construct() {
$this->define_constants();
$this->includes();
$this->plugin_settings();
// Load classes
$this->post_types = new WPSL_Post_Types();
$this->i18n = new WPSL_i18n();
$this->frontend = new WPSL_Frontend();
$this->templates = new WPSL_Templates();
register_activation_hook( __FILE__, array( $this, 'install' ) );
}
/**
* Setup plugin constants.
*
* @since 1.0.0
* @return void
*/
public function define_constants() {
if ( !defined( 'WPSL_VERSION_NUM' ) )
define( 'WPSL_VERSION_NUM', '2.2.234' );
if ( !defined( 'WPSL_URL' ) )
define( 'WPSL_URL', plugin_dir_url( __FILE__ ) );
if ( !defined( 'WPSL_BASENAME' ) )
define( 'WPSL_BASENAME', plugin_basename( __FILE__ ) );
if ( !defined( 'WPSL_PLUGIN_DIR' ) )
define( 'WPSL_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
}
/**
* Include the required files.
*
* @since 2.0.0
* @return void
*/
public function includes() {
require_once( WPSL_PLUGIN_DIR . 'inc/wpsl-functions.php' );
require_once( WPSL_PLUGIN_DIR . 'inc/class-templates.php' );
require_once( WPSL_PLUGIN_DIR . 'inc/class-post-types.php' );
require_once( WPSL_PLUGIN_DIR . 'inc/class-i18n.php' );
require_once( WPSL_PLUGIN_DIR . 'frontend/class-frontend.php' );
if ( is_admin() || defined( 'WP_CLI' ) && WP_CLI ) {
require_once( WPSL_PLUGIN_DIR . 'admin/roles.php' );
require_once( WPSL_PLUGIN_DIR . 'admin/class-admin.php' );
}
}
/**
* Setup the plugin settings.
*
* @since 2.0.0
* @return void
*/
public function plugin_settings() {
global $wpsl_settings, $wpsl_default_settings;
$wpsl_settings = wpsl_get_settings();
$wpsl_default_settings = wpsl_get_default_settings();
}
/**
* Install the plugin data.
*
* @since 2.0.0
* @return void
*/
public function install( $network_wide ) {
require_once( WPSL_PLUGIN_DIR . 'inc/install.php' );
wpsl_install( $network_wide );
}
}
$GLOBALS['wpsl'] = new WP_Store_locator();
}