Merged in feature/from-pantheon (pull request #16)
code from pantheon * code from pantheon
This commit is contained in:
107
wp/wp-content/plugins/imagify/inc/3rd-party/nextgen-gallery/inc/admin/bulk.php
vendored
Normal file
107
wp/wp-content/plugins/imagify/inc/3rd-party/nextgen-gallery/inc/admin/bulk.php
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
<?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;
|
||||
}
|
||||
45
wp/wp-content/plugins/imagify/inc/3rd-party/nextgen-gallery/inc/admin/enqueue.php
vendored
Normal file
45
wp/wp-content/plugins/imagify/inc/3rd-party/nextgen-gallery/inc/admin/enqueue.php
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
<?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 );
|
||||
}
|
||||
64
wp/wp-content/plugins/imagify/inc/3rd-party/nextgen-gallery/inc/admin/gallery.php
vendored
Normal file
64
wp/wp-content/plugins/imagify/inc/3rd-party/nextgen-gallery/inc/admin/gallery.php
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
<?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;
|
||||
}
|
||||
19
wp/wp-content/plugins/imagify/inc/3rd-party/nextgen-gallery/inc/admin/menu.php
vendored
Normal file
19
wp/wp-content/plugins/imagify/inc/3rd-party/nextgen-gallery/inc/admin/menu.php
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
<?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' );
|
||||
}
|
||||
Reference in New Issue
Block a user