Skip to content

Commit

Permalink
int v1.4.8
Browse files Browse the repository at this point in the history
## [1.4.8]

- Sets the WordPress tested up to version to 6.4.2
- Resolved backslash issues when add extra fields with character (').
  • Loading branch information
R-Atik authored Jan 27, 2024
1 parent 95dbb97 commit 9761fbc
Show file tree
Hide file tree
Showing 8 changed files with 452 additions and 528 deletions.
10 changes: 5 additions & 5 deletions Educare.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<?php
/**
* @package Educare
* @version 1.4.5
* @version 1.4.8
* @author FixBD <[email protected]>
* @copyright GPL-2.0+
* @link http://github.com/fixbd/educare
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Plugin Name: Educare
* Plugin URI: http://github.com/fixbd/educare
* Description: Educare is a powerful online School/College students & results management system dev by FixBD. This plugin allows you to manage and publish students results. You can easily Add/Edit/Delete Students, Results, Class, Exam, Year Custom field and much more... Also you can import & export unlimited students and results just a click!
* Version: 1.4.5
* Description: Educare is a online Students & Results management system developed by FixBD. This powerful results management plugin is built to easily manage institute, academy, or student results online. Designed to be universally adaptable, this solution seamlessly integrates with result systems across the world. No matter the format, Educare supports diverse result systems, making it your go-to choice for streamlined and efficient management.
* Version: 1.4.8
* Author: FixBD
* Author URI: http://github.com/fixbd
* Author URI: http://fixbd.net
* License: GPL-2.0+
* Text Domain: Educare
*
Expand Down Expand Up @@ -44,7 +44,7 @@

// Make it simple! (Define Educare Name-Space)
// Plugin Version
define('EDUCARE_VERSION', '1.4.5');
define('EDUCARE_VERSION', '1.4.8');
// Settings Version
define('EDUCARE_SETTINGS_VERSION', '1.0');
define('EDUCARE_RESULTS_VERSION', '1.0');
Expand Down
262 changes: 91 additions & 171 deletions assets/js/clone-field-1.0.js
Original file line number Diff line number Diff line change
@@ -1,97 +1,22 @@
/**
== Clone Field ==
* == FixBD Clone Field ==
*
* Contributors: fixbd
* GitHub link: https://github.com/fixbd/clone-field/assets/clone-field-1.0.js
* Tags: jQuery field, jQuery form field copy on click, Clone input field
* Tags: jQuery Clone, jQuery form field copy on click, Clone input field
* Category: jQuery plugins
* Required: jQuery
* Tested up to: jQuery v-2.1.3
* Stable tag: 1.0
* License: GPLv2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
*
*****************************************************************
*****************************************************************
*
* Usage =>
cloneField({
// options => value
countMsgs: 'Currently you are add #count field of #max',
maxMsgs: 'Sorry, You can not add more than #max field. Please remove one then try!',
maxField: 10
});
<!-- ==Clone start== /clone one or more field -->
<div class='cloneField'>
<!-- Main menu -->
<div class='mainField'>
<input type="text" name="player[]" value="" placeholder=""/>
<!-- Show/Hide Sub menu -->
<a class='showSubfield'><i class='dashicons dashicons-ellipsis'></i></a>
<!-- Remove cloned menu -->
<a href="javascript:void(0);" class="remove_button"><i class="dashicons dashicons-no"></i></a>
</div>
<!-- Sub menu -->
<div class='subField'>
<b>Details</b>
Select Category:
Player Age:
<input type='number' name='age[]' value='' placeholder=''/>
Number:
<input type='number' name='mobile[]' value='' placeholder=''/>
</div>
</div>
<!-- ==Clone end== -->
<?php
}
$grade_system = array(
'80-100' => 'A+',
'70-79' => 'A',
'60-69' => 'A-',
'50-59' => 'B',
'40-49' => 'c',
'33-39' => 'D',
'0-32' => 'F'
);
?>
<form id='addForm'>
<div class='fixbd_cloneField'>
<h2>Players</h2>
<p id='status' class='warning sticky'></p>
<div id='cloneBody'>
<?php
foreach ( $grade_system as $name => $details ) {
crickup_get_player_formx($name, $details);
}
?>
</div>
<a href='javascript:void(0);' class='addButton' title='Add more field'><i class='dashicons dashicons-plus-alt'></i></a>
</div>
<button id='save_addForm'>Add</button>
</form>
<div id='cloneWrapper' style='display: none;'>
<?php crickup_get_player_formx();?>
</div>
<script type="text/javascript">cloneField()</script>
*/

(function( $ ) {
$.fn.cloneField = function(options) {
(function ($) {

$.fn.cloneField = function (options) {

// Default options
var settings = $.extend({
// Main options
Expand All @@ -113,46 +38,47 @@ cloneField({
status: '#status', // Where to display clone status
countMsgs: 'Field Added #max/#count',
maxMsgs: 'You can not add more than #max field',
maxClass: 'field_over' // Add specific class when field is over
maxClass: 'field_over', // Add specific class when field is over
copyData: '<tr class="cloneField"><td><input type="number" name="rules1[]" value="" placeholder="Less Mark"/></td><td><input type="number" name="rules2[]" value="" placeholder="Greater Mark"/></td><td><input class="" type="number" name="point[]" value="" placeholder="Grade point"/></td><td><input class="bold" type="text" name="grade[]" value="" placeholder="Grade"/></td><td><a href="javascript:void(0);" class="remove_button"><i class="dashicons dashicons-no"></i></a></td></tr>'
}, options);

// Make it simple!
var s = settings;

var showSub = $('.showSubfield').html();
var cloneHtml = $(s.wrapper).html();
var cloneField = $(s.cloneBody + ' ' + s.cloneField).length;
var cloneHtml = $(s.wrapper).html();
var cloneField = $(s.cloneBody + ' ' + s.cloneField).length;
var counter;

// Check auto counter settings, manual or auto
if (s.autoCunter === true) {
if (s.autoCunter === true) {
counter = cloneField;
} else {
counter = s.counter;
}

/**
* Minimum field settings
* Disable remove button if field is equal and less than minimum field
* @since: v1.0
* @param int arg, for compare with minimum field
* @return class sync/add or removed class
*/
function minField(arg) {
var removeBtn = $(s.removeButton);
if (arg <= s.minField) {
removeBtn.removeClass('yes').addClass('disabled');
} else {
removeBtn.removeClass('disabled').addClass('yes');
}
}
function minField(arg) {

var removeBtn = $(s.removeButton);

if (arg <= s.minField) {
removeBtn.removeClass('yes').addClass('disabled');
} else {
removeBtn.removeClass('disabled').addClass('yes');
}

}

// Set minimum field on load
minField(counter);
minField(counter);

/**
* Support short key (#max, #count) for message.
* This way, user can easily customize there msgs.
Expand All @@ -172,91 +98,85 @@ cloneField({
msgs = $(s.status).html(msgs);
return msgs;
}

// Display clone/copied field status/msgs on load
msgs(s.countMsgs);

/**
* Function for open sub field Immediately, when add a field
* If quick sub field is true, it's open sub field at a same time when main field is added.
* @since: v1.0
*/
function quickSubfield() {
$(s.cloneBody + ' ' + s.cloneField + ':last').hide()
// Open append field with effect
.slideDown('fast', function() {
if (s.quickSubfield === true) {
$(this).find(s.subField).slideDown('fast');
$(this).find(s.showSubfield).html(s.hideSubfield).addClass('hide');
$(s.cloneBody + ' ' + s.cloneField + ':last').hide().slideDown('fast', function () {
if (s.quickSubfield === true) {
$(this).find(s.subField).slideDown('fast');
$(this).find(s.showSubfield).html(s.hideSubfield).addClass('hide');
}
}
});
);
}

// Set quick subfield on load
quickSubfield();

/***************************************************************************
ADD, REMOVE AND SHOW/HIDE SUB FIELD
***************************************************************************/

// Once add button is clicked
$(s.addButton).click(function() {

//Check maximum number of input fields
if(counter < s.maxField) {
// Increment field counter
counter++;
//Add field html
$(s.cloneBody).append('<tr class="cloneField"><td><input type="number" name="rules1[]" value="" placeholder="Less Mark"/></td><td><input type="number" name="rules2[]" value="" placeholder="Greater Mark"/></td><td><input class="" type="number" name="point[]" value="" placeholder="Grade point"/></td><td><input class="bold" type="text" name="grade[]" value="" placeholder="Grade"/></td><td><a href="javascript:void(0);" class="remove_button"><i class="dashicons dashicons-no"></i></a></td></tr>');

/*
$(s.cloneBody + ' ' + s.cloneField + ':last')
.find('input, select') .each(function () {
$(this).val('');
});
*/


/*
===================================
ADD, REMOVE AND SHOW/HIDE SUB FIELD
===================================
*/

// Once add button is clicked
$(s.addButton).click(function () {

//Check maximum number of input fields
if (counter < s.maxField) {
// Increment field counter
counter++;
//Add field html
$(s.cloneBody).append(s.copyData);

quickSubfield();
minField(counter);
msgs(s.countMsgs);
$(this).removeClass('disabled');
} else {
msgs(s.maxMsgs);
msgs(s.countMsgs);
$(this).removeClass('disabled');
} else {
msgs(s.maxMsgs);
$(this).addClass('disabled');
$(s.status).addClass(s.maxClass);
}
});
// Once remove button is clicked
$(s.cloneBody).on('click', s.removeButton + '.yes', function(e) {
e.preventDefault();
// Remove field html
$(this).parents(s.cloneField).fadeOut('fast', function() {
}

});

// Once remove button is clicked
$(s.cloneBody).on('click', s.removeButton + '.yes', function (e) {
e.preventDefault();

// Remove field html
$(this).parents(s.cloneField).fadeOut('fast', function () {
$(this).remove();
});
// Decrement field counter
counter--;
minField(counter);
msgs(s.countMsgs);
$(s.addButton).removeClass('disabled');

// Decrement field counter
counter--;
minField(counter);
msgs(s.countMsgs);
$(s.addButton).removeClass('disabled');
$(s.status).removeClass(s.maxClass);
});

});

// Show/Hide sub menu button is clicked
$(s.cloneBody).on('click', s.showSubfield, function(event) {
$(s.cloneBody).on('click', s.showSubfield, function (event) {
event.preventDefault();

// select parent elements
var cloneField = $(this).parents(s.cloneField);
// find/search current s.subField for show/hide
var subField = cloneField.find(s.subField);
var cloneField = $(this).parents(s.cloneField);
// find/search current s.subField for show/hide
var subField = cloneField.find(s.subField);
// hide or show subField
$(this).toggleClass('hide');

// slice(1) Remove (.) from s.showSubfield
if ($(this).attr('class') == s.showSubfield.slice(1)) {
// Change icon
Expand All @@ -265,17 +185,17 @@ cloneField({
subField.slideUp('fast');
} else {
$(this).html(s.hideSubfield);
// hide subField
subField.slideDown();
// hide subField
subField.slideDown();
}

});

// Close main function
}

// define function as cloneField()
cloneField = $.fn.cloneField;
}( jQuery ));

}(jQuery));

16 changes: 16 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
## [1.4.8]

- Sets the WordPress tested up to version to 6.4.2
- Resolved backslash issues when add extra fields with character (').

## [1.4.7]

- Improved security measures
- Fixed well-known errors
- Added a new security layer for Admin Ajax

## [1.4.6]

- Removed unnecessary code and comments.
- Sets the WordPress tested up to version to 6.3.1

## [1.4.5]

### Stable - Security Release
Expand Down
Loading

0 comments on commit 9761fbc

Please sign in to comment.