-
Notifications
You must be signed in to change notification settings - Fork 0
/
placepress.php
177 lines (154 loc) · 4.58 KB
/
placepress.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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
<?php
/*
Plugin Name: PlacePress
Plugin URI: https://wpplacepress.org
Description: PlacePress adds Location and Tour post types, structured map blocks (for single and global locations), structured tour stop blocks, and custom taxonomies.
Version: 1.4.9
Text Domain: wp_placepress
Domain Path: /languages
Author: CSU Center for Public History + Digital Humanities
Author URI: https://csudigitalhumanities.org
Contributors: ebellempire,cphdh
Donate link: https://csudigitalhumanities.org/about/donate/
Tags: placepress, history, public, digital humanities, map, curatescape, blocks, location, tour, post type, walking, leaflet
Requires at least: 5.0
Tested up to: 6.7
Requires PHP: 7.4.3
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
/*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
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, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Copyright 2019 CSU Center for Public History + Digital Humanities (email : digitalhumanities@csuohio.edu)
*/
if (!defined("ABSPATH")) {
exit();
}
// Read Version from Plugin Header
function placepress_header_version($version=0){
if(is_admin()){
if(!function_exists('get_plugin_data')){
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
}
if(function_exists('get_plugin_data')){
$plugin_data = get_plugin_data( __FILE__ );
$version=isset($plugin_data["Version"]) ? $plugin_data["Version"] : 0;
}
}
return $version;
}
// Constants
define("PLACEPRESS_VERSION", placepress_header_version());
define("LEAFLET_JS", plugins_url()."/placepress/javascripts/leaflet@1.9.3/leaflet.js");
define("LEAFLET_CSS", plugins_url()."/placepress/javascripts/leaflet@1.9.3/leaflet.css");
define(
"CLUSTER_JS",
plugins_url()."/placepress/javascripts/leaflet.markercluster@1.4.1/leaflet.markercluster.js"
);
define(
"CLUSTER_CSS",
plugins_url()."/placepress/javascripts/leaflet.markercluster@1.4.1/MarkerCluster.css"
);
define(
"CLUSTER_CSS_DEFAULT",
plugins_url()."/placepress/javascripts/leaflet.markercluster@1.4.1/MarkerCluster.Default.css"
);
define(
"PLACEPRESS_TILE_PROVIDER",
plugins_url() . "/placepress/placepress-blocks/src/tile-provider.js"
);
define(
"PLACEPRESS_MAIN_JS",
plugins_url() . "/placepress/placepress-blocks/src/placepress.js"
);
define(
"PLACEPRESS_SETTINGS_JS",
plugins_url() . "/placepress/admin/settings/settings.js"
);
define(
"PLACEPRESS_SETTINGS_CSS",
plugins_url() . "/placepress/admin/settings/settings.css"
);
/*
** PLUGIN SETTINGS
*/
require_once plugin_dir_path(__FILE__) . "admin/settings/settings.php";
/*
** POST TYPES AND TAXONOMIES
*/
require_once plugin_dir_path(__FILE__) . "admin/post_types.php";
/*
** METABOXES
*/
require_once plugin_dir_path(__FILE__) . "admin/metaboxes.php";
/*
** BLOCKS
*/
require_once plugin_dir_path(__FILE__) . "placepress-blocks/src/init.php";
/*
** WIDGETS
*/
require_once plugin_dir_path(__FILE__) . "widgets/widgets.php";
/*
** MENUS
*/
require_once plugin_dir_path(__FILE__) . "admin/menus.php";
/*
** DASHBOARD
*/
require_once plugin_dir_path(__FILE__) . "admin/dashboard.php";
/*
** LANGUAGES
*/
require_once plugin_dir_path(__FILE__) . "languages/languages.php";
/*
** HELPERS
*/
require_once plugin_dir_path(__FILE__) . "helpers/helpers.php";
/*
** API
*/
require_once plugin_dir_path(__FILE__) . "api/output.php";
/*
** FILTERS
*/
require_once plugin_dir_path(__FILE__) . "filters/filters.php";
/*
** HOOKS
*/
require_once plugin_dir_path(__FILE__) . "hooks/hooks.php";
/*
** ACTIVATE
*/
function placepress_activate()
{
add_option("placepress_do_activation_redirect", true);
}
register_activation_hook(__FILE__, "placepress_activate");
function placepress_plugin_activation_redirect()
{
if (get_option("placepress_do_activation_redirect", false)) {
delete_option("placepress_do_activation_redirect");
flush_rewrite_rules();
wp_redirect("options-general.php?page=placepress");
exit();
}
}
add_action("admin_init", "placepress_plugin_activation_redirect");
/*
** DEACTIVATE
*/
function placepress_deactivate()
{
flush_rewrite_rules();
}
register_deactivation_hook(__FILE__, "placepress_deactivate");