Changeset 3244757
- Timestamp:
- 02/22/2025 02:58:26 AM (10 months ago)
- Location:
- acf-galerie-4/trunk
- Files:
-
- 5 edited
-
acf-galerie-4.php (modified) (2 diffs)
-
assets/css/acf-galerie-4.css (modified) (5 diffs)
-
assets/js/acf-galerie-4.js (modified) (4 diffs)
-
providers/class.register-field-type.php (modified) (4 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
acf-galerie-4/trunk/acf-galerie-4.php
r3237616 r3244757 9 9 * License: GPL v2 or later 10 10 * License URI: https://www.gnu.org/licenses/gpl-2.0.html 11 * Version: 1.4. 011 * Version: 1.4.1 12 12 * Domain Path: /lang 13 13 * Requires PHP: 7.4 … … 24 24 25 25 public function initialize() { 26 $this->define( 'ACFG4_VERSION', '1.4. 0' );26 $this->define( 'ACFG4_VERSION', '1.4.1' ); 27 27 $this->define( 'ACFG4_PLUGIN', __FILE__ ); 28 28 $this->define( 'ACFG4_PLUGIN_BASENAME', plugin_basename( ACFG4_PLUGIN ) ); -
acf-galerie-4/trunk/assets/css/acf-galerie-4.css
r3163273 r3244757 12 12 box-sizing: border-box; 13 13 border: 1px solid #ccc; 14 border-radius: 3px;14 border-radius: 5px; 15 15 overflow: hidden; 16 16 background-color: #fff; 17 padding: 3px;17 padding: 5px; 18 18 text-align: center; 19 19 position: relative; 20 transition: box-shadow 0.3s ease-in-out; 20 21 } 21 22 … … 25 26 object-fit: cover; 26 27 display: block; 27 border-radius: 3px;28 border-radius: 5px; 28 29 } 29 30 … … 40 41 41 42 .acf-galerie-4-container:last-child { 42 margin-bottom: 0 px;43 margin-bottom: 0; 43 44 } 44 45 45 46 .acf-field-galerie-4 .acf-galerie-4-add-media span.dashicons { 46 vertical-align: sub;47 vertical-align: middle; 47 48 font-size: 18px; 48 49 } … … 51 52 position: absolute; 52 53 background: rgba(0, 0, 0, 0.6); 53 width: 92%;54 width: calc(100% - 6px); 54 55 bottom: 2px; 55 56 color: #fff; 56 57 padding: 7px 5px; 57 58 left: 3px; 58 right: 0px; 59 min-height: 16px; 60 max-height: 16px; 59 text-align: center; 60 font-size: 12px; 61 line-height: 16px; 62 white-space: nowrap; 63 overflow: hidden; 64 text-overflow: ellipsis; 65 border-radius: 3px; 61 66 } 62 67 … … 64 69 position: absolute; 65 70 cursor: pointer; 66 background: #000;71 background: rgba(0, 0, 0, 0.8); 67 72 color: #fff; 68 73 border-radius: 50%; 69 top: 40%;70 left: 40%;74 top: 50%; 75 left: 50%; 71 76 height: 40px; 72 77 width: 40px; 73 78 border: none; 74 79 opacity: 0; 75 transition: opacity 0.3s ease-in-out; 76 font-size: revert; 77 padding: 0px; 80 transition: opacity 0.3s ease-in-out, transform 0.2s ease-in-out; 81 font-size: 16px; 82 padding: 0; 83 display: flex; 84 align-items: center; 85 justify-content: center; 86 transform: translate(-50%, -50%); 87 outline: none; 78 88 } 79 89 80 90 .acf-field-galerie-4 81 91 .attachment-thumbnail-container:hover 92 > .acf-galerie-4-remove-attachment, 93 .acf-field-galerie-4 94 .attachment-thumbnail-container:focus-within 82 95 > .acf-galerie-4-remove-attachment { 83 96 opacity: 1; 97 display: flex; 84 98 } 99 100 .acf-field-galerie-4 .acf-galerie-4-remove-attachment:hover { 101 background: rgba(255, 0, 0, 0.9); 102 transform: translate(-50%, -50%) scale(1.1); 103 } -
acf-galerie-4/trunk/assets/js/acf-galerie-4.js
r3179670 r3244757 57 57 58 58 $(document).on("click", ".acf-galerie-4-add-media", function (e) { 59 varcontainer = $(this)59 const container = $(this) 60 60 .closest(".acf-galerie-4-container") 61 61 .find(".acf-galerie-4-attachments"); 62 62 63 var key = container 63 const field_name = $(this) 64 .closest(".acf-galerie-4-container") 65 .find('input[type="hidden"]')[0].name; 66 67 const key = container 64 68 .attr("class") 65 69 .match(/acf-galerie-4-attachments-(\w+)/)[1]; 66 70 67 var dataset = datasets.find((x) => x.key === key); 71 const dataset = datasets.find((x) => x.key === key); 72 dataset["field_name"] = field_name; 68 73 69 74 wp_media_library(container, dataset); … … 84 89 $html += `<div data-id="${attachment.id}" class="${thumbnail_class}">`; 85 90 $html += `<img src='${icon}'/>`; 86 $html += `<input type="hidden" value="${attachment.id}" name="${dataset. type}[${dataset.name}][]"/>`;91 $html += `<input type="hidden" value="${attachment.id}" name="${dataset.field_name}[]"/>`; 87 92 $html += `</div>`; 88 93 }); … … 92 97 93 98 $(document).on( 94 "click ",95 ".acf-field-galerie-4 .acf-galerie-4-remove-attachment ",99 "click touchend", 100 ".acf-field-galerie-4 .acf-galerie-4-remove-attachment", 96 101 function () { 97 102 var id = $(this).closest(".attachment-thumbnail-container").data("id"); … … 108 113 ); 109 114 115 $(document).on( 116 "touchstart", 117 ".acf-field-galerie-4 .attachment-thumbnail-container img", 118 function (event) { 119 event.stopPropagation(); 120 121 let $button = $(this) 122 .closest(".attachment-thumbnail-container") 123 .find(".acf-galerie-4-remove-attachment"); 124 125 if ($button.css("opacity") === "1") { 126 $button.css("opacity", "0"); 127 $button.css("display", "none"); 128 } else { 129 $(".acf-galerie-4-remove-attachment").css("opacity", "0"); 130 $button.css("opacity", "1"); 131 $button.css("display", "inline-block"); 132 } 133 } 134 ); 135 110 136 if (typeof acf.add_action !== "undefined") { 111 137 /** -
acf-galerie-4/trunk/providers/class.register-field-type.php
r3237616 r3244757 137 137 ?> 138 138 <div> 139 <input type="hidden" name="<?php echo esc_attr( $field['name'] ); ?>" value="" />140 <input type="hidden" name="_<?php echo esc_attr( $this->name ); ?>_nonce[<?php echo esc_attr( $field['key'] ); ?>]" value="<?php echo esc_attr( wp_create_nonce( esc_attr( $field['key'] ) ) ); ?>" />141 139 <div class="<?php echo esc_attr( $this->add_class('container') ); ?>"> 142 <div class="<?php echo esc_attr( $this->add_class('attachments') ); ?> <?php echo esc_attr( $this->add_class('attachments') ); ?>-<?php echo esc_attr( $field['key'] ); ?>"> 140 <input type="hidden" name="<?php echo esc_attr( $field['name'] ); ?>" value="" /> 141 <div 142 class="<?php echo esc_attr( $this->add_class('attachments') ); ?> 143 <?php echo esc_attr( $this->add_class('attachments') ); ?>-<?php echo esc_attr( $field['key'] ); ?>" 144 data-name="<?php echo esc_attr( $field['name'] ); ?>"> 143 145 <?php if ( $attachments ) : ?> 144 146 <?php … … 154 156 ?> 155 157 <div data-id="<?php echo esc_attr( $attachment_id ); ?>" class="<?php echo esc_attr( 'attachment-thumbnail-container' ); ?> <?php echo esc_attr( "attachment-thumbnail-container-{$attachment_id}" ); ?> <?php echo esc_attr( $thumbnail_class ); ?>"> 158 <input type="hidden" name="<?php echo esc_attr( $field['name'] ); ?>[]" value="<?php echo esc_attr( $attachment_id ); ?>" /> 156 159 <button 157 160 type="button" … … 160 163 <span class="dashicons dashicons-trash"></span> 161 164 </button> 162 <input type="hidden" name="<?php echo esc_attr( $field['type'] ); ?>[<?php echo esc_attr( $field['_name'] ); ?>][]" value="<?php echo esc_attr( $attachment_id ); ?>" />163 165 <img 164 166 src="<?php echo esc_url( $thumbnail ); ?>" … … 201 203 * @return array An array of sanitized integer values representing the field's data. 202 204 */ 203 function update_value( $value, $post_id, $field ) { 204 $field_type = $field['type']; 205 $field_key = $field['key']; 206 $nonce_key = "_{$field_type}_nonce"; 207 208 if( 209 empty( $_POST[$nonce_key] ) or 210 empty( $_POST[$nonce_key][$field_key] ) ) die(); 211 212 $nonce_key = sanitize_text_field( wp_unslash( $_POST[$nonce_key][$field_key] ) ); 213 214 if( ! wp_verify_nonce( $nonce_key, $field_key ) ) die(); 215 216 if ( empty( $_POST[$field_type] ) or empty( $_POST[$field_type][$field['name']] ) ){ 205 function update_value( $value, $post_id, $field ) { 206 if ( empty( $value ) ) { 217 207 return array(); 218 208 } 219 220 $value = array_map( 'sanitize_text_field', wp_unslash( $_POST[$field_type][$field['name']] ) );221 209 222 210 return array_map( 'intval', $value ); -
acf-galerie-4/trunk/readme.txt
r3237618 r3244757 5 5 Requires at least: 5.8 6 6 Tested up to: 6.7 7 Stable tag: 1.4. 07 Stable tag: 1.4.1 8 8 Requires PHP: 7.0 9 9 License: GPLv2 or later … … 46 46 47 47 == Changelog == 48 = 1.4.1 = 49 * [Added] Support for ACF Group and Repeater fields. 50 * [Added] Mobile device support. 51 48 52 = 1.4.0 = 49 53 * [Added] Wrapped the main function inside a class to prevent conflicts with other WordPress functions.
Note: See TracChangeset
for help on using the changeset viewer.