Skip to content

Commit

Permalink
fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
remyperona committed Dec 19, 2024
1 parent 5a06cf9 commit 71f3910
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions inc/Engine/Media/Fonts/Admin/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ public function __construct( Options_Data $options ) {
*
* @return void
*/
public function schedule_data_collection() {
public function schedule_data_collection() {
if ( ! $this->is_enabled() ) {
return;
}

$this->schedule_recurring( time(), WEEK_IN_SECONDS, 'rocket_fonts_data_collection' );
}
$this->schedule_recurring( time(), WEEK_IN_SECONDS, 'rocket_fonts_data_collection' );
}

/**
* Collect data.
Expand All @@ -71,27 +71,32 @@ public function collect_data() {
'ttf',
'otf',
];

$total_font_count = 0;
$total_font_size = 0;

foreach( $fonts as $file ) {
//check file is not a directory.
foreach ( $fonts as $file ) {
// check file is not a directory.
if ( $file->isDir() ) {
continue;
}

$extension = strtolower( pathinfo( $file->getFilename(), PATHINFO_EXTENSION ) );

if ( in_array( $extension, $allowed_extensions, true ) ) {
$total_font_count++;
++$total_font_count;
$total_font_size += $file->getSize();
}
}

set_transient( 'rocket_fonts_data_collection', [
'fonts_total_number' => $total_font_count,
'fonts_total_size' => size_format( $total_font_size )
], WEEK_IN_SECONDS );
set_transient(
'rocket_fonts_data_collection',
[
'fonts_total_number' => $total_font_count,
'fonts_total_size' => size_format( $total_font_size ),
],
WEEK_IN_SECONDS
);
}

/**
Expand Down

0 comments on commit 71f3910

Please sign in to comment.