This commit is contained in:
2024-05-20 15:37:46 +03:00
commit 00b7dbd0b7
10404 changed files with 3285853 additions and 0 deletions

View File

@ -0,0 +1,120 @@
<?php
namespace ShortPixel;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
use \ShortPixel\Controller\BulkController as BulkController;
$bulk = BulkController::getInstance();
$queueRunning = $bulk->isAnyBulkRunning();
?>
<section class='panel bulk-restore' data-panel="bulk-restore" >
<h3 class='heading'>
<?php esc_html_e("Bulk Restore", 'shortpixel-image-optimiser'); ?>
</h3>
<div class='bulk-special-wrapper'>
<h4 class='warning'><?php esc_html_e('Warning', 'shortpixel-image-optimiser'); ?></h4>
<p><?php printf(esc_html__('By starting the %s bulk restore %s process, the plugin will try to restore %s all images %s to the original state. All images will become unoptimized.', 'shortpixel-image-optimiser'), '<b>', '</b>', '<b>', '</b>'); ?></p>
<p><?php printf(esc_html__('We recommend users to %s contact us %s before restoring the images - many times the restoring is not necessary and we can help. But if you choose to continue then we strongly recommend to create a full backup before starting the process.', 'shortpixel-image-optimiser'), '<b><a href="https://shortpixel.com/contact" target="_blank">', '</a></b>'); ?>
</p>
<p class='warning'><?php esc_html_e('It is strongly advised to create a full backup before starting this process.', 'shortpixel-image-optimiser'); ?></p>
<?php if ($this->view->approx->custom->has_custom === true) : ?>
<div class='optiongroup' data-check-visibility data-control="data-check-custom-hascustom">
<div class='switch_button'>
<label>
<input type="checkbox" class="switch" id="restore_media_checkbox" >
<div class="the_switch">&nbsp; </div>
</label>
</div>
<h4><label for="restore_media_checkbox"><?php esc_html_e('Restore media library','shortpixel-image-optimiser'); ?></label></h4>
</div>
<div class='optiongroup' data-check-visibility data-control="data-check-custom-hascustom">
<div class='switch_button'>
<label>
<input type="checkbox" class="switch" id="restore_custom_checkbox" value='1' >
<div class="the_switch">&nbsp; </div>
</label>
</div>
<h4><label for="restore_custom_checkbox"><?php esc_html_e('Restore custom media','shortpixel-image-optimiser'); ?></label></h4>
</div>
<?php endif ?>
<p class='optiongroup warning hidden' id="restore_media_warn"><?php esc_html_e('Please select one of the options', 'shortpixel-image-optimiser'); ?></p>
<p class='optiongroup' ><input type="checkbox" id="bulk-restore-agree" value="agree" data-action="ToggleButton" data-target="bulk-restore-button"> <?php esc_html_e('I want to restore all selected images. I understand this action is permanent and nonreversible', 'shortpixel-image-optimiser'); ?></p>
<nav>
<button type="button" class="button" data-action="open-panel" data-panel="dashboard"><?php esc_html_e('Back','shortpixel-image-optimiser'); ?></button>
<button type="button" class="button button-primary disabled" id='bulk-restore-button' data-action="BulkRestoreAll" disabled><?php esc_html_e('Bulk Restore All Images', 'shortpixel-image-optimiser') ?></button>
</nav>
</div>
</section>
<section class='panel bulk-migrate' data-panel="bulk-migrate" >
<h3 class='heading'>
<?php esc_html_e("Bulk Migrate", 'shortpixel-image-optimiser'); ?>
</h3>
<div class='bulk-special-wrapper'>
<h4 class='warning'><?php esc_html_e('Warning', 'shortpixel-image-optimiser'); ?></h4>
<p><?php printf(esc_html__('By starting the %s bulk metadata migration %s process, the plugin will try to migrate the old format of optimization information (used by the plugin for versions prior to 5.0) to the new format used from version 5.0 onward for %s all the images. %s It is possible to have exceptions and some of the image information migration may fail. You should get all the details for these cases at the end of the process, in the Errors section.', 'shortpixel-image-optimiser'), '<b>', '</b>', '<b>', '</b>'); ?></p>
<p class='warning optiongroup'><?php esc_html_e('It is strongly advised to create a full backup before starting this process.', 'shortpixel-image-optimiser'); ?></p>
<p class='optiongroup'><input type="checkbox" id="bulk-migrate-agree" value="agree" data-action="ToggleButton" data-target="bulk-migrate-button"> <?php esc_html_e('I want to migrate the metadata for all images. I understand this action is permanent. I made a backup of my site including images and database.', 'shortpixel-image-optimiser'); ?></p>
<nav>
<button class="button" type="button" data-action="open-panel" data-panel="dashboard"><?php esc_html_e('Back','shortpixel-image-optimiser'); ?></button>
<button type="button" type="button" class="button disabled button-primary" disabled id='bulk-migrate-button' data-action="BulkMigrateAll" ><?php esc_html_e('Search and migrate All Images', 'shortpixel-image-optimiser') ?>
</button>
</nav>
</div>
</section>
<section class='panel bulk-removeLegacy' data-panel="bulk-removeLegacy" >
<h3 class='heading'>
<?php esc_html_e("Bulk remove legacy data", 'shortpixel-image-optimiser'); ?>
</h3>
<div class='bulk-special-wrapper'>
<h4 class='warning'><?php esc_html_e('Warning', 'shortpixel-image-optimiser'); ?></h4>
<p><?php printf(esc_html__('By starting the %s remove legacy metadata %s process, the plugin will try to remove all the %s legacy data %s (that was used by the plugin to store the optimization information in versions earlier than 5.0). If this legacy metadata isn\'t properly migrated or some of the migration failed for any reason, it will be impossible to undo or redo the process. In these cases, the optimization information for images processed with versions earlier than 5.0 could be lost.', 'shortpixel-image-optimiser'), '<b>', '</b>', '<b>', '</b>'); ?></p>
<p class='warning optiongroup'><?php esc_html_e('It is strongly advised to create a full backup before starting this process.', 'shortpixel-image-optimiser'); ?></p>
<p class='optiongroup'><input type="checkbox" id="bulk-migrate-agree" value="agree" data-action="ToggleButton" data-target="bulk-removelegacy-button"> <?php esc_html_e('I want to remove all legacy data. I understand this action is permanent. I made a backup of my site including images and database.', 'shortpixel-image-optimiser'); ?></p>
<nav>
<button type="button" class="button" data-action="open-panel" data-panel="dashboard"><?php esc_html_e('Back','shortpixel-image-optimiser'); ?></button>
<button type="button" class="button disabled button-primary" disabled id='bulk-removelegacy-button' data-action="BulkRemoveLegacy" ><?php esc_html_e('Remove all legacy metadata', 'shortpixel-image-optimiser') ?></button>
</nav>
</div>
</section>

