Changeset 3110639
- Timestamp:
- 07/01/2024 05:21:34 PM (4 months ago)
- Location:
- dynamic-year-block
- Files:
-
- 13 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
dynamic-year-block/trunk/README.md
r3069691 r3110639 8 8 * Requires at least: 5.9 9 9 * Requires PHP: 7.0 10 * Stable tag: 0.6. 310 * Stable tag: 0.6. 11 11 * License: GPL 2.0 or later 12 12 -
dynamic-year-block/trunk/README.txt
r3069691 r3110639 5 5 Requires at least: 5.9 6 6 Requires PHP: 7.0 7 Stable tag: 0.6. 37 Stable tag: 0.6. 8 8 License: GPL 2.0 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 90 90 == Changelog == 91 91 92 93 94 95 92 96 = 0.6.3 = 93 97 * Updated the code for WordPress version 6.5 -
dynamic-year-block/trunk/build/block.json
r3050068 r3110639 3 3 "apiVersion": 3, 4 4 "name": "epico/dynamic-year-block", 5 "version": "0.6. 3",5 "version": "0.6.", 6 6 "title": "Dynamic Year", 7 7 "category": "text", 8 8 "icon": "calendar", 9 9 "keywords": [ 10 11 12 13 14 15 10 "year", 11 "dynamic", 12 "date", 13 "block", 14 "footer", 15 "copyright" 16 16 ], 17 17 "description": "A block that always displays the current year.", 18 18 "textdomain": "dynamic-year-block", 19 19 "attributes": { 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 20 "format": { 21 "type": "string", 22 "default": "Y" 23 }, 24 "beforeElement": { 25 "type": "string", 26 "default": "" 27 }, 28 "afterElement": { 29 "type": "string", 30 "default": "" 31 }, 32 "alignment": { 33 "type": "string", 34 "default": "none" 35 }, 36 "displaySiteName": { 37 "type": "boolean", 38 "default": false 39 } 40 40 }, 41 41 "usesContext": [ 42 43 42 "backgroundColor", 43 "foregroundColor" 44 44 ], 45 45 "supports": { 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 46 "anchor": true, 47 "html": false, 48 "className": true, 49 "__experimentalBorder": { 50 "color": true, 51 "radius": true, 52 "style": true, 53 "width": true 54 }, 55 "spacing": { 56 "padding": true, 57 "margin": true 58 }, 59 "dimensions": { 60 "minHeight": true 61 }, 62 "color": { 63 "gradients": true, 64 "link": true, 65 "__experimentalDefaultControls": { 66 "background": true, 67 "text": true, 68 "link": true 69 } 70 }, 71 "typography": { 72 "fontSize": true, 73 "lineHeight": true, 74 "__experimentalFontFamily": true, 75 "__experimentalFontWeight": true, 76 "__experimentalFontStyle": true, 77 "__experimentalTextTransform": true, 78 "__experimentalTextDecoration": true, 79 "__experimentalLetterSpacing": true, 80 "__experimentalDefaultControls": { 81 "fontSize": true, 82 "__experimentalFontFamily": true, 83 "__experimentalFontStyle": true, 84 "__experimentalFontWeight": true 85 } 86 }, 87 "interactivity": { 88 "clientNavigation": true 89 } 90 90 }, 91 91 "editorScript": "file:./index.js" -
dynamic-year-block/trunk/dynamic-year-block.php
r3050068 r3110639 4 4 * Plugin URI: https://github.com/EpicoStudio/dynamic-year-block 5 5 * Description: A block that always displays the current year in your copyright footer notice. 6 * Version: 0.6. 36 * Version: 0.6. 7 7 * Requires at least: 5.9 8 8 * Requires PHP: 7.0 … … 39 39 $current_date = current_datetime(); 40 40 $format = isset( $attributes['format'] ) ? $attributes['format'] : 'Y'; 41 $dynamic_year = $current_date->format( $format);41 $dynamic_year = $current_date->format(); 42 42 43 43 // Get the optional text BEFORE the year. 44 44 $before = $attributes['beforeElement'] !== null ? $attributes['beforeElement'] : ''; 45 $beforeStart = ! empty($attributes['beforeElement']) ? '<span class="dynamic-year-before">' : '';46 $beforeEnd = ! empty($attributes['beforeElement']) ? '</span>' : '';45 $beforeStart = !) ? '<span class="dynamic-year-before">' : ''; 46 $beforeEnd = !) ? '</span>' : ''; 47 47 48 // Get the optional text AFTER the year. 49 $ after = $attributes['afterElement'] !== null ? $attributes['afterElement'] : '';50 $ afterStart = !empty($attributes['afterElement']) ? '<span class="dynamic-year-after">' : '';51 $after End = !empty($attributes['afterElement']) ? '</span>' : '';48 // Get the optional text AFTER the year. 49 $; 50 $; 51 $after; 52 52 53 // Define the aria-current attribute. 53 // Determine if the afterElement content should be wrapped. 54 $afterStart = ! empty( $attributes['afterElement'] ) && strcmp( $attributes['afterElement'], $defaultText ) !== 0 ? '<span class="dynamic-year-after">' : ''; 55 $afterEnd = ! empty( $attributes['afterElement'] ) && strcmp( $attributes['afterElement'], $defaultText ) !== 0 ? '</span>' : ''; 56 57 // Determine if the `afterElement` content should be wrapped. 58 $afterStart = ! empty( $attributes['afterElement'] ) ? '<span class="dynamic-year-after">' : ''; 59 $afterEnd = ! empty( $attributes['afterElement'] ) ? '</span>' : ''; 60 61 // Define the `aria-current` attribute. 54 62 $aria_current = ''; 55 63 if ( is_front_page() ) : … … 61 69 62 70 // Check if the site title is included and define the markup. 63 $siteName = ( $attributes['displaySiteName'] !== false ) ? ' <a target="_self" rel="home" href="' . get_bloginfo( 'url', 'display' ) . '"' . $aria_current . '>' . get_bloginfo( 'name', 'display') . '</a>' : '';71 $siteName = ( $attributes['displaySiteName'] !== false ) ? ' <a target="_self" rel="home" href="' . ) . '</a>' : ''; 64 72 65 73 // Markup. … … 102 110 // Add variables for usage on the block editor. 103 111 wp_add_inline_script( 'epico-dynamic-year-block-editor-script', 'const dynamicYearBlockData = ' . json_encode( array( 104 'siteTitle' => get_bloginfo( 'name'),105 'siteUrl' => get_bloginfo( 'url'),112 'siteTitle' => ), 113 'siteUrl' => ), 106 114 ) ), 'before' ); 107 115
Note: See TracChangeset
for help on using the changeset viewer.