| Server IP : 89.248.107.232 / Your IP : 216.73.217.70 Web Server : Apache System : Linux host2.kasilh.com 5.14.0-687.36.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Aug 7 05:40:49 EDT 2026 x86_64 User : seg ( 10005) PHP Version : 7.4.33 Disable Function : opcache_get_status MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/vhosts/seg-sa.es/grupo-seg.com/wp-content/plugins/mapplic-geo/ |
Upload File : |
<?php
/**
* Plugin Name: Mapplic GEO
* Plugin URI: https://www.mapplic.com/geo
* Description: Build amazing custom interactive maps of the world.
* Version: 1.0.3
* Text Domain: mgeo
* Author: sekler
* Author URI: https://1.envato.market/R5Nv
*/
if (!class_exists('MapplicGeo')) :
class MapplicGeo {
public $admin;
public static $version = '1.0.3';
public function __construct() {
define('MGEO_PATH', plugin_dir_url(__FILE__));
add_action('init', array($this, 'mgeo_register_post_type'));
add_action('init', array($this, 'mgeo_register_scripts_styles'));
add_filter('single_template', array($this, 'mgeo_single_map'));
add_filter('show_admin_bar' , array($this, 'mgeo_hide_admin_bar'));
add_shortcode('mgeo', array($this, 'mgeo_shortcode'));
if (is_admin()) {
include('admin/mgeo-admin.php');
$this->admin = new MapplicGeoAdmin();
register_activation_hook(__FILE__, array('MapplicGeoAdmin', 'mgeo_activation'));
}
}
public function mgeo_register_post_type() {
$labels = array(
'name' => esc_html__('Maps', 'mgeo'),
'singular_name' => esc_html__('Map', 'mgeo'),
'add_new_item' => esc_html__('Add New Map', 'mgeo'),
'new_item' => esc_html__('New Map', 'mgeo'),
'edit_item' => esc_html__('Edit Map', 'mgeo')
);
register_post_type('mgeo_map',
array(
'labels' => $labels,
'description' => esc_html__('Interactive maps', 'mgeo'),
'show_ui' => true,
'public' => true,
'publicly_queryable' => true,
'menu_icon' => 'dashicons-admin-site',
'rewrite' => array('slug' => 'mgeo_map'),
'supports' => array('title', 'author')
)
);
}
public function mgeo_register_scripts_styles() {
wp_register_style('openlayers', MGEO_PATH . 'ol/ol.css', false, '7.1.0');
wp_register_style('mgeo', MGEO_PATH . 'css/mgeo.css', array('openlayers'), MapplicGeo::$version);
wp_register_script('openlayers', MGEO_PATH . 'ol/ol.js', false, '7.1.0');
wp_register_script('papaparse', MGEO_PATH .'js/papaparse.min.js', false, '5.3.1');
wp_register_script('mgeo', MGEO_PATH . 'js/mgeo.js', array('openlayers', 'papaparse'), MapplicGeo::$version, true);
$mgeo_localize = array(
'search' => esc_html__('Search', 'mgeo'),
'more' => esc_html__('More', 'mgeo'),
'pdir' => MGEO_PATH
);
wp_localize_script('mgeo', 'mgeo_localize', $mgeo_localize);
}
public function mgeo_single_map($template) {
global $post;
$file = 'single-mgeo_map.php';
if ($post->post_type == 'mgeo_map' && locate_template(array($file)) !== $template) return plugin_dir_path(__FILE__) . 'single-mgeo_map.php';
else return $template;
}
public function mgeo_hide_admin_bar($show){
global $post;
if ($post->post_type == 'mgeo_map') return false;
else return $show;
}
public function mgeo_shortcode($atts) {
$a = array(
'id' => false
);
extract(shortcode_atts($a, $atts, 'mgeo'));
$post = get_post($id);
if (!$post) return '<p class="mgeo-warning">'. esc_html__('Invalid map ID', 'mgeo') .'<p/>';
wp_enqueue_style('mgeo');
wp_enqueue_script('mgeo');
$output = '<div id="mgeo-' . $id . '" class="mgeo-map" data-jsonstr="' . htmlentities($post->post_content, ENT_QUOTES, 'UTF-8') . '"></div>';
return $output;
}
}
endif;
function mgeo_build() {
global $mgeo;
if (!isset($mgeo)) $mgeo = new MapplicGeo();
return $mgeo;
}
mgeo_build();
?>