__( 'Let\'s get you started!', 'imagify' ),
'signupText' => __( 'Enter your email to get an API key:', 'imagify' ),
'signupConfirmButtonText' => __( 'Sign Up', 'imagify' ),
'signupErrorEmptyEmail' => __( 'You need to specify an email!', 'imagify' ),
'signupSuccessTitle' => __( 'Congratulations!', 'imagify' ),
'signupSuccessText' => __( 'Your account has been succesfully created. Please check your mailbox, you are going to receive an email with API key.', 'imagify' ),
'saveApiKeyTitle' => __( 'Connect to Imagify!', 'imagify' ),
'saveApiKeyText' => __( 'Paste your API key below:', 'imagify' ),
'saveApiKeyConfirmButtonText' => __( 'Connect me', 'imagify' ),
'waitApiKeyCheckText' => __( 'Check in progress...', 'imagify' ),
'ApiKeyCheckSuccessTitle' => __( 'Congratulations!', 'imagify' ),
'ApiKeyCheckSuccessText' => __( 'Your API key is valid. You can now configure the Imagify settings to optimize your images.', 'imagify' ),
'ValidApiKeyText' => __( 'Your API key is valid.', 'imagify' )
);
wp_localize_script( 'imagify-js-admin', 'imagify', $admin_data );
wp_enqueue_script( 'imagify-js-admin' );
/*
* Scripts loaded in /wp-admin/options-general.php?page=imagify
*/
if ( isset( $current_screen ) && ( 'settings_page_imagify' === $current_screen->base || 'settings_page_imagify-network' === $current_screen->base ) ) {
wp_enqueue_script( 'imagify-js-chart' );
wp_enqueue_script( 'imagify-js-event-move' );
wp_enqueue_script( 'imagify-js-twentytwenty' );
wp_enqueue_script( 'imagify-js-options' );
wp_enqueue_style( 'imagify-css-twentytwenty' );
$options_data = array(
'noBackupTitle' => __( 'Don\'t Need a Parachute?', 'imagify' ),
'noBackupText' => __( 'If you keep this option deactivated, you won\'t be able to re-optimize your images to another compression level and restore your original images in case of need.', 'imagify' )
);
wp_localize_script( 'imagify-js-options', 'imagifyOptions', $options_data );
}
/**
* Scripts loaded in /wp-admin/upload.php and post.php
*/
if ( isset( $current_screen ) && ( 'upload' === $current_screen->base || 'post' === $current_screen->base ) ) {
$upload_data = array(
'bulkActionsLabels' => array(
'optimize' => __( 'Optimize', 'imagify' ),
'restore' => __( 'Restore Original', 'imagify' ),
),
);
wp_localize_script( 'imagify-js-upload', 'imagifyUpload', $upload_data );
wp_enqueue_script( 'imagify-js-chart' );
wp_enqueue_script( 'imagify-js-upload' );
}
/**
* Scripts loaded in /wp-admin/post.php (for attachment post type)
*/
if ( isset( $current_screen ) && 'post' === $current_screen->base && 'attachment' === $current_screen->post_type ) {
wp_localize_script( 'imagify-js-twentytwenty', 'imagifyTTT', array(
'labels' => array(
'original_l' => __( 'Original Image', 'imagify' ),
'optimized_l' => __( 'Optimized Image', 'imagify' ),
'compare' => __( 'Compare Original VS Optimized', 'imagify' ),
'close' => __( 'Close', 'imagify' ),
'filesize' => __( 'File Size:', 'imagify' ),
'saving' => __( 'Original Saving:', 'imagify' ),
)
));
wp_enqueue_script( 'imagify-js-chart' );
wp_enqueue_script( 'imagify-js-event-move' );
wp_enqueue_script( 'imagify-js-twentytwenty' );
wp_enqueue_style( 'imagify-css-twentytwenty' );
}
/**
* Scripts loaded in /wp-admin/upload.php?page=imagify-bulk-optimization
*/
if ( isset( $current_screen ) && 'media_page_imagify-bulk-optimization' === $current_screen->base ) {
$user = get_imagify_user();
$bulk_data = array(
'waitTitle' => __( 'Please wait...', 'imagify' ),
'waitText' => __( 'We are trying to get your unoptimized images, it may take time depending on the number of images.', 'imagify' ),
'waitImageUrl' => IMAGIFY_ASSETS_IMG_URL . 'popin-loader.svg',
'getUnoptimizedImagesErrorTitle' => __( 'Oops, There is something wrong!', 'imagify' ),
'getUnoptimizedImagesErrorText' => __( 'An unknow error occurred when we tried to get all your unoptimized images. Try again and if the issue still persist, please contact us!', 'imagify' ),
'overviewChartLabels' => array(
'optimized' => __( 'Optimized', 'imagify' ),
'unoptimized' => __( 'Unoptimized', 'imagify' ),
'error' => __( 'Error', 'imagify' ),
),
'overQuotaTitle' => __( 'Oops, It\'s Over!', 'imagify' ),
'noAttachmentToOptimizeTitle' => __( 'Hold on!', 'imagify' ),
'noAttachmentToOptimizeText' => __( 'All your images have been optimized by Imagify. Congratulations!', 'imagify' ),
'pluginURL' => 'https://wordpress.org/plugins/imagify',
'textToShare' => __( 'Discover @imagify, the new compression tool to optimize your images for free. I saved %1$s out of %2$s!', 'imagify' ),
'totalOptimizedAttachments' => imagify_count_optimized_attachments(),
'totalUnoptimizedAttachments' => imagify_count_unoptimized_attachments(),
'totalErrorsAttachments' => imagify_count_error_attachments(),
'processing' => __( 'Imagify is still processing. Are you sure you want to leave this page?', 'imagify' ),
);
if ( imagify_valid_key() ) {
if ( is_wp_error( $user ) ) {
$bulk_data['overQuotaText'] = sprintf( __( 'To continue to optimize your images, log in to your Imagify account to %sbuy a pack or subscribe to a plan%s.', 'imagify' ), '', '' );
}
else {
$bulk_data['overQuotaText'] = sprintf( __( 'You have consumed all your credit for this month. You will have %s back on %s.', 'imagify' ), size_format( $user->quota * 1048576 ), date_i18n( __( 'F j, Y' ), strtotime( $user->next_date_update ) ) ) . '
' . sprintf( __( 'To continue to optimize your images, log in to your Imagify account to %sbuy a pack or subscribe to a plan%s.', 'imagify' ), '', '' );
}
}
wp_localize_script( 'imagify-js-bulk', 'imagifyBulk', $bulk_data );
wp_enqueue_script( 'imagify-js-chart' );
wp_enqueue_script( 'imagify-js-async' );
wp_enqueue_script( 'imagify-js-bulk' );
}
}
/**
* Add Intercom on Options page an Bulk Optimization
*
* @since 1.0
*/
add_action( 'admin_footer-media_page_imagify-bulk-optimization', '_imagify_admin_print_intercom' );
add_action( 'admin_footer-settings_page_imagify', '_imagify_admin_print_intercom' );
function _imagify_admin_print_intercom() {
$user = get_imagify_user();
if ( ! imagify_valid_key() || empty( $user->is_intercom ) ) {
return;
}
?>