Skip to content

Commit

Permalink
Fix the phpcs warnings for class-module
Browse files Browse the repository at this point in the history
  • Loading branch information
ingeniumed committed Jun 24, 2024
1 parent d27c743 commit 3ec7432
Show file tree
Hide file tree
Showing 2 changed files with 166 additions and 212 deletions.
48 changes: 1 addition & 47 deletions common/php/class-module.php
Original file line number Diff line number Diff line change
Expand Up @@ -436,52 +436,6 @@ function get_module_url( $file ) {
return trailingslashit( $module_url );
}

/**
* Produce a human-readable version of the time since a timestamp
*
* @param int $original The UNIX timestamp we're producing a relative time for
* @return string $relative_time Human-readable version of the difference between the timestamp and now
*/
function timesince( $original ) {
// array of time period chunks
$chunks = array(
array(60 * 60 * 24 * 365 , 'year'),
array(60 * 60 * 24 * 30 , 'month'),
array(60 * 60 * 24 * 7, 'week'),
array(60 * 60 * 24 , 'day'),
array(60 * 60 , 'hour'),
array(60 , 'minute'),
array(1 , 'second'),
);

$today = time(); /* Current unix time */
$since = $today - $original;

if ( $since > $chunks[2][0] ) {
$print = date("M jS", $original);

if( $since > $chunks[0][0] ) { // Seconds in a year
$print .= ", " . date( "Y", $original );
}

return $print;
}

// $j saves performing the count function each time around the loop
for ($i = 0, $j = count($chunks); $i < $j; $i++) {

$seconds = $chunks[$i][0];
$name = $chunks[$i][1];

// finding the biggest chunk (if the chunk fits, break)
if (($count = floor($since / $seconds)) != 0) {
break;
}
}

return sprintf( _n( "1 $name ago", "$count {$name}s ago", $count), $count);
}

/**
* Displays a list of users that can be selected!
*
Expand Down Expand Up @@ -529,7 +483,7 @@ function users_select_form( $selected = null, $args = null ) {
<label for="<?php echo esc_attr( $input_id .'-'. $user->ID ) ?>">
<div class="ef-user-subscribe-actions">
<?php do_action( 'ef_user_subscribe_actions', $user->ID, $checked ) ?>
<input type="checkbox" id="<?php echo esc_attr( $input_id .'-'. $user->ID ) ?>" name="<?php echo esc_attr( $input_id ) ?>[]" value="<?php echo esc_attr( $user->ID ); ?>" <?php echo $checked; echo $current_user_class; ?> />
<input type="checkbox" id="<?php echo esc_attr( $input_id .'-'. $user->ID ) ?>" name="<?php echo esc_attr( $input_id ) ?>[]" value="<?php echo esc_attr( $user->ID ); ?>" <?php echo esc_attr($checked); echo esc_attr($current_user_class); ?> />
</div>

<span class="ef-user_displayname"><?php echo esc_html( $user->display_name ); ?></span>
Expand Down
Loading

0 comments on commit 3ec7432

Please sign in to comment.