Plugin Directory

Changeset 2680429


Ignore:
Timestamp:
02/17/2022 05:24:42 AM (4 years ago)
Author:
hardikchavada
Message:

version 1.3 trunk folder update

Location:
calculate-bmr/trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • calculate-bmr/trunk/README.txt

    r2567282 r2680429  
    11=== Calculate BMR ===
    22Contributors: hardikchavada
    3 Donate link: https://testhardik.ml/about/
    4 Tags: Calculate BMR, MY BMR calculator, bmi calculator
     3Donate link: https://www.youtube.com/watch?v=gv7lMeaLdOQ
     4Tags: Calculate BMR, MY BMR calculator, bmi calculator, Calculate BMI, BMI Calculator Plugin
    55Requires at least: 4.7
    6 Tested up to: 5.7
    7 Stable tag: 1.2
     6Tested up to: 5.9
     7Stable tag: 1.3
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
    1010
    11 This plugin will help you to add BMR calculator to your Pages/Posts. Add the following shortcode wherever you want to display the BMR form [bmr_shortcode]
     11This plugin will help you to add BMR/BMI calculator to your Pages/Posts. Add the following shortcodes [bmr_shortcode] and [bmi_shortcode]
    1212
    1313== Description ==
    1414
    15 A complete mobile responsive BMR calculator for your website. You need to add [bmr_shortcode] shortcode into your pages / posts and it will display the BMR calculator in front-end.
     15A complete mobile responsive BMR and BMI calculator for your website.
    1616
    1717A few notes about the sections above:
     
    2121== Installation ==
    2222
    23 1. Upload `calculate-bmr` plugin to the `/wp-content/plugins/` directory
     231. Upload plugin to the `/wp-content/plugins/` directory
    24242. Activate the plugin through the 'Plugins' menu in WordPress
    25 3. Add shortcode [bmr_shortcode] directly into your pages/posts
     253. Add shortcodes [bmr_shortcode] [bmi_shortcode] directly into your pages/posts
    2626
    2727== Frequently Asked Questions ==
    2828= Are there any extra settings? =
    29 Currently there are not extra settings for this version. You just need to add the shortcode [bmr_shortcode] into your pages/posts
     29Currently there are not extra settings for this version.
    3030
    3131= Are there translations? =
     
    3535== Upgrade Notice ==
    3636
    37 = 1.3 =
     37= 1.4 =
    3838Future Updates will have more designs & features.
    3939
     
    42421. screenshot-1.png
    43432. screenshot-2.png
     443. screenshot-3.png
     454. screenshot-4.png
    4446
    4547
    4648== Changelog ==
     49
     50= 1.3 =
     51* Added BMI Calculation form
    4752
    4853= 1.2 =
  • calculate-bmr/trunk/admin/class-calculate-bmr-admin.php

    r2436849 r2680429  
    114114
    115115        wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/calculate-bmr-admin.js', array( ), $this->version, true );
     116       
     117    }   
    116118
    117         //add custom javascript files
    118         /*
    119         //removing added custom styles because In this plugin we have enqueued style only when the shortcode is called in file calculate-bmr.php
    120         wp_enqueue_script( 'my_bmr_js', CALCULATE_BMR_PLUGIN_URL . 'admin/js/my-bmr-script.js', array(), $this->version, true );
    121         */
    122     }
    123 
    124 
    125     //Register Menu Page code by Hardy
    126     public function add_bmr_page(){
     119    public function add_bmr_bmi_menu() {
     120        //Register Menu Page
     121       
    127122        add_menu_page(
    128             "Calculate BMR", //Page title
    129             "Calculate BMR",// Menu title
     123            "BMI and BMR", //Page title
     124            "BMI and BMR",// Menu title
    130125            "manage_options", //Admin Level
    131             "calculate-bmr", //Menu Slug
    132             array($this,"calc_bmr"), //Callback function
     126            "bmi-and-bmr", //Menu Slug
     127            array($this,"calc_bmi_bmr"), //Callback function
    133128            "dashicons-table-col-before", //icon link
    134129            8);
     130                   
    135131    }
    136    
    137132    // Callback function
    138     public function calc_bmr(){
    139         echo "<h3> User shortcode [bmr_shortcode] to display BMR on your pages and posts</h3>";
     133    public function calc_bmi_bmr(){
     134        echo "<h3> User shortcode [bmr_shortcode] to display BMR on your pages and posts</h3><br>";
     135       
     136        echo "<h3> User shortcode [bmi_shortcode] to display BMI on your pages and posts</h3>";
    140137    }
    141138
  • calculate-bmr/trunk/admin/partials/calculate-bmr-admin-display.php

    r2436849 r2680429  
    1515
    1616<!-- This file should primarily consist of HTML with a little bit of PHP. -->
    17 
    18 <div class="main-bg">
    19    <div class="card">
    20        <div class="top">
    21            <h2>Calculate BMR</h2>
    22        </div>
    23        <div class="form-area">
    24        
    25             <div class="form-group">
    26                 <input type="number" id="height" placeholder="Height in cm" >
    27             </div>
    28 
    29             <div class="form-group">
    30                 <input type="number" id="weight" placeholder="Weight in kg" >
    31             </div>
    32 
    33             <div class="form-group">
    34                 <input type="number" id="age" placeholder="Age" >
    35             </div>
    36 
    37             <div class="form-group gender">
    38                 <label for="gender">Gender:</label>
    39                 <span>Male</span>
    40                 <input type="radio" id="male" name="gender" value="male" checked>
    41                 <span>Female</span>
    42                 <input type="radio" id="female" name="gender" value="female">
    43             </div>
    44 
    45             <div class="form-group">
    46                
    47                 <input type="text" id="bmr-value" placeholder="BMR Value is" >
    48             </div>
    49 
    50             <div class="form-group">
    51                  <button type="submit" id="" class="btn-submit" onclick="getbmrvalue()">Calculate BMR</button>
    52             </div>
    53            
    54        </div>
    55    </div>
    56 </div>
  • calculate-bmr/trunk/calculate-bmr.php

    r2485023 r2680429  
    99 * that starts the plugin.
    1010 *
    11  * @link              https://testhardik.ml/about/
     11 * @link              https://www.youtube.com/watch?v=gv7lMeaLdOQ
    1212 * @since             1.0.0
    1313 * @package           Calculate_Bmr
    1414 *
    1515 * @wordpress-plugin
    16  * Plugin Name:       Calculate BMR
    17  * Plugin URI:        https://testhardik.ml/
    18  * Description:       This is a Plugin for Calculating BMR.
    19  * Version:           1.2.0
     16 * Plugin Name:       Calculate BMR and BMI
     17 * Plugin URI:        https://profiles.wordpress.org/hardikchavada/#content-plugins
     18 * Description:       This is a Plugin for Calculating BMR And BMI.
     19 * Version:           1.3.0
    2020 * Author:            Hardik Chavada
    21  * Author URI:        https://testhardik.ml/about/
     21 * Author URI:        https://www.youtube.com/watch?v=gv7lMeaLdOQ
    2222 * License:           GPL-2.0+
    2323 * License URI:       http://www.gnu.org/licenses/gpl-2.0.txt
     
    3636 * Rename this for your plugin and update it as you release new versions.
    3737 */
    38 define( 'CALCULATE_BMR_VERSION', '1.2.0' );
     38define( 'CALCULATE_BMR_VERSION', '1.3.0' );
    3939
    4040//desine plugin url
     
    4747function activate_calculate_bmr() {
    4848    require_once plugin_dir_path( __FILE__ ) . 'includes/class-calculate-bmr-activator.php';
    49     Calculate_Bmr_Activator::activate();
     49    //Calculate_Bmr_Activator::activate();
    5050}
    5151
     
    5656function deactivate_calculate_bmr() {
    5757    require_once plugin_dir_path( __FILE__ ) . 'includes/class-calculate-bmr-deactivator.php';
    58     Calculate_Bmr_Deactivator::deactivate();
     58    //Calculate_Bmr_Deactivator::deactivate();
    5959}
    6060
     
    9191
    9292function add_bmr_shortcode(){
    93     wp_enqueue_style( 'my_bmr_style', plugin_dir_url( __FILE__ ) . '/admin/css/my-bmr-style.css', array());
    94     wp_enqueue_script( 'my_bmr_js', plugin_dir_url( __FILE__ ) . '/admin/js/my-bmr-script.js', array(), true );
    95    
    9693    ob_start();
    97     include_once plugin_dir_path(__FILE__)."/admin/partials/calculate-bmr-admin-display.php";
     94    include_once plugin_dir_path(__FILE__)."/public/partials/calculate-bmr-public-display.php";
    9895    $content = ob_get_contents();
    9996    ob_end_clean();
    10097    return $content;
    101 
    102    
    10398}
    10499add_shortcode('bmr_shortcode', 'add_bmr_shortcode');
     100
     101function add_bmi_shortcode(){   
     102   
     103    ob_start();
     104    include_once plugin_dir_path(__FILE__)."/public/partials/calculate-bmi-public-display.php";
     105    $content = ob_get_contents();
     106    ob_end_clean();
     107    return $content;
     108}
     109add_shortcode('bmi_shortcode', 'add_bmi_shortcode');
  • calculate-bmr/trunk/includes/class-calculate-bmr-activator.php

    r2436849 r2680429  
    2929     *
    3030     * @since    1.0.0
    31      */
    32     public static function activate() {
    33 
    34     }
     31     */
    3532
    3633}
  • calculate-bmr/trunk/includes/class-calculate-bmr.php

    r2436849 r2680429  
    157157        $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
    158158        $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
    159 
    160         $this->loader->add_action( 'admin_menu', $plugin_admin, 'add_bmr_page' );
     159        $this->loader->add_action( 'admin_menu', $plugin_admin, 'add_bmr_bmi_menu' );
    161160    }
    162161
  • calculate-bmr/trunk/public/class-calculate-bmr-public.php

    r2436849 r2680429  
    7474         */
    7575
    76         wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/calculate-bmr-public.css', array(), $this->version, 'all' );
     76        wp_enqueue_style( 'bmr-css-file', plugin_dir_url( __FILE__ ) . 'css/calculate-bmr-public.css', array(), $this->version, 'all' );
     77
     78        wp_enqueue_style( 'bmi-css-file', plugin_dir_url( __FILE__ ) . 'css/calculate-bmi-public.css', array(), $this->version, 'all' );
    7779
    7880    }
     
    9799         */
    98100
    99         wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/calculate-bmr-public.js', array( 'jquery' ), $this->version, false );
     101        wp_enqueue_script( 'bmr-js-file', plugin_dir_url( __FILE__ ) . 'js/calculate-bmr-public.js', array( 'jquery' ), $this->version, true );
     102
     103        wp_enqueue_script( 'bmi-js-file', plugin_dir_url( __FILE__ ) . 'js/calculate-bmi-public.js', array( 'jquery' ), $this->version, true );
    100104
    101105    }
    102106
     107
    103108}
  • calculate-bmr/trunk/public/css/calculate-bmr-public.css

    r2436849 r2680429  
    11/**
    2  * All of the CSS for your public-facing functionality should be
    3  * included in this file.
     2 * My Custom CSS file
    43 */
     4
     5 *{
     6    margin: 0;
     7    padding: 0;
     8}
     9
     10.bmr-main-bg{
     11    height: auto;
     12    width: 100%;   
     13    display: flex;
     14    justify-content: center;
     15    align-items: center;
     16    font-family: inherit;
     17}
     18
     19.bmr-card {
     20    width: 400px;
     21    height: auto;
     22    display: flex;
     23    flex-direction: column;
     24    justify-content: center;   
     25    align-items: center;
     26    border: 1px solid #b9b6b6;
     27    border-radius: 5px;
     28    padding: 25px 0;
     29}
     30
     31.bmr-top h2 {
     32    font-size: 30px;
     33}
     34.bmr-fields {
     35    width: 90%;
     36    display: flex;
     37    justify-content: center;
     38    align-items: center;
     39    margin: 5px 0;
     40}
     41
     42.bmr-fields input[type="number"] {
     43    width: 70%;
     44    height: 40px;
     45    background: transparent;
     46    border: none;
     47    border-bottom: 1px solid #FFDA66;
     48    font-size: 15px;
     49    color: #ff6b66;
     50    text-align: center;
     51}
     52.bmr-fields input[type="number"]:focus {
     53    outline: none;
     54    border-bottom: 2px solid red;   
     55}
     56
     57.bmr-fields span {
     58    margin: 0 3px;
     59}
     60#bmr-gender {
     61    margin: 15px;
     62}
     63
     64#bmr-value {
     65    width: 80%;
     66    height: 40px;
     67    background: transparent;
     68    border: none;
     69    border-bottom: 2px solid #2248f0;
     70    font-size: 15px;
     71    color: #f12e6f;
     72    text-align: center;
     73}
     74
     75.bmr-fields button {
     76    height: 40px;
     77    width: 150px;
     78    background-image: linear-gradient(45deg, #46e317, #f8e826f0);
     79    color: #fff;
     80    border-radius: 5px;
     81    margin-top: 10px;
     82}
     83
     84
     85
     86@media only screen and (max-width: 600px) {
     87    .form-area {
     88        width: 100%;
     89        margin: auto;
     90    }
     91    .card {
     92        width: 100%;
     93    }
     94  }
  • calculate-bmr/trunk/public/js/calculate-bmr-public.js

    r2436849 r2680429  
    1 (function( $ ) {
    2     'use strict';
     1/**
     2     * My custom Javasctipr code
     3     */
     4 function getbmrvalue(){
     5           
     6    // for Male: BMR = 10W + 6.25H - 5A + 5
    37
    4     /**
    5      * All of the code for your public-facing JavaScript source
    6      * should reside in this file.
    7      *
    8      * Note: It has been assumed you will write jQuery code here, so the
    9      * $ function reference has been prepared for usage within the scope
    10      * of this function.
    11      *
    12      * This enables you to define handlers, for when the DOM is ready:
    13      *
    14      * $(function() {
    15      *
    16      * });
    17      *
    18      * When the window is loaded:
    19      *
    20      * $( window ).load(function() {
    21      *
    22      * });
    23      *
    24      * ...and/or other possibilities.
    25      *
    26      * Ideally, it is not considered best practise to attach more than a
    27      * single DOM-ready or window-load handler for a particular page.
    28      * Although scripts in the WordPress core, Plugins and Themes may be
    29      * practising this, we should strive to set a better example in our own work.
    30      */
     8    // BMR for Female: = 10W + 6.25H - 5A - 161
     9   
     10    let weight = document.getElementById('bmr-weight').value;
     11    let height = document.getElementById('bmr-height').value;
     12    let age = document.getElementById('bmr-age').value;
     13    let male = document.getElementById('bmr-male').value;
     14    let female = document.getElementById('bmr-female').value;
    3115
    32 })( jQuery );
     16    if(document.getElementById('bmr-male').checked)
     17    {
     18        bmr_male = (10 * weight) + (6.25*height) - (5*age) + 5;
     19
     20        // newBmiValue = newBmiValue.toFixed(2); //fixed the decimal to only two digits
     21
     22        document.getElementById("bmr-value").value = bmr_male + ' Calories/day';
     23
     24    }
     25    else
     26    {
     27        bmr_female = (10 * weight) + (6.25*height) - (5*age) -161;
     28
     29        // newBmiValue = newBmiValue.toFixed(2); //fixed the decimal to only two digits
     30
     31        document.getElementById("bmr-value").value = bmr_female + ' Calories/day';
     32
     33    }
     34}
  • calculate-bmr/trunk/public/partials/calculate-bmr-public-display.php

    r2436849 r2680429  
    1515
    1616<!-- This file should primarily consist of HTML with a little bit of PHP. -->
     17<div class="bmr-main-bg">
     18    <div class="bmr-card">
     19       <div class="bmr-top">
     20           <h2>Calculate BMR</h2>
     21       </div>
     22        <div class="bmr-fields ">
     23            <input type="number" id="bmr-height" placeholder="Height in cm" >
     24        </div>
     25
     26        <div class="bmr-fields ">
     27            <input type="number" id="bmr-weight" placeholder="Weight in kg" >
     28        </div>
     29
     30        <div class="bmr-fields ">
     31            <input type="number" id="bmr-age" placeholder="Age" >
     32        </div>
     33
     34        <div class="bmr-fields ">
     35            <span for="gender" id="bmr-gender">Gender:</span>
     36            <span>Male</span>
     37            <input type="radio" id="bmr-male" name="gender" value="male" checked>
     38            <span>Female</span>
     39            <input type="radio" id="bmr-female" name="gender" value="female">
     40        </div>
     41
     42        <div class="bmr-fields ">
     43            <input type="text" id="bmr-value" placeholder="Result..." >
     44        </div>
     45
     46        <div class="bmr-fields ">
     47                <button type="submit" id="" class="btn-submit" onclick="getbmrvalue()">Calculate BMR</button>
     48        </div>
     49    </div>
     50</div>
Note: See TracChangeset for help on using the changeset viewer.