-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathextensions-leaflet-map.php
More file actions
139 lines (117 loc) · 5.04 KB
/
Copy pathextensions-leaflet-map.php
File metadata and controls
139 lines (117 loc) · 5.04 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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<?php
/**
* Plugin Name: Extensions for Leaflet Map Github Version
* Description: Extends the WordPress Plugin <a href="https://wordpress.org/plugins/leaflet-map/">Leaflet Map</a> with Leaflet Plugins and other functions.
* Plugin URI: https://leafext.de/en/
* Update URI: https://github.com/hupe13/extensions-leaflet-map-github
* Version: 5.0-260608
* Requires PHP: 8.2
* Requires Plugins: leaflet-map
* Author: hupe13
* Author URI: https://leafext.de/en/
* License: GPL v2 or later
* GitHub Plugin URI: https://github.com/hupe13/extensions-leaflet-map-github
* Primary Branch: main
*
* @package Extensions for Leaflet Map
**/
// Direktzugriff auf diese Datei verhindern.
defined( 'ABSPATH' ) || die();
define( 'LEAFEXT_PLUGIN_FILE', __FILE__ ); // /pfad/wp-content/plugins/extensions-leaflet-map/extensions-leaflet-map.php .
define( 'LEAFEXT_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); // /pfad/wp-content/plugins/extensions-leaflet-map-github/ .
define( 'LEAFEXT_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); // https://url/wp-content/plugins/extensions-leaflet-map-github/ .
define( 'LEAFEXT_PLUGIN_PICTS', LEAFEXT_PLUGIN_URL . 'pict/' ); // https://url/wp-content/plugins/extensions-leaflet-map-github/pict/ .
define( 'LEAFEXT_PLUGIN_SETTINGS', dirname( plugin_basename( __FILE__ ) ) ); // extensions-leaflet-map-github .
if ( ! function_exists( 'get_plugin_data' ) ) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
// string $plugin_file, bool $markup = true, bool $translate = true
$leafext_plugin_data = get_plugin_data( __FILE__, true, false );
define( 'LEAFEXT_VERSION', $leafext_plugin_data['Version'] );
if ( ! function_exists( 'leafext_plugin_active' ) ) {
function leafext_plugin_active( $slug ) {
$plugins = get_option( 'active_plugins' );
if ( is_array( $plugins ) ) {
$is_active = preg_grep( '/^.*\/' . $slug . '\.php$/', $plugins );
if ( count( $is_active ) === 1 ) {
return true;
}
}
$plugins = get_site_option( 'active_sitewide_plugins' );
if ( is_array( $plugins ) ) {
$is_active = preg_grep( '/^.*\/' . $slug . '\.php$/', array_flip( $plugins ) );
if ( count( $is_active ) === 1 ) {
return true;
}
}
return false;
}
}
if ( is_admin() ) {
require_once __DIR__ . '/admin.php';
}
require_once __DIR__ . '/php/enqueue-leafletplugins.php';
require_once __DIR__ . '/php/functions.php';
require_once __DIR__ . '/pkg/JShrink/Minifier.php';
require_once __DIR__ . '/php/elevation.php';
require_once __DIR__ . '/php/sgpx.php';
require_once __DIR__ . '/php/multielevation.php';
require_once __DIR__ . '/php/fullscreen.php';
require_once __DIR__ . '/php/gesture.php';
require_once __DIR__ . '/php/hover.php';
require_once __DIR__ . '/php/hoverlap.php';
require_once __DIR__ . '/php/markercluster.php';
require_once __DIR__ . '/php/placementstrategies.php';
require_once __DIR__ . '/php/clustergroup.php';
require_once __DIR__ . '/php/featuregroup.php';
require_once __DIR__ . '/php/parentgroup.php';
require_once __DIR__ . '/php/extramarker.php';
require_once __DIR__ . '/php/geojsonmarker.php';
require_once __DIR__ . '/php/extramarker-geojson.php';
require_once __DIR__ . '/php/hidemarkers.php';
require_once __DIR__ . '/php/choropleth.php';
require_once __DIR__ . '/php/zoomhome.php';
require_once __DIR__ . '/php/tileserver.php';
require_once __DIR__ . '/php/leaflet-search.php';
require_once __DIR__ . '/php/leaflet-directory.php';
require_once __DIR__ . '/php/managefiles.php';
require_once __DIR__ . '/php/overview-map.php';
require_once __DIR__ . '/php/featured-map.php';
require_once __DIR__ . '/php/targetmarker.php';
require_once __DIR__ . '/php/listmarker.php';
/**
* Add settings to plugin page.
*/
function leafext_add_action_links( $actions ) {
$actions[] = '<a href="' . esc_url( get_admin_url( null, 'admin.php?page=' . LEAFEXT_PLUGIN_SETTINGS ) ) . '">' . esc_html__( 'Settings', 'extensions-leaflet-map' ) . '</a>';
return $actions;
}
add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'leafext_add_action_links' );
/**
* For translating elevation.
*/
function leafext_extra_textdomain( $mofile, $domain ) {
if ( 'extensions-leaflet-map' === $domain ) {
if ( file_exists( LEAFEXT_PLUGIN_DIR . '/lang/extensions-leaflet-map-' . get_locale() . '.mo' ) ) {
$mofile = LEAFEXT_PLUGIN_DIR . '/lang/extensions-leaflet-map-' . get_locale() . '.mo';
}
}
return $mofile;
}
add_filter( 'load_textdomain_mofile', 'leafext_extra_textdomain', 10, 2 );
// Disable activation the other of WP / Github Version
if ( ! function_exists( 'leafext_disable_extensions_activation' ) ) {
function leafext_disable_extensions_activation( $actions, $plugin_file ) {
if ( array_key_exists( 'activate', $actions ) ) {
if ( basename( $plugin_file ) === basename( __FILE__ ) ) {
$actions['activate'] = wp_strip_all_tags( $actions['activate'] );
}
}
return $actions;
}
}
add_filter( 'plugin_action_links', 'leafext_disable_extensions_activation', 10, 2 );
// Github
if ( is_admin() ) {
require_once LEAFEXT_PLUGIN_DIR . 'github-backend-extensions.php';
}