Changeset 2964519
- Timestamp:
- 09/08/2023 01:49:24 PM (3 years ago)
- Location:
- image-rights
- Files:
-
- 16 added
- 1 deleted
- 4 edited
-
tags/1.2 (added)
-
tags/1.2/css (added)
-
tags/1.2/css/admin-styles.css (added)
-
tags/1.2/css/styles.css (added)
-
tags/1.2/image-rights.php (added)
-
tags/1.2/js (added)
-
tags/1.2/js/admin-scripts.js (added)
-
tags/1.2/js/scripts.js (added)
-
tags/1.2/languages (added)
-
tags/1.2/languages/photocredits-de_DE.mo (added)
-
tags/1.2/languages/photocredits-de_DE.po (added)
-
tags/1.2/languages/photocredits-de_DE_formal.mo (added)
-
tags/1.2/languages/photocredits-de_DE_formal.po (added)
-
tags/1.2/readme.txt (added)
-
trunk/image-rights.php (modified) (4 diffs)
-
trunk/languages/photocredits-de_DE.mo (modified) (previous)
-
trunk/languages/photocredits-de_DE.po (modified) (2 diffs)
-
trunk/languages/photocredits-de_DE_formal.mo (added)
-
trunk/languages/photocredits-de_DE_formal.po (added)
-
trunk/languages/photocredits.pot (deleted)
-
trunk/readme.txt (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
image-rights/trunk/image-rights.php
r2833883 r2964519 13 13 Author: WSM – Walter Solbach Metallbau GmbH 14 14 Author URI: https://www.wsm.eu/ 15 Version: 1. 115 Version: 1.2 16 16 Text Domain: photocredits 17 17 Domain Path: /languages/ … … 60 60 61 61 /** 62 * Register admin setting 63 * 64 */ 65 function pcr_settings_section() { 66 add_settings_section( 67 'pcr_settings_section', // Section ID 68 __( 'Image Rights Options', 'photocredits' ), // Section Title 69 'pcr_section_options_callback', // Callback 70 'media' // What Page? This makes the section show up on the General Settings Page 71 ); 72 73 add_settings_field( 74 'pcr_option_1', 75 __( 'Copyright overlay on images', 'photocredits' ), 76 'pcr_imageoverlay_field_cb', 77 'media', 78 'pcr_settings_section', 79 array( 80 'type' => 'checkbox', 81 'option_group' => 'pcr_options', 82 'name' => 'pcr_option_1', 83 'label_for' => 'pcr_option_1', 84 'value' => get_option('pcr_option_1', '0'), 85 'description' => __( 'activate', 'photocredits' ), 86 'checked' => get_option('pcr_option_1', '0'), 87 ) 88 ); 89 90 register_setting('media', 'pcr_option_1', 'esc_attr'); 91 } 92 add_action('admin_init', 'pcr_settings_section'); 93 94 function pcr_section_options_callback() { // Section Callback 95 echo ''; 96 } 97 98 function pcr_imageoverlay_field_cb($args) { 99 $checked = $args['checked']; 100 $value = $args['value']; 101 102 if($checked) { $checked = ' checked="checked" '; } 103 // Could use ob_start. 104 $html = ''; 105 $html .= '<input id="' . esc_attr( $args['name'] ) . '" 106 name="' . esc_attr( $args['name'] ) .'" value="1" 107 type="checkbox" ' . $checked . '/>'; 108 $html .= '<span class="wndspan">' . esc_html( $args['description'] ) .'</span>'; 109 110 echo $html; 111 } 112 113 114 /** 62 115 * Load Front styles and scripts 63 116 * … … 76 129 wp_enqueue_style( 'pcr_front_styles', $pcr_styles_css, array(), filemtime( $pcr_styles_path_css ), 'all' ); 77 130 78 //$pcr_scripts_js = plugin_dir_url(__FILE__) . 'js/scripts.js';79 //$pcr_scripts_path_js = plugin_dir_path(__FILE__) . 'js/scripts.js';80 //wp_enqueue_script( 'pcr-custom-js', $pcr_scripts_js, array( 'jquery' ), filemtime( $pcr_scripts_path_js ), true );81 82 131 $post_thumbnail_id = get_post_meta( $post->ID, '_thumbnail_id', true ); 83 132 $pcr_photographer_name = get_post_meta( $post_thumbnail_id, 'pcr_photographer_name', true ); … … 243 292 */ 244 293 function pcr_post_thumb_meta_data( $html, $post_id, $post_image_id ) { 245 246 // check if not a single post 247 if ( !is_singular() ) { 248 249 // Return default if NOT single post / page 294 295 // check if overlay was activted in admin settings 296 if ( get_option('pcr_option_1') == "1" ) { 297 298 // check if not a single post or front page 299 if ( !is_singular() || is_front_page() ) { 300 301 // Return default if NOT single post / page / front 302 return $html; 303 304 } else { 305 306 //get meta information 307 $meta_photographer = get_post_meta( $post_image_id, 'pcr_photographer_name', true ); 308 $meta_platform = get_post_meta( $post_image_id, 'pcr_photographer_platform', true ); 309 $featured_image = get_the_post_thumbnail_url( $post_id, 'medium' ); 310 311 // init string 312 $meta = $meta_photographer . ' | ' . $meta_platform; 313 314 // remove pipe sign if only one meta field present 315 if ( str_starts_with( $meta, ' | ' ) || str_ends_with( $meta, ' | ' ) ) : 316 $meta = str_replace( ' | ', '', $meta ); 317 endif; 318 319 // add layer if meta present 320 if ( !empty( $meta ) ) : 321 if ( str_contains( $html, 'figcaption' ) ) { 322 $html = str_replace( '</figcaption>', '</figcaption><span>' . $meta . '</span>', $html ); 323 $html = '<div class="pcr_featured_wrap">' . $html . '</div>'; 324 } else { 325 $html = '<div class="pcr_featured_wrap">' . $html . '<span>' . $meta . '</span></div>'; 326 } 327 endif; 328 329 return $html; 330 } 331 332 } else { 333 334 // not activated, return standard markup 250 335 return $html; 251 252 } else { 336 337 } 338 } 339 add_filter( 'post_thumbnail_html', 'pcr_post_thumb_meta_data', 10, 3 ); 340 341 342 /** 343 * Add meta layer over content images 344 * 345 */ 346 function pcr_img_add_meta_data( $filtered_image, $context, $attachment_id ) { 347 348 // check if overlay was activted in admin settings 349 if ( get_option('pcr_option_1') == "1" ) { 253 350 254 351 //get meta information 255 $meta_photographer = get_post_meta( $ post_image_id, 'pcr_photographer_name', true );256 $meta_platform = get_post_meta( $ post_image_id, 'pcr_photographer_platform', true );257 $featured_image = get_the_post_thumbnail_url( $post_id, 'medium' );352 $meta_photographer = get_post_meta( $attachment_id, 'pcr_photographer_name', true ); 353 $meta_platform = get_post_meta( $attachment_id, 'pcr_photographer_platform', true ); 354 $featured_image = get_the_post_thumbnail_url( get_the_ID(), 'medium' ); 258 355 259 356 // init string 260 357 $meta = $meta_photographer . ' | ' . $meta_platform; 261 358 262 359 // remove pipe sign if only one meta field present 263 360 if ( str_starts_with( $meta, ' | ' ) || str_ends_with( $meta, ' | ' ) ) : 264 361 $meta = str_replace( ' | ', '', $meta ); 265 362 endif; 266 363 267 364 // add layer if meta present 268 365 if ( !empty( $meta ) ) : 269 if ( str_contains( $ html, 'figcaption' ) ) {270 $ html = str_replace( '</figcaption>', '</figcaption><span>' . $meta . '</span>', $html);271 $ html = '<div class="pcr_featured_wrap">' . $html. '</div>';366 if ( str_contains( $filtered_image, 'figcaption' ) ) { 367 $filtered_image = str_replace( '</figcaption>', '</figcaption><span>' . $meta . '</span>', $filtered_image ); 368 $filtered_image = '<div class="pcr_content_wrap">' . $filtered_image . '</div>'; 272 369 } else { 273 $ html = '<div class="pcr_featured_wrap">' . $html. '<span>' . $meta . '</span></div>';370 $filtered_image = '<div class="pcr_content_wrap">' . $filtered_image . '<span>' . $meta . '</span></div>'; 274 371 } 275 372 endif; 276 277 return $html; 278 } 279 } 280 add_filter( 'post_thumbnail_html', 'pcr_post_thumb_meta_data', 10, 3 ); 281 282 283 /** 284 * Add meta layer over content images 285 * 286 */ 287 function pcr_img_add_meta_data( $filtered_image, $context, $attachment_id ) { 288 289 //get meta information 290 $meta_photographer = get_post_meta( $attachment_id, 'pcr_photographer_name', true ); 291 $meta_platform = get_post_meta( $attachment_id, 'pcr_photographer_platform', true ); 292 $featured_image = get_the_post_thumbnail_url( get_the_ID(), 'medium' ); 293 294 // init string 295 $meta = $meta_photographer . ' | ' . $meta_platform; 296 297 // remove pipe sign if only one meta field present 298 if ( str_starts_with( $meta, ' | ' ) || str_ends_with( $meta, ' | ' ) ) : 299 $meta = str_replace( ' | ', '', $meta ); 300 endif; 301 302 // add layer if meta present 303 if ( !empty( $meta ) ) : 304 if ( str_contains( $filtered_image, 'figcaption' ) ) { 305 $filtered_image = str_replace( '</figcaption>', '</figcaption><span>' . $meta . '</span>', $filtered_image ); 306 $filtered_image = '<div class="pcr_content_wrap">' . $filtered_image . '</div>'; 307 } else { 308 $filtered_image = '<div class="pcr_content_wrap">' . $filtered_image . '<span>' . $meta . '</span></div>'; 309 } 310 endif; 311 // return the block content 312 return $filtered_image; 373 // return the block content 374 return $filtered_image; 375 376 } else { 377 378 // not activated, return standard image 379 return $filtered_image; 380 381 } 313 382 } 314 383 add_filter( 'wp_content_img_tag', 'pcr_img_add_meta_data', 15, 3 ); -
image-rights/trunk/languages/photocredits-de_DE.po
r2466964 r2964519 1 1 msgid "" 2 2 msgstr "" 3 "Plural-Forms: nplurals=2; plural=(n != 1);\n" 4 "Project-Id-Version: Photo Credits\n" 5 "POT-Creation-Date: 2021-02-01 19:56+0100\n" 6 "PO-Revision-Date: 2021-02-01 19:58+0100\n" 7 "Language-Team: Christian Leuenberg\n" 3 "Project-Id-Version: Image Rights\n" 4 "POT-Creation-Date: 2023-09-08 14:57+0200\n" 5 "PO-Revision-Date: 2023-09-08 14:58+0200\n" 6 "Last-Translator: \n" 7 "Language-Team: \n" 8 "Language: de\n" 8 9 "MIME-Version: 1.0\n" 9 10 "Content-Type: text/plain; charset=UTF-8\n" … … 11 12 "X-Generator: Poedit 1.8.12\n" 12 13 "X-Poedit-Basepath: ..\n" 13 "X-Poedit-WPHeader: photo-credits.php\n" 14 "X-Poedit-WPHeader: image-rights.php\n" 15 "Plural-Forms: nplurals=2; plural=(n != 1);\n" 14 16 "X-Poedit-SourceCharset: UTF-8\n" 15 "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__; esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;_nx_noop:3c,1,2;__ngettext_noop:1,2\n"16 " Last-Translator: Christian Leuenberg\n"17 " Language: de_DE\n"17 "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;" 18 "esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;" 19 "_n_noop:1,2;_nx_noop:3c,1,2;__ngettext_noop:1,2\n" 18 20 "X-Poedit-SearchPath-0: .\n" 19 21 "X-Poedit-SearchPathExcluded-0: *.js\n" 20 22 21 #: photo-credits.php:63 23 #: image-rights.php:68 24 msgid "Image Rights Options" 25 msgstr "Image Rights Einstellungen" 26 27 #: image-rights.php:75 28 msgid "Copyright overlay on images" 29 msgstr "Bildrechte-Overlay auf Bildern" 30 31 #: image-rights.php:85 32 msgid "activate" 33 msgstr "aktivieren" 34 35 #: image-rights.php:155 22 36 msgid "Photographer Name" 23 msgstr "Name Fotograf"37 msgstr "Name des Fotografen" 24 38 25 #: photo-credits.php:6639 #: image-rights.php:158 26 40 msgid "Provide name of photographer" 27 msgstr "G ibden Namen des Fotografen an"41 msgstr "Geben Sie den Namen des Fotografen an" 28 42 29 #: photo-credits.php:70 photo-credits.php:176 photo-credits.php:17843 #: image-rights.php:162 image-rights.php:271 image-rights.php:273 30 44 msgid "Platform" 31 45 msgstr "Plattform" 32 46 33 #: photo-credits.php:7347 #: image-rights.php:165 34 48 msgid "Provide name of platform (e.g. Adobe Stock)" 35 msgstr "G ibden Namen der Plattform an (z. B. Adobe Stock)"49 msgstr "Geben Sie den Namen der Plattform an (z. B. Adobe Stock)" 36 50 37 #: photo-credits.php:15451 #: image-rights.php:249 38 52 msgid "Image" 39 53 msgstr "Bild" 40 54 41 #: photo-credits.php:15455 #: image-rights.php:249 42 56 msgid "Image rights" 43 57 msgstr "Bildrechte" 44 58 45 #: photo-credits.php:17159 #: image-rights.php:266 46 60 msgid "Photographer" 47 61 msgstr "Fotograf" 48 62 49 63 #. Plugin Name of the plugin/theme 50 msgid " Photo Credits"51 msgstr " Bildquellennachweise"64 msgid "Image Rights" 65 msgstr "" 52 66 53 67 #. Description of the plugin/theme 54 msgid "Adds additional fields for photo credits into Media Library items."68 msgid "Adds additional fields for setting image credits in the media library." 55 69 msgstr "" 56 70 57 71 #. Author of the plugin/theme 58 msgid " Christian Leuenberg, L.net Web Solutions"72 msgid "WSM – Walter Solbach Metallbau GmbH" 59 73 msgstr "" 60 74 61 75 #. Author URI of the plugin/theme 62 msgid "https://www. l-net.biz/"76 msgid "https://www.wsm.eu/" 63 77 msgstr "" -
image-rights/trunk/readme.txt
r2833891 r2964519 4 4 Tags: image rights, photo credits, copyrights, media library, custom fields, meta fields, images, photos, copyright, dsgvo 5 5 Requires at least: 6 Tested up to: 6. 1.17 Stable tag: 1. 16 Tested up to: 6.3.1 7 Stable tag: 1.2 8 8 License: GPLv3 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 21 21 * set an optional stock photo platform 22 22 * shortcode `[photo_credits]` displays all images with credits set 23 * optional image overlay with copyright information 23 24 24 25 == Installation == … … 29 30 3. Use the shortcode `[photo_credits]` in order to display a simple table with all your copyrighted images. 30 31 4. Optionally change table layout by addressing CSS class `table.photo-credits-table` in your theme's stylesheet. 32 5. Activate an optional copyright overlay for images under Settings > Media > Image Rights Options 31 33 32 34 == Screenshots == … … 37 39 == Changelog == 38 40 41 = 1.2 = 42 * Added admin option to make overlays in frontend optional 43 * Updated German language file 44 * Small bugfixes 45 39 46 = 1.1 = 40 47 * Added layers on images with credits in frontend.
Note: See TracChangeset
for help on using the changeset viewer.