123 lines
5 KiB
PHP
123 lines
5 KiB
PHP
<?php
|
|
/**
|
|
* Plugin Name: Image-Rights HTML-Generator
|
|
* Description: Fügt einen Button hinzu, um Bildrechte zu bearbeiten und als HTML-Snippet in die Bildbeschriftung einzufügen.
|
|
* Version: 1.0
|
|
* Author: Dein Name
|
|
*/
|
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
exit; // Exit if accessed directly
|
|
}
|
|
|
|
function irhg_enqueue_scripts($hook) {
|
|
// Enqueue script and style on all admin pages for testing
|
|
wp_enqueue_script(
|
|
'irhg-script',
|
|
plugin_dir_url( __FILE__ ) . 'js/image-rights-html-generator.js','jquery',
|
|
'1.0',
|
|
true
|
|
);
|
|
|
|
|
|
wp_enqueue_style(
|
|
'tailwind-style',
|
|
plugin_dir_url( __FILE__ ) . 'assets/css/tailwind.css'
|
|
);
|
|
wp_enqueue_style(
|
|
'tailwind-output',
|
|
plugin_dir_url( __FILE__ ) . 'assets/css/tailwind-output.css',['tailwind-style']
|
|
);
|
|
wp_enqueue_style(
|
|
'irhg-style',
|
|
plugin_dir_url( __FILE__ ) . 'css/style.css'
|
|
);
|
|
}
|
|
add_action( 'admin_enqueue_scripts', 'irhg_enqueue_scripts' );
|
|
|
|
function irhg_add_modal() {
|
|
?>
|
|
<div
|
|
id="modal"
|
|
class="fixed inset-0 flex items-center justify-center bg-white bg-opacity-90 dark:bg-zinc-800 dark:bg-opacity-90 z-50 hidden"
|
|
role="dialog"
|
|
aria-modal="true"
|
|
aria-labelledby="modalTitle"
|
|
>
|
|
<div class="bg-white dark:bg-zinc-800 p-4 rounded-lg shadow-lg w-full max-w-md">
|
|
<h2 id="modalTitle" class="text-lg font-bold mb-4 text-zinc-800 dark:text-zinc-200">
|
|
Bild Metadaten bearbeiten
|
|
</h2>
|
|
<form id="metaDataForm">
|
|
<label for="imageTitle" class="block text-sm font-medium text-zinc-800 dark:text-zinc-200">Titel</label>
|
|
<input
|
|
type="text"
|
|
id="imageTitle"
|
|
name="imageTitle"
|
|
class="w-full border-zinc-300 dark:border-zinc-700 rounded-md shadow-sm focus:ring-blue-500 focus:border-blue-500 sm:text-sm"
|
|
aria-describedby="imageTitleHelp"
|
|
/>
|
|
<span id="imageTitleHelp" class="sr-only">Titel des Bildes eingeben</span>
|
|
<label for="imageSourceUrl" class="block text-sm font-medium text-zinc-800 dark:text-zinc-200 mt-2">Bildquelle Url</label>
|
|
<input
|
|
type="text"
|
|
id="imageSourceUrl"
|
|
name="imageSourceUrl"
|
|
class="w-full border-zinc-300 dark:border-zinc-700 rounded-md shadow-sm focus:ring-blue-500 focus:border-blue-500 sm:text-sm"
|
|
aria-describedby="imageSourceUrlHelp"
|
|
/>
|
|
<span id="imageSourceUrlHelp" class="sr-only">URL der Bildquelle eingeben</span>
|
|
<label for="imageAuthor" class="block text-sm font-medium text-zinc-800 dark:text-zinc-200 mt-2">Autor</label>
|
|
<input
|
|
type="text"
|
|
id="imageAuthor"
|
|
name="imageAuthor"
|
|
class="w-full border-zinc-300 dark:border-zinc-700 rounded-md shadow-sm focus:ring-blue-500 focus:border-blue-500 sm:text-sm"
|
|
aria-describedby="imageAuthorHelp"
|
|
/>
|
|
<span id="imageAuthorHelp" class="sr-only">Autor des Bildes eingeben</span>
|
|
<label for="authorImageUrl" class="block text-sm font-medium text-zinc-800 dark:text-zinc-200 mt-2">Autor URL</label>
|
|
<input
|
|
type="text"
|
|
id="authorImageUrl"
|
|
name="authorImageUrl"
|
|
class="w-full border-zinc-300 dark:border-zinc-700 rounded-md shadow-sm focus:ring-blue-500 focus:border-blue-500 sm:text-sm"
|
|
aria-describedby="authorImageUrlHelp"
|
|
/>
|
|
<span id="authorImageUrlHelp" class="sr-only">URL des Autors eingeben</span>
|
|
<label for="imageLicense" class="block text-sm font-medium text-zinc-800 dark:text-zinc-200 mt-2">Lizenz</label>
|
|
<input
|
|
type="text"
|
|
id="imageLicense"
|
|
name="imageLicense"
|
|
class="w-full border-zinc-300 dark:border-zinc-700 rounded-md shadow-sm focus:ring-blue-500 focus:border-blue-500 sm:text-sm"
|
|
aria-describedby="imageLicenseHelp"
|
|
/>
|
|
<span id="imageLicenseHelp" class="sr-only">Lizenz des Bildes eingeben</span>
|
|
<label for="licenseUrl" class="block text-sm font-medium text-zinc-800 dark:text-zinc-200 mt-2">Lizenz URL</label>
|
|
<input
|
|
type="text"
|
|
id="licenseUrl"
|
|
name="licenseUrl"
|
|
class="w-full border-zinc-300 dark:border-zinc-700 rounded-md shadow-sm focus:ring-blue-500 focus:border-blue-500 sm:text-sm"
|
|
aria-describedby="licenseUrlHelp"
|
|
/>
|
|
<span id="licenseUrlHelp" class="sr-only">URL der Lizenz eingeben</span>
|
|
<div class="mt-4 flex justify-end">
|
|
<button type="submit" class="bg-blue-500 text-white px-4 py-2 rounded-md">Speichern</button>
|
|
<button
|
|
type="button"
|
|
id="closeModal"
|
|
class="bg-zinc-200 text-zinc-700 dark:bg-zinc-700 dark:text-zinc-200 px-4 py-2 rounded-md ml-2"
|
|
>
|
|
Abbrechen
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
<?php
|
|
}
|
|
add_action( 'admin_footer', 'irhg_add_modal' );
|
|
?>
|