| Server IP : 216.106.184.20 / Your IP : 216.73.216.234 Web Server : LiteSpeed System : Linux asmodeus.in-hell.com 5.14.0-570.58.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Oct 29 06:24:11 EDT 2025 x86_64 User : sekoaid1 ( 1891) PHP Version : 7.3.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/sekoaid1/public_html/wp-content/plugins/wp-map-block/includes/ |
Upload File : |
<?php
namespace WPMapBlock;
class Assets
{
public static function init()
{
$self = new self();
add_action('init', [$self, 'register_block_assets']);
}
public function register_block_assets()
{
$frontend_dependencies = include_once WPMAPBLOCK_ASSETS_DIR_PATH . 'dist/wpmapblock-frontend.core.min.asset.php';
wp_register_style(
'wp-map-block-stylesheets',
WPMAPBLOCK_ASSETS_URI . 'css/wpmapblock-frontend.css',
is_admin() ? array('wp-editor') : null,
$frontend_dependencies['version']
);
wp_register_script('wpmapblock-leaflet', plugins_url('assets/js/leaflet.js', dirname(__FILE__)), array('jquery'), null, true);
wp_register_script('wpmapblock-leaflet-fullscreen', plugins_url('assets/js/Control.FullScreen.js', dirname(__FILE__)), array('jquery'), null, true);
// Register block script for frontend.
wp_register_script(
'wp-map-block-frontend-js', // Handle.
WPMAPBLOCK_ASSETS_URI . 'dist/wpmapblock-frontend.core.min.js',
array_merge(array('jquery'), $frontend_dependencies['dependencies']),
$frontend_dependencies['version'],
true
);
$backend_dependencies = include_once WPMAPBLOCK_ASSETS_DIR_PATH . 'dist/wpmapblock.core.min.asset.php';
// Register block editor styles for backend.
wp_register_style(
'wp-map-block-editor-css',
WPMAPBLOCK_ASSETS_URI . 'css/wpmapblock-editor.css',
array('wp-edit-blocks'),
$backend_dependencies['version']
);
// Register block editor script for backend.
wp_register_script(
'wp-map-block-js', // Handle.
WPMAPBLOCK_ASSETS_URI . 'dist/wpmapblock.core.min.js',
$backend_dependencies['dependencies'],
$backend_dependencies['version'],
true
);
// WP Localized globals. Use dynamic PHP stuff in JavaScript via `wpmapblockGlobal` object.
wp_localize_script(
'wp-map-block-js',
'wpmapblockGlobal', // Array containing dynamic data for a JS Global.
[
'pluginDirPath' => plugin_dir_path(__DIR__),
'pluginDirUrl' => plugin_dir_url(__DIR__),
// Add more data here that you want to access from `wpmapblockGlobal` object.
]
);
wp_set_script_translations( 'wp-map-block-js', 'wp-map-block', WPMAPBLOCK_ROOT_DIR_PATH . 'languages/' );
}
}