Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions classes/Media/Upload/Upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ public function add_imagify_filter_to_attachments_dropdown() {
}

$status = isset( $_GET['imagify-status'] ) ? wp_unslash( $_GET['imagify-status'] ) : 0; // WPCS: CSRF ok.
$options = array(
$options = [
'optimized' => _x( 'Optimized', 'Media Files', 'imagify' ),
'unoptimized' => _x( 'Unoptimized', 'Media Files', 'imagify' ),
'errors' => _x( 'Errors', 'Media Files', 'imagify' ),
);
];

echo '<label class="screen-reader-text" for="filter-by-optimization-status">' . __( 'Filter by status', 'imagify' ) . '</label>';
echo '<select id="filter-by-optimization-status" name="imagify-status">';
Expand Down
2 changes: 1 addition & 1 deletion classes/Notices/Notices.php
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,7 @@ protected function get_conflicting_plugins() {
*
* @param array $plugins List of recommended plugins to deactivate.
*/
$plugins = wpm_apply_filters_typed( 'array', 'imagify_plugins_to_deactivate', self::$conflicting_plugins );
$plugins = wpm_apply_filters_typed( 'array', 'imagify_plugins_to_deactivate', self::$conflicting_plugins );

return array_filter( $plugins, 'is_plugin_active' );
}
Expand Down
2 changes: 1 addition & 1 deletion classes/Optimization/Process/AbstractProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -1662,7 +1662,7 @@ public function can_create_next_gen_version( $file_path ) {
return false;
}

$can = apply_filters_deprecated( 'imagify_pre_can_create_webp_version', array( null, $file_path ), '2.2', 'imagify_pre_can_create_next_gen_version' );
$can = apply_filters_deprecated( 'imagify_pre_can_create_webp_version', [ null, $file_path ], '2.2', 'imagify_pre_can_create_next_gen_version' );

/**
* Tell if a next-gen version can be created for the given file.
Expand Down
4 changes: 2 additions & 2 deletions imagify.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ function imagify_pass_requirements() {
require_once IMAGIFY_PATH . 'inc/classes/class-imagify-requirements-check.php';

$requirement_checks = new Imagify_Requirements_Check(
array(
[
'plugin_name' => 'Imagify',
'plugin_file' => IMAGIFY_FILE,
'plugin_version' => IMAGIFY_VERSION,
'wp_version' => '5.3',
'php_version' => '7.0',
)
]
);

$check = $requirement_checks->check();
Expand Down
4 changes: 2 additions & 2 deletions inc/3rd-party/formidable-pro/classes/Main.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ class Main {
* @author Grégory Viguier
*/
public function init() {
add_action( 'parse_query', array( $this, 'maybe_remove_media_library_filter' ) );
add_action( 'posts_selection', array( $this, 'maybe_put_media_library_filter_back' ) );
add_action( 'parse_query', [ $this, 'maybe_remove_media_library_filter' ] );
add_action( 'posts_selection', [ $this, 'maybe_put_media_library_filter_back' ] );
}

/**
Expand Down
4 changes: 2 additions & 2 deletions inc/3rd-party/hosting/siteground.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ function imagify_siteground_change_user_agent( $r, $url ) {
return $r;
}

$paths = array(
$paths = [
'/wp-admin/admin-ajax.php',
'/wp-admin/admin-post.php',
'/wp-cron.php',
);
];

if ( ! isset( $site_url ) ) {
$site_url = wp_parse_url( site_url( '/' ) );
Expand Down
10 changes: 5 additions & 5 deletions inc/3rd-party/nextgen-gallery/classes/DB.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,13 @@ public static function get_instance() {
* @return array
*/
public function get_columns() {
return array(
return [
'data_id' => '%d',
'pid' => '%d',
'optimization_level' => '%s',
'status' => '%s',
'data' => '%s',
);
];
}

/**
Expand All @@ -111,13 +111,13 @@ public function get_columns() {
* @return array
*/
public function get_column_defaults() {
return array(
return [
'data_id' => 0,
'pid' => 0,
'optimization_level' => '',
'status' => '',
'data' => array(),
);
'data' => [],
];
}

