-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathalpha-google-map-for-elementor.php
More file actions
110 lines (94 loc) · 3.99 KB
/
Copy pathalpha-google-map-for-elementor.php
File metadata and controls
110 lines (94 loc) · 3.99 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
<?php
/**
* Plugin Name: Alpha Google Map For Elementor
* Plugin URI: https://ali-ali.org/
* Description: Premium Google Map features for WordPress.
* Author: Ali Ali
* Author URI: https://github.com/Ali7Ali
* Version: 1.5.0
* Text Domain: alpha-google-map-for-elementor
* Domain Path: /languages
* Requires at least: 6.4
* Tested up to: 7.0
* Requires PHP: 7.4
* License: GPLv3
*
* @package AlphaGoogleMap
* */
/*
Copyright 2021 Ali Ali (email : ali.abdalhadi.ali@gmail.com)
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, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
if ( defined( 'ALPHAMAP_ADDONS_PL_ROOT' ) && realpath( (string) ALPHAMAP_ADDONS_PL_ROOT ) !== realpath( __FILE__ ) ) {
if ( ! function_exists( 'alpha_google_map_for_elementor_duplicate_copy_notice' ) ) {
/**
* Display a notice when another copy of the plugin is already active.
*/
function alpha_google_map_for_elementor_duplicate_copy_notice(): void {
printf(
'<div class="notice notice-error"><p>%s</p></div>',
esc_html__( 'Alpha Google Map For Elementor is already active from another plugin folder. Deactivate and delete the old copy before activating this one, or install the update using a ZIP whose top-level folder is alpha-google-map-for-elementor.', 'alpha-google-map-for-elementor' )
);
}
}
add_action( 'admin_notices', 'alpha_google_map_for_elementor_duplicate_copy_notice' );
register_activation_hook(
__FILE__,
static function (): void {
if ( ! function_exists( 'deactivate_plugins' ) ) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
deactivate_plugins( plugin_basename( __FILE__ ) );
wp_die(
esc_html__( 'Alpha Google Map For Elementor is already active from another plugin folder. Deactivate and delete the old copy before activating this one, or install the update using a ZIP whose top-level folder is alpha-google-map-for-elementor.', 'alpha-google-map-for-elementor' ),
esc_html__( 'Plugin activation blocked', 'alpha-google-map-for-elementor' ),
array( 'back_link' => true )
);
}
);
return;
}
define( 'ALPHAMAP_VERSION', '1.5.0' );
define( 'ALPHAMAP_ADDONS_PL_ROOT', __FILE__ );
define( 'ALPHAMAP_PL_URL', plugins_url( '/', ALPHAMAP_ADDONS_PL_ROOT ) );
define( 'ALPHAMAP_PL_PATH', plugin_dir_path( ALPHAMAP_ADDONS_PL_ROOT ) );
define( 'ALPHAMAP_PL_ASSETS', trailingslashit( ALPHAMAP_PL_URL . 'assets' ) );
define( 'ALPHAMAP_PL_INCLUDE', trailingslashit( ALPHAMAP_PL_PATH . 'include' ) );
define( 'ALPHAMAP_PL_LANGUAGES', trailingslashit( ALPHAMAP_PL_PATH . 'languages' ) );
define( 'ALPHAMAP_PLUGIN_BASE', plugin_basename( ALPHAMAP_ADDONS_PL_ROOT ) );
/**
* Plugin activation hook.
*/
function alpha_google_map_activate(): void {
include_once ALPHAMAP_PL_INCLUDE . '/class-alpha-google-map.php';
if ( class_exists( '\AlphaGoogleMap\Alpha_Google_Map' ) ) {
\AlphaGoogleMap\Alpha_Google_Map::activate();
}
}
register_activation_hook( __FILE__, 'alpha_google_map_activate' );
/**
* Initializes and runs the Alpha Google Map add-on by including the required plugin file
* and invoking the instance of the Alpha_Google_Map class.
*
* @return void
*/
function alpha_google_map_addon() {
// Load plugin file.
include_once ALPHAMAP_PL_INCLUDE . '/class-alpha-google-map.php';
// Run the plugin.
\AlphaGoogleMap\Alpha_Google_Map::instance();
}
add_action( 'plugins_loaded', 'alpha_google_map_addon' );