-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #53 from chesio/release-0.9
Release version 0.9
- Loading branch information
Showing
88 changed files
with
3,518 additions
and
1,467 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* Check running */ | ||
.bcs-check--running { | ||
opacity: 0.5; | ||
} | ||
|
||
/* Check passed */ | ||
.bcs-check--ok .dashicons:before { | ||
content: "\f147"; | ||
} | ||
|
||
/* Check failed */ | ||
.bcs-check--ko .dashicons:before { | ||
content: "\f158"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
(function($, bc_security_checklist) { | ||
$(function() { | ||
var $checks = $('.bcs-check'); | ||
var $run_checks_buttons = $('button.bcs-run-checks'); | ||
|
||
// Activate "select all" button. | ||
$('#bcs-mark-all-checks').prop('disabled', false).on('click', function() { | ||
$checks.find('input[type="checkbox"]').prop('checked', true); | ||
}); | ||
|
||
// Activate "select none" button. | ||
$('#bcs-mark-no-checks').prop('disabled', false).on('click', function() { | ||
$checks.find('input[type="checkbox"]').prop('checked', false); | ||
}); | ||
|
||
// Activate "select only passing" button. | ||
$('#bcs-mark-passing-checks').prop('disabled', false).on('click', function() { | ||
$checks.find('input[type="checkbox"]').prop('checked', function() { return $(this).closest('.bcs-check').hasClass('bcs-check--ok'); }); | ||
}); | ||
|
||
// Activate "Run checks" buttons. | ||
$run_checks_buttons.on('click', function() { | ||
// Disable all "Run checks" buttons. | ||
$run_checks_buttons.prop('disabled', true); | ||
|
||
var $button = $(this); | ||
var requests = []; | ||
|
||
$checks.filter('.' + $button.data('check-class')).each(function() { | ||
var $check = $(this).removeClass('bcs-check--ok').removeClass('bcs-check--ko').addClass('bcs-check--running'); | ||
var $last_run = $('.bcs-check__last-run', $check); | ||
var $message = $('.bcs-check__message', $check).html(bc_security_checklist.messages.check_is_running); | ||
|
||
// https://api.jquery.com/jQuery.ajax/ | ||
var request = $.ajax({ | ||
url : bc_security_checklist.ajaxurl, | ||
method : 'POST', | ||
data : {action: bc_security_checklist.action, _ajax_nonce: bc_security_checklist.nonce, check_id: $check.data('check-id')}, | ||
dataType: 'json', | ||
cache : false, | ||
timeout : 0, // no timeout | ||
error : function() { | ||
$message.html(bc_security_checklist.messages.check_failed); | ||
}, | ||
success : function(response) { | ||
if (response.success) { | ||
$last_run.text(response.data.timestamp); | ||
if (response.data.status !== null) { | ||
$check.addClass('bcs-check--' + (response.data.status ? 'ok' : 'ko')); | ||
} | ||
} | ||
$message.html(response.data.message); | ||
}, | ||
complete : function() { | ||
$check.removeClass('bcs-check--running').addClass('bcs-check--done'); | ||
} | ||
}); | ||
|
||
requests.push(request); | ||
}); | ||
|
||
$.when.apply($, requests).always(function() { | ||
$run_checks_buttons.prop('disabled', false); | ||
}); | ||
}); | ||
}); | ||
})(jQuery, bc_security_checklist); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,12 +2,12 @@ | |
/** | ||
* Plugin Name: BC Security | ||
* Plugin URI: https://github.com/chesio/bc-security | ||
* Description: Helps keeping WordPress websites secure. Plugin requires PHP 7.0 or newer to run. | ||
* Version: 0.8.1 | ||
* Description: Helps keeping WordPress websites secure. | ||
* Version: 0.9.0 | ||
* Author: Česlav Przywara <[email protected]> | ||
* Author URI: https://www.chesio.com | ||
* Requires PHP: 7.0 | ||
* Requires WP: 4.7 | ||
* Requires WP: 4.9 | ||
* Tested up to: 4.9 | ||
* Text Domain: bc-security | ||
* GitHub Plugin URI: https://github.com/chesio/bc-security | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?php | ||
/** | ||
* @package BC_Security | ||
*/ | ||
|
||
namespace BlueChip\Security\Core\Admin; | ||
|
||
use BlueChip\Security\Core\AssetsManager; | ||
|
||
trait PageWithAssets | ||
{ | ||
/** | ||
* @var \BlueChip\Security\Core\AssetsManager | ||
*/ | ||
private $assets_manager; | ||
|
||
|
||
/** | ||
* @param \BlueChip\Security\Core\AssetsManager $assets_manager | ||
*/ | ||
protected function useAssetsManager(AssetsManager $assets_manager) | ||
{ | ||
$this->assets_manager = $assets_manager; | ||
} | ||
|
||
|
||
/** | ||
* @param array $assets JS assets to enqueue in [ handle => filename ] format. | ||
*/ | ||
protected function enqueueJsAssets(array $assets) | ||
{ | ||
add_action('admin_enqueue_scripts', function () use ($assets) { | ||
foreach ($assets as $handle => $filename) { | ||
wp_enqueue_script( | ||
$handle, | ||
$this->assets_manager->getScriptFileUrl($filename), | ||
['jquery'], | ||
filemtime($this->assets_manager->getScriptFilePath($filename)), | ||
true | ||
); | ||
} | ||
}, 10, 0); | ||
} | ||
|
||
|
||
/** | ||
* @param array $assets CSS assets to enqueue in [ handle => filename ] format. | ||
*/ | ||
protected function enqueueCssAssets(array $assets) | ||
{ | ||
add_action('admin_enqueue_scripts', function () use ($assets) { | ||
foreach ($assets as $handle => $filename) { | ||
wp_enqueue_style( | ||
$handle, | ||
$this->assets_manager->getStyleFileUrl($filename), | ||
[], | ||
filemtime($this->assets_manager->getStyleFilePath($filename)) | ||
); | ||
} | ||
}, 10, 0); | ||
} | ||
} |
Oops, something went wrong.