This commit is contained in:
Tony Volpe
2024-06-17 14:41:24 -04:00
parent f885e93ca8
commit a00f379f7f
11158 changed files with 0 additions and 1781316 deletions

View File

@@ -1,107 +0,0 @@
<?php
defined( 'ABSPATH' ) || die( 'Cheatin uh?' );
add_filter( 'imagify_bulk_page_types', 'imagify_ngg_bulk_page_types' );
/**
* Filter the types to display in the bulk optimization page.
*
* @since 1.7.1
* @author Grégory Viguier
*
* @param array $types The folder types displayed on the page. If a folder type is "library", the context should be suffixed after a pipe character. They are passed as array keys.
* @return array
*/
function imagify_ngg_bulk_page_types( $types ) {
if ( ! empty( $_GET['page'] ) && imagify_get_ngg_bulk_screen_slug() === $_GET['page'] ) { // WPCS: CSRF ok.
$types['library|ngg'] = 1;
}
return $types;
}
add_filter( 'imagify_bulk_stats', 'imagify_ngg_bulk_stats', 10, 2 );
/**
* Filter the generic stats used in the bulk optimization page.
*
* @since 1.7.1
* @author Grégory Viguier
*
* @param array $data The data.
* @param array $types The folder types. They are passed as array keys.
* @return array
*/
function imagify_ngg_bulk_stats( $data, $types ) {
if ( ! isset( $types['library|ngg'] ) ) {
return $data;
}
add_filter( 'imagify_count_saving_data', 'imagify_ngg_count_saving_data', 8 );
$total_saving_data = imagify_count_saving_data();
remove_filter( 'imagify_count_saving_data', 'imagify_ngg_count_saving_data', 8 );
// Global chart.
$data['total_attachments'] += imagify_ngg_count_attachments();
$data['unoptimized_attachments'] += imagify_ngg_count_unoptimized_attachments();
$data['optimized_attachments'] += imagify_ngg_count_optimized_attachments();
$data['errors_attachments'] += imagify_ngg_count_error_attachments();
// Stats block.
$data['already_optimized_attachments'] += $total_saving_data['count'];
$data['original_human'] += $total_saving_data['original_size'];
$data['optimized_human'] += $total_saving_data['optimized_size'];
return $data;
}
add_filter( 'imagify_bulk_page_data', 'imagify_ngg_bulk_page_data', 10, 2 );
/**
* Filter the data to use on the bulk optimization page.
*
* @since 1.7
* @since 1.7.1 Added the $types parameter.
* @author Grégory Viguier
*
* @param array $data The data to use.
* @param array $types The folder types displayed on the page. They are passed as array keys.
* @return array
*/
function imagify_ngg_bulk_page_data( $data, $types ) {
if ( ! isset( $types['library|ngg'] ) ) {
return $data;
}
// Limits.
$data['unoptimized_attachment_limit'] += imagify_get_unoptimized_attachment_limit();
// Group.
$data['groups']['ngg'] = array(
/**
* 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().
*/
'group_id' => 'library',
'context' => 'ngg',
'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;
}
add_filter( 'imagify_optimization_errors_url', 'imagify_ngg_optimization_errors_url', 10, 2 );
/**
* Provide a URL to a page displaying optimization errors for the NGG context.
*
* @since 1.9
* @author Grégory Viguier
*
* @param string $url The URL.
* @param string $context The context.
* @return string
*/
function imagify_ngg_optimization_errors_url( $url, $context ) {
if ( 'ngg' === $context ) {
return admin_url( 'admin.php?page=nggallery-manage-gallery' );
}
return $url;
}

View File

@@ -1,45 +0,0 @@
<?php
defined( 'ABSPATH' ) || die( 'Cheatin uh?' );
add_action( 'imagify_assets_enqueued', '_imagify_ngg_admin_print_styles' );
/**
* Add some CSS and JS for NGG compatibility.
*
* @since 1.5
* @since 1.6.10 Use the new class Imagify_Assets.
* @author Jonathan Buttigieg
* @author Grégory Viguier
*/
function _imagify_ngg_admin_print_styles() {
$assets = Imagify_Assets::get_instance();
/**
* Manage Gallery Images.
*/
if ( imagify_is_screen( 'nggallery-manage-images' ) || isset( $_GET['gid'] ) && ! empty( $_GET['pid'] ) && imagify_is_screen( 'nggallery-manage-gallery' ) ) { // WPCS: CSRF ok.
$assets->enqueue_style( 'admin' )->enqueue_script( 'library' );
return;
}
/**
* NGG Bulk Optimization.
*/
$bulk_screen_id = imagify_get_ngg_bulk_screen_id();
if ( ! imagify_is_screen( $bulk_screen_id ) ) {
return;
}
$assets->remove_deferred_localization( 'bulk', 'imagifyBulk' );
$l10n = $assets->get_localization_data( 'bulk', [
'bufferSizes' => [
'ngg' => 4,
],
] );
/** This filter is documented in inc/functions/i18n.php */
$l10n['bufferSizes'] = apply_filters( 'imagify_bulk_buffer_sizes', $l10n['bufferSizes'] );
$assets->enqueue_assets( [ 'pricing-modal', 'bulk' ] )->localize( 'imagifyBulk', $l10n );
}

View File

@@ -1,64 +0,0 @@
<?php
defined( 'ABSPATH' ) || die( 'Cheatin uh?' );
add_filter( 'ngg_manage_images_number_of_columns', '_imagify_ngg_manage_images_number_of_columns' );
/**
* Add "Imagify" column in admin.php?page=nggallery-manage-gallery.
*
* @since 1.5
* @author Jonathan Buttigieg
*
* @param int $count Number of columns.
* @return int Incremented number of columns.
*/
function _imagify_ngg_manage_images_number_of_columns( $count ) {
$count++;
add_filter( 'ngg_manage_images_column_' . $count . '_header', '_imagify_ngg_manage_media_columns' );
add_filter( 'ngg_manage_images_column_' . $count . '_content', '_imagify_ngg_manage_media_custom_column', 10, 2 );
return $count;
}
/**
* Get the column title.
*
* @since 1.5
* @author Jonathan Buttigieg
*
* @return string
*/
function _imagify_ngg_manage_media_columns() {
return 'Imagify';
}
/**
* Get the column content.
*
* @since 1.5
* @author Jonathan Buttigieg
*
* @param string $output The column content.
* @param object $image An NGG Image object.
* @return string
*/
function _imagify_ngg_manage_media_custom_column( $output, $image ) {
$process = imagify_get_optimization_process( $image, 'ngg' );
return get_imagify_media_column_content( $process );
}
add_filter( 'imagify_display_missing_thumbnails_link', '_imagify_ngg_hide_missing_thumbnails_link', 10, 3 );
/**
* Hide the "Optimize missing thumbnails" link.
*
* @since 1.6.10
* @author Grégory Viguier
*
* @param bool $display True to display the link. False to not display it.
* @param object $attachment The attachement object.
* @param string $context The context.
* @return bool
*/
function _imagify_ngg_hide_missing_thumbnails_link( $display, $attachment, $context ) {
return 'ngg' === $context ? false : $display;
}

View File

@@ -1,19 +0,0 @@
<?php
defined( 'ABSPATH' ) || die( 'Cheatin uh?' );
add_action( 'admin_menu', '_imagify_ngg_bulk_optimization_menu' );
/**
* Add submenu in menu "Media"
*
* @since 1.5
* @author Jonathan Buttigieg
*/
function _imagify_ngg_bulk_optimization_menu() {
if ( ! defined( 'NGGFOLDER' ) ) {
return;
}
$capacity = imagify_get_context( 'ngg' )->get_capacity( 'bulk-optimize' );
add_submenu_page( NGGFOLDER, __( 'Bulk Optimization', 'imagify' ), __( 'Bulk Optimization', 'imagify' ), $capacity, imagify_get_ngg_bulk_screen_slug(), '_imagify_display_bulk_page' );
}

View File

@@ -1,347 +0,0 @@
<?php
use \Imagify\Optimization\File;
use \Imagify\ThirdParty\NGG;
defined( 'ABSPATH' ) || die( 'Cheatin uh?' );
add_action( 'ngg_after_new_images_added', '_imagify_ngg_optimize_attachment', IMAGIFY_INT_MAX, 2 );
/**
* Auto-optimize when a new attachment is added to the database (NGG plugin's table), except for images imported from the library.
*
* @since 1.5
* @author Jonathan Buttigieg
*
* @param int $gallery_id A Gallery ID.
* @param array $image_ids An array of Ids or objects. Ids which are sucessfully added.
*/
function _imagify_ngg_optimize_attachment( $gallery_id, $image_ids ) {
if ( ! Imagify_Requirements::is_api_key_valid() || ! get_imagify_option( 'auto_optimize' ) ) {
return;
}
$is_maybe_library_import = ! empty( $_POST['action'] ) && 'import_media_library' === $_POST['action'] && ! empty( $_POST['attachment_ids'] ) && is_array( $_POST['attachment_ids'] ); // WPCS: CSRF ok.
if ( $is_maybe_library_import && ! empty( $_POST['nextgen_upload_image_sec'] ) ) { // WPCS: CSRF ok.
/**
* The images are imported from the library.
* In this case, those images are dealt with in _imagify_ngg_media_library_imported_image_data().
*/
return;
}
if ( $is_maybe_library_import && ( ! empty( $_POST['gallery_id'] ) || ! empty( $_POST['gallery_name'] ) ) ) { // WPCS: CSRF ok.
/**
* Same thing but for NGG 2.0 probably.
*/
return;
}
foreach ( $image_ids as $image ) {
if ( is_numeric( $image ) ) {
$image_id = (int) $image;
} elseif ( is_object( $image ) && ! empty( $image->pid ) ) {
$image_id = (int) $image->pid;
} else {
$image_id = 0;
}
if ( ! $image_id ) {
continue;
}
/**
* Allow to prevent automatic optimization for a specific NGG gallery image.
*
* @since 1.6.12
* @author Grégory Viguier
*
* @param bool $optimize True to optimize, false otherwise.
* @param int $image_id Image ID.
* @param int $gallery_id Gallery ID.
*/
$optimize = apply_filters( 'imagify_auto_optimize_ngg_gallery_image', true, $image_id, $gallery_id );
if ( ! $optimize ) {
continue;
}
$process = imagify_get_optimization_process( $image, 'ngg' );
if ( ! $process->is_valid() ) {
continue;
}
if ( $process->get_data()->get_optimization_status() ) {
// Optimization already attempted.
continue;
}
$process->optimize();
}
}
add_filter( 'ngg_medialibrary_imported_image', '_imagify_ngg_media_library_imported_image_data', 10, 2 );
/**
* Import Imagify data from a WordPress image to a new NGG image, and optimize the thumbnails.
*
* @since 1.5
* @author Jonathan Buttigieg
*
* @param object $image A NGG image object.
* @param object $attachment An attachment object.
* @return object
*/
function _imagify_ngg_media_library_imported_image_data( $image, $attachment ) {
$wp_process = imagify_get_optimization_process( $attachment->ID, 'wp' );
if ( ! $wp_process->is_valid() || ! $wp_process->get_media()->is_supported() ) {
return $image;
}
$wp_data = $wp_process->get_data();
if ( ! $wp_data->is_optimized() ) {
// The main image is not optimized.
return $image;
}
// Copy the full size data.
$wp_full_size_data = $wp_data->get_size_data();
$optimization_level = $wp_data->get_optimization_level();
NGG\DB::get_instance()->update( $image->pid, [
'pid' => $image->pid,
'optimization_level' => $optimization_level,
'status' => $wp_data->get_optimization_status(),
'data' => [
'sizes' => [
'full' => $wp_full_size_data,
],
'stats' => [
'original_size' => $wp_full_size_data['original_size'],
'optimized_size' => $wp_full_size_data['optimized_size'],
'percent' => $wp_full_size_data['percent'],
],
],
] );
$ngg_process = imagify_get_optimization_process( $image->pid, 'ngg' );
if ( ! $ngg_process->is_valid() ) {
// WTF.
return $image;
}
// Copy the backup file (we don't want to backup the optimized file if it can be avoided).
$ngg_media = $ngg_process->get_media();
$wp_media = $wp_process->get_media();
$wp_backup_path = $wp_media->get_backup_path();
$filesystem = imagify_get_filesystem();
$backup_copied = false;
if ( $wp_backup_path ) {
$ngg_backup_path = $ngg_media->get_raw_backup_path();
$backup_copied = $filesystem->copy( $wp_backup_path, $ngg_backup_path, true );
if ( $backup_copied ) {
$filesystem->chmod_file( $ngg_backup_path );
}
}
/**
* Next-gen for the full size.
* Look for an existing copy locally:
* - if it exists, copy it (and its optimization data),
* - if not, add it to the optimization queue.
*/
$add_full_nextgen = $wp_media->is_image();
if ( $add_full_nextgen ) {
$formats = [
'avif' => $wp_process::AVIF_SUFFIX,
'webp' => $wp_process::WEBP_SUFFIX,
];
foreach ( $formats as $extension => $suffix ) {
$wp_full_path_nextgen = false;
$nextgen_size_name = 'full' . $suffix;
$wp_nextgen_data = $wp_data->get_size_data( $nextgen_size_name );
// Get the path to the next-gen image if it exists.
$wp_full_path_nextgen = $wp_process->get_fullsize_file()->get_path_to_nextgen( $extension );
if ( $wp_full_path_nextgen && ! $filesystem->exists( $wp_full_path_nextgen ) ) {
$wp_full_path_nextgen = false;
}
if ( $wp_full_path_nextgen ) {
// We know we have a next-gen version. Make sure we have the right data.
$wp_nextgen_data['success'] = true;
if ( empty( $wp_nextgen_data['original_size'] ) ) {
// The next-gen data is missing.
$full_size_weight = $wp_full_size_data['original_size'];
if ( ! $full_size_weight && $wp_backup_path ) {
// For some reason we don't have the original file weight, but we can get it from the backup file.
$full_size_weight = $filesystem->size( $wp_backup_path );
if ( $full_size_weight ) {
$wp_nextgen_data['original_size'] = $full_size_weight;
}
}
}
if ( ! empty( $wp_nextgen_data['original_size'] ) && empty( $wp_nextgen_data['optimized_size'] ) ) {
// The next-gen file size.
$wp_nextgen_data['optimized_size'] = $filesystem->size( $wp_full_path_nextgen );
}
if ( empty( $wp_nextgen_data['original_size'] ) || empty( $wp_nextgen_data['optimized_size'] ) ) {
// We must have both original and optimized sizes.
$wp_nextgen_data = [];
}
}
if ( $wp_full_path_nextgen && $wp_nextgen_data ) {
// We have the file and the data.
// Copy the file.
$ngg_full_file = new File( $ngg_media->get_raw_fullsize_path() );
$ngg_full_path_nextgen = $ngg_full_file->get_path_to_nextgen( $extension ); // Destination.
if ( $ngg_full_path_nextgen ) {
$copied = $filesystem->copy( $wp_full_path_nextgen, $ngg_full_path_nextgen, true );
if ( $copied ) {
// Success.
$filesystem->chmod_file( $ngg_full_path_nextgen );
$add_full_nextgen = false;
}
}
if ( ! $add_full_nextgen ) {
// The next-gen file has been successfully copied: now, copy the data.
$ngg_process->get_data()->update_size_optimization_data( $nextgen_size_name, $wp_nextgen_data );
}
}
}
}
// Optimize thumbnails.
$sizes = $ngg_media->get_media_files();
unset( $sizes['full'] );
if ( $add_full_nextgen ) {
// We could not use a local next-gen copy: ask for a new one.
$formats = imagify_nextgen_images_formats();
foreach ( $formats as $format ) {
if ( 'webp' === $format ) {
$suffix = $wp_process::WEBP_SUFFIX;
} elseif ( 'avif' === $format ) {
$suffix = $wp_process::AVIF_SUFFIX;
}
$sizes[ 'full' . $suffix ] = [];
}
}
if ( ! $sizes ) {
return $image;
}
$args = [
'hook_suffix' => 'optimize_imported_images',
];
$ngg_process->optimize_sizes( array_keys( $sizes ), $optimization_level, $args );
return $image;
}
add_action( 'ngg_generated_image', 'imagify_ngg_maybe_add_dynamic_thumbnail_to_background_process', IMAGIFY_INT_MAX, 2 );
/**
* Add a dynamically generated thumbnail to the background process queue.
* Note that this wont work when images are imported (from WP Library or uploaded), since they are already being processed, and locked.
*
* @since 1.8
* @since 1.9 Doesn't use the class Imagify_NGG_Dynamic_Thumbnails_Background_Process anymore.
* @author Grégory Viguier
*
* @param object $image A NGG image object.
* @param string $size The thumbnail size name.
*/
function imagify_ngg_maybe_add_dynamic_thumbnail_to_background_process( $image, $size ) {
NGG\DynamicThumbnails::get_instance()->push_to_queue( $image, $size );
}
add_action( 'ngg_delete_picture', 'imagify_ngg_cleanup_after_media_deletion', 10, 2 );
/**
* Delete everything when a NGG image is deleted.
*
* @since 1.9
* @author Grégory Viguier
*
* @param int $image_id The image ID.
* @param object $image A NGG object.
*/
function imagify_ngg_cleanup_after_media_deletion( $image_id, $image ) {
$process = imagify_get_optimization_process( $image, 'ngg' );
if ( ! $process->is_valid() ) {
return;
}
// Trigger a common hook.
imagify_trigger_delete_media_hook( $process );
/**
* The backup file has already been deleted by NGG.
* Delete the next-gen versions and the optimization data.
*/
$process->delete_nextgen_files();
$process->get_data()->delete_optimization_data();
}
add_filter( 'imagify_crop_thumbnail', 'imagify_ngg_should_crop_thumbnail', 10, 4 );
/**
* In case of a dynamic thumbnail, tell if the image must be croped or resized.
*
* @since 1.9
* @author Grégory Viguier
*
* @param bool $crop True to crop the thumbnail, false to resize. Null by default.
* @param string $size Name of the thumbnail size.
* @param array $size_data Data of the thumbnail being processed. Contains at least 'width', 'height', and 'path'.
* @param MediaInterface $media The MediaInterface instance corresponding to the image being processed.
* @return bool
*/
function imagify_ngg_should_crop_thumbnail( $crop, $size, $size_data, $media ) {
static $data_per_media = [];
static $storage_per_media = [];
if ( 'ngg' !== $media->get_context() ) {
return $crop;
}
$media_id = $media->get_id();
if ( ! isset( $data_per_media[ $media_id ] ) ) {
$image = \nggdb::find_image( $media_id );
if ( ! empty( $image->_ngiw ) ) {
$storage_per_media[ $media_id ] = $image->_ngiw->get_storage()->object;
} else {
$storage_per_media[ $media_id ] = \C_Gallery_Storage::get_instance()->object;
}
$data_per_media[ $media_id ] = $storage_per_media[ $media_id ]->_image_mapper->find( $media_id ); // stdClass Object.
}
$params = $storage_per_media[ $media_id ]->get_image_size_params( $data_per_media[ $media_id ], $size );
return ! empty( $params['crop'] );
}

View File

@@ -1,198 +0,0 @@
<?php
use \Imagify\ThirdParty\NGG\DB;
defined( 'ABSPATH' ) || die( 'Cheatin uh?' );
/**
* Count number of attachments.
*
* @since 1.5
* @author Jonathan Buttigieg
*
* @return int The number of attachments.
*/
function imagify_ngg_count_attachments() {
global $wpdb;
static $count;
if ( isset( $count ) ) {
return $count;
}
$table_name = $wpdb->prefix . 'ngg_pictures';
$count = (int) $wpdb->get_var( "SELECT COUNT($table_name.pid) FROM $table_name" ); // WPCS: unprepared SQL ok.
return $count;
}
/**
* Count number of optimized attachments with an error.
*
* @since 1.5
* @author Jonathan Buttigieg
*
* @return int The number of attachments.
*/
function imagify_ngg_count_error_attachments() {
static $count;
if ( isset( $count ) ) {
return $count;
}
$ngg_db = DB::get_instance();
$key = $ngg_db->get_primary_key();
$count = (int) $ngg_db->get_var_by( "COUNT($key)", 'status', 'error' );
return $count;
}
/**
* Count number of optimized attachments (by Imagify or an other tool before).
*
* @since 1.5
* @author Jonathan Buttigieg
*
* @return int The number of attachments.
*/
function imagify_ngg_count_optimized_attachments() {
static $count;
if ( isset( $count ) ) {
return $count;
}
$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' ) );
return $count;
}
/**
* Count number of unoptimized attachments.
*
* @since 1.0
* @author Jonathan Buttigieg
*
* @return int The number of attachments.
*/
function imagify_ngg_count_unoptimized_attachments() {
return imagify_ngg_count_attachments() - imagify_ngg_count_optimized_attachments() - imagify_ngg_count_error_attachments();
}
/**
* Count percent of optimized attachments.
*
* @since 1.0
* @author Jonathan Buttigieg
*
* @return int The percent of optimized attachments.
*/
function imagify_ngg_percent_optimized_attachments() {
$total_attachments = imagify_ngg_count_attachments();
$total_optimized_attachments = imagify_ngg_count_optimized_attachments();
if ( ! $total_attachments || ! $total_optimized_attachments ) {
return 0;
}
return min( round( 100 * $total_optimized_attachments / $total_attachments ), 100 );
}
/**
* Count percent, original & optimized size of all images optimized by Imagify.
*
* @since 1.5
* @since 1.6.7 Revamped to handle huge libraries.
* @author Jonathan Buttigieg
*
* @param bool|array $attachments An array containing the keys 'count', 'original_size', and 'optimized_size', or an array of attachments (back compat', deprecated), or false.
* @return array An array containing the keys 'count', 'original_size', and 'optimized_size'.
*/
function imagify_ngg_count_saving_data( $attachments ) {
global $wpdb;
if ( is_array( $attachments ) ) {
return $attachments;
}
/**
* Filter the query to get all optimized NGG attachments.
* 3rd party will be able to override the result.
*
* @since 1.6.7
*
* @param bool|array $attachments An array containing the keys ('count', 'original_size', and 'optimized_size'), or false.
*/
$attachments = apply_filters( 'imagify_ngg_count_saving_data', false );
if ( is_array( $attachments ) ) {
return $attachments;
}
$original_size = 0;
$optimized_size = 0;
$count = 0;
/** This filter is documented in /inc/functions/admin-stats.php */
$limit = apply_filters( 'imagify_count_saving_data_limit', 15000 );
$limit = absint( $limit );
$offset = 0;
$query = "
SELECT data
FROM $wpdb->ngg_imagify_data
WHERE status = 'success'
LIMIT %d, %d";
$attachments = $wpdb->get_col( $wpdb->prepare( $query, $offset, $limit ) ); // WPCS: unprepared SQL ok.
$wpdb->flush();
while ( $attachments ) {
$attachments = array_map( 'maybe_unserialize', $attachments );
foreach ( $attachments as $attachment_data ) {
if ( ! $attachment_data ) {
continue;
}
++$count;
$original_data = $attachment_data['sizes']['full'];
// Increment the original sizes.
$original_size += $original_data['original_size'] ? $original_data['original_size'] : 0;
$optimized_size += $original_data['optimized_size'] ? $original_data['optimized_size'] : 0;
unset( $attachment_data['sizes']['full'], $original_data );
// Increment the thumbnails sizes.
foreach ( $attachment_data['sizes'] as $size_data ) {
if ( ! empty( $size_data['success'] ) ) {
$original_size += $size_data['original_size'] ? $size_data['original_size'] : 0;
$optimized_size += $size_data['optimized_size'] ? $size_data['optimized_size'] : 0;
}
}
unset( $size_data );
}
unset( $attachment_data );
if ( count( $attachments ) === $limit ) {
// Unless we are really unlucky, we still have attachments to fetch.
$offset += $limit;
$attachments = $wpdb->get_col( $wpdb->prepare( $query, $offset, $limit ) ); // WPCS: unprepared SQL ok.
$wpdb->flush();
} else {
// Save one request, don't go back to the beginning of the loop.
$attachments = array();
}
} // End while().
return array(
'count' => $count,
'original_size' => $original_size,
'optimized_size' => $optimized_size,
);
}

View File

@@ -1,21 +0,0 @@
<?php
defined( 'ABSPATH' ) || die( 'Cheatin uh?' );
/**
* Get the backup path of a specific attachement.
*
* @since 1.6.8
* @author Grégory Viguier
*
* @param string $file_path The file path.
* @return string|bool The backup path. False on failure.
*/
function get_imagify_ngg_attachment_backup_path( $file_path ) {
$file_path = wp_normalize_path( (string) $file_path );
if ( ! $file_path ) {
return false;
}
return $file_path . '_backup';
}

View File

@@ -1,32 +0,0 @@
<?php
defined( 'ABSPATH' ) || die( 'Cheatin uh?' );
/**
* Get NGG Bulk Optimization screen ID.
* Because WP nonsense, the screen ID depends on the menu title, which is translated. So the screen ID changes depending on the administration locale.
*
* @since 1.6.13
* @author Grégory Viguier
*
* @return string
*/
function imagify_get_ngg_bulk_screen_id() {
global $admin_page_hooks;
$ngg_menu_slug = defined( 'NGGFOLDER' ) ? plugin_basename( NGGFOLDER ) : 'nextgen-gallery';
$ngg_menu_slug = isset( $admin_page_hooks[ $ngg_menu_slug ] ) ? $admin_page_hooks[ $ngg_menu_slug ] : 'gallery';
return $ngg_menu_slug . '_page_' . imagify_get_ngg_bulk_screen_slug();
}
/**
* Get NGG Bulk Optimization screen slug.
*
* @since 1.7
* @author Grégory Viguier
*
* @return string
*/
function imagify_get_ngg_bulk_screen_slug() {
return IMAGIFY_SLUG . '-ngg-bulk-optimization';
}