/**
Expand Down
4 changes: 2 additions & 2 deletions inc/3rd-party/nextgen-gallery/inc/admin/bulk.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function imagify_ngg_bulk_page_data( $data, $types ) {
// Limits.
$data['unoptimized_attachment_limit'] += imagify_get_unoptimized_attachment_limit();
// Group.
$data['groups']['ngg'] = array(
$data['groups']['ngg'] = [
/**
* The group_id corresponds to the file names like 'part-bulk-optimization-results-row-{$group_id}'.
* It is also used in get_imagify_localize_script_translations().
Expand All @@ -82,7 +82,7 @@ function imagify_ngg_bulk_page_data( $data, $types ) {
'title' => __( 'NextGen Galleries', 'imagify' ),
/* translators: 1 is the opening of a link, 2 is the closing of this link. */
'footer' => sprintf( __( 'You can also re-optimize your images more finely directly in each %1$sgallery%2$s.', 'imagify' ), '<a href="' . esc_url( admin_url( 'admin.php?page=nggallery-manage-gallery' ) ) . '">', '</a>' ),
);
];

return $data;
}
Expand Down
8 changes: 4 additions & 4 deletions inc/3rd-party/nextgen-gallery/inc/functions/admin-stats.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function imagify_ngg_count_optimized_attachments() {

$ngg_db = DB::get_instance();
$key = $ngg_db->get_primary_key();
$count = (int) $ngg_db->get_var_in( "COUNT($key)", 'status', array( 'success', 'already_optimized' ) );
$count = (int) $ngg_db->get_var_in( "COUNT($key)", 'status', [ 'success', 'already_optimized' ] );

return $count;
}
Expand Down Expand Up @@ -186,13 +186,13 @@ function imagify_ngg_count_saving_data( $attachments ) {
$wpdb->flush();
} else {
// Save one request, don't go back to the beginning of the loop.
$attachments = array();
$attachments = [];
}
}

return array(
return [
'count' => $count,
'original_size' => $original_size,
'optimized_size' => $optimized_size,
);
];
}
6 changes: 3 additions & 3 deletions inc/admin/custom-folders.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function imagify_sync_theme_plugin_files_on_update( $response, $hook_extra, $res
}

$folders_to_sync = get_site_transient( 'imagify_themes_plugins_to_sync' );
$folders_to_sync = is_array( $folders_to_sync ) ? $folders_to_sync : array();
$folders_to_sync = is_array( $folders_to_sync ) ? $folders_to_sync : [];

$folders_to_sync[] = $result['destination'];

