getAssetUrl('css/attachment-delete-loading.css'), [], $this->getAssetVersion('css/attachment-delete-loading.css') ); wp_enqueue_script( 'advmo-attachment-delete-loading', $this->getAssetUrl('js/attachment-delete-loading.js'), ['jquery', 'media-views'], $this->getAssetVersion('js/attachment-delete-loading.js'), true ); wp_localize_script('advmo-attachment-delete-loading', 'advmoDeleteLoading', [ 'i18n' => [ 'deleting' => __('Deleting…', 'advanced-media-offloader'), ], ]); } private function getAssetUrl(string $path): string { return plugins_url('assets/' . $path, dirname(__DIR__, 2) . '/advanced-media-offloader.php'); } private function getAssetVersion(string $path): string { $file = dirname(__DIR__, 2) . '/assets/' . $path; if (file_exists($file)) { return (string) filemtime($file); } return defined('ADVMO_VERSION') ? (string) constant('ADVMO_VERSION') : '1.0.0'; } }