Plugin Directory

Changeset 3347699


Ignore:
Timestamp:
08/20/2025 06:11:50 PM (6 months ago)
Author:
adnanthemes
Message:

Release 1.0.7 – Updated plugin files:

  • fitcalc.php (main plugin file)
  • css/style.css (UI improvements & responsiveness)
  • includes/fitcalc-functions.php (calculation logic refinements)
  • readme.txt (version bump & tested up to WP 6.6)
Location:
fitcalc-bmi-calculator/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • fitcalc-bmi-calculator/trunk/css/style.css

    r3347678 r3347699  
    1 /* === FitCalc Container === */
    2 .fitcalc-container {
     1/* === FitCalc Container (for current template) === */
     2.fitcalc-bmi-form {
    33    max-width: 600px;
    44    margin: 40px auto;
     
    77    background: #f9f9f9;
    88    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    9     font-family: 'Segoe UI', sans-serif;
     9    font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
    1010}
    1111
    12 /* === Headings === */
    13 .fitcalc-title {
    14     text-align: center;
    15     font-size: 26px;
    16     margin-bottom: 25px;
    17     color: #333;
     12/* Rows / fields */
     13.fitcalc-row {
     14    display: flex;
     15    flex-direction: column;
     16    gap: 6px;
     17    margin-bottom: 18px;
    1818}
    1919
    20 /* === Form Group === */
    21 .fitcalc-group {
    22     margin-bottom: 20px;
    23     display: flex;
    24     flex-direction: column;
    25 }
    26 
    27 /* === Labels and Inputs === */
    28 .fitcalc-group label {
     20.fitcalc-row label {
    2921    font-weight: 600;
    30     margin-bottom: 5px;
    3122    color: #222;
    3223}
    3324
    34 .fitcalc-group input,
    35 .fitcalc-group select {
     25.fitcalc-row input,
     26.fitcalc-row select {
    3627    padding: 10px 12px;
    3728    font-size: 16px;
    38     border: 1px solid #ccc;
     29    border: 1px solid #ccd0d4;
    3930    border-radius: 6px;
    40     background-color: #fff;
    41     transition: border 0.3s ease;
     31    background: #fff;
     32    transition: border .25s ease;
    4233}
    4334
    44 .fitcalc-group input:focus,
    45 .fitcalc-group select:focus {
     35.fitcalc-row input:focus,
     36.fitcalc-row select:focus {
    4637    border-color: #0073aa;
    4738    outline: none;
    4839}
    4940
    50 /* === Button === */
    51 .fitcalc-btn {
     41/* Imperial inline fields (ft + in) */
     42.fitcalc-inline {
     43    display: grid;
     44    grid-template-columns: 1fr 1fr;
     45    gap: 10px;
     46}
     47
     48/* Button */
     49.fitcalc-actions button {
    5250    background-color: #28a745;
    53     color: white;
    54     font-size: 17px;
    55     font-weight: bold;
    56     padding: 12px 20px;
    57     border: none;
     51    color: #fff;
     52    font-size: 16px;
     53    font-weight: 700;
     54    padding: 12px 18px;
     55    border: 0;
    5856    border-radius: 6px;
    5957    cursor: pointer;
    60     transition: background-color 0.3s ease;
     58    transition: background-color .2s ease-in-out;
    6159}
    6260
    63 .fitcalc-btn:hover {
     61.fitcalc-actions button:hover {
    6462    background-color: #218838;
    6563}
    6664
    67 /* === Result Box === */
     65/* Result box */
    6866.fitcalc-result {
    69     margin-top: 25px;
    70     padding: 20px;
    71     background-color: #e8f7f0;
     67    margin-top: 20px;
     68    padding: 16px;
    7269    border-left: 6px solid #28a745;
    7370    border-radius: 6px;
     71    background: #e8f7f0;
    7472    color: #333;
    7573    display: none;
    7674}
    7775
    78 .fade-in {
    79     animation: fadeIn 0.5s ease-in-out forwards;
     76.fade-in { animation: fitcalcFadeIn .4s ease-out forwards; }
     77
     78@keyframes fitcalcFadeIn {
     79  from { opacity: 0; transform: translateY(6px); }
     80  to   { opacity: 1; transform: translateY(0); }
    8081}
    8182
    82 @keyframes fadeIn {
    83     from { opacity: 0; transform: translateY(10px); }
    84     to { opacity: 1; transform: translateY(0); }
     83/* Category color accents (optional) */
     84.fitcalc-under  { background: #fff7f7; border-left-color: #e55353; }
     85.fitcalc-normal { background: #f3fff6; border-left-color: #28a745; }
     86.fitcalc-over   { background: #fffaf0; border-left-color: #ffb84d; }
     87.fitcalc-obese  { background: #fff0f0; border-left-color: #ff6b6b; }
     88
     89/* Responsive */
     90@media (max-width: 600px) {
     91    .fitcalc-bmi-form { padding: 16px; }
     92    .fitcalc-inline { grid-template-columns: 1fr 1fr; gap: 8px; }
    8593}
    86 
    87 /* === Mobile Friendly === */
    88 @media (max-width: 600px) {
    89     .fitcalc-container {
    90         padding: 15px;
    91     }
    92 
    93     .fitcalc-title {
    94         font-size: 22px;
    95     }
    96 
    97     .fitcalc-btn {
    98         font-size: 16px;
    99         padding: 10px;
    100     }
    101 }
    102 
    103 .fitcalc-under  { background: #fff7f7; }
    104 .fitcalc-normal { background: #f3fff6; }
    105 .fitcalc-over   { background: #fffaf0; }
    106 .fitcalc-obese  { background: #fff0f0; }
  • fitcalc-bmi-calculator/trunk/fitcalc.php

    r3347678 r3347699  
    1616
    1717/**
    18  * Load text domain
    19  * (Urdu: translations load karne ke liye)
     18 * Load text domain for translations.
    2019 */
    2120add_action('plugins_loaded', function () {
    22     load_plugin_textdomain('fitcalc-bmi-calculator', false, dirname(plugin_basename(__FILE__)) . '/languages');
     21    load_plugin_textdomain(
     22        'fitcalc-bmi-calculator',
     23        false,
     24        dirname(plugin_basename(__FILE__)) . '/languages'
     25    );
    2326});
    2427
    2528/**
    26  * Enqueue CSS/JS
    27  */
    28 function fitcalc_enqueue_assets() {
    29     wp_enqueue_style('fitcalc-style', plugin_dir_url(__FILE__) . 'css/style.css', array(), '1.0.0');
    30     wp_enqueue_script('fitcalc-script', plugin_dir_url(__FILE__) . 'js/fitcalc-script.js', array('jquery'), '1.0.0', true);
    31 }
    32 add_action('wp_enqueue_scripts', 'fitcalc_enqueue_assets');
    33 
    34 /**
    35  * Load core includes
    36  */
    37 require_once plugin_dir_path(__FILE__) . 'includes/class-fitcalc.php';
    38 require_once plugin_dir_path(__FILE__) . 'includes/fitcalc-functions.php';
    39 
    40 /**
    41  * Shortcode: [fitcalc_bmi]
     29 * Register shortcode: [fitcalc_bmi]
     30 * Enqueue CSS/JS only when the shortcode is rendered (perf-friendly).
    4231 */
    4332function fitcalc_bmi_shortcode() {
     33    // Enqueue assets (versioned to avoid cache issues)
     34    wp_enqueue_style(
     35        'fitcalc-style',
     36        plugin_dir_url(__FILE__) . 'css/style.css',
     37        array(),
     38        '1.0.7'
     39    );
     40    wp_enqueue_script(
     41        'fitcalc-script',
     42        plugin_dir_url(__FILE__) . 'js/fitcalc-script.js',
     43        array(), // no jQuery dependency
     44        '1.0.7',
     45        true
     46    );
     47
     48    // Render template
    4449    ob_start();
    45     // Template file
    4650    $template = plugin_dir_path(__FILE__) . 'templates/fitcalc-form.php';
    47     if ( file_exists( $template ) ) {
     51    if ( file_exists($template) ) {
    4852        include $template;
    4953    } else {
    50         // Fallback message (escaped + translatable)
    5154        echo '<p>' . esc_html__( 'FitCalc template not found.', 'fitcalc-bmi-calculator' ) . '</p>';
    5255    }
     
    5659
    5760/**
    58  * Admin Notice after activate (how to use)
     61 * One-time admin notice after activation — shows shortcode usage then disappears.
    5962 */
    60 function fitcalc_admin_notice() {
    61     echo '<div class="notice notice-success is-dismissible"><p><strong>' .
    62          esc_html__( 'FitCalc BMI Calculator:', 'fitcalc-bmi-calculator' ) .
    63          '</strong> ' .
    64          sprintf(
    65              /* translators: %s: shortcode */
    66              esc_html__( 'Use shortcode %s to display the calculator on any page or post.', 'fitcalc-bmi-calculator' ),
    67              '<code>[fitcalc_bmi]</code>'
    68          ) .
    69          '</p></div>';
     63function fitcalc_set_activation_notice() {
     64    set_transient('fitcalc_activation_notice', 1, 30); // 30 seconds is enough for first page load
    7065}
    71 add_action('admin_notices', 'fitcalc_admin_notice');
     66register_activation_hook(__FILE__, 'fitcalc_set_activation_notice');
     67
     68function fitcalc_show_activation_notice() {
     69    if ( get_transient('fitcalc_activation_notice') ) {
     70        delete_transient('fitcalc_activation_notice');
     71        echo '<div class="notice notice-success is-dismissible"><p><strong>' .
     72             esc_html__( 'FitCalc BMI Calculator', 'fitcalc-bmi-calculator' ) .
     73             '</strong> — ' .
     74             sprintf(
     75                 /* translators: %s: shortcode */
     76                 esc_html__( 'Use shortcode %s to display the calculator on any page or post.', 'fitcalc-bmi-calculator' ),
     77                 '<code>[fitcalc_bmi]</code>'
     78             ) .
     79             '</p></div>';
     80    }
     81}
     82add_action('admin_notices', 'fitcalc_show_activation_notice');
    7283
    7384/**
    74  * Plugin row meta: show shortcode
     85 * Plugin row meta: Show shortcode hint under the plugin name on Plugins screen.
    7586 */
    7687function fitcalc_plugin_row_meta( $links, $file ) {
    77     if ( $file === plugin_basename( __FILE__ ) ) {
     88    if ( $file === plugin_basename(__FILE__) ) {
    7889        $links[] = '<span><strong>' . esc_html__( 'Shortcode:', 'fitcalc-bmi-calculator' ) .
    7990                   '</strong> <code>[fitcalc_bmi]</code></span>';
     
    8293}
    8394add_filter('plugin_row_meta', 'fitcalc_plugin_row_meta', 10, 2);
     95
     96/**
     97 * Core includes (keep separate for maintainability).
     98 */
     99require_once plugin_dir_path(__FILE__) . 'includes/class-fitcalc.php';
     100require_once plugin_dir_path(__FILE__) . 'includes/fitcalc-functions.php';
  • fitcalc-bmi-calculator/trunk/includes/fitcalc-functions.php

    r3347678 r3347699  
    1919 */
    2020function fitcalc_get_plugin_version() {
    21     return '1.0.0';
     21    return '1.0.7';
    2222}
    2323
  • fitcalc-bmi-calculator/trunk/readme.txt

    r3347678 r3347699  
    1 === FitCalc - BMI Calculator ===
     1=== FitCalc BMI Calculator ===
    22Contributors: adnanthemes
    33Tags: bmi, calculator, health, fitness, responsive
     
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
    10 Fitcalc is an responsible BMI calculator plugin that supports metric and imperial units. Health, fitness and weight tracking websites designed. Just add shortcode [fitcalc_bmi] to any page or post.
    1110
    12 == details ==
    13 Fitcalc is a light BMI calculator plugin designed for WordPress websites. Easily embedded via shortcode, it provides immediate BMI calculations and classification with support for both metric (cm/kg) and Imperial (ft/lbs) units.
     11Lightweight and responsive BMI Calculator plugin for WordPress. Supports both Metric (cm/kg) and Imperial (ft/lbs) units. Easily embed using shortcode [fitcalc_bmi].
    1412
    15 == Establishment ==
    16 1. Upload plugin files to '/WP-content/plugins/fitcalc' directory.
    17 2. Activate the plugin through the 'plugins' menu in WordPress.
    18 3. Use shortcode `[fitcalc_bmi]` in any post or page.
     13== Description ==
     14FitCalc is a lightweight and responsive Body Mass Index (BMI) calculator plugin for WordPress websites. 
     15It allows visitors to quickly calculate their BMI using either Metric (cm/kg) or Imperial (ft/lbs) units. 
     16The plugin instantly displays the BMI value along with its classification (e.g., underweight, normal, overweight, obese). 
    1917
     18**Features:**
     19* Simple shortcode `[fitcalc_bmi]`
     20* Supports Metric and Imperial units
     21* Responsive design
     22* Quick BMI classification
     23
     24== Installation ==
     251. Upload the plugin files to the `/wp-content/plugins/fitcalc` directory, or install the plugin directly from the WordPress plugins screen.
     262. Activate the plugin through the 'Plugins' screen in WordPress.
     273. Add the shortcode `[fitcalc_bmi]` to any post or page where you want the calculator to appear.
     28
     29== Frequently Asked Questions ==
     30= How do I display the calculator? =
     31Use the shortcode `[fitcalc_bmi]` inside any post or page.
     32
     33= Does it support both metric and imperial? =
     34Yes, users can switch between metric (cm/kg) and imperial (ft/lbs).
     35
     36== Screenshots ==
     371. BMI calculator form in metric units
     382. BMI calculator form in imperial units
     393. BMI result display with classification
    2040
    2141== Changelog ==
    2242= 1.0.7 =
    23 * Early release of FitCalc - BMI calculator plugin.
     43* First release of FitCalc BMI Calculator plugin.
     44
     45== Upgrade Notice ==
     46= 1.0.7 =
     47Initial stable release. Upgrade for responsive BMI calculation.
Note: See TracChangeset for help on using the changeset viewer.