Skip to content

Commit

Permalink
Cast rate limit variables to integers
Browse files Browse the repository at this point in the history
  • Loading branch information
danielmilner authored Apr 12, 2022
1 parent 419139a commit bb886b2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions ccbpress-core.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Church Data Connect for Church Community Builder
* Plugin URI: https://churchdataconnect.com/
* Description: Display information from Church Community Builder on your WordPress site.
* Version: 1.4.5
* Version: 1.4.6
* Author: FireTree Design, LLC <[email protected]>
* Author URI: https://firetreedesign.com/
* Text Domain: ccbpress-core
Expand Down Expand Up @@ -66,7 +66,7 @@ class CCBPress_Core {
* @var string
* @since 1.0.0
*/
public $version = '1.4.5';
public $version = '1.4.6';

/**
* Main CCBPress_Core Instance
Expand Down
6 changes: 3 additions & 3 deletions includes/class-ccbpress-connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -354,15 +354,15 @@ public function rate_limit_ok( $srv ) {
}

if ( isset( $ccbpress_rate_limits[ $srv ]['limit'] ) && isset( $ccbpress_rate_limits[ $srv ]['remaining'] ) ) {
$limit = $ccbpress_rate_limits[ $srv ]['limit'];
$remaining = $ccbpress_rate_limits[ $srv ]['remaining'];
$limit = intval($ccbpress_rate_limits[ $srv ]['limit']);
$remaining = intval($ccbpress_rate_limits[ $srv ]['remaining']);
if ($remaining >= ($limit / 2)) {
return true;
}
}

if ( isset( $ccbpress_rate_limits[ $srv ]['reset'] ) ) {
$reset = $ccbpress_rate_limits[ $srv ]['reset'];
$reset = intval($ccbpress_rate_limits[ $srv ]['reset']);
if ( time() >= $reset ) {
return true;
} else {
Expand Down
5 changes: 4 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Tags: church, ccb, church community builder, chms, gutenberg
Requires at least: 4.3
Tested up to: 5.9
Requires PHP: 5.3
Stable tag: 1.4.5
Stable tag: 1.4.6
License: GPLv2 or later
License URI: http://ww.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -45,6 +45,9 @@ Extend the capabilities of Church Data Connect for Church Community Builder with

== Changelog ==

= 1.4.6 =
* Fixed a PHP compatibility issue.

= 1.4.5 =
* Fixed an issue when loading the Widgets page in the WordPress Admin.

Expand Down

0 comments on commit bb886b2

Please sign in to comment.