Skip to content

Commit

Permalink
Fix CS issues
Browse files Browse the repository at this point in the history
  • Loading branch information
carstingaxion committed Sep 4, 2023
1 parent dc0977c commit a025dcb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 32 deletions.
25 changes: 4 additions & 21 deletions inc/pwa/namespace.php
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,10 @@ function set_screenshots( array $manifest ) : array {
*
* Get a screenshot of a website using Automatics mShots service.
*
* @see https://github.com/BinaryMoon/browser-shots/blob/master/browser-shots.php#L176-L202
* @see https://github.com/Automattic/mShots/blob/master/public_html/class-mshots.php
* @todo #28 Re-Enable locale storage for PWA screenshots (privacy)
*
* @see https://github.com/BinaryMoon/browser-shots/blob/master/browser-shots.php#L176-L202
* @see https://github.com/Automattic/mShots/blob/master/public_html/class-mshots.php
*
* @since 1.3 Removed call $this->save_screenshot( $remote_url, $new_name )
*
Expand All @@ -304,25 +306,6 @@ function set_screenshots( array $manifest ) : array {
*/
function get_shot( string $url = '', int $width = 600, int $height = 450, string $new_name = '' ) : string {

// $new_name = 'pwa-'.$new_name.'.jpeg';

// $dir = $this->set_screenshots_dir_path(); // !
// $new_file = $dir.'/'.$new_name;

// already cached ?
// DISABLED,
// because it's nothing saved
// to pick up here
// if (
// file_exists($new_file)
// &&
// file not older than 7 days
// ! ( time() - filemtime($new_file) > 7 * 24 * 3600 )
// file not older than 60 seconds // DEBUG
// ! ( time() - filemtime($new_file) > 60 )
// )
// return $this->set_screenshots_dir_url() . $new_name; //!

// Image found.
if ( '' !== $url ) {
/*
Expand Down
22 changes: 11 additions & 11 deletions inc/wp-super-preload/namespace.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ function filter_options() :void {
}

/**
*
* Get all options, that this plugin uses, prepared for 'pre_get_option'.
*
* @return array<string, bool|string|array<mixed>>
*/
Expand All @@ -103,7 +103,7 @@ function pre_option_super_preload_settings() : array {
}

/**
*
* Get static & fixed options, that this plugin uses, prepared for 'pre_get_option'.
*
* @access private
*
Expand Down Expand Up @@ -145,11 +145,11 @@ function static_super_preload_settings() : array {
}

/**
*
* Get dynamic parts of the options, that this plugin uses, prepared for 'pre_get_option'.
*
* @access private
*
* @param array<string, bool|string|array<mixed>> $super_preload_settings
* @param array<string, bool|string|array<mixed>> $super_preload_settings Static default parts of 'super_preload_settings'.
*
* @return array<string, bool|string|array<mixed>>
*/
Expand Down Expand Up @@ -201,7 +201,7 @@ function specific_super_preload_settings( array $super_preload_settings ) : arra
}

/**
*
* Bare bone defaults of get_option('super_preload_settings').
*
* @return array<string, int|string>
*/
Expand Down Expand Up @@ -245,21 +245,21 @@ function( string $data_name ) : string {
*/
function on_site_cache_deletion( string $cleared_url, int $cleared_site_id, array $cache_cleared_index ) : void {

switch_to_blog( $cleared_site_id );
switch_to_blog( $cleared_site_id ); // phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.switch_to_blog_switch_to_blog

shedule_preload_on_cache_deletion( $cleared_url, $cleared_site_id, 'site' );

restore_current_blog();
}

/**
*
* Shedule the next cache-preload if it is not already sheduled within the next minute.
*
* @access private
*
* @param string $url
* @param int $id
* @param string $preload_type
* @param string $url Full URL of the (page|site) cleared.
* @param int $id ID of the (page|site) cleared.
* @param string $preload_type Can be either 'site' or 'page'.
*
* @return void
*/
Expand Down Expand Up @@ -324,7 +324,7 @@ function preload_on_site_cache_deletion( string $cleared_url = '', int $cleared_

// May not been set.
if ( 0 < $cleared_id ) {
switch_to_blog( $cleared_id );
switch_to_blog( $cleared_id ); // phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.switch_to_blog_switch_to_blog
}

// Get Plugin path (to get the right instance).
Expand Down

0 comments on commit a025dcb

Please sign in to comment.