Plugin Directory

Changeset 3477864


Ignore:
Timestamp:
03/09/2026 08:50:38 AM (3 weeks ago)
Author:
razipathhan
Message:

update 1.2.0

Location:
hash-converter
Files:
27 added
12 edited

Legend:

Unmodified
Added
Removed
  • hash-converter/trunk/assets/js/converter.js

    r3441858 r3477864  
    182182        const showFormula = widget.dataset.formula === 'true';
    183183
    184         // localStorage key for this widget's preferences
    185         const storageKey = 'uuc_prefs_' + (widget.id || 'default');
    186 
    187         // Load preferences from localStorage
    188         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 button
    196                         catBtns.forEach(b => {
    197                             b.classList.toggle('active', b.dataset.cat === currentCategory);
    198                         });
    199                     }
    200                 }
    201             } catch (e) {
    202                 // Ignore localStorage errors
    203             }
    204         }
    205 
    206         // Save preferences to localStorage
    207         function savePreferences() {
    208             try {
    209                 const prefs = {
    210                     category: currentCategory,
    211                     fromUnit: fromUnit.value,
    212                     toUnit: toUnit.value
    213                 };
    214                 localStorage.setItem(storageKey, JSON.stringify(prefs));
    215             } catch (e) {
    216                 // Ignore localStorage errors
    217             }
    218         }
    219 
    220184        // Input validation
    221185        function validateInput() {
     
    225189            return isValid;
    226190        }
    227 
    228         // Load saved preferences
    229         loadPreferences();
    230191
    231192        // Load initial units
     
    241202                loadUnits(currentCategory);
    242203                convert();
    243                 savePreferences();
    244204            });
    245205        });
     
    299259        fromUnit.addEventListener('change', () => {
    300260            convert();
    301             savePreferences();
    302261        });
    303262        toUnit.addEventListener('change', () => {
    304263            convert();
    305             savePreferences();
    306264        });
    307265
  • hash-converter/trunk/assets/js/converter.min.js

    r3441858 r3477864  
    182182        const showFormula = widget.dataset.formula === 'true';
    183183
    184         // localStorage key for this widget's preferences
    185         const storageKey = 'uuc_prefs_' + (widget.id || 'default');
    186 
    187         // Load preferences from localStorage
    188         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 button
    196                         catBtns.forEach(b => {
    197                             b.classList.toggle('active', b.dataset.cat === currentCategory);
    198                         });
    199                     }
    200                 }
    201             } catch (e) {
    202                 // Ignore localStorage errors
    203             }
    204         }
    205 
    206         // Save preferences to localStorage
    207         function savePreferences() {
    208             try {
    209                 const prefs = {
    210                     category: currentCategory,
    211                     fromUnit: fromUnit.value,
    212                     toUnit: toUnit.value
    213                 };
    214                 localStorage.setItem(storageKey, JSON.stringify(prefs));
    215             } catch (e) {
    216                 // Ignore localStorage errors
    217             }
    218         }
    219 
    220184        // Input validation
    221185        function validateInput() {
     
    225189            return isValid;
    226190        }
    227 
    228         // Load saved preferences
    229         loadPreferences();
    230191
    231192        // Load initial units
     
    241202                loadUnits(currentCategory);
    242203                convert();
    243                 savePreferences();
    244204            });
    245205        });
     
    299259        fromUnit.addEventListener('change', () => {
    300260            convert();
    301             savePreferences();
    302261        });
    303262        toUnit.addEventListener('change', () => {
    304263            convert();
    305             savePreferences();
    306264        });
    307265
  • hash-converter/trunk/hash-converter.php

    r3464202 r3477864  
    33/**
    44 * 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 Life
    9  * Author URI: https://profiles.wordpress.org/awordpresslife/#content-plugins
     5 * 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
    1010 * License: GPL v2 or later
    1111 * Text Domain: uuc
     
    1616}
    1717
    18 define('UUC_VERSION', '1.1.0');
     18define('UUC_VERSION', '1.2.0');
    1919define('UUC_PLUGIN_DIR', plugin_dir_path(__FILE__));
    2020define('UUC_PLUGIN_URL', plugin_dir_url(__FILE__));
     
    106106    $options = uuc_get_options();
    107107
     108    // Template override
    108109    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
    111115    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        }
    113123    }
    114124
    115125    return uuc_render_template($options);
    116126}
    117 add_shortcode('converter', 'uuc_shortcode');
     127// Register shortcodes
     128add_shortcode('AWL_converter', 'uuc_shortcode');
     129add_shortcode('converter', 'uuc_shortcode'); // Backward compatibility
    118130
    119131/**
  • hash-converter/trunk/includes/admin-settings.php

    r3441858 r3477864  
    11<?php
     2
    23/**
    34 * Admin Settings Page - Enhanced Version
     
    137138    $templates = uuc_get_templates();
    138139    $categories = uuc_get_categories();
    139     ?>
     140?>
    140141    <style>
    141142        .uuc-admin {
     
    384385            min-width: 140px;
    385386        }
     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        }
    386418    </style>
    387419
    388420    <div class="uuc-admin">
    389421        <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>
    391423            <p><?php _e('Configure your unit converter widget appearance, behavior, and features.', UUC_TXTDM); ?></p>
    392424        </div>
     
    541573                    <h2>📋 <?php _e('Shortcode', UUC_TXTDM); ?></h2>
    542574                    <div class="uuc-shortcode-box">
    543                         <code>[converter]</code>
     575                        <code>[AWL_converter]</code>
    544576                    </div>
    545577                    <div class="uuc-shortcode-box" style="margin-top: 10px;">
    546                         <code>[converter template="glass"]</code>
     578                        <code>[AWL_converter template="glass"]</code>
    547579                    </div>
    548580                    <div class="uuc-shortcode-box" style="margin-top: 10px;">
    549                         <code>[converter category="weight"]</code>
     581                        <code>[AWL_converter category="weight"]</code>
    550582                    </div>
    551583                    <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>
    559626                </div>
    560627
     
    569636        </div>
    570637    </div>
    571     <?php
     638<?php
    572639}
  • hash-converter/trunk/readme.txt

    r3464202 r3477864  
    66Tested up to: 6.9
    77Requires PHP: 7.0
    8 Stable tag: 1.1.0
     8Stable tag: 1.2.0
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    45452. Navigate to "Unit Converter" in your admin menu
    46463. Configure the appearance and behavior options
    47 4. Copy the shortcode `[converter]`
     474. Copy the shortcode `[AWL_converter]`
    48485. Paste the shortcode into any page, post, or widget area
    4949
     
    9090= Shortcode Support =
    9191Use flexible shortcode options:
    92 * `[converter]` - Display with default settings
    93 * `[converter template="glass"]` - Use specific template
    94 * `[converter category="weight"]` - Default to specific category
    95 * `[converter template="split" category="temperature"]` - Combine options
     92* `[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
    9696
    9797= Widget Ready =
     
    134134= How do I display the converter on my site? =
    135135
    136 Use the shortcode `[converter]` in any page, post, or text widget. You can also use the Unit Converter widget in sidebar areas.
     136Use the shortcode `[AWL_converter]` in any page, post, or text widget. You can also use the Unit Converter widget in sidebar areas.
    137137
    138138= Can I change which categories are shown? =
     
    146146= Can I use different templates on different pages? =
    147147
    148 Yes. Use the template attribute in your shortcode: `[converter template="glass"]`
     148Yes. Use the template attribute in your shortcode: `[AWL_converter template="glass"]`
    149149
    150150= What are the keyboard shortcuts? =
     
    169169
    170170== 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
    171181
    172182= 1.1.0 =
     
    228238== Upgrade Notice ==
    229239
     240= 1.2.0 =
     241This 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
    230243= 1.1.0 =
    231244* Improved WordPress coding standards compliance and fixed number format options. All users should update.
  • hash-converter/trunk/templates/dashboard.php

    r3441858 r3477864  
    11<?php
     2
    23/**
    34 * Template: Dashboard - Top Navigation Bar
     
    3940                if (!in_array($key, $enabled_categories))
    4041                    continue;
    41                 ?>
     42            ?>
    4243                <button class="uuc-tab <?php echo $key === $default_category ? 'active' : ''; ?>"
    4344                    data-cat="<?php echo esc_attr($key); ?>">
  • hash-converter/trunk/templates/floating.php

    r3441858 r3477864  
    11<?php
     2
    23/**
    34 * Template: Floating Cards - Modern Minimal
     
    3839            if (!in_array($key, $enabled_categories))
    3940                continue;
    40             ?>
     41        ?>
    4142            <button class="uuc-pill <?php echo $key === $default_category ? 'active' : ''; ?>"
    4243                data-cat="<?php echo esc_attr($key); ?>">
  • hash-converter/trunk/templates/glass.php

    r3441858 r3477864  
    11<?php
     2
    23/**
    34 * Template: Glassmorphism - Frosted Glass Effect
     
    4142                if (!in_array($key, $enabled_categories))
    4243                    continue;
    43                 ?>
     44            ?>
    4445                <button class="uuc-glass-pill <?php echo $key === $default_category ? 'active' : ''; ?>"
    4546                    data-cat="<?php echo esc_attr($key); ?>">
  • hash-converter/trunk/templates/gradient.php

    r3441858 r3477864  
    11<?php
     2
    23/**
    34 * Template: Gradient - Colorful Gradient Design
     
    3839            if (!in_array($key, $enabled_categories))
    3940                continue;
    40             ?>
     41        ?>
    4142            <button class="uuc-grad-btn <?php echo $key === $default_category ? 'active' : ''; ?>"
    4243                data-cat="<?php echo esc_attr($key); ?>">
  • hash-converter/trunk/templates/minimal.php

    r3441858 r3477864  
    11<?php
     2
    23/**
    34 * Template: Minimal - Sidebar Navigation
     
    3940                if (!in_array($key, $enabled_categories))
    4041                    continue;
    41                 ?>
     42            ?>
    4243                <button class="uuc-nav-btn <?php echo $key === $default_category ? 'active' : ''; ?>"
    4344                    data-cat="<?php echo esc_attr($key); ?>">
  • hash-converter/trunk/templates/neumorphism.php

    r3441858 r3477864  
    11<?php
     2
    23/**
    34 * Template: Neumorphism - Soft UI Design
     
    4041            if (!in_array($key, $enabled_categories))
    4142                continue;
    42             ?>
     43        ?>
    4344            <button class="uuc-neu-pill <?php echo $key === $default_category ? 'active' : ''; ?>"
    4445                data-cat="<?php echo esc_attr($key); ?>">
  • hash-converter/trunk/templates/split.php

    r3441858 r3477864  
    11<?php
     2
    23/**
    34 * Template: Split View - Two Columns Side by Side
     
    3435                    if (!in_array($key, $enabled_categories))
    3536                        continue;
    36                     ?>
     37                ?>
    3738                    <button class="uuc-split-cat <?php echo $key === $default_category ? 'active' : ''; ?>"
    3839                        data-cat="<?php echo esc_attr($key); ?>">
Note: See TracChangeset for help on using the changeset viewer.