Expand Down Expand Up @@ -75,12 +75,12 @@ function imagify_sync_theme_plugin_files_after_update() {
// Sync the folder files.
Imagify_Custom_Folders::synchronize_files_from_folders(
[
$folder['folder_id'] => array(
$folder['folder_id'] => [
'folder_id' => $folder['folder_id'],
'path' => $placeholder,
'active' => $folder['active'],
'folder_path' => $folder_path,
),
],
]
);
}
Expand Down
4 changes: 2 additions & 2 deletions inc/admin/media.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ function _imagify_attachment_fields_to_edit( $form_fields, $post ) {

$process = imagify_get_optimization_process( $post->ID, 'wp' );

$form_fields['imagify'] = array(
$form_fields['imagify'] = [
'label' => 'Imagify',
'input' => 'html',
'html' => get_imagify_media_column_content( $process ),
'show_in_edit' => true,
'show_in_modal' => true,
);
];

return $form_fields;
}
Expand Down
2 changes: 1 addition & 1 deletion inc/admin/meta-boxes.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function _imagify_attachment_submitbox_misc_actions() {
</div>
<?php
} else {
$url = get_imagify_admin_url( 'optimize', array( 'attachment_id' => $post->ID ) );
$url = get_imagify_admin_url( 'optimize', [ 'attachment_id' => $post->ID ] );
?>
<div class="misc-pub-section misc-pub-imagify">
<a class="button-primary" href="<?php echo esc_url( $url ); ?>"><?php esc_html_e( 'Optimize', 'imagify' ); ?></a>
Expand Down
12 changes: 6 additions & 6 deletions inc/admin/upgrader.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,17 +227,17 @@ function _imagify_new_upgrade( $network_version, $site_version ) {
'post_type' => 'attachment',
'post_status' => imagify_get_post_statuses(),
'post_mime_type' => imagify_get_mime_types(),
'meta_query' => array(
'meta_query' => [
'relation' => 'AND',
array(
[
'key' => '_imagify_data',
'compare' => 'EXISTS',
),
array(
],
[
'key' => '_imagify_optimization_level',
'compare' => 'NOT EXISTS',
),
),
],
],
'posts_per_page' => -1,
'update_post_term_cache' => false,
'no_found_rows' => true,
Expand Down
6 changes: 3 additions & 3 deletions inc/admin/upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function _imagify_sort_attachments_by_status( $vars ) {
$status = wp_unslash( $_GET['imagify-status'] ); // WPCS: CSRF ok.
$meta_key = '_imagify_status';
$meta_compare = '=';
$relation = array();
$relation = [];

switch ( $status ) {
case 'unoptimized':
Expand All @@ -66,11 +66,11 @@ function _imagify_sort_attachments_by_status( $vars ) {
break;
case 'optimized':
$status = 'success';
$relation = array(
$relation = [
'key' => $meta_key,
'value' => 'already_optimized',
'compare' => $meta_compare,
);
];
break;
case 'errors':
$status = 'error';
Expand Down
20 changes: 10 additions & 10 deletions inc/classes/class-imagify-abstract-cron.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,14 @@ public static function get_instance() {
* @author Grégory Viguier
*/
public function init() {
add_action( 'init', array( $this, 'schedule_event' ) );
add_action( $this->get_event_name(), array( $this, 'do_event' ) );
add_filter( 'cron_schedules', array( $this, 'maybe_add_recurrence' ) );
add_action( 'init', [ $this, 'schedule_event' ] );
add_action( $this->get_event_name(), [ $this, 'do_event' ] );
add_filter( 'cron_schedules', [ $this, 'maybe_add_recurrence' ] );

if ( did_action( static::get_deactivation_hook_name() ) ) {
$this->unschedule_event();
} else {
add_action( static::get_deactivation_hook_name(), array( $this, 'unschedule_event' ) );
add_action( static::get_deactivation_hook_name(), [ $this, 'unschedule_event' ] );
}
}

Expand Down Expand Up @@ -144,24 +144,24 @@ public function unschedule_event() {
* @return array
*/
public function maybe_add_recurrence( $schedules ) {
$default_schedules = array(
$default_schedules = [
'hourly' => 1,
'twicedaily' => 1,
'daily' => 1,
);
];

$event_recurrence = $this->get_event_recurrence();

if ( ! empty( $schedules[ $event_recurrence ] ) || ! empty( $default_schedules[ $event_recurrence ] ) ) {
return $schedules;
}

$recurrences = array(
'weekly' => array(
$recurrences = [
'weekly' => [
'interval' => WEEK_IN_SECONDS,
'display' => __( 'Once Weekly', 'imagify' ),
),
);
],
];

if ( method_exists( $this, 'get_event_recurrence_attributes' ) ) {
$recurrences[ $event_recurrence ] = $this->get_event_recurrence_attributes();
Expand Down
12 changes: 6 additions & 6 deletions inc/classes/class-imagify-abstract-db.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public static function get_instance() {
* @author Grégory Viguier
*/
public function init() {
add_action( 'admin_init', array( $this, 'maybe_upgrade_table' ) );
add_action( 'admin_init', [ $this, 'maybe_upgrade_table' ] );
}

/**
Expand Down Expand Up @@ -233,7 +233,7 @@ public function has_items() {
*/
public function get( $row_id ) {
if ( $row_id <= 0 ) {
return array();
return [];
}

return $this->get_by( $this->primary_key, $row_id );
Expand Down Expand Up @@ -446,7 +446,7 @@ public function insert( $data ) {
* @param string $where A column name.
* @return bool
*/
public function update( $row_id, $data = array(), $where = '' ) {
public function update( $row_id, $data = [], $where = '' ) {
global $wpdb;

if ( $row_id <= 0 ) {
Expand Down Expand Up @@ -477,7 +477,7 @@ public function update( $row_id, $data = array(), $where = '' ) {
// Reorder $column_formats to match the order of columns given in $data.
$column_formats = array_merge( $data, $column_formats );

return (bool) $wpdb->update( $this->table_name, $data, array( $where => $row_id ), $column_formats, $this->get_placeholder( $where ) );
return (bool) $wpdb->update( $this->table_name, $data, [ $where => $row_id ], $column_formats, $this->get_placeholder( $where ) );
}

/**
Expand Down Expand Up @@ -580,9 +580,9 @@ protected function set_table_not_ready() {
unset( $wpdb->{$this->table} );

if ( $this->table_is_global ) {
$wpdb->global_tables = array_diff( $wpdb->global_tables, array( $this->table ) );
$wpdb->global_tables = array_diff( $wpdb->global_tables, [ $this->table ] );
} else {
$wpdb->tables = array_diff( $wpdb->tables, array( $this->table ) );
$wpdb->tables = array_diff( $wpdb->tables, [ $this->table ] );
}
}

Expand Down
Loading
Loading