Changeset 3477864
- Timestamp:
- 03/09/2026 08:50:38 AM (3 weeks ago)
- Location:
- hash-converter
- Files:
-
- 27 added
- 12 edited
-
tags/1.2.0 (added)
-
tags/1.2.0/assets (added)
-
tags/1.2.0/assets/css (added)
-
tags/1.2.0/assets/css/converter.css (added)
-
tags/1.2.0/assets/css/converter.min.css (added)
-
tags/1.2.0/assets/css/fonts.css (added)
-
tags/1.2.0/assets/icons (added)
-
tags/1.2.0/assets/icons/lucide-sprite.php (added)
-
tags/1.2.0/assets/js (added)
-
tags/1.2.0/assets/js/admin.js (added)
-
tags/1.2.0/assets/js/admin.min.js (added)
-
tags/1.2.0/assets/js/converter.js (added)
-
tags/1.2.0/assets/js/converter.min.js (added)
-
tags/1.2.0/assets/promo-banner.png (added)
-
tags/1.2.0/hash-converter.php (added)
-
tags/1.2.0/includes (added)
-
tags/1.2.0/includes/admin-settings.php (added)
-
tags/1.2.0/includes/class-widget.php (added)
-
tags/1.2.0/readme.txt (added)
-
tags/1.2.0/templates (added)
-
tags/1.2.0/templates/dashboard.php (added)
-
tags/1.2.0/templates/floating.php (added)
-
tags/1.2.0/templates/glass.php (added)
-
tags/1.2.0/templates/gradient.php (added)
-
tags/1.2.0/templates/minimal.php (added)
-
tags/1.2.0/templates/neumorphism.php (added)
-
tags/1.2.0/templates/split.php (added)
-
trunk/assets/js/converter.js (modified) (4 diffs)
-
trunk/assets/js/converter.min.js (modified) (4 diffs)
-
trunk/hash-converter.php (modified) (3 diffs)
-
trunk/includes/admin-settings.php (modified) (5 diffs)
-
trunk/readme.txt (modified) (7 diffs)
-
trunk/templates/dashboard.php (modified) (2 diffs)
-
trunk/templates/floating.php (modified) (2 diffs)
-
trunk/templates/glass.php (modified) (2 diffs)
-
trunk/templates/gradient.php (modified) (2 diffs)
-
trunk/templates/minimal.php (modified) (2 diffs)
-
trunk/templates/neumorphism.php (modified) (2 diffs)
-
trunk/templates/split.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
hash-converter/trunk/assets/js/converter.js
r3441858 r3477864 182 182 const showFormula = widget.dataset.formula === 'true'; 183 183 184 // localStorage key for this widget's preferences185 const storageKey = 'uuc_prefs_' + (widget.id || 'default');186 187 // Load preferences from localStorage188 function loadPreferences() {189 try {190 const saved = localStorage.getItem(storageKey);191 if (saved) {192 const prefs = JSON.parse(saved);193 if (prefs.category && units[prefs.category]) {194 currentCategory = prefs.category;195 // Update active category button196 catBtns.forEach(b => {197 b.classList.toggle('active', b.dataset.cat === currentCategory);198 });199 }200 }201 } catch (e) {202 // Ignore localStorage errors203 }204 }205 206 // Save preferences to localStorage207 function savePreferences() {208 try {209 const prefs = {210 category: currentCategory,211 fromUnit: fromUnit.value,212 toUnit: toUnit.value213 };214 localStorage.setItem(storageKey, JSON.stringify(prefs));215 } catch (e) {216 // Ignore localStorage errors217 }218 }219 220 184 // Input validation 221 185 function validateInput() { … … 225 189 return isValid; 226 190 } 227 228 // Load saved preferences229 loadPreferences();230 191 231 192 // Load initial units … … 241 202 loadUnits(currentCategory); 242 203 convert(); 243 savePreferences();244 204 }); 245 205 }); … … 299 259 fromUnit.addEventListener('change', () => { 300 260 convert(); 301 savePreferences();302 261 }); 303 262 toUnit.addEventListener('change', () => { 304 263 convert(); 305 savePreferences();306 264 }); 307 265 -
hash-converter/trunk/assets/js/converter.min.js
r3441858 r3477864 182 182 const showFormula = widget.dataset.formula === 'true'; 183 183 184 // localStorage key for this widget's preferences185 const storageKey = 'uuc_prefs_' + (widget.id || 'default');186 187 // Load preferences from localStorage188 function loadPreferences() {189 try {190 const saved = localStorage.getItem(storageKey);191 if (saved) {192 const prefs = JSON.parse(saved);193 if (prefs.category && units[prefs.category]) {194 currentCategory = prefs.category;195 // Update active category button196 catBtns.forEach(b => {197 b.classList.toggle('active', b.dataset.cat === currentCategory);198 });199 }200 }201 } catch (e) {202 // Ignore localStorage errors203 }204 }205 206 // Save preferences to localStorage207 function savePreferences() {208 try {209 const prefs = {210 category: currentCategory,211 fromUnit: fromUnit.value,212 toUnit: toUnit.value213 };214 localStorage.setItem(storageKey, JSON.stringify(prefs));215 } catch (e) {216 // Ignore localStorage errors217 }218 }219 220 184 // Input validation 221 185 function validateInput() { … … 225 189 return isValid; 226 190 } 227 228 // Load saved preferences229 loadPreferences();230 191 231 192 // Load initial units … … 241 202 loadUnits(currentCategory); 242 203 convert(); 243 savePreferences();244 204 }); 245 205 }); … … 299 259 fromUnit.addEventListener('change', () => { 300 260 convert(); 301 savePreferences();302 261 }); 303 262 toUnit.addEventListener('change', () => { 304 263 convert(); 305 savePreferences();306 264 }); 307 265 -
hash-converter/trunk/hash-converter.php
r3464202 r3477864 3 3 /** 4 4 * Plugin Name: Universal Unit Converter 5 * Plugin URI: https:// awplife.com/6 * Description: A beautiful, customizable unit converter widget with 7 unique template designs. Use shortcode [converter] or the sidebar widget.7 * Version: 1.1.0 8 * Author: A WP Life9 * Author URI: https://profiles.wordpress.org/awordpresslife/#content-plugins5 * Plugin URI: https://developer.developer.developer 6 * Description: Universal unit converter with 7 modern templates. Real-time conversion for Length, Weight, Data, Speed, Time, and more. 7 8 * Version: 1.2.0 9 * Author: Developer 10 10 * License: GPL v2 or later 11 11 * Text Domain: uuc … … 16 16 } 17 17 18 define('UUC_VERSION', '1. 1.0');18 define('UUC_VERSION', '1.2.0'); 19 19 define('UUC_PLUGIN_DIR', plugin_dir_path(__FILE__)); 20 20 define('UUC_PLUGIN_URL', plugin_dir_url(__FILE__)); … … 106 106 $options = uuc_get_options(); 107 107 108 // Template override 108 109 if (!empty($atts['template'])) { 109 $options['template'] = sanitize_text_field($atts['template']); 110 } 110 $template = strtolower(sanitize_text_field($atts['template'])); 111 $options['template'] = $template; 112 } 113 114 // Category override 111 115 if (!empty($atts['category'])) { 112 $options['default_category'] = sanitize_text_field($atts['category']); 116 $category = strtolower(sanitize_text_field($atts['category'])); 117 $options['default_category'] = $category; 118 119 // Ensure the specified category is in the enabled list for this instance 120 if (!in_array($category, $options['enabled_categories'])) { 121 $options['enabled_categories'][] = $category; 122 } 113 123 } 114 124 115 125 return uuc_render_template($options); 116 126 } 117 add_shortcode('converter', 'uuc_shortcode'); 127 // Register shortcodes 128 add_shortcode('AWL_converter', 'uuc_shortcode'); 129 add_shortcode('converter', 'uuc_shortcode'); // Backward compatibility 118 130 119 131 /** -
hash-converter/trunk/includes/admin-settings.php
r3441858 r3477864 1 1 <?php 2 2 3 /** 3 4 * Admin Settings Page - Enhanced Version … … 137 138 $templates = uuc_get_templates(); 138 139 $categories = uuc_get_categories(); 139 ?>140 ?> 140 141 <style> 141 142 .uuc-admin { … … 384 385 min-width: 140px; 385 386 } 387 388 .uuc-ref-table { 389 width: 100%; 390 border-collapse: collapse; 391 margin-top: 10px; 392 font-size: 12px; 393 } 394 395 .uuc-ref-table th, 396 .uuc-ref-table td { 397 text-align: left; 398 padding: 8px 4px; 399 border-bottom: 1px solid #f3f4f6; 400 } 401 402 .uuc-ref-table th { 403 font-weight: 600; 404 color: #4b5563; 405 text-transform: uppercase; 406 font-size: 10px; 407 letter-spacing: 0.05em; 408 } 409 410 .uuc-slug-badge { 411 background: #eef2ff; 412 padding: 2px 6px; 413 border-radius: 4px; 414 font-family: 'Monaco', 'Menlo', monospace; 415 color: #4f46e5; 416 font-weight: 500; 417 } 386 418 </style> 387 419 388 420 <div class="uuc-admin"> 389 421 <div class="uuc-admin-header"> 390 <h1>⚡ <?php _e('Universal Unit Converter', UUC_TXTDM); ?> </h1>422 <h1>⚡ <?php _e('Universal Unit Converter', UUC_TXTDM); ?> <span style="font-size: 14px; vertical-align: middle; opacity: 0.8; margin-left: 10px;">v<?php echo UUC_VERSION; ?></span></h1> 391 423 <p><?php _e('Configure your unit converter widget appearance, behavior, and features.', UUC_TXTDM); ?></p> 392 424 </div> … … 541 573 <h2>📋 <?php _e('Shortcode', UUC_TXTDM); ?></h2> 542 574 <div class="uuc-shortcode-box"> 543 <code>[ converter]</code>575 <code>[AWL_converter]</code> 544 576 </div> 545 577 <div class="uuc-shortcode-box" style="margin-top: 10px;"> 546 <code>[ converter template="glass"]</code>578 <code>[AWL_converter template="glass"]</code> 547 579 </div> 548 580 <div class="uuc-shortcode-box" style="margin-top: 10px;"> 549 <code>[ converter category="weight"]</code>581 <code>[AWL_converter category="weight"]</code> 550 582 </div> 551 583 <div class="uuc-shortcode-box" style="margin-top: 10px;"> 552 <code>[converter template="split" category="temperature"]</code> 553 </div> 554 <p class="hint" style="margin-top: 12px; font-size: 11px;"> 555 <strong><?php _e('Templates:', UUC_TXTDM); ?></strong> minimal, dashboard, gradient, neumorphism, floating, glass, split<br> 556 <strong><?php _e('Categories:', UUC_TXTDM); ?></strong> length, weight, temperature, volume, area, 557 speed, time, data 558 </p> 584 <code>[AWL_converter template="split" category="temperature"]</code> 585 </div> 586 587 <div style="margin-top: 24px;"> 588 <h3 style="font-size: 13px; margin-bottom: 8px;"><?php _e('Template Slugs', UUC_TXTDM); ?></h3> 589 <table class="uuc-ref-table"> 590 <thead> 591 <tr> 592 <th><?php _e('Template Name', UUC_TXTDM); ?></th> 593 <th><?php _e('Slug', UUC_TXTDM); ?></th> 594 </tr> 595 </thead> 596 <tbody> 597 <?php foreach ($templates as $slug => $label): ?> 598 <tr> 599 <td><?php echo esc_html($label); ?></td> 600 <td><span class="uuc-slug-badge"><?php echo esc_html($slug); ?></span></td> 601 </tr> 602 <?php endforeach; ?> 603 </tbody> 604 </table> 605 </div> 606 607 <div style="margin-top: 20px;"> 608 <h3 style="font-size: 13px; margin-bottom: 8px;"><?php _e('Category Slugs', UUC_TXTDM); ?></h3> 609 <table class="uuc-ref-table"> 610 <thead> 611 <tr> 612 <th><?php _e('Category Name', UUC_TXTDM); ?></th> 613 <th><?php _e('Slug', UUC_TXTDM); ?></th> 614 </tr> 615 </thead> 616 <tbody> 617 <?php foreach ($categories as $slug => $cat): ?> 618 <tr> 619 <td><?php echo esc_html($cat['label']); ?></td> 620 <td><span class="uuc-slug-badge"><?php echo esc_html($slug); ?></span></td> 621 </tr> 622 <?php endforeach; ?> 623 </tbody> 624 </table> 625 </div> 559 626 </div> 560 627 … … 569 636 </div> 570 637 </div> 571 <?php638 <?php 572 639 } -
hash-converter/trunk/readme.txt
r3464202 r3477864 6 6 Tested up to: 6.9 7 7 Requires PHP: 7.0 8 Stable tag: 1. 1.08 Stable tag: 1.2.0 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 45 45 2. Navigate to "Unit Converter" in your admin menu 46 46 3. Configure the appearance and behavior options 47 4. Copy the shortcode `[ converter]`47 4. Copy the shortcode `[AWL_converter]` 48 48 5. Paste the shortcode into any page, post, or widget area 49 49 … … 90 90 = Shortcode Support = 91 91 Use flexible shortcode options: 92 * `[ converter]` - Display with default settings93 * `[ converter template="glass"]` - Use specific template94 * `[ converter category="weight"]` - Default to specific category95 * `[ converter template="split" category="temperature"]` - Combine options92 * `[AWL_converter]` - Display with default settings 93 * `[AWL_converter template="glass"]` - Use specific template 94 * `[AWL_converter category="weight"]` - Default to specific category 95 * `[AWL_converter template="split" category="temperature"]` - Combine options 96 96 97 97 = Widget Ready = … … 134 134 = How do I display the converter on my site? = 135 135 136 Use the shortcode `[ converter]` in any page, post, or text widget. You can also use the Unit Converter widget in sidebar areas.136 Use the shortcode `[AWL_converter]` in any page, post, or text widget. You can also use the Unit Converter widget in sidebar areas. 137 137 138 138 = Can I change which categories are shown? = … … 146 146 = Can I use different templates on different pages? = 147 147 148 Yes. Use the template attribute in your shortcode: `[ converter template="glass"]`148 Yes. Use the template attribute in your shortcode: `[AWL_converter template="glass"]` 149 149 150 150 = What are the keyboard shortcuts? = … … 169 169 170 170 == Changelog == 171 172 = 1.2.0 = 173 * Added: New shortcode prefix `[AWL_converter]` for better brand consistency 174 * Added: Backward compatibility for the original `[converter]` shortcode 175 * Added: Shortcode slug reference tables (Templates and Categories) in admin settings 176 * Fixed: Live preview bug where user selections were saved to localStorage 177 * Fixed: Shortcode category override (specified categories are now always enabled for that instance) 178 * Improved: Case-insensitivity for shortcode attributes (`category="Speed"` now works) 179 * Improved: Admin header now displays current plugin version clearly 180 * Tested: WordPress 6.9 compatibility 171 181 172 182 = 1.1.0 = … … 228 238 == Upgrade Notice == 229 239 240 = 1.2.0 = 241 This update adds the new [AWL_converter] shortcode, fixes live preview persistence issues, and adds helpful slug reference tables to the admin page. Existing [converter] shortcodes will continue to work. 242 230 243 = 1.1.0 = 231 244 * Improved WordPress coding standards compliance and fixed number format options. All users should update. -
hash-converter/trunk/templates/dashboard.php
r3441858 r3477864 1 1 <?php 2 2 3 /** 3 4 * Template: Dashboard - Top Navigation Bar … … 39 40 if (!in_array($key, $enabled_categories)) 40 41 continue; 41 ?>42 ?> 42 43 <button class="uuc-tab <?php echo $key === $default_category ? 'active' : ''; ?>" 43 44 data-cat="<?php echo esc_attr($key); ?>"> -
hash-converter/trunk/templates/floating.php
r3441858 r3477864 1 1 <?php 2 2 3 /** 3 4 * Template: Floating Cards - Modern Minimal … … 38 39 if (!in_array($key, $enabled_categories)) 39 40 continue; 40 ?>41 ?> 41 42 <button class="uuc-pill <?php echo $key === $default_category ? 'active' : ''; ?>" 42 43 data-cat="<?php echo esc_attr($key); ?>"> -
hash-converter/trunk/templates/glass.php
r3441858 r3477864 1 1 <?php 2 2 3 /** 3 4 * Template: Glassmorphism - Frosted Glass Effect … … 41 42 if (!in_array($key, $enabled_categories)) 42 43 continue; 43 ?>44 ?> 44 45 <button class="uuc-glass-pill <?php echo $key === $default_category ? 'active' : ''; ?>" 45 46 data-cat="<?php echo esc_attr($key); ?>"> -
hash-converter/trunk/templates/gradient.php
r3441858 r3477864 1 1 <?php 2 2 3 /** 3 4 * Template: Gradient - Colorful Gradient Design … … 38 39 if (!in_array($key, $enabled_categories)) 39 40 continue; 40 ?>41 ?> 41 42 <button class="uuc-grad-btn <?php echo $key === $default_category ? 'active' : ''; ?>" 42 43 data-cat="<?php echo esc_attr($key); ?>"> -
hash-converter/trunk/templates/minimal.php
r3441858 r3477864 1 1 <?php 2 2 3 /** 3 4 * Template: Minimal - Sidebar Navigation … … 39 40 if (!in_array($key, $enabled_categories)) 40 41 continue; 41 ?>42 ?> 42 43 <button class="uuc-nav-btn <?php echo $key === $default_category ? 'active' : ''; ?>" 43 44 data-cat="<?php echo esc_attr($key); ?>"> -
hash-converter/trunk/templates/neumorphism.php
r3441858 r3477864 1 1 <?php 2 2 3 /** 3 4 * Template: Neumorphism - Soft UI Design … … 40 41 if (!in_array($key, $enabled_categories)) 41 42 continue; 42 ?>43 ?> 43 44 <button class="uuc-neu-pill <?php echo $key === $default_category ? 'active' : ''; ?>" 44 45 data-cat="<?php echo esc_attr($key); ?>"> -
hash-converter/trunk/templates/split.php
r3441858 r3477864 1 1 <?php 2 2 3 /** 3 4 * Template: Split View - Two Columns Side by Side … … 34 35 if (!in_array($key, $enabled_categories)) 35 36 continue; 36 ?>37 ?> 37 38 <button class="uuc-split-cat <?php echo $key === $default_category ? 'active' : ''; ?>" 38 39 data-cat="<?php echo esc_attr($key); ?>">
Note: See TracChangeset
for help on using the changeset viewer.