View File

@ -0,0 +1,120 @@
<?php
namespace ShortPixel;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
?>
<section class='dashboard panel active' data-panel="dashboard" style='display: block' >
<div class="panel-container">
<h3 class="heading"><span><img src="<?php echo esc_url(\wpSPIO()->plugin_url('res/img/robo-slider.png')); ?>"></span>
<?php esc_html_e('Welcome to the Bulk Processing page!', 'shortpixel-image-optimiser'); ?>
</h3>
<div class='interface wrapper'>
<div class='bulk-wrapper'>
<button type="button" class="button-primary button" id="start-optimize" data-action="open-panel" data-panel="selection" <?php echo ($this->view->error) ? "disabled" : ''; ?> >
<span class='dashicons dashicons-controls-play'>&nbsp;</span>
<p><?php esc_html_e('Start optimizing','shortpixel-image-optimiser'); ?></p>
</button>
</div>
<div class='dashboard-text'>
<p class='description'><?php esc_html_e('Here you can (re)optimize your Media Library or Custom Media folders from your website.', 'shortpixel-image-optimiser'); ?></p>
<p class='description'><?php
printf(__('If you have any question don\'t hesitate to %s contact us %s %s, we are friendly and helpful, 24/7. %s
Also, if you have a minute please leave a %s review %s for us, it always brings joy to our team! %s','shortpixel-image-optimiser'),
'<a href="https://shortpixel.com/contact" target="_blank">',
'</a>',
'&#x1F4AC;',
'<br>',
'<a href="https://wordpress.org/support/plugin/shortpixel-image-optimiser/reviews/?filter=5" target="_blank">',
'</a>',
'&#x1F913');
?>
</p>
</div>
</div>
<?php if ($this->view->error): ?>
<div class='bulk error'>
<h3><?php echo esc_html($this->view->errorTitle); ?></h3>
<p><?php echo $this->view->errorContent; ?></p>
<?php if (property_exists($this->view, 'errorText')): ?>
<p class='text'><?php echo esc_html($this->view->errorText) ?></p>
<?php endif; ?>
</div>
<?php endif; ?>
<?php if (count($this->view->logs) > 0): ?>
<div id="LogModal" class="shortpixel-modal shortpixel-hide bulk-modal">
<span class="close" data-action="CloseModal" data-id="LogModal">X</span>
<div class='title'>
</div>
<div class="content sptw-modal-spinner">
<div class='table-wrapper'>
</div>
</div>
</div>
<div id="LogModal-Shade" class='sp-modal-shade'></div>
<div class='dashboard-log'>
<h3><?php esc_html_e('Previous Bulks', 'shortpixel_image_optimizer'); ?></h3>
<?php
echo "<div class='head'>";
foreach($this->view->logHeaders as $header)
{
echo "<span>" . esc_attr($header) . "</span>";
}
echo "</div>";
foreach ($this->view->logs as $logItem):
{
echo "<div class='data " . esc_attr($logItem['type']) . "'>";
echo "<span>" . esc_html($logItem['images']) . '</span>';
echo "<span>" . $logItem['errors'] . '</span>';
echo '<span class="checkmark_green date">' . sprintf(esc_html__('%sCompleted%s on %s','shortpixel-image-optimiser'), '<b>','</b>', esc_html($logItem['date'])) . '</span>';
echo "<span>" . esc_html($logItem['bulkName']) . '</span>';
echo "</div>";
}
?>
<?php endforeach; ?>
</div>
<?php endif; ?>
<?php if (! $this->view->error): ?>
<div class='shortpixel-bulk-loader' id="bulk-loading" data-status='loading'>
<div class='loader'>
<span class="svg-spinner"><?php $this->loadView('snippets/part-svgloader', false); ?></span>
<span>
<h2><?php esc_html_e('Please wait, ShortPixel is loading'); ?></h2>
</span>
</div>
</div>
<?php endif; ?>
</div> <!-- panel-container -->
</section> <!-- section -->

View File

@ -0,0 +1,140 @@
<?php
namespace ShortPixel;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
?>
<section class="panel finished" data-panel="finished">
<div class="panel-container">
<h3 class="heading"><span><img src="<?php echo \wpSPIO()->plugin_url('res/img/robo-slider.png'); ?>"></span>
<?php esc_html_e('The ShortPixel Bulk Processing is finished' ,'shortpixel-image-optimiser'); ?>
<div class='average-optimization'>
<p><?php esc_html_e('Average Optimization','shortpixel-image-optimiser'); ?></p>
<svg class="opt-circle-average" viewBox="-10 0 150 140">
<path class="trail" d="
M 50,50
m 0,-46
a 46,46 0 1 1 0,92
a 46,46 0 1 1 0,-92
" stroke-width="16" fill-opacity="0">
</path>
<path class="path" d="
M 50,50
m 0,-46
a 46,46 0 1 1 0,92
a 46,46 0 1 1 0,-92
" stroke-width="16" fill-opacity="0" style="stroke-dasharray: 289.027px, 289.027px; stroke-dashoffset: 180px;">
</path>
<text class="text" x="50" y="50"><?php esc_html_e('N/A', 'shortpixel-image-optimiser'); ?></text>
</svg>
</div>
</h3>
<?php $this->loadView('bulk/part-progressbar', false); ?>
<span class='hidden' data-check-media-total data-stats-media="total">0</span>
<span class='hidden' data-check-media-customOperation data-stats-media="isCustomOperation">-1</span>
<div class='bulk-summary' data-check-visibility="false" data-control='data-check-media-customOperation'>
<p class='finished-paragraph'>
<?php printf(__('Congratulations, ShortPixel has optimized %s %s images and thumbs %s for your website! Yay to faster loading websites! %s', 'shortpixel-image-optimiser'), '<b>', '<span data-stats-total="total"></span>','</b>', '&#x1F389;');
?>
<br>
<?php
printf(__('ShortPixel plugins are installed on hundreds of thousands of websites and we save our users over 500 GB by optimizing over 15 million images. Each and every day! %s', 'shortpixel-image-optimiser'), '&#x1F4AA;');
?>
<br>
<?php
printf(__('We have been working on improving ShortPixel every day for over 7 years. It is very motivating for us when customers take a minute to leave us a %sreview%s. We thank you for that! %s', 'shortpixel-image-optimiser'), '<a href="https://wordpress.org/support/plugin/shortpixel-image-optimiser/reviews/?filter=5" target="_blank">','</a>', '&#x1F64C;');
?>
</p>
</div>
<div class='bulk-summary' data-check-visibility data-control="data-check-media-total">
<div class='heading'>
<span><i class='dashicons dashicons-images-alt2'>&nbsp;</i> <?php esc_html_e('Media Library','shortpixel-image-optimiser'); ?></span>
<span>
<span class='line-progressbar'>
<span class='done-text'><i data-stats-media="percentage_done"></i> %</span>
<span class='done' data-stats-media="percentage_done" data-presentation="css.width.percentage"></span>
</span>
</span>
<span><?php esc_html_e('Processing','shortpixel-image-optimiser') ?>: <i data-stats-media="in_process">0</i></span>
</div>
<div>
<span><?php esc_html_e('Processed','shortpixel-image-optimiser'); ?>: <i data-stats-media="done">0</i></span>
<span><?php esc_html_e('Images Left','shortpixel-image-optimiser'); ?>: <i data-stats-media="in_queue">0</i></span>
<span><?php esc_html_e('Errors','shortpixel-image-optimiser'); ?>: <i data-check-media-fatalerrors data-stats-media="fatal_errors" class='error'>0 </i>
<span class="display-error-box" data-check-visibility data-control="data-check-media-fatalerrors" ><label title="<?php esc_html_e('Show Errors', 'shortpixel-image-optimiser'); ?>">
<input type="checkbox" name="show-errors" value="show" data-action='ToggleErrorBox' data-errorbox='media' data-event='change'><?php esc_html_e('Show Errors','shortpixel-image-optimiser'); ?></label>
</span>
</span>
</div>
</div>
<div data-error-media="message" data-presentation="append" class='errorbox media'>
<?php if(property_exists($this->view, 'mediaErrorLog') && $this->view->mediaErrorLog !== false)
{
echo $this->view->mediaErrorLog;
}
?>
</div>
<!-- ****** CUSTOM ******** --->
<span class='hidden' data-check-custom-total data-stats-custom="total">0</span>
<div class='bulk-summary' data-check-visibility data-control="data-check-custom-total">
<div class='heading'>
<span><i class='dashicons dashicons-open-folder'>&nbsp;</i> <?php esc_html_e('Custom Media','shortpixel-image-optimiser'); ?></span>
<span>
<span class='line-progressbar'>
<span class='done-text'><i data-stats-custom="percentage_done"></i> %</span>
<span class='done' data-stats-custom="percentage_done" data-presentation="css.width.percentage"></span>
</span>
</span>
<span><?php esc_html_e('Processing','shortpixel-image-optimiser') ?>: <i data-stats-custom="in_process">-</i></span>
</div>
<div>
<span><?php esc_html_e('Processed','shortpixel-image-optimiser'); ?>: <i data-stats-custom="done">-</i></span>
<span><?php esc_html_e('Images Left', 'shortpixel-image-optimiser') ?>: <i data-stats-custom="in_queue">-</i></span>
<span><?php esc_html_e('Errors','shortpixel-image-optimiser') ?>: <i data-check-custom-fatalerrors data-stats-custom="fatal_errors" class='error'>-</i>
<span class="display-error-box" data-check-visibility data-control="data-check-custom-fatalerrors" ><label title="<?php esc_html_e('Show Errors', 'shortpixel-image-optimiser'); ?>">
<input type="checkbox" name="show-errors" value="show" data-action='ToggleErrorBox' data-errorbox='custom' data-event='change'>Show Errors</label>
</span>
</span>
</div>
</div>
<div data-error-custom="message" data-presentation="append" class='errorbox custom'>
<?php if(property_exists($this->view, 'customErrorLog') && $this->view->customErrorLog !== false)
{
echo $this->view->customErrorLog;
}
?>
</div>
<nav>
<button class='button finish' type="button" data-action="FinishBulk" id="FinishBulkButton"><?php esc_html_e('Finish Bulk Process','shortpixel-image-optimiser'); ?></button>
</nav>
</div>
</section>

View File

@ -0,0 +1,207 @@
<?php
namespace ShortPixel;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
?>
<section class="panel process" data-panel="process" >
<div class="panel-container">
<h3 class="heading"><span><img src="<?php echo esc_url(\wpSPIO()->plugin_url('res/img/robo-slider.png')); ?>"></span>
<?php esc_html_e('ShortPixel Bulk Process is in progress','shortpixel-image-optimiser'); ?>
<div class='average-optimization'>
<p><?php esc_html_e('Average this run','shortpixel-image-optimiser'); ?></p>
<svg class="opt-circle-average" viewBox="-10 0 150 140">
<path class="trail" d="
M 50,50
m 0,-46
a 46,46 0 1 1 0,92
a 46,46 0 1 1 0,-92
" stroke-width="16" fill-opacity="0">
</path>
<path class="path" d="
M 50,50
m 0,-46
a 46,46 0 1 1 0,92
a 46,46 0 1 1 0,-92
" stroke-width="16" fill-opacity="0" style="stroke-dasharray: 289.027px, 289.027px; stroke-dashoffset: 180px;">
</path>
<text class="text" x="50" y="50"><?php esc_html_e('N/A', 'shortpixel-image-optimiser'); ?></text>
</svg>
</div>
</h3>
<p class='description'><?php esc_html_e('ShortPixel is processing your images. Please keep this window open to complete the process.', 'shortpixel-image-optimiser'); ?> </p>
<?php $this->loadView('bulk/part-progressbar', false); ?>
<!--- ###### MEDIA ###### -->
<span class='hidden' data-check-media-total data-stats-media="total">0</span>
<div class='bulk-summary' data-check-visibility data-control="data-check-media-total">
<div class='heading'>
<span><i class='dashicons dashicons-images-alt2'>&nbsp;</i> <?php esc_html_e('Media Library' ,'shortpixel-image-optimiser'); ?></span>
<span>
<span class='line-progressbar'>
<span class='done-text'><i data-stats-media="percentage_done"></i> %</span>
<span class='done' data-stats-media="percentage_done" data-presentation="css.width.percentage"></span>
</span>
<span class='dashicons spin dashicons-update line-progressbar-spinner' data-check-visibility data-control="data-check-media-in_process">&nbsp;</span>
</span>
<span><?php esc_html_e('Processing', 'shortpixel-image-optimiser') ?>: <i data-stats-media="in_process" data-check-media-in_process >0</i></span>
</div>
<div>
<span><?php esc_html_e('Processed', 'shortpixel-image-optimiser'); ?>: <i data-stats-media="done">0</i></span>
<span><?php esc_html_e('Waiting','shortpixel-image-optimiser'); ?>: <i data-stats-media="in_queue">0</i></span>
<span><?php esc_html_e('Errors','shortpixel-image-optimiser') ?>: <i data-check-media-fatalerrors data-stats-media="fatal_errors" class='error'>0 </i>
<span class="display-error-box" data-check-visibility data-control="data-check-media-fatalerrors" ><label title="<?php esc_html_e('Show Errors', 'shortpixel-image-optimiser'); ?>">
<input type="checkbox" name="show-errors" value="show" data-action='ToggleErrorBox' data-errorbox='media' data-event='change'>
<?php esc_html_e('Show Errors','shortpixel-image-optimiser'); ?></label>
</span>
</span>
</div>
</div>
<div data-error-media="message" data-presentation="append" class='errorbox media'>
<?php if(property_exists($this->view, 'mediaErrorLog') && $this->view->mediaErrorLog !== false)
{
echo $this->view->mediaErrorLog;
}
?>
</div>
<!-- ****** CUSTOM ******** --->
<span class='hidden' data-check-custom-total data-stats-custom="total">0</span>
<div class='bulk-summary' data-check-visibility data-control="data-check-custom-total">
<div class='heading'>
<span><i class='dashicons dashicons-open-folder'>&nbsp;</i> <?php esc_html_e('Custom Media', 'shortpixel-image-optimiser'); ?> </span>
<span>
<span class='line-progressbar'>
<span class='done-text'><i data-stats-custom="percentage_done"></i> %</span>
<span class='done' data-stats-custom="percentage_done" data-presentation="css.width.percentage"></span>
</span>
<span class='dashicons spin dashicons-update line-progressbar-spinner' data-check-visibility data-control="data-check-custom-in_process">&nbsp;</span>
</span>
<span><?php esc_html_e('Processing', 'shortpixel-image-optimiser') ?>: <i data-stats-custom="in_process" data-check-custom-in_process>-</i></span>
</div>
<div>
<span><?php esc_html_e('Processed','shortpixel-image-optimiser'); ?>: <i data-stats-custom="done">-</i></span>
<span><?php esc_html_e('Waiting','shortpixel-image-optimiser'); ?>: <i data-stats-custom="in_queue">-</i></span>
<span><?php esc_html_e('Errors') ?>: <i data-check-custom-fatalerrors data-stats-custom="fatal_errors" class='error'>-</i>
<span class="display-error-box" data-check-visibility data-control="data-check-custom-fatalerrors" ><label title="<?php esc_html_e('Show Errors', 'shortpixel-image-optimiser'); ?>">
<input type="checkbox" name="show-errors" value="show" data-action='ToggleErrorBox' data-errorbox='custom' data-event='change'><?php esc_html_e('Show Errors','shortpixel-image-optimiser'); ?></label>
</span>
</span>
</div>
</div>
<div data-error-custom="message" data-presentation="append" class='errorbox custom'>
<?php if(property_exists($this->view, 'customErrorLog') && $this->view->customErrorLog !== false)
{
echo $this->view->customErrorLog;
}
?>
</div>
<nav>
<button class='button stop' type='button' data-action="StopBulk" >
<?php esc_html_e('Stop Bulk Processing' ,'shortpixel-image-optimiser'); ?>
</button>
<button class='button pause' type='button' data-action="PauseBulk" id="PauseBulkButton">
<?php esc_html_e('Pause Bulk Processing' ,'shortpixel-image-optimiser') ?>
</button>
<button class='button button-primary resume' type='button' data-action='ResumeBulk' id="ResumeBulkButton">
<?php esc_html_e('Resume Bulk Processing','shortpixel-image-optimiser'); ?>
</button>
</nav>
<div class='image-preview-section hidden'> <!-- /hidden -->
<div class='title'><?php esc_html_e('Just Optimized', 'shortpixel-image-optimiser'); ?></div>
<div class="image-preview-line">
<!-- <strong data-result="queuetype"></strong> -->
<span>&nbsp;</span> <!-- Spacer for flex -->
<span data-result="filename">&nbsp;</span>
<svg class="opt-circle-image" viewBox="0 0 100 100">
<path class="trail" d="
M 50,50
m 0,-46
a 46,46 0 1 1 0,92
a 46,46 0 1 1 0,-92
" stroke-width="8" fill-opacity="0">
</path>
<path class="path" d="
M 50,50
m 0,-46
a 46,46 0 1 1 0,92
a 46,46 0 1 1 0,-92
" stroke-width="8" fill-opacity="0" style="stroke-dasharray: 289.027px, 289.027px; stroke-dashoffset: 180px;">
</path>
<text class="text" x="50" y="50">-- %</text>
</svg>
</div>
<div class="preview-wrapper">
<div class="slide-mask" id="preview-structure" data-placeholder="<?php echo esc_url(\wpSPIO()->plugin_url('res/img/bulk/placeholder.svg')); ?>">
<div class='current preview-image'>
<div class="image source">
<img src="<?php echo esc_url(\wpSPIO()->plugin_url('res/img/bulk/placeholder.svg')); ?>" >
<p><?php esc_html_e('Original Image', 'shortpixel-image-optimiser'); ?></p>
<?php $this->loadView('snippets/part-svgloader', false); ?>
</div>
<div class="image result">
<img src="<?php echo esc_url(\wpSPIO()->plugin_url('res/img/bulk/placeholder.svg')); ?>" >
<p><?php esc_html_e('Optimized Image', 'shortpixel-image-optimiser'); ?>
- <span data-result="improvements-totalpercentage"></span>% <?php _e('smaller', 'shortpixel-image-optimiser'); ?>
</p>
<?php $this->loadView('snippets/part-svgloader', false); ?>
</div>
</div>
<div class='new preview-image'>
<div class="image source">
<img src="<?php echo esc_url(\wpSPIO()->plugin_url('res/img/bulk/placeholder.svg')); ?>" >
<?php $this->loadView('snippets/part-svgloader', false); ?>
<p><?php esc_html_e('Original Image','shortpixel-image-optimiser'); ?></p>
</div>
<div class="image result">
<img src="<?php echo esc_url(\wpSPIO()->plugin_url('res/img/bulk/placeholder.svg')); ?>" >
<?php $this->loadView('snippets/part-svgloader', false); ?>
<p><?php esc_html_e('Optimized Image','shortpixel-image-optimiser'); ?>
- <span data-result="improvements-totalpercentage"></span>% <?php _e('smaller', 'shortpixel-image-optimiser'); ?>
</p>
</div>
</div>
</div> <!-- slidemask -->
</div> <!-- preview wrapper -->
</div>
<div id="preloader" class="hidden">
</div>
</section>

View File

@ -0,0 +1,33 @@
<?php
namespace ShortPixel;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
?>
<section class='spio-progressbar'>
<div class="flex">
<div class="select">
<span class='line'></span>
<span class="step">1</span>
<span class="text"><?php esc_html_e('Select Images','shortpixel-image-optimiser'); ?></span>
</div>
<div class="summary">
<span class='line'></span>
<span class="step">2</span>
<span class="text"><?php esc_html_e('Summary','shortpixel-image-optimiser'); ?></span>
</div>
<div class="process">
<span class='line'></span>
<span class="step">3</span>
<span class="text"><?php esc_html_e('Bulk Process','shortpixel-image-optimiser'); ?></span>
</div>
<div class="result">
<span class='line'></span>
<span class="step">4</span>
<span class="text"><?php esc_html_e('Results','shortpixel-image-optimiser'); ?></span>
</div>
</div>
</section>

View File

@ -0,0 +1,190 @@
<?php
namespace ShortPixel;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
$approx = $this->view->approx;
?>
<section class='panel selection' data-panel="selection" data-status="loaded" >
<div class="panel-container">
<span class='hidden' data-check-custom-hascustom >
<?php echo ($this->view->approx->custom->has_custom === true) ? 1 : 0; ?>
</span>
<h3 class="heading"><span><img src="<?php echo esc_url(\wpSPIO()->plugin_url('res/img/robo-slider.png')); ?>"></span>
<?php esc_html_e('ShortPixel Bulk Optimization - Select Images', 'shortpixel-image-optimiser'); ?>
</h3>
<p class='description'><?php esc_html_e('Select the type of images that ShortPixel should optimize for you.','shortpixel-image-optimiser'); ?></p>
<?php $this->loadView('bulk/part-progressbar', false); ?>
<div class='load wrapper' >
<div class='loading'>
<span><img src="<?php echo esc_url(\wpSPIO()->plugin_url('res/img/bulk/loading-hourglass.svg')); ?>" /></span>
<span>
<p><?php esc_html_e('Please wait, ShortPixel is checking the images to be processed...','shortpixel-image-optimiser'); ?><br>
<span class="number" data-stats-total="total">x</span> <?php esc_html_e('items found', 'shortpixel-image-optimiser'); ?></p>
</span>
</div>
<div class='loading skip'>
<span><p><button class='button' data-action="SkipPreparing"><?php _e('Start now', 'shortpixel-image-optimiser'); ?></button></p>
</span>
<span>
<p><?php _e("Clicking this button will start optimization of the items added to the queue. The remaining items can be processed in a new bulk. After completion, you can start bulk and the system will continue with the unprocessed images.",'shortpixel-image-optimiser'); ?></p>
</span>
</div>
</div>
<div class="interface wrapper">
<div class="option-block">
<h2><?php esc_html_e('Optimize:','shortpixel-image-optimiser'); ?> </h2>
<p><?php printf(esc_html__('ShortPixel has %sestimated%s the number of images that can still be optimized. %sAfter you select the options, the plugin will calculate exactly how many images to optimize.','shortpixel-image-optimiser'), '<b>','</b>', '<br />'); ?></p>
<?php if ($approx->media->isLimited): ?>
<h4 class='count_limited'><?php esc_html_e('ShortPixel has detected a high number of images. This estimates are limited for performance reasons. On the next step an accurate count will be produced', 'shortpixel-image-optimiser'); ?></h4>
<?php endif; ?>
<div class="media-library optiongroup">
<div class='switch_button'>
<label>
<input type="checkbox" class="switch" id="media_checkbox" checked>
<div class="the_switch">&nbsp; </div>
</label>
</div>
<h4><label for="media_checkbox"><?php esc_html_e('Media Library','shortpixel-image-optimiser'); ?></label></h4>
<div class='option'>
<label><?php esc_html_e('Images (estimate)', 'shortpixel-image-optimiser'); ?></label>
<span class="number" ><?php echo esc_html($approx->media->items) ?></span>
</div>
<?php if (\wpSPIO()->settings()->processThumbnails == 1): ?>
<div class='option'>
<label><?php esc_html_e('Thumbnails (estimate)','shortpixel-image-optimiser'); ?></label> <span class="number" ><?php echo esc_html($approx->media->thumbs) ?> </span>
</div>
<?php endif; ?>
</div>
<?php if (! \wpSPIO()->settings()->processThumbnails): ?>
<div class='thumbnails optiongroup'>
<div class='switch_button'>
<label>
<input type="checkbox" class="switch" id="thumbnails_checkbox" <?php checked(\wpSPIO()->settings()->processThumbnails); ?>>
<div class="the_switch">&nbsp; </div>
</label>
</div>
<h4><label for="thumbnails_checkbox"><?php esc_html_e('Process Image Thumbnails','shortpixel-image-optimiser'); ?></label></h4>
<div class='option'>
<label><?php esc_html_e('Thumbnails (estimate)','shortpixel-image-optimiser'); ?></label>
<span class="number" ><?php echo esc_html($approx->media->total) ?> </span>
</div>
<p><?php esc_html_e('It is recommended to process the WordPress thumbnails. These are the small images that are most often used in posts and pages.This option changes the global ShortPixel settings of your site.','shortpixel-image-optimiser'); ?></p>
</div>
<?php endif; ?>
<div class="custom-images optiongroup" data-check-visibility data-control="data-check-custom-hascustom" >
<div class='switch_button'>
<label>
<input type="checkbox" class="switch" id="custom_checkbox" checked>
<div class="the_switch">&nbsp; </div>
</label>
</div>
<h4><label for="custom_checkbox"><?php esc_html_e('Custom Media images','shortpixel-image-optimiser') ?></label></h4>
<div class='option'>
<label><?php esc_html_e('Images (estimate)','shortpixel-image-optimiser'); ?></label>
<span class="number" ><?php echo esc_html($approx->custom->images) ?></span>
</div>
</div>
</div> <!-- block -->
<div class="option-block selection-settings">
<h2><?php esc_html_e('Options','shortpixel-image-optimiser') ?>: </h2>
<p><?php esc_html_e('Enable these options if you also want to create WebP/AVIF files. These options change the global ShortPixel settings of your site.','shortpixel-image-optimiser'); ?></p>
<div class='optiongroup' >
<div class='switch_button'>
<label>
<input type="checkbox" class="switch" id="webp_checkbox" name="webp_checkbox"
<?php checked(\wpSPIO()->settings()->createWebp); ?> />
<div class="the_switch">&nbsp; </div>
</label>
</div>
<h4><label for="webp_checkbox">
<?php printf(esc_html__('Also create WebP versions of the images' ,'shortpixel-image-optimiser') ); ?>
</label></h4>
<div class="option"><?php esc_html_e('The total number of WebP images will be calculated in the next step.','shortpixel-image-optimiser'); ?></div>
</div>
<?php
$avifEnabled = $this->access()->isFeatureAvailable('avif');
$createAvifChecked = (\wpSPIO()->settings()->createAvif == 1 && $avifEnabled === true) ? true : false;
$disabled = ($avifEnabled === false) ? 'disabled' : '';
?>
<div class='optiongroup'>
<div class='switch_button'>
<label>
<input type="checkbox" class="switch" id="avif_checkbox" name="avif_checkbox" <?php echo $disabled ?>
<?php checked($createAvifChecked); ?> />
<div class="the_switch">&nbsp; </div>
</label>
</div>
<h4><label for="avif_checkbox"><?php esc_html_e('Also create AVIF versions of the images','shortpixel-image-optimiser'); ?></label></h4>
<?php if ($avifEnabled == true): ?>
<div class="option"><?php esc_html_e('The total number of AVIF images will be calculated in the next step.','shortpixel-image-optimiser'); ?></div>
</div>
<?php else : ?>
<div class="option warning"><?php printf(esc_html__('The creation of AVIF files is not possible with this license type. %s Read more %s ','shortpixel-image-optimiser'), '<a href="https://shortpixel.com/knowledge-base/article/555-how-does-the-unlimited-plan-work" target="_blank">', '</a>'); ?>
</div>
</div>
<?php endif; ?>
</div>
<div class="option-block">
<div class='optiongroup' data-check-visibility="false" data-control="data-check-approx-total">
<h3><?php esc_html_e('No images found', 'shortpixel-image-optimiser'); ?></h3>
<p><?php esc_html_e('ShortPixel Bulk couldn\'t find any optimizable images.','shortpixel-image-optimiser'); ?></p>
</div>
<h4 class='approx'><?php esc_html_e('An estimate of unoptimized images in this installation', 'shortpixel-image-optimiser'); ?> :
<span data-check-approx-total><?php echo esc_html($approx->total->images) ?></span> </h4>
<div><p><?php printf(__('In the next step, the plugin will calculate the total number of images to be optimized, and your bulk process will be prepared. The processing %s will not start yet %s, but a summary of the images to be optimized will be displayed.', 'shortpixel-image-optimiser'),'<b>','</b>'); ?></p></div>
</div>
<nav>
<button class="button" type="button" data-action="FinishBulk">
<span class='dashicons dashicons-arrow-left'></span>
<p><?php esc_html_e('Back', 'shortpixel-image-optimiser'); ?></p>
</button>
<button class="button-primary button" type="button" data-action="CreateBulk" data-panel="summary" data-check-disable data-control="data-check-total-total">
<span class='dashicons dashicons-arrow-right'></span>
<p><?php esc_html_e('Calculate', 'shortpixel-image-optimiser'); ?></p>
</button>
</nav>
</div> <!-- interface wrapper -->
</div><!-- container -->
</section>

View File

@ -0,0 +1,140 @@
<?php
namespace ShortPixel;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
?>
<section class="panel summary" data-panel="summary">
<div class="panel-container">
<h3 class="heading"><span><img src="<?php echo esc_url(\wpSPIO()->plugin_url('res/img/robo-slider.png')); ?>"></span>
<?php esc_html_e('ShortPixel Bulk Optimization - Summary','shortpixel-image-optimiser'); ?>
</h3>
<p class='description'><?php esc_html_e('Welcome to the bulk optimization wizard, where you can select the images that ShortPixel will optimize in the background for you.','shortpixel-image-optimiser'); ?></p>
<?php $this->loadView('bulk/part-progressbar', false); ?>
<div class='summary-list'>
<h3><?php esc_html_e('Review and start the Bulk Process', 'shortpixel-image-optimiser'); ?>
<span>
<img src="<?php echo esc_url(wpSPIO()->plugin_url('res/img/robo-notes.png')); ?>" style="transform: scale(-1, 1);height: 50px;"/>
</span>
</h3>
<div class="section-wrapper" data-check-visibility data-control="data-check-media-total">
<h4><span class='dashicons dashicons-images-alt2'>&nbsp;</span>
<?php esc_html_e('Media Library','shortpixel-image-optimiser'); ?> (<span data-stats-media="in_queue">0</span> <?php esc_html_e('items','shortpixel-image-optimiser'); ?>)</h4>
<div class="list-table">
<div><span><?php esc_html_e('Images','shortpixel-image-optimiser'); ?></span>
<span data-stats-media="images-images_basecount">n/a</span>
</div>
<div class='filetypes' data-check-visibility data-control="data-check-has-webp">
<span>&nbsp; <?php esc_html_e('+ WebP images','shortpixel-image-optimiser'); ?> </span><span data-stats-media="images-images_webp" data-check-has-webp>&nbsp;</span>
</div>
<div class='filetypes' data-check-visibility data-control="data-check-has-avif">
<span>&nbsp; <?php esc_html_e('+ AVIF images','shortpixel-image-optimiser'); ?> </span><span data-stats-media="images-images_avif" data-check-has-avif>&nbsp;</span>
</div>
<div><span><?php esc_html_e('Total from Media Library','shortpixel-image-optimiser'); ?></span><span data-stats-media="images-images">0</span></div>
</div>
</div>
<div class="section-wrapper" data-check-visibility data-control="data-check-custom-total">
<h4><span class='dashicons dashicons-open-folder'>&nbsp;</span><?php esc_html_e('Custom Media', 'shortpixel-image-optimiser') ?> (<span data-stats-custom="in_queue">0</span> <?php esc_html_e('items','shortpixel-image-optimiser'); ?>)</h4>
<div class="list-table">
<div><span><?php esc_html_e('Images','shortpixel-image-optimiser'); ?></span>
<span data-stats-custom="images-images_basecount">n/a</span>
</div>
<div class='filetypes' data-check-visibility data-control="data-check-has-custom-webp" ><span>&nbsp; <?php esc_html_e('+ WebP images','shortpixel-image-optimiser'); ?></span>
<span data-stats-custom="images-images_webp" data-check-has-custom-webp>&nbsp;</span>
</div>
<div class='filetypes' data-check-visibility data-control="data-check-has-custom-avif">
<span>&nbsp; <?php esc_html_e('+ AVIF images','shortpixel-image-optimiser'); ?></span><span data-stats-custom="images-images_avif" data-check-has-custom-avif>&nbsp;</span>
</div>
<div><span><?php esc_html_e('Total from Custom Media','shortpixel-image-optimiser'); ?></span><span data-stats-custom="images-images">0</span></div>
</div>
</div>
<?php
$quotaData = $this->view->quotaData;
?>
<div class="totals">
<?php
$quotaData->unlimited ? esc_html_e('Total','shortpixel-image-optimiser') : esc_html_e('Total credits needed','shortpixel-image-optimiser');
?>: <span class="number" data-stats-total="images-images" data-check-total-total >0</span>
<span class='number'></span>
</div>
</div>
<?php
if(true === $quotaData->unlimited): ?>
<div class='credits'>
<p><span><?php _e('This site is currently on the ShortPixel Unlimited plan, so you do not have to worry about credits. Enjoy!', 'shortpixel-image-optimiser'); ?></span></p>
</div>
<?php else: ?>
<div class="credits">
<p class='heading'><span><?php esc_html_e('Your ShortPixel Credits Available', 'shortpixel-image-optimiser'); ?></span>
<span><?php echo esc_html($this->formatNumber($quotaData->total->remaining, 0)) ?></span>
<span><a href="<?php echo esc_url($this->view->buyMoreHref) ?>" target="_new" class='button button-primary'><?php esc_html_e('Buy unlimited credits','shortpixel-image-optimiser'); ?></a></span>
</p>
<p><span><?php esc_html_e('Your monthly plan','shortpixel-image-optimiser'); ?></span>
<span><?php echo esc_html($quotaData->monthly->text) ?> <br>
<?php esc_html_e('Used:', 'shortpixel-image-optimiser'); ?> <?php echo esc_html($this->formatNumber($quotaData->monthly->consumed, 0)); ?>
<?php esc_html_e('; Remaining:', 'shortpixel-image-optimiser'); ?> <?php echo esc_html($this->formatNumber($quotaData->monthly->remaining, 0)); ?>
</span>
</p>
<p>
<span><?php esc_html_e('Your one-time credits') ?></span>
<span><?php echo esc_html($quotaData->onetime->text) ?> <br>
<?php esc_html_e('Used:', 'shortpixel-image-optimiser'); ?> <?php echo esc_html($this->formatNumber($quotaData->onetime->consumed, 0)); ?>
<?php esc_html_e('; Remaining:', 'shortpixel-image-optimiser'); ?> <?php echo esc_html($this->formatNumber($quotaData->onetime->remaining, 0)) ?>
</span>
</p>
</div>
<div class="over-quota" data-check-visibility="false" data-control="data-quota-remaining" data-control-check="data-check-total-total">
<span><img src="<?php echo esc_url(wpSPIO()->plugin_url('res/img/bulk/over-quota.svg')) ?>" /></span>
<p><?php printf(esc_html('In your ShortPixel account you %shave only %s credits available %s, but you have chosen %s images to be optimized in this bulk process. You can either go back and select less images, or you can upgrade to a higher plan or buy one-time credits.','shortpixel-image-optimiser'), '<span class="red">', esc_html($this->formatNumber($quotaData->total->remaining, 0)), '</span>', '<b data-stats-total="images-images">0</b>'); ?>
<button type="button" class="button" onClick="ShortPixel.proposeUpgrade();"><?php esc_html_e('Show me the best options') ?></button>
</p>
<span class='hidden' data-quota-remaining><?php
// This is hidden check, no number format.
echo esc_html($quotaData->total->remaining);
?></span>
</div>
<?php $this->loadView('snippets/part-upgrade-options'); ?>
<?php endif;
?>
<div class='no-images' data-check-visibility="false" data-control="data-check-total-total">
<?php esc_html_e('The current selection contains no images. The bulk process cannot start.', 'shortpixel-image-optimiser'); ?>
</div>
<nav>
<button class="button" type="button" data-action="open-panel" data-panel="selection">
<span class='dashicons dashicons-arrow-left' ></span>
<p><?php esc_html_e('Back','shortpixel-image-optimiser'); ?></p>
</button>
<button class="button-primary button" type="button" data-action="StartBulk" data-control="data-check-total-total" data-check-presentation="disable">
<span class='dashicons dashicons-arrow-right'></span>
<p><?php esc_html_e('Start Bulk Optimization', 'shortpixel-image-optimiser'); ?></p>
</button>
</nav>
</div>
</section>