Changeset 2680429
- Timestamp:
- 02/17/2022 05:24:42 AM (4 years ago)
- Location:
- calculate-bmr/trunk
- Files:
-
- 10 edited
-
README.txt (modified) (4 diffs)
-
admin/class-calculate-bmr-admin.php (modified) (1 diff)
-
admin/partials/calculate-bmr-admin-display.php (modified) (1 diff)
-
calculate-bmr.php (modified) (5 diffs)
-
includes/class-calculate-bmr-activator.php (modified) (1 diff)
-
includes/class-calculate-bmr.php (modified) (1 diff)
-
public/class-calculate-bmr-public.php (modified) (2 diffs)
-
public/css/calculate-bmr-public.css (modified) (1 diff)
-
public/js/calculate-bmr-public.js (modified) (1 diff)
-
public/partials/calculate-bmr-public-display.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
calculate-bmr/trunk/README.txt
r2567282 r2680429 1 1 === Calculate BMR === 2 2 Contributors: hardikchavada 3 Donate link: https:// testhardik.ml/about/4 Tags: Calculate BMR, MY BMR calculator, bmi calculator 3 Donate link: https://www.youtube.com/watch?v=gv7lMeaLdOQ 4 Tags: Calculate BMR, MY BMR calculator, bmi calculator, Calculate BMI, BMI Calculator Plugin 5 5 Requires at least: 4.7 6 Tested up to: 5. 77 Stable tag: 1. 26 Tested up to: 5.9 7 Stable tag: 1.3 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html 10 10 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]11 This plugin will help you to add BMR/BMI calculator to your Pages/Posts. Add the following shortcodes [bmr_shortcode] and [bmi_shortcode] 12 12 13 13 == Description == 14 14 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.15 A complete mobile responsive BMR and BMI calculator for your website. 16 16 17 17 A few notes about the sections above: … … 21 21 == Installation == 22 22 23 1. Upload `calculate-bmr`plugin to the `/wp-content/plugins/` directory23 1. Upload plugin to the `/wp-content/plugins/` directory 24 24 2. Activate the plugin through the 'Plugins' menu in WordPress 25 3. Add shortcode [bmr_shortcode] directly into your pages/posts25 3. Add shortcodes [bmr_shortcode] [bmi_shortcode] directly into your pages/posts 26 26 27 27 == Frequently Asked Questions == 28 28 = 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/posts29 Currently there are not extra settings for this version. 30 30 31 31 = Are there translations? = … … 35 35 == Upgrade Notice == 36 36 37 = 1. 3=37 = 1.4 = 38 38 Future Updates will have more designs & features. 39 39 … … 42 42 1. screenshot-1.png 43 43 2. screenshot-2.png 44 3. screenshot-3.png 45 4. screenshot-4.png 44 46 45 47 46 48 == Changelog == 49 50 = 1.3 = 51 * Added BMI Calculation form 47 52 48 53 = 1.2 = -
calculate-bmr/trunk/admin/class-calculate-bmr-admin.php
r2436849 r2680429 114 114 115 115 wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/calculate-bmr-admin.js', array( ), $this->version, true ); 116 117 } 116 118 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 127 122 add_menu_page( 128 " CalculateBMR", //Page title129 " CalculateBMR",// Menu title123 "BMI and BMR", //Page title 124 "BMI and BMR",// Menu title 130 125 "manage_options", //Admin Level 131 " calculate-bmr", //Menu Slug132 array($this,"calc_bm r"), //Callback function126 "bmi-and-bmr", //Menu Slug 127 array($this,"calc_bmi_bmr"), //Callback function 133 128 "dashicons-table-col-before", //icon link 134 129 8); 130 135 131 } 136 137 132 // 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>"; 140 137 } 141 138 -
calculate-bmr/trunk/admin/partials/calculate-bmr-admin-display.php
r2436849 r2680429 15 15 16 16 <!-- 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 9 9 * that starts the plugin. 10 10 * 11 * @link https:// testhardik.ml/about/11 * @link https://www.youtube.com/watch?v=gv7lMeaLdOQ 12 12 * @since 1.0.0 13 13 * @package Calculate_Bmr 14 14 * 15 15 * @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.016 * 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 20 20 * Author: Hardik Chavada 21 * Author URI: https:// testhardik.ml/about/21 * Author URI: https://www.youtube.com/watch?v=gv7lMeaLdOQ 22 22 * License: GPL-2.0+ 23 23 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt … … 36 36 * Rename this for your plugin and update it as you release new versions. 37 37 */ 38 define( 'CALCULATE_BMR_VERSION', '1. 2.0' );38 define( 'CALCULATE_BMR_VERSION', '1.3.0' ); 39 39 40 40 //desine plugin url … … 47 47 function activate_calculate_bmr() { 48 48 require_once plugin_dir_path( __FILE__ ) . 'includes/class-calculate-bmr-activator.php'; 49 Calculate_Bmr_Activator::activate();49 //Calculate_Bmr_Activator::activate(); 50 50 } 51 51 … … 56 56 function deactivate_calculate_bmr() { 57 57 require_once plugin_dir_path( __FILE__ ) . 'includes/class-calculate-bmr-deactivator.php'; 58 Calculate_Bmr_Deactivator::deactivate();58 //Calculate_Bmr_Deactivator::deactivate(); 59 59 } 60 60 … … 91 91 92 92 function 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 96 93 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"; 98 95 $content = ob_get_contents(); 99 96 ob_end_clean(); 100 97 return $content; 101 102 103 98 } 104 99 add_shortcode('bmr_shortcode', 'add_bmr_shortcode'); 100 101 function 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 } 109 add_shortcode('bmi_shortcode', 'add_bmi_shortcode'); -
calculate-bmr/trunk/includes/class-calculate-bmr-activator.php
r2436849 r2680429 29 29 * 30 30 * @since 1.0.0 31 */ 32 public static function activate() { 33 34 } 31 */ 35 32 36 33 } -
calculate-bmr/trunk/includes/class-calculate-bmr.php
r2436849 r2680429 157 157 $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' ); 158 158 $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' ); 161 160 } 162 161 -
calculate-bmr/trunk/public/class-calculate-bmr-public.php
r2436849 r2680429 74 74 */ 75 75 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' ); 77 79 78 80 } … … 97 99 */ 98 100 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 ); 100 104 101 105 } 102 106 107 103 108 } -
calculate-bmr/trunk/public/css/calculate-bmr-public.css
r2436849 r2680429 1 1 /** 2 * All of the CSS for your public-facing functionality should be 3 * included in this file. 2 * My Custom CSS file 4 3 */ 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 3 7 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; 31 15 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 15 15 16 16 <!-- 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.