Skip to content

Commit

Permalink
Merge pull request #534 from Automattic/fix/php72-count-modules
Browse files Browse the repository at this point in the history
Fix PHP count() warning
  • Loading branch information
dchymko authored Oct 31, 2019
2 parents 2f5ecb4 + e954944 commit 259321a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
5 changes: 3 additions & 2 deletions edit_flow.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,8 @@ private function __construct() {
}

private function setup_globals() {

$this->modules = new stdClass();

$this->modules_count = 0;
}

/**
Expand Down Expand Up @@ -296,6 +295,8 @@ public function register_module( $name, $args = array() ) {

$this->modules->$name = (object) $args;

$this->modules_count++;

/**
* Fires after edit_flow has registered a module.
*
Expand Down
10 changes: 5 additions & 5 deletions modules/settings/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,18 +225,18 @@ function print_default_footer( $current_module ) {
<?php endif; ?>
<?php
}

function print_modules() {
global $edit_flow;
if ( !count( $edit_flow->modules ) ) {

if ( ! $edit_flow->modules_count ) {
echo '<div class="message error">' . __( 'There are no Edit Flow modules registered', 'edit-flow' ) . '</div>';
} else {

foreach ( $edit_flow->modules as $mod_name => $mod_data ) {
if ( $mod_data->autoload )
continue;

$classes = array(
'edit-flow-module',
);
Expand Down

0 comments on commit 259321a

Please sign in to comment.