first
This commit is contained in:
@ -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"> </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"> </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>
|
@ -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'> </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>',
|
||||
'💬',
|
||||
'<br>',
|
||||
'<a href="https://wordpress.org/support/plugin/shortpixel-image-optimiser/reviews/?filter=5" target="_blank">',
|
||||
'</a>',
|
||||
'🤓');
|
||||
?>
|
||||
|
||||
</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 -->
|
@ -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>', '🎉');
|
||||
?>
|
||||
<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'), '💪');
|
||||
?>
|
||||
<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>', '🙌');
|
||||
?>
|
||||
</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'> </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'> </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>
|
@ -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'> </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"> </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'> </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"> </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> </span> <!-- Spacer for flex -->
|
||||
<span data-result="filename"> </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>
|
@ -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>
|
@ -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"> </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"> </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"> </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"> </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"> </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>
|
@ -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'> </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> <?php esc_html_e('+ WebP images','shortpixel-image-optimiser'); ?> </span><span data-stats-media="images-images_webp" data-check-has-webp> </span>
|
||||
</div>
|
||||
<div class='filetypes' data-check-visibility data-control="data-check-has-avif">
|
||||
<span> <?php esc_html_e('+ AVIF images','shortpixel-image-optimiser'); ?> </span><span data-stats-media="images-images_avif" data-check-has-avif> </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'> </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> <?php esc_html_e('+ WebP images','shortpixel-image-optimiser'); ?></span>
|
||||
<span data-stats-custom="images-images_webp" data-check-has-custom-webp> </span>
|
||||
</div>
|
||||
|
||||
<div class='filetypes' data-check-visibility data-control="data-check-has-custom-avif">
|
||||
<span> <?php esc_html_e('+ AVIF images','shortpixel-image-optimiser'); ?></span><span data-stats-custom="images-images_avif" data-check-has-custom-avif> </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>
|
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
namespace ShortPixel;
|
||||
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- This is not a form
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
?>
|
||||
|
||||
<div class='pagination tablenav bottom'>
|
||||
<div class='tablenav-pages'>
|
||||
<?php echo $this->view->pagination; ?>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,73 @@
|
||||
<?php
|
||||
namespace ShortPixel;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
?>
|
||||
<div class="wrap shortpixel-other-media">
|
||||
<h2>
|
||||
<?php esc_html_e($view->title);?>
|
||||
</h2>
|
||||
|
||||
<div class='toolbar'>
|
||||
|
||||
<hr class='wp-header-end' />
|
||||
|
||||
<?php if (property_exists($view, 'show_search') && true === $view->show_search): ?>
|
||||
<div class="searchbox">
|
||||
<form method="get">
|
||||
<input type="hidden" name="page" value="wp-short-pixel-custom" />
|
||||
<input type='hidden' name='order' value="<?php echo esc_attr($this->order) ?>" />
|
||||
<input type="hidden" name="orderby" value="<?php echo esc_attr($this->orderby) ?>" />
|
||||
|
||||
<p class="search-form">
|
||||
<label><?php esc_html_e('Search', 'shortpixel-image-optimiser'); ?></label>
|
||||
<input type="text" name="s" value="<?php echo esc_attr($this->search) ?>" />
|
||||
|
||||
</p>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class='pagination tablenav'>
|
||||
|
||||
<?php if ($this->view->pagination !== false): ?>
|
||||
<div class='tablenav-pages'>
|
||||
<?php echo $this->view->pagination; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
$file_url = esc_url(add_query_arg('part', 'files', $this->url));
|
||||
$folder_url = esc_url(add_query_arg('part', 'folders', $this->url));
|
||||
$scan_url = esc_url(add_query_arg('part', 'scan', $this->url));
|
||||
|
||||
$current_part = isset($_GET['part']) ? sanitize_text_field($_GET['part']) : 'files';
|
||||
|
||||
$tabs = array(
|
||||
'files' => array('link' => $file_url,
|
||||
'text' => __('Files', 'shortpixel-image-optimiser'),
|
||||
),
|
||||
'folders' => array('link' => $folder_url,
|
||||
'text' => __('Folders', 'shortpixel-image-optimiser'),
|
||||
),
|
||||
'scan' => array('link' => $scan_url,
|
||||
'text' => __('Scan', 'shortpixel-image-optimiser'),
|
||||
|
||||
),
|
||||
);
|
||||
|
||||
?>
|
||||
|
||||
<div class="custom-media-tabs">
|
||||
<?php foreach($tabs as $tabName => $tab)
|
||||
{
|
||||
$class = ($current_part == $tabName) ? ' class="selected" ' : '';
|
||||
|
||||
echo '<a href="' . $tab['link'] . '" ' . $class . '>' . $tab['text'] . '</a>';
|
||||
} ?>
|
||||
</div>
|
@ -0,0 +1,116 @@
|
||||
<?php
|
||||
|
||||
namespace ShortPixel;
|
||||
use ShortPixel\ShortPixelLogger\ShortPixelLogger as Log;
|
||||
use ShortPixel\Notices\NoticeController as Notices;
|
||||
|
||||
use ShortPixel\Helper\UiHelper as UiHelper;
|
||||
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
$item = $this->view->current_item;
|
||||
|
||||
$folder_id = $item->get('id');
|
||||
|
||||
$type_display = ($item->get('is_nextgen') ) ? __('Nextgen', 'shortpixel-image-optimiser') : __('Custom Media', 'shortpixel-image-optimiser');
|
||||
$stat = $item->getStats();
|
||||
|
||||
|
||||
$fullstatus = esc_html__("Optimized",'shortpixel-image-optimiser') . ": " . $stat['optimized'] . "\n"
|
||||
. "" . esc_html__("Unoptimized",'shortpixel-image-optimiser') . ": " . $stat['waiting'] . "\n"
|
||||
;
|
||||
//$fullstatus .= ($item->get('is_nextgen') ) ? __('Nextgen', 'shortpixel-image-optimiser') : "";
|
||||
|
||||
|
||||
/*
|
||||
if ($stat['total'] == 0)
|
||||
{
|
||||
$optimize_status = __("Empty",'shortpixel-image-optimiser');
|
||||
$fullstatus = '';
|
||||
}
|
||||
elseif ($stat['total'] == $stat['optimized'])
|
||||
{
|
||||
$optimize_status = __("Optimized",'shortpixel-image-optimiser');
|
||||
}
|
||||
elseif ($stat['optimized'] > 0)
|
||||
{
|
||||
$optimize_status = __("Pending",'shortpixel-image-optimiser');
|
||||
}
|
||||
else
|
||||
{
|
||||
$optimize_status = __("Waiting",'shortpixel-image-optimiser');
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
// $action = __("Stop monitoring",'shortpixel-image-optimiser');
|
||||
|
||||
$err = ''; // unused since failed is gone.
|
||||
if (! $item->exists() && ! $err)
|
||||
$err = __('Directory does not exist', 'shortpixel-image-optimiser');
|
||||
|
||||
|
||||
if ($item->get('is_nextgen') && $view->settings->includeNextGen == 1)
|
||||
$action = false;
|
||||
|
||||
$refreshUrl = add_query_arg(array('sp-action' => 'action_refreshfolder', 'folder_id' => $folder_id, 'part' => 'adv-settings'), $this->url); // has url
|
||||
|
||||
$rowActions = $this->getRowActions($item);
|
||||
?>
|
||||
<div class='item item-<?php echo esc_attr($item->get('id')) ?>'>
|
||||
<span><input type="checkbox" /></span>
|
||||
|
||||
<span class='folder folder-<?php echo esc_attr($item->get('id')) ?>'>
|
||||
<?php echo esc_html($item->getPath()); ?>
|
||||
|
||||
<div class="row-actions">
|
||||
<span class='item-id'>#<?php echo esc_attr($item->get('id')); ?></span>
|
||||
<?php
|
||||
if (isset($rowActions)):
|
||||
$i = 0;
|
||||
foreach($rowActions as $actionName => $action):
|
||||
$classes = '';
|
||||
$link = ($action['type'] == 'js') ? 'javascript:' . $action['function'] : $action['function'];
|
||||
|
||||
if ($i > 0)
|
||||
echo "|";
|
||||
?>
|
||||
<a href="<?php echo $link ?>" class="<?php echo $classes ?>"><?php echo $action['text'] ?></a>
|
||||
<?php
|
||||
$i++;
|
||||
endforeach;
|
||||
|
||||
endif;
|
||||
?>
|
||||
</div>
|
||||
|
||||
|
||||
</span>
|
||||
<span>
|
||||
<?php echo $type_display; ?>
|
||||
</span>
|
||||
<span>
|
||||
|
||||
<span title="<?php echo esc_attr($fullstatus); ?>" class='info-icon'>
|
||||
<img alt='<?php esc_html_e('Info Icon', 'shortpixel-image-optimiser') ?>' src='<?php echo esc_url( wpSPIO()->plugin_url('res/img/info-icon.png' ));?>' style="margin-bottom: -2px;"/>
|
||||
</span> <?php
|
||||
//echo esc_html($type_display. ' ' );
|
||||
?>
|
||||
|
||||
<span class='files-number'><?php
|
||||
echo esc_html($stat['optimized']);
|
||||
echo '/';
|
||||
echo esc_html($stat['total']); ?>
|
||||
</span> <?php _e('Files', 'shortpixel-image-optimiser'); ?>
|
||||
</span>
|
||||
<span>
|
||||
<?php echo esc_html(UiHelper::formatTS($item->get('updated'))) ?>
|
||||
</span>
|
||||
<span class='status'>
|
||||
|
||||
</span>
|
||||
|
||||
</div>
|
@ -0,0 +1,669 @@
|
||||
<?php
|
||||
namespace ShortPixel;
|
||||
use \ShortPixel\Helper\UiHelper as UiHelper;
|
||||
use ShortPixel\Helper\UtilHelper as UtilHelper;
|
||||
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
?>
|
||||
<section id="tab-adv-settings" class="clearfix <?php echo esc_attr(($this->display_part == 'adv-settings') ? ' sel-tab ' :''); ?> ">
|
||||
<h2><a class='tab-link' href='javascript:void(0);' data-id="tab-adv-settings"><?php esc_html_e('Advanced','shortpixel-image-optimiser');?></a></h2>
|
||||
|
||||
<?php
|
||||
$deliverWebpAlteredDisabled = '';
|
||||
$deliverWebpUnalteredDisabled = '';
|
||||
$deliverWebpAlteredDisabledNotice = false;
|
||||
$deliverWebpUnalteredLabel ='';
|
||||
$deliverAVIFLabel ='';
|
||||
|
||||
if( $this->is_nginx ){
|
||||
$deliverWebpUnaltered = ''; // Uncheck
|
||||
$deliverWebpUnalteredDisabled = 'disabled'; // Disable
|
||||
$deliverWebpUnalteredLabel = __('It looks like you\'re running your site on an NGINX server. This means that you can only achieve this functionality by directly configuring the server config files. Please follow this link for instructions:','shortpixel-image-optimiser')." <a class=\"shortpixel-help-link\" href=\"https://shortpixel.com/knowledge-base/article/111-configure-nginx-to-transparently-serve-webp-files-when-supported\" target=\"_blank\" data-beacon-article=\"5bfeb9de2c7d3a31944e78ee\"><span class=\"dashicons dashicons-editor-help\"></span></a>";
|
||||
$deliverAVIFLabel = __('<strong>It looks like you\'re running your site on an NGINX server. You may need additional configuration for the AVIF delivery to work as expected</strong>','shortpixel-image-optimiser')." <a class=\"shortpixel-help-link\" href=\"https://shortpixel.com/knowledge-base/article/499-how-do-i-configure-my-web-server-to-deliver-avif-images\" target=\"_blank\"><span class=\"dashicons dashicons-editor-help\"></span></a>";
|
||||
} else {
|
||||
if( !$this->is_htaccess_writable ){
|
||||
$deliverWebpUnalteredDisabled = 'disabled'; // Disable
|
||||
if( $view->data->deliverWebp == 3 ){
|
||||
$deliverWebpAlteredDisabled = 'disabled'; // Disable
|
||||
$deliverWebpUnalteredLabel = __('It looks like you recently moved from an Apache server to an NGINX server, while the option to use .htacces was in use. Please follow this tutorial to see how you could implement by yourself this functionality, outside of the WP plugin: ','shortpixel-image-optimiser') . '<a href="https://shortpixel.com/knowledge-base/article/111-configure-nginx-to-transparently-serve-webp-files-when-supported" target="_blank" data-beacon-article="5bfeb9de2c7d3a31944e78ee"></a>';
|
||||
} else {
|
||||
$deliverWebpUnalteredLabel = __('It looks like your .htaccess file cannot be written. Please fix this and then return to refresh this page to enable this option.','shortpixel-image-optimiser');
|
||||
}
|
||||
} elseif (isset($_SERVER['HTTP_USER_AGENT']) && strpos( wp_unslash($_SERVER['HTTP_USER_AGENT']), 'Chrome') !== false) {
|
||||
// Show a message about the risks and caveats of serving WEBP images via .htaccess
|
||||
$deliverWebpUnalteredLabel = '<span style="color: initial;">'. esc_html__('Based on testing your particular hosting configuration, we determined that your server','shortpixel-image-optimiser').
|
||||
' <img alt="can or can not" src="'. esc_url(plugins_url( 'res/img/test.jpg' , SHORTPIXEL_PLUGIN_FILE)) .'"> '.
|
||||
esc_html__('serve the WebP or AVIF versions of the JPEG files seamlessly, via .htaccess.','shortpixel-image-optimiser').' <a href="https://shortpixel.com/knowledge-base/article/127-delivering-webp-images-via-htaccess" target="_blank" data-beacon-article="5c1d050e04286304a71d9ce4">Open article to read more about this.</a></span>';
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<div class="wp-shortpixel-options wp-shortpixel-tab-content" style='visibility: hidden'>
|
||||
<table class="form-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row"><?php esc_html_e('Next Generation Images','shortpixel-image-optimiser');?></th>
|
||||
<td>
|
||||
<div class="spio-inline-help"><span class="dashicons dashicons-editor-help" title="Click for more info" data-link="https://shortpixel.com/knowledge-base/article/286-how-to-serve-webp-files-using-spio"></span></div>
|
||||
<div class='switch_button'>
|
||||
<label>
|
||||
<input type="checkbox" class="switch" name="createWebp" value="1" <?php checked( $view->data->createWebp, "1" );?>>
|
||||
<div class="the_switch"> </div>
|
||||
<?php printf(esc_html__('Create %s WebP versions %s of the images. Each image/thumbnail will use an additional credit unless you use the %s Unlimited plan. %s','shortpixel-image-optimiser'), '<a href="https://shortpixel.com/blog/how-webp-images-can-speed-up-your-site/" target="_blank">', '</a>', '<a href="https://shortpixel.com/knowledge-base/article/555-how-does-the-unlimited-plan-work" target="_blank">', '</a>' );?>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<p> </p>
|
||||
<?php
|
||||
$avifEnabled = $this->access()->isFeatureAvailable('avif');
|
||||
$createAvifChecked = ($view->data->createAvif == 1 && $avifEnabled === true) ? true : false;
|
||||
$disabled = ($avifEnabled === false) ? 'disabled' : '';
|
||||
$avifEnabledNotice = false;
|
||||
if ($avifEnabled == false)
|
||||
{
|
||||
$avifEnabledNotice = '<div class="sp-notice sp-notice-warning avifNoticeDisabled">';
|
||||
$avifEnabledNotice .= __('The creation of AVIF files is not possible with this license type.', 'shortpixel-image-optimiser') ;
|
||||
$avifEnabledNotice .= '<div class="spio-inline-help"><span class="dashicons dashicons-editor-help" title="Click for more info" data-link="https://shortpixel.com/knowledge-base/article/555-how-does-the-unlimited-plan-work"></span></div>';
|
||||
$avifEnabledNotice .= '</div>';
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="spio-inline-help"><span class="dashicons dashicons-editor-help" title="Click for more info" data-link="https://shortpixel.com/knowledge-base/article/467-how-to-create-and-serve-avif-files-using-shortpixel-image-optimizer"></span></div>
|
||||
<div class='switch_button'>
|
||||
<label>
|
||||
<input type="checkbox" class="switch" name="createAvif" value="1" <?php echo $disabled ?> <?php checked( $createAvifChecked );?>>
|
||||
<div class="the_switch"> </div>
|
||||
<?php printf(esc_html__('Create %s AVIF versions %s of the images. Each image/thumbnail will use an additional credit. ','shortpixel-image-optimiser'), '<a href="https://shortpixel.com/blog/what-is-avif-and-why-is-it-good/" target="_blank">', '</a>');?>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<?php if(strlen($deliverAVIFLabel)){ ?>
|
||||
<p class="sp-notice sp-notice-warning">
|
||||
<?php echo ( $deliverAVIFLabel );?>
|
||||
</p>
|
||||
<?php } ?>
|
||||
<?php if ($avifEnabledNotice !== false) { echo $avifEnabledNotice; } ?>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<div class="deliverWebpSettings">
|
||||
<div class="spio-inline-help"><span class="dashicons dashicons-editor-help" title="Click for more info" data-link="https://shortpixel.com/knowledge-base/article/126-which-webp-files-delivery-method-is-the-best-for-me"></span></div>
|
||||
<div class='switch_button'>
|
||||
<label>
|
||||
<input type="checkbox" class="switch" name="deliverWebp" data-toggle="deliverTypes" value="1" <?php checked( ($view->data->deliverWebp > 0), true);?>>
|
||||
<div class="the_switch"> </div>
|
||||
<?php esc_html_e('Deliver the next generation versions of the images in the front-end:','shortpixel-image-optimiser');?>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
|
||||
<ul class="deliverWebpTypes toggleTarget" id="deliverTypes">
|
||||
<li>
|
||||
<input type="radio" name="deliverWebpType" id="deliverWebpAltered" <?php checked( ($view->data->deliverWebp >= 1 && $view->data->deliverWebp <= 2), true); ?> <?php echo esc_attr( $deliverWebpAlteredDisabled );?> value="deliverWebpAltered" data-toggle="deliverAlteringTypes">
|
||||
<label for="deliverWebpAltered">
|
||||
<?php esc_html_e('Using the <PICTURE> tag syntax','shortpixel-image-optimiser');?>
|
||||
</label>
|
||||
|
||||
<?php if($deliverWebpAlteredDisabledNotice){ ?>
|
||||
<p class="sp-notice">
|
||||
<?php esc_html_e('After the option to work on .htaccess was selected, the .htaccess file has become unaccessible / read-only. Please make the .htaccess file writeable again to be able to further set this option up.','shortpixel-image-optimiser')?>
|
||||
</p>
|
||||
<?php } ?>
|
||||
|
||||
<p class="settings-info">
|
||||
<?php esc_html_e('Each <img> will be replaced with a <picture> tag that will also provide AVIF and WebP images for browsers that support it. Also, it loads the picturefill.js for browsers that don\'t support the <picture> tag. You don\'t need to activate this if you\'re using the Cache Enabler plugin because your AVIF\WebP images are already handled by this plugin. <strong>Please run some tests before using this option!</strong> If the styles that your theme is using rely on the position of your <img> tags, you may experience display problems.','shortpixel-image-optimiser'); ?>
|
||||
<strong><?php esc_html_e('You can revert anytime to the previous state just by deactivating the option.','shortpixel-image-optimiser'); ?></strong>
|
||||
</p>
|
||||
|
||||
<ul class="deliverWebpAlteringTypes toggleTarget" id="deliverAlteringTypes">
|
||||
<li>
|
||||
<input type="radio" name="deliverWebpAlteringType" id="deliverWebpAlteredWP" <?php checked(($view->data->deliverWebp == 2), true);?> value="deliverWebpAlteredWP">
|
||||
<label for="deliverWebpAlteredWP">
|
||||
<?php esc_html_e('Only via Wordpress hooks (like the_content, the_excerpt, etc)');?>
|
||||
</label>
|
||||
</li>
|
||||
<li>
|
||||
<input type="radio" name="deliverWebpAlteringType" id="deliverWebpAlteredGlobal" <?php checked(($view->data->deliverWebp == 1),true)?> value="deliverWebpAlteredGlobal">
|
||||
<label for="deliverWebpAlteredGlobal">
|
||||
<?php esc_html_e('Global (processes the whole output buffer before sending the HTML to the browser)','shortpixel-image-optimiser');?>
|
||||
</label>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<input type="radio" name="deliverWebpType" id="deliverWebpUnaltered" <?php checked(($view->data->deliverWebp == 3), true);?> <?php echo esc_attr( $deliverWebpUnalteredDisabled );?> value="deliverWebpUnaltered" data-toggle="deliverAlteringTypes" data-toggle-reverse>
|
||||
|
||||
<label for="deliverWebpUnaltered">
|
||||
<?php esc_html_e('Without altering the page code (via .htaccess)','shortpixel-image-optimiser')?>
|
||||
</label>
|
||||
<?php if(strlen($deliverWebpUnalteredLabel)){ ?>
|
||||
<p class="sp-notice sp-notice-warning"><strong>
|
||||
<?php echo( $deliverWebpUnalteredLabel );?>
|
||||
</strong>
|
||||
</p>
|
||||
<?php } ?>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php esc_html_e('Optimize media on upload','shortpixel-image-optimiser');?></th>
|
||||
<td>
|
||||
<div class="spio-inline-help"><span class="dashicons dashicons-editor-help" title="Click for more info" data-link="https://shortpixel.com/knowledge-base/article/521-settings-optimize-media-on-upload"></span></div>
|
||||
<div class='switch_button'>
|
||||
<label>
|
||||
<input type="checkbox" class="switch" name="autoMediaLibrary" id='autoMediaLibrary' value="1" <?php checked( $view->data->autoMediaLibrary, "1" );?>>
|
||||
<div class="the_switch"> </div>
|
||||
<?php esc_html_e('Automatically optimize images after they are uploaded (recommended).','shortpixel-image-optimiser');?>
|
||||
</label>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
<?php if ( $view->data->frontBootstrap == 1): ?>
|
||||
|
||||
|
||||
<tr id="frontBootstrapRow">
|
||||
<th scope="row"><?php esc_html_e('Process in the front-end','shortpixel-image-optimiser');?></th>
|
||||
<td>
|
||||
<input name="frontBootstrap" type="checkbox" id="frontBootstrap" value="1" <?php checked( $view->data->frontBootstrap, '1' );?>>
|
||||
<label for="frontBootstrap"><?php esc_html_e('Automatically optimize images added by users in front-end of the site.','shortpixel-image-optimiser');?></label>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope='row'> </th>
|
||||
<td>
|
||||
<div class="spio-inline-help"><span class="dashicons dashicons-editor-help" title="Click for more info" data-link="https://shortpixel.com/knowledge-base/article/536-why-is-the-option-process-in-the-front-end-gone"></span></div>
|
||||
<div class='view-notice warning'><p><?php esc_html_e('Important. From version 5 the front processing option is no longer available. There will be no processing on the frontend. To enable optimizing images without visiting the backend, please see the options available for command line optimization.', 'shortpixel-image-optimiser') ?></p>
|
||||
<p><?php esc_html_e('To turn off this message, click the checkbox and save settings', 'shortpixel-image-optimiser'); ?></p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
|
||||
<?php if($this->has_nextgen) { ?>
|
||||
<tr>
|
||||
<th scope="row"><?php esc_html_e('NextGen','shortpixel-image-optimiser');?></th>
|
||||
<td>
|
||||
<div class='switch_button'>
|
||||
<label>
|
||||
<input name="includeNextGen" type="checkbox" id="nextGen" value='1' <?php echo checked($view->data->includeNextGen,'1' );?>>
|
||||
|
||||
<div class="the_switch"> </div>
|
||||
<?php esc_html_e('Optimize NextGen galleries.','shortpixel-image-optimiser');?>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<tr>
|
||||
<th scope="row"><?php esc_html_e('Optimize PDFs','shortpixel-image-optimiser');?></th>
|
||||
<td>
|
||||
<div class="spio-inline-help"><span class="dashicons dashicons-editor-help" title="Click for more info" data-link="https://shortpixel.com/knowledge-base/article/520-settings-optimize-pdfs"></span></div>
|
||||
<div class='switch_button'>
|
||||
|
||||
<label>
|
||||
<input type="checkbox" class="switch" name="optimizePdfs" value="1" <?php checked( $view->data->optimizePdfs, "1" );?>>
|
||||
<div class="the_switch"> </div>
|
||||
<?php esc_html_e('Also optimize PDF documents.','shortpixel-image-optimiser');?>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php esc_html_e('Optimize Retina images','shortpixel-image-optimiser');?></th>
|
||||
<td>
|
||||
<div class="spio-inline-help"><span class="dashicons dashicons-editor-help" title="Click for more info" data-link="https://shortpixel.com/knowledge-base/article/518-settings-optimize-retina-images"></span></div>
|
||||
<div class='switch_button'>
|
||||
<label>
|
||||
<input type="checkbox" class="switch" name="optimizeRetina" value="1" <?php checked( $view->data->optimizeRetina, "1" );?>>
|
||||
<div class="the_switch"> </div>
|
||||
<?php esc_html_e('Also optimize the Retina images (@2x) if they exist.','shortpixel-image-optimiser');?>
|
||||
</label>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php if (true === $this->disable_heavy_features): ?>
|
||||
<tr class="heavy-feature-virtual retina view-notice-row">
|
||||
<th scope="row"> </th>
|
||||
<td>
|
||||
<div class='heavy-feature-virtual warning view-notice'>
|
||||
<p><?php printf(esc_html__('This feature has been disabled in offload mode for performance reasons. You can enable it again with a %s filter hook %s ', 'shortpixel-image-optimiser' ),'<a target="_blank" href="https://shortpixel.com/knowledge-base/article/577-performance-improvement-shortpixel-image-optimization-media-offload-plugin">', '</a>'); ?></p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
|
||||
<tr>
|
||||
<th scope="row"><?php esc_html_e('Optimize other thumbnails','shortpixel-image-optimiser');?></th>
|
||||
<td>
|
||||
<div class="spio-inline-help"><span class="dashicons dashicons-editor-help" title="Click for more info" data-link="https://shortpixel.com/knowledge-base/article/519-settings---optimize-other-thumbs"></span></div>
|
||||
<div class='switch_button'>
|
||||
<label>
|
||||
<input type="checkbox" class="switch" name="optimizeUnlisted" value="1" <?php checked( $view->data->optimizeUnlisted, "1" );?>>
|
||||
<div class="the_switch"> </div>
|
||||
<?php esc_html_e('Also optimize unlisted thumbnails, if found.','shortpixel-image-optimiser');?>
|
||||
</label>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php if (true === $this->disable_heavy_features): ?>
|
||||
<tr class="heavy-feature-virtual unlisted view-notice-row ">
|
||||
<th scope="row"> </th>
|
||||
<td>
|
||||
<div class='heavy-feature-virtual warning view-notice'>
|
||||
<p><?php printf(esc_html__('This feature has been disabled in offload mode for performance reasons. You can enable it again with a %s filter hook %s ', 'shortpixel-image-optimiser' ),'<a target="_blank" href="https://shortpixel.com/knowledge-base/article/577-performance-improvement-shortpixel-image-optimization-media-offload-plugin">', '</a>'); ?></p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
|
||||
<tr>
|
||||
<th scope="row"><?php esc_html_e('Convert PNG images to JPEG','shortpixel-image-optimiser');?></th>
|
||||
<td>
|
||||
<div class="spio-inline-help"><span class="dashicons dashicons-editor-help" title="Click for more info" data-link="https://shortpixel.com/knowledge-base/article/516-settings-convert-png-images-to-jpeg"></span></div>
|
||||
<div class='switch_button option-png2jpg'>
|
||||
<label>
|
||||
<input type="checkbox" class="switch" name="png2jpg" value="1" <?php checked( ($view->data->png2jpg > 0), true);?> <?php echo($this->is_gd_installed ? '' : 'disabled') ?> data-toggle="png2jpgforce">
|
||||
<div class="the_switch"> </div>
|
||||
<?php esc_html_e('Automatically convert the PNG images to JPEG, if possible.','shortpixel-image-optimiser'); ?>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<?php if(!$this->is_gd_installed):
|
||||
?>
|
||||
<div style="color:red;"><?php esc_html_e('You need PHP GD with support for JPEG and PNG files for this feature. Please ask your hosting provider to install it.','shortpixel-image-optimiser'); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<div class='switch_button option-png2jpgforce toggleTarget suboption' id="png2jpgforce">
|
||||
<p> </p>
|
||||
<label>
|
||||
<input type="checkbox" class="switch" name="png2jpgForce" value="1" <?php checked(($view->data->png2jpg > 1), true);?> <?php echo($this->is_gd_installed ? '' : 'disabled') ?>>
|
||||
<div class="the_switch"> </div>
|
||||
<?php esc_html_e('Also force the conversion of images with transparency.','shortpixel-image-optimiser'); ?>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr class='exif_warning view-notice-row'>
|
||||
<th scope="row"> </th>
|
||||
<td>
|
||||
<div class='view-notice warning'><p><?php printf(esc_html__('Warning - Converting from PNG to JPG will %s not %s keep the EXIF information!', 'shortpixel-image-optimiser'), "<strong>","</strong>"); ?></p></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><?php esc_html_e('CMYK to RGB conversion','shortpixel-image-optimiser');?></th>
|
||||
<td>
|
||||
<div class="spio-inline-help"><span class="dashicons dashicons-editor-help" title="Click for more info" data-link="https://shortpixel.com/knowledge-base/article/517-settings---cmyk-to-rgb-conversion"></span></div>
|
||||
<div class='switch_button'>
|
||||
<label>
|
||||
<input type="checkbox" class="switch" name="cmyk2rgb" value="1" <?php checked( $view->data->CMYKtoRGBconversion, "1" );?>>
|
||||
<div class="the_switch"> </div>
|
||||
<?php esc_html_e('Adjust your images\' colors for computer and mobile displays.','shortpixel-image-optimiser');?>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="excludeSizes"><?php esc_html_e('Exclude thumbnail sizes','shortpixel-image-optimiser');?></label></th>
|
||||
<td>
|
||||
<div class="spio-inline-help"><span class="dashicons dashicons-editor-help" title="Click for more info" data-link="https://shortpixel.com/knowledge-base/article/113-how-can-i-optimize-only-certain-thumbnail-sizes"></span></div>
|
||||
<div class="option-content">
|
||||
|
||||
<?php
|
||||
foreach($view->allThumbSizes as $sizeKey => $sizeVal) {
|
||||
?>
|
||||
<span class="excludeSizeOption">
|
||||
<label>
|
||||
|
||||
<?php
|
||||
$excludeSizes = property_exists($view->data, 'excludeSizes') ? $view->data->excludeSizes : array();
|
||||
$checked = in_array($sizeKey, $excludeSizes) ? 'checked' : '';
|
||||
$width = isset($sizeVal['width']) ? $sizeVal['width'] : '*';
|
||||
$height = isset($sizeVal['height']) ? $sizeVal['height'] : '*';
|
||||
|
||||
$name = isset($sizeVal['nice-name']) ? $sizeVal['nice-name'] : ucfirst($sizeKey);
|
||||
$label = $name . " ( $width × $height )";
|
||||
|
||||
printf(' <input name="excludeSizes[]" type="checkbox" id="excludeSizes_%s" value="%s" %s>%s ', esc_attr($sizeKey), esc_attr($sizeKey), $checked, $label);
|
||||
?>
|
||||
</label>
|
||||
</span>
|
||||
|
||||
<?php } // exclude sizes ?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="excludePatterns"><?php esc_html_e('Exclude patterns','shortpixel-image-optimiser');?></label></th>
|
||||
<td>
|
||||
<div class="option-content">
|
||||
<div class="spio-inline-help"><span class="dashicons dashicons-editor-help" title="Click for more info" data-link="https://shortpixel.com/knowledge-base/article/88-how-to-exclude-images-from-being-optimized"></span></div>
|
||||
|
||||
<p class="settings-info" data-toggle="exclude-settings-expanded">
|
||||
|
||||
<button class='button button-primary new-exclusion-button' type='button' name="addNewExclusion">
|
||||
<?php _e('Add new Exclusion', 'shortpixel-image-optimiser'); ?>
|
||||
</button>
|
||||
|
||||
<?php
|
||||
printf(esc_html__('Use this section to exclude images based on patterns. There are three types of exclusions: based on the file name, on the file path or on the file size. Each exclusion type can be applied to: all images and thumbnails of that image (including the scaled or original image), only thumbnails (in this case the original and scaled images are not excluded), only Custom Media images (in this case the items from the Media Library are not excluded) or only for a selection of thumbnails of your choice. Examples can be found in the fold-out area below.','shortpixel-image-optimiser'),
|
||||
'<b>','</b>',
|
||||
'<b>','</b>'
|
||||
);
|
||||
?>
|
||||
|
||||
</p>
|
||||
|
||||
<p class="settings-info">
|
||||
<label><input type='checkbox' class='shortpixel-hide' data-toggle='exclude-settings-expanded'> >> <?php printf(esc_html__('See examples')); ?></label>
|
||||
</p>
|
||||
|
||||
<div class='exclude-settings-expanded toggleTarget ' id="exclude-settings-expanded">
|
||||
<p class="settings-info">
|
||||
<?php
|
||||
printf(esc_html__('For the %s"Name"%s type, only the file name is matched, i.e. if you enter %s"flower.jpg"%s in the "Value" field, ShortPixel excludes all JPEG images ending in "flower" (lower case). If, on the other hand, you enter %s"logo"%s in the "Value" field, all images – PNG/JPEG/GIF – that contain the word "logo" in their name will be excluded: "nicelogo.jpg", "alllogos.png", "logo.gif"..', 'shortpixel-image-optimiser'),
|
||||
'<b>','</b>',
|
||||
'<b>','</b>',
|
||||
'<b>','</b>'
|
||||
);
|
||||
?>
|
||||
|
||||
</p>
|
||||
<br />
|
||||
<p class="settings-info">
|
||||
<?php
|
||||
printf(esc_html__('With the %s"Path"%s type, the entire path is matched (useful for excluding certain (sub)directories altogether). For example, if you enter %s"2022"%s in the "Value" field, all images uploaded in 2022 will be excluded, but also images that contain 2022 in the file name (as this is also part of the path). If you only want to exclude images uploaded in 2022, enter %s"/2022/"%s instead.','shortpixel-image-optimiser'),
|
||||
'<b>','</b>',
|
||||
'<b>','</b>',
|
||||
'<b>','</b>'
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<br />
|
||||
<p class="settings-info">
|
||||
<?php
|
||||
printf(esc_html__('For both types mentioned above ("Name" and "Path") you can activate the option %s"Check as regular expression"%s. It works in the same way, but requires a valid regular expression between slashes in the "Value" field. Special characters should be preceded by a \ as an escape character. For example, %s/[0-9]+[^\/]*\.(PNG|png)/%s in the "Value" field for the "Name" type excludes all PNG images that have a numeric prefix.','shortpixel-image-optimiser'),
|
||||
'<b>','</b>',
|
||||
'<b>','</b>'
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
<br />
|
||||
<p class="settings-info">
|
||||
<?php
|
||||
printf(esc_html__('The %s"Size"%s type is applied to all images and thumbnails whose size is within the specified range. You can either use intervals or specify an exact size if you enable the %s"Exact sizes"%s option.','shortpixel-image-optimiser'),
|
||||
'<b>','</b>',
|
||||
'<b>','</b>'
|
||||
);
|
||||
?>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<?php
|
||||
$exclusions = UtilHelper::getExclusions();
|
||||
$excludeArray = $exclusions; //(strlen($excludePatterns) > 0) ? explode(',', $excludePatterns) : array();
|
||||
|
||||
if (is_array($excludeArray) && count($excludeArray) > 0)
|
||||
{
|
||||
echo "<ul class='exclude-list'>";
|
||||
echo '<input type="hidden" id="new-exclusion-index" name="new-index" value="' . (count($excludeArray) -1) . '">';
|
||||
$i = 0;
|
||||
foreach($excludeArray as $index => $option)
|
||||
{
|
||||
$exclude_id = 'id="exclude-' . $i . '"';
|
||||
$type = $option['type'];
|
||||
$value = $option['value'];
|
||||
$apply = $option['apply'];
|
||||
$thumblist = isset($option['thumblist']) ? $option['thumblist'] : array();
|
||||
$hasError = (isset($option['has-error']) && true == $option['has-error']) ? true : false;
|
||||
|
||||
$option_code = json_encode($option);
|
||||
|
||||
$typeStrings = UiHelper::getSettingsStrings('exclusion_types');
|
||||
$applyStrings = UiHelper::getSettingsStrings('exclusion_apply');
|
||||
|
||||
|
||||
$apply_name = isset($applyStrings[$apply]) ? $applyStrings[$apply] : '';
|
||||
|
||||
switch($type)
|
||||
{
|
||||
case 'name':
|
||||
case 'regex-name':
|
||||
$field_name = $typeStrings['name'];
|
||||
break;
|
||||
case 'path':
|
||||
case 'regex-path':
|
||||
$field_name = $typeStrings['path']; // __('Path', 'shortpixel-image-optimiser');
|
||||
break;
|
||||
case 'size':
|
||||
$field_name = $typeStrings['size']; // __('Size', 'shortpixel-image-optimiser');
|
||||
break;
|
||||
default:
|
||||
$field_name = __('Unknown', 'shortpixel-image-optimiser');
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
$classes = array();
|
||||
if (true === $hasError)
|
||||
{
|
||||
$classes[] = 'has-error';
|
||||
}
|
||||
|
||||
if (strpos($type, 'regex') !== false)
|
||||
{
|
||||
$classes[] = 'is-regex';
|
||||
}
|
||||
|
||||
$class = '';
|
||||
if (count($classes) > 0)
|
||||
{
|
||||
$class = 'class="' . implode(' ', $classes) . '"';
|
||||
}
|
||||
|
||||
|
||||
$title = '';
|
||||
if ('selected-thumbs' == $apply)
|
||||
{
|
||||
$thumbTitles = array();
|
||||
foreach($thumblist as $thumbName)
|
||||
{
|
||||
$thumb = $view->allThumbSizes[$thumbName];
|
||||
$thumbTitles[] = (isset($thumb['nice-name'])) ? $thumb['nice-name'] : $thumbName;
|
||||
}
|
||||
$title = 'title="' . implode(', ', $thumbTitles) . '"';
|
||||
}
|
||||
|
||||
|
||||
echo "<li $class $title $exclude_id>";
|
||||
|
||||
echo "<input type='hidden' name='exclusions[]' value='$option_code' />";
|
||||
echo "<span>$field_name :</span>
|
||||
<span>$value</span>";
|
||||
echo "<span>$apply_name</span>";
|
||||
|
||||
echo "</li>";
|
||||
$i++;
|
||||
}
|
||||
echo "</ul>";
|
||||
}
|
||||
else {
|
||||
echo '<input type="hidden" id="new-exclusion-index" name="new-index" value="0">';
|
||||
|
||||
echo '<ul class="exclude-list"><li class="no-exclusion-item">' . __('No exclusions', 'shortpixel-image-optimiser') . '</li></ul>';
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</div> <!-- option-content -->
|
||||
|
||||
<div class='new-exclusion not-visible'>
|
||||
<input type="hidden" name="edit-exclusion" value="">
|
||||
<h3 class='new-title not-visible'><?php _e('New Exclusion' ,'shortpixel-image-optimiser'); ?></h3>
|
||||
<h3 class='edit-title not-visible'><?php _e('Edit Exclusion' ,'shortpixel-image-optimiser'); ?></h3>
|
||||
<div>
|
||||
<label><?php _e('Type:', 'shortpixel-image-optimiser'); ?></label>
|
||||
<select name="exclusion-type" class='new-exclusion-type'>
|
||||
<option value='name'><?php _e('Name', 'shortpixel-image-optimiser'); ?></option>
|
||||
<option value='path' data-example="/path/"><?php _e('Path', 'shortpixel-image-optimiser'); ?></option>
|
||||
<option value='size' data-example="widthXheight-widthXheight"><?php _e('Size', 'shortpixel-image-optimiser'); ?></option>
|
||||
|
||||
</select>
|
||||
|
||||
</div>
|
||||
|
||||
<div class='regex-option'>
|
||||
<label> </label>
|
||||
<div class='switch_button'>
|
||||
<label>
|
||||
<input type="checkbox" class="switch" name="exclusion-regex">
|
||||
<div class="the_switch"> </div>
|
||||
<?php esc_html_e('Check as regular expression','shortpixel-image-optimiser');?>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='value-option '>
|
||||
<label><?php _e('Value:', 'shortpixel-image-optimiser'); ?></label>
|
||||
<input type="text" name="exclusion-value" value="">
|
||||
</div>
|
||||
|
||||
<div class='size-option not-visible'>
|
||||
<div class='exact-option'>
|
||||
<label> </label>
|
||||
<div class='switch_button'>
|
||||
<label>
|
||||
<input type="checkbox" class="switch" name="exclusion-exactsize">
|
||||
<div class="the_switch"> </div>
|
||||
<?php esc_html_e('Exact sizes','shortpixel-image-optimiser');?>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='size-option-range'>
|
||||
<div class='width'>
|
||||
<label><?php _e('Width between:', 'shortpixel-image-optimiser'); ?></label>
|
||||
<input type="number" class='small' name="exclusion-minwidth" value="">px -
|
||||
<input type="number" class='small' name="exclusion-maxwidth" value="">px
|
||||
</div>
|
||||
<div class='height'>
|
||||
<label><?php _e('Height between:', 'shortpixel-image-optimiser'); ?></label>
|
||||
<input type="number" class='small' name="exclusion-minheight" value="">px -
|
||||
<input type="number" class='small' name="exclusion-maxheight" value="">px
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='size-option-exact not-visible'>
|
||||
<div class='exact'>
|
||||
<label>
|
||||
<?php _e('Exact size:', 'shortpixel-image-optimiser'); ?></label>
|
||||
<input type="number" class='small' name="exclusion-width" value="">px x
|
||||
<input type="number" class='small' name="exclusion-height" value="">px
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label><?php _e('Apply To:', 'shortpixel-image-optimiser'); ?></label>
|
||||
<select name='apply-select' class='thumbnail-type-option'>
|
||||
<option value='all'><?php _e('All Images', 'shortpixel-image-optimiser'); ?></option>
|
||||
<option value='only-thumbs'><?php _e('Only Thumbnails','shortpixel-image-optimiser'); ?>
|
||||
</option>
|
||||
<option value='only-custom'><?php _e('Only Custom Media images', 'shortpixel-image-optimiser'); ?>
|
||||
</option>
|
||||
<option value='selected-thumbs'><?php _e('Selected thumbnails', 'shortpixel-image-optimiser'); ?></option>
|
||||
</select>
|
||||
|
||||
<select multiple="multiple" name='thumbnail-select' class='not-visible thumbnail-option'>
|
||||
<?php foreach($view->allThumbSizes as $name => $data)
|
||||
{
|
||||
$nice_name = isset($data['nice-name']) ? $data['nice-name'] : $name;
|
||||
echo "<option value='$name'>$nice_name</option>";
|
||||
} ?>
|
||||
</select>
|
||||
|
||||
</div>
|
||||
<div class='button-actions'>
|
||||
<button type="button" class="button" name='cancelEditExclusion'><?php _e('Close', 'shortpixel-image-optimiser'); ?></button>
|
||||
|
||||
<button type="button" class="button button-primary not-visible" name="addExclusion">
|
||||
<?php _e('Add Exclusion', 'shortpixel-image-optimiser'); ?></button>
|
||||
|
||||
<button type="button" class="button button-primary not-visible" name="updateExclusion">
|
||||
<?php _e("Update", 'shortpixel-image-optimiser'); ?>
|
||||
</button>
|
||||
|
||||
<button type="button" class="button button-primary not-visible" name="removeExclusion">
|
||||
<?php _e("Remove", 'shortpixel-image-optimiser'); ?>
|
||||
</button>
|
||||
|
||||
</div>
|
||||
</div> <!-- new exclusion -->
|
||||
|
||||
<p class='exclusion-save-reminder hidden'><?php _e('Reminder: Save the settings for the exclusion changes to take effect!', 'shortpixel-image-optimiser'); ?></p>
|
||||
|
||||
</td>
|
||||
</tr> <!--- exclusions -->
|
||||
|
||||
|
||||
<tr>
|
||||
<th scope="row"><label for="additional-media"><?php esc_html_e('Custom Media folders','shortpixel-image-optimiser');?></label></th>
|
||||
<td>
|
||||
<div class='switch_button'>
|
||||
<label>
|
||||
<input type="checkbox" class="switch" name="showCustomMedia" value="1" <?php checked( $view->data->showCustomMedia, "1" );?>>
|
||||
<div class="the_switch"> </div>
|
||||
<?php esc_html_e('Show Custom Media menu item','shortpixel-image-optimiser');?>
|
||||
</label>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"><label for="authentication"><?php esc_html_e('HTTP AUTH credentials','shortpixel-image-optimiser');?></label></th>
|
||||
<td>
|
||||
<?php if (! defined('SHORTPIXEL_HTTP_AUTH_USER')): ?>
|
||||
<input name="siteAuthUser" type="text" id="siteAuthUser" value="<?php echo( esc_html(wp_unslash($view->data->siteAuthUser )));?>" class="regular-text" placeholder="<?php esc_html_e('User','shortpixel-image-optimiser');?>" style="margin-bottom: 8px"><br>
|
||||
<input name="siteAuthPass" type="text" id="siteAuthPass" value="<?php echo( esc_html(wp_unslash($view->data->siteAuthPass )));?>" class="regular-text" placeholder="<?php esc_html_e('Password','shortpixel-image-optimiser');?>" style="margin-bottom: 8px">
|
||||
<p class="settings-info">
|
||||
<?php printf(esc_html__('Only fill in these fields if your site (front-end) is not publicly accessible and visitors need a user/pass to connect to it.
|
||||
If you don\'t know what is this then just %sleave the fields empty%s.','shortpixel-image-optimiser'), '<strong>', '</strong>'); ?>
|
||||
</p>
|
||||
<?php else: ?>
|
||||
<p><?php esc_html_e('The HTTP AUTH credentials have been defined in the wp-config file.', 'shortpixel-image-optimiser'); ?></p>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="submit">
|
||||
<input type="submit" name="save" id="saveAdv" class="button button-primary" title="<?php esc_attr_e('Save Changes','shortpixel-image-optimiser');?>" value="<?php esc_attr_e('Save Changes','shortpixel-image-optimiser');?>">
|
||||
<input type="submit" name="save_bulk" id="bulkAdvGo" class="button button-primary" title="<?php esc_attr_e('Save and go to the Bulk Processing page','shortpixel-image-optimiser');?>" value="<?php esc_attr_e('Save and Go to Bulk Process','shortpixel-image-optimiser');?>">
|
||||
</p>
|
||||
</div>
|
||||
<script>
|
||||
<!-- @todo // Inline JS -->
|
||||
jQuery(document).ready(function () { ShortPixel.setupAdvancedTab();});
|
||||
</script>
|
||||
</section>
|
@ -0,0 +1,118 @@
|
||||
<?php
|
||||
namespace ShortPixel;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
?>
|
||||
|
||||
<section id="tab-cloudflare" class="<?php echo esc_attr(($this->display_part == 'cloudflare') ? 'sel-tab ' :''); ?>">
|
||||
<h2><a class='tab-link' href='javascript:void(0);'
|
||||
data-id="tab-cloudflare"><?php esc_html_e('Cloudflare API', 'shortpixel-image-optimiser'); ?></a>
|
||||
</h2>
|
||||
|
||||
<div class="wp-shortpixel-tab-content" style="visibility: hidden">
|
||||
<?php
|
||||
|
||||
if(! $this->is_curl_installed) {
|
||||
echo('<p style="font-weight:bold;color:red">' . esc_html__("Please enable PHP cURL extension for the Cloudflare integration to work.", 'shortpixel-image-optimiser') . '</p>' );
|
||||
}
|
||||
?>
|
||||
<div class="spio-inline-help"><span class="dashicons dashicons-editor-help" title="Click for more info" data-link="https://shortpixel.com/knowledge-base/article/160-cloudlfare"></span></div>
|
||||
|
||||
<p><?php esc_html_e("If you are using Cloudflare on your site, we recommend that you to fill in the details below. This will allow ShortPixel to work seamlessly with Cloudflare, so that any image optimized/restored by ShortPixel is automatically updated on Cloudflare as well.",'shortpixel-image-optimiser');?></p>
|
||||
|
||||
<table class="form-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row"><label
|
||||
for="cloudflare-zone-id"><?php esc_html_e('Zone ID', 'shortpixel-image-optimiser'); ?></label>
|
||||
</th>
|
||||
<td>
|
||||
<input name="cloudflareZoneID" type="text" id="cloudflare-zone-id" <?php echo(! $this->is_curl_installed ? 'disabled' : '');?>
|
||||
value="<?php echo( esc_attr(wp_unslash($view->data->cloudflareZoneID))); ?>" class="regular-text">
|
||||
<p class="settings-info">
|
||||
<?php esc_html_e('You can find this in your Cloudflare account in the "Overview" section for your domain.','shortpixel-image-optimiser');?>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row" class='cf_switch <?php if ($view->hide_cf_global === true) { echo 'global-hidden'; } ?>'>
|
||||
<?php
|
||||
$token_checked = (strlen($view->data->cloudflareToken) > 0) ? 'checked' : '';
|
||||
$global_checked = (strlen($view->data->cloudflareAuthKey) > 0) ? 'checked' : '';
|
||||
|
||||
if ($token_checked == '' && $global_checked == '')
|
||||
$token_checked = 'checked'; // default.
|
||||
|
||||
|
||||
?>
|
||||
<label><input type='radio' name='cf_auth_switch' value='token' <?php echo esc_attr($token_checked) ?> ><span><?php esc_html_e('Cloudflare Token', 'shortpixel-image-optimiser'); ?></span></label>
|
||||
<?php if ($view->hide_cf_global === false): ?>
|
||||
<label><input type='radio' name='cf_auth_switch' value='global' <?php echo esc_attr($global_checked) ?> ><span><?php esc_html_e('Global API Key', 'shortpixel-image-optimiser') ?></span></label>
|
||||
<?php endif; ?>
|
||||
</th>
|
||||
<td class='token-cell'>
|
||||
<input name="cloudflareToken" type="text" id="cloudflare-token" <?php echo(! $this->is_curl_installed ? 'disabled' : '');?> value="<?php echo esc_attr($view->data->cloudflareToken) ?>" class='regular-text' autocomplete="off">
|
||||
|
||||
<?php if ($view->hide_cf_global === false): ?>
|
||||
<p class='settings-info'><?php printf(esc_html__('%s Preferred Method %s. Enter your %s site token %s for authentication. This token needs %sCache Purge permission!%s', 'shortpixel-image-optimiser'), '<b>', '</b>', '<a href="https://dash.cloudflare.com/profile/api-tokens" target="_blank">', '</a>', '<a href="https://shortpixel.com/knowledge-base/article/325-using-shortpixel-image-optimizer-with-cloudflare-api-token" target="_blank">', '</a>'); ?></p>
|
||||
<p class='settings-info'><?php esc_html_e('When using a token, leave the email and global API key fields empty.', 'shortpixel-image-optimiser'); ?></p>
|
||||
<?php else: ?>
|
||||
<p class='settings-info'><?php printf(esc_html__('Enter your %s site token %s for authentication. This token needs %s Cache Purge permission %s! ', 'shortpixel-image-optimiser'), '<a href="https://dash.cloudflare.com/profile/api-tokens" target="_blank">', '</a>', '<a href="https://shortpixel.com/knowledge-base/article/325-using-shortpixel-image-optimizer-with-cloudflare-api-token" target="_blank">', '</a>'); ?></p>
|
||||
<?php endif; ?>
|
||||
<a href="https://shortpixel.com/knowledge-base/article/325-using-shortpixel-image-optimizer-with-cloudflare-api-token" target="_blank" class="shortpixel-help-link">
|
||||
<span class="dashicons dashicons-editor-help"></span><?php esc_html_e('How to set it up','shortpixel-image-optimiser');?>
|
||||
</a>
|
||||
|
||||
</td>
|
||||
<?php if ($view->hide_cf_global === false): ?>
|
||||
<td class='authkey-cell'>
|
||||
<input name="cloudflareAuthKey" type="text" id="cloudflare-auth-key" <?php echo(! $this->is_curl_installed ? 'disabled' : '');?> value="<?php echo(esc_html(wp_unslash($view->data->cloudflareAuthKey))); ?>" class="regular-text" autocomplete="off">
|
||||
<p class="settings-info">
|
||||
<?php esc_html_e("This can be found when you're logged into your account, on the My Profile page:",'shortpixel-image-optimiser');?> <a href='https://www.cloudflare.com/a/profile' target='_blank'>https://www.cloudflare.com/a/profile</a>
|
||||
</p>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
</tr>
|
||||
<tr class='email-cell'>
|
||||
<th scope="row">
|
||||
<label for="cloudflare-email"><?php esc_html_e('Cloudflare E-mail:', 'shortpixel-image-optimiser'); ?></label>
|
||||
</th>
|
||||
<td>
|
||||
<input name="cloudflareEmail" type="text" id="cloudflare-email" <?php echo(! $this->is_curl_installed ? 'disabled' : '');?>
|
||||
value="<?php echo( esc_html(wp_unslash($view->data->cloudflareEmail))); ?>" class="regular-text">
|
||||
<p class="settings-info">
|
||||
<?php esc_html_e('The e-mail address you use to login to CloudFlare.','shortpixel-image-optimiser');?>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="submit">
|
||||
<input type="submit" name="saveCloudflare" id="saveCloudflare" class="button button-primary"
|
||||
title="<?php esc_attr_e('Save Changes', 'shortpixel-image-optimiser'); ?>"
|
||||
value="<?php esc_attr_e('Save Changes', 'shortpixel-image-optimiser'); ?>">
|
||||
</p>
|
||||
</div>
|
||||
<script language="javascript">
|
||||
<!-- @todo Inline JS - remove version 5.1 -->
|
||||
function switchCF()
|
||||
{
|
||||
if ( jQuery('input[name="cf_auth_switch"]:checked').val() == 'token')
|
||||
{
|
||||
jQuery('.authkey-cell, .email-cell').hide();
|
||||
jQuery('.token-cell').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('.token-cell').hide();
|
||||
jQuery('.authkey-cell, .email-cell').show();
|
||||
}
|
||||
}
|
||||
switchCF();
|
||||
jQuery('input[name="cf_auth_switch"]').on('change', switchCF);
|
||||
</script>
|
||||
</section>
|
@ -0,0 +1,271 @@
|
||||
<?php
|
||||
namespace ShortPixel;
|
||||
use ShortPixel\Notices\NoticeController as NoticeController;
|
||||
use ShortPixel\Controller\StatsController as StatsController;
|
||||
use ShortPixel\Controller\OptimizeController as OptimizeController;
|
||||
use ShortPixel\Controller\AdminNoticesController as AdminNoticesController;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
$opt = new OptimizeController();
|
||||
|
||||
$q = $opt->getQueue('media');
|
||||
|
||||
$env = \wpSPIO()->env();
|
||||
$fs = \wpSPIO()->filesystem();
|
||||
|
||||
$debugUrl = add_query_arg(array('part' => 'debug', 'noheader' => true), $this->url);
|
||||
?>
|
||||
|
||||
<section id="tab-debug" class="<?php echo esc_attr(($this->display_part == 'debug') ? ' sel-tab ' :''); ?>">
|
||||
<h2><a class='tab-link' href='javascript:void(0);' data-id="tab-debug">
|
||||
<?php esc_html_e('Debug','shortpixel-image-optimiser');?></a>
|
||||
</h2>
|
||||
|
||||
<div class="wp-shortpixel-options wp-shortpixel-tab-content" style="visibility: hidden">
|
||||
<div class='env'>
|
||||
<h3><?php esc_html_e('Environment', 'shortpixel'); ?></h3>
|
||||
<div class='flex'>
|
||||
<span>NGINX</span><span><?php var_export($this->is_nginx); ?></span>
|
||||
<span>KeyVerified</span><span><?php var_export($this->is_verifiedkey); ?></span>
|
||||
<span>HtAccess writable</span><span><?php var_export($this->is_htaccess_writable); ?></span>
|
||||
<span>Multisite</span><span><?php var_export($this->is_multisite); ?></span>
|
||||
<span>Main site</span><span><?php var_export($this->is_mainsite); ?></span>
|
||||
<span>Constant key</span><span><?php var_export($this->is_constant_key); ?></span>
|
||||
<span>Hide Key</span><span><?php var_export($this->hide_api_key); ?></span>
|
||||
<span>Has Nextgen</span><span><?php var_export($this->has_nextgen); ?></span>
|
||||
<span>Has Offload</span><span><?php
|
||||
$offload = \wpSPIO()->env()->hasOffload();
|
||||
var_export($offload);
|
||||
if (true === $offload)
|
||||
{
|
||||
echo ' (' . \wpSPIO()->env()->getOffloadName() . ') ';
|
||||
}
|
||||
?></span>
|
||||
|
||||
</div>
|
||||
<div class='flex'>
|
||||
<span>GD Installed</span><span><?php var_export($env->is_gd_installed); ?></span>
|
||||
<span>Curl Installed</span><span><?php var_export($env->is_curl_installed); ?></span>
|
||||
</div>
|
||||
|
||||
<div class='flex'>
|
||||
<span>Uploads Base</span><span><?php echo esc_html((defined('SHORTPIXEL_UPLOADS_BASE')) ? SHORTPIXEL_UPLOADS_BASE : 'not defined'); ?></span>
|
||||
<span>Uploads Name</span><span><?php echo esc_html((defined('SHORTPIXEL_UPLOADS_NAME')) ? SHORTPIXEL_UPLOADS_NAME : 'not defined'); ?></span>
|
||||
<span>Backup Folder</span><span><?php echo esc_html((defined('SHORTPIXEL_BACKUP_FOLDER')) ? SHORTPIXEL_BACKUP_FOLDER : 'not defined'); ?></span>
|
||||
<span>Backup URL</span><span><?php echo esc_html((defined('SHORTPIXEL_BACKUP_URL')) ? SHORTPIXEL_BACKUP_URL : 'not defined'); ?></span>
|
||||
|
||||
<span>
|
||||
|
||||
|
||||
</div>
|
||||
</div> <!-- /env -->
|
||||
|
||||
<div class='fs'>
|
||||
<h3><?php esc_html_e('FileSystem', 'shortpixel'); ?></h3>
|
||||
<div class='flex'>
|
||||
<span>WpFileBase</span><span><?php var_export($fs->getWPFileBase()); ?></span>
|
||||
<span>Upload Base</span><span><?php var_export($fs->getWPUploadBase()); ?></span>
|
||||
<span>WPAbspath</span><span><?php var_export($fs->getWPAbsPath()); ?></span>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class='settings'>
|
||||
<h3><?php esc_html_e('Settings', 'shortpixel'); ?></h3>
|
||||
<?php $local = $this->view->data;
|
||||
$local->apiKey = strlen($local->apiKey) . ' chars'; ?>
|
||||
<pre><?php var_export($local); ?></pre>
|
||||
</div>
|
||||
|
||||
<div class='quotadata'>
|
||||
<h3><?php esc_html_e('Quota Data', 'shortpixel'); ?></h3>
|
||||
<pre><?php var_export($this->quotaData); ?></pre>
|
||||
</div>
|
||||
|
||||
|
||||
<div class='debug-quota'>
|
||||
<form method="POST" action="<?php echo esc_url(add_query_arg(array('sp-action' => 'action_debug_resetquota'), $debugUrl)) ?>">
|
||||
<?php wp_nonce_field($this->form_action, 'sp-nonce'); ?>
|
||||
<button class='button' type='submit'>Clear Quota Data</button>
|
||||
</form>
|
||||
</div>
|
||||
<div class="stats env">
|
||||
<h3><?php esc_html_e('Stats', 'shortpixel-image-optimiser'); ?></h3>
|
||||
<h4>Media</h4>
|
||||
<div class='flex'>
|
||||
<?php $statsControl = StatsController::getInstance();
|
||||
?>
|
||||
<span>Items</span><span><?php echo esc_html($statsControl->find('media', 'items')); ?></span>
|
||||
<span>Thumbs</span><span><?php echo esc_html($statsControl->find('media', 'thumbs')); ?></span>
|
||||
<span>Images</span><span><?php echo esc_html($statsControl->find('media', 'images')); ?></span>
|
||||
<span>ItemsTotal</span><span><?php echo esc_html($statsControl->find('media', 'itemsTotal')); ?></span>
|
||||
<span>ThumbsTotal</span><span><?php echo esc_html($statsControl->find('media', 'thumbsTotal')); ?></span>
|
||||
|
||||
</div>
|
||||
<h4>Custom</h4>
|
||||
<div class='flex'>
|
||||
<span>Custom Optimized</span><span><?php echo esc_html($statsControl->find('custom', 'items')); ?></span>
|
||||
<span>Custom itemsTotal</span><span><?php echo esc_html($statsControl->find('custom', 'itemsTotal')); ?>
|
||||
</span>
|
||||
</div>
|
||||
<h4>Total</h4>
|
||||
<div class='flex'>
|
||||
<span>Items</span><span><?php echo esc_html($statsControl->find('total', 'items')); ?></span>
|
||||
<span>Images</span><span><?php echo esc_html($statsControl->find('total', 'images')); ?></span>
|
||||
<span>Thumbs</span><span><?php echo esc_html($statsControl->find('total', 'thumbs')); ?></span>
|
||||
</div>
|
||||
<h4>Period</h4>
|
||||
<div class='flex'>
|
||||
<span>Month #1 </span><span><?php echo esc_html($statsControl->find('period', 'months', '1')); ?></span>
|
||||
<span>Month #2 </span><span><?php echo esc_html($statsControl->find('period', 'months', '2')); ?></span>
|
||||
<span>Month #3 </span><span><?php echo esc_html($statsControl->find('period', 'months', '3')); ?></span>
|
||||
<span>Month #4 </span><span><?php echo esc_html($statsControl->find('period', 'months', '4')); ?></span>
|
||||
</div>
|
||||
</div> <!-- stats -->
|
||||
|
||||
<div class='debug-stats'>
|
||||
<form method="POST" action="<?php echo esc_url(add_query_arg(array('sp-action' => 'action_debug_resetStats'), $debugUrl)) ?>"
|
||||
id="shortpixel-form-debug-stats">
|
||||
<?php wp_nonce_field($this->form_action, 'sp-nonce'); ?>
|
||||
<button class='button' type='submit'>Clear statistics cache</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<?php $noticeController = NoticeController::getInstance();
|
||||
$notices = $noticeController->getNotices();
|
||||
?>
|
||||
|
||||
<h3>Notices (<?php echo esc_html(count($notices)); ?>)</h3>
|
||||
<div class='table notices'>
|
||||
|
||||
<div class='head'>
|
||||
<span>ID</span><span>Done</span><span>Dismissed</span><span>Persistent</span><span>Exclude</span><span>Include</span>
|
||||
</div>
|
||||
|
||||
<?php foreach ($notices as $noticeObj):
|
||||
$exclude = $noticeObj->_debug_getvar('exclude_screens');
|
||||
$include = $noticeObj->_debug_getvar('include_screens');
|
||||
|
||||
$exclude = is_array($exclude) ? implode(',', $exclude) : $exclude;
|
||||
$include = is_array($include) ? implode(',', $include) : $include;
|
||||
|
||||
?>
|
||||
|
||||
<div>
|
||||
<span><?php echo esc_html($noticeObj->getID()); ?></span>
|
||||
<span><?php echo ($noticeObj->isDone()) ? 'Y' : 'N'; ?> </span>
|
||||
<span><?php echo ($noticeObj->isDismissed()) ? 'Y' : 'N'; ?> </span>
|
||||
<span><?php echo ($noticeObj->isPersistent()) ? 'Y' : 'N'; ?> </span>
|
||||
<span><?php echo $exclude ?></span>
|
||||
<span><?php echo $include ?></span>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
|
||||
<div class='debug-notices'>
|
||||
<form method="POST" action="<?php echo esc_url(add_query_arg(array('sp-action' => 'action_debug_resetNotices'), $debugUrl)) ?>"
|
||||
id="shortpixel-form-debug-stats">
|
||||
<?php wp_nonce_field($this->form_action, 'sp-nonce'); ?>
|
||||
<button class='button' type='submit'>Reset Notices</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class='trigger-notices'>
|
||||
<form method="POST" action="<?php echo esc_url(add_query_arg(array('sp-action' => 'action_debug_triggerNotice'), $debugUrl)) ?>"
|
||||
id="shortpixel-form-debug-stats">
|
||||
<?php wp_nonce_field($this->form_action, 'sp-nonce'); ?>
|
||||
<?php
|
||||
$controller = AdminNoticesController::getInstance();
|
||||
$notices = $controller->getAllNotices();
|
||||
|
||||
?>
|
||||
<select name="notice_constant">
|
||||
<option value="trigger-all">Trigger All</option>
|
||||
<?php foreach($notices as $key => $noticeObj)
|
||||
echo "<option value='$key'>$key </option>";
|
||||
?>
|
||||
</select>
|
||||
<button class="button" type="submit">Trigger this Notice</button>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<div class='table queue-stats'>
|
||||
<?php
|
||||
$opt = new OptimizeController();
|
||||
|
||||
$statsMedia = $opt->getQueue('media');
|
||||
$statsCustom = $opt->getQueue('custom');
|
||||
|
||||
$opt->setBulk(true);
|
||||
|
||||
$bulkMedia = $opt->getQueue('media');
|
||||
$bulkCustom = $opt->getQueue('custom');
|
||||
|
||||
$queues = array('media' => $statsMedia, 'custom' => $statsCustom, 'mediaBulk' => $bulkMedia, 'customBulk' => $bulkCustom);
|
||||
|
||||
?>
|
||||
<div class='head'>
|
||||
<span>Name</span>
|
||||
<span>In Queue</span>
|
||||
<span>In process</span>
|
||||
<span>Errors</span>
|
||||
<span>Fatal</span>
|
||||
<span>Done</span>
|
||||
<span>Total</span>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
foreach($queues as $name => $queue):
|
||||
$stats = $queue->getStats();
|
||||
echo "<div>";
|
||||
echo "<span>" . esc_html($name) . '</span>';
|
||||
echo "<span>" . esc_html($stats->in_queue) . '</span>';
|
||||
echo "<span>" . esc_html($stats->in_process) . '</span>';
|
||||
echo "<span>" . esc_html($stats->errors) . '</span>';
|
||||
echo "<span>" . esc_html($stats->fatal_errors) . '</span>';
|
||||
echo "<span>" . esc_html($stats->done) . '</span>';
|
||||
echo "<span>" . esc_html($stats->total) . '</span>';
|
||||
|
||||
echo "</div>";
|
||||
?>
|
||||
|
||||
<?php endforeach; ?>
|
||||
|
||||
<div class='debug-queue'>
|
||||
<form method="POST" action="<?php echo esc_url(add_query_arg(array('sp-action' => 'action_debug_resetQueue'),$debugUrl)) ?>"
|
||||
id="shortpixel-form-reset-queue">
|
||||
<?php wp_nonce_field($this->form_action, 'sp-nonce'); ?>
|
||||
<button class='button' type='submit'>Reset ShortQ</button>
|
||||
<select name="queue">
|
||||
<option>All</option>
|
||||
<?php foreach($queues as $name => $q)
|
||||
{
|
||||
echo "<option>" . esc_attr($name) . "</option>";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</form>
|
||||
</div>
|
||||
</div> <!--- stats -->
|
||||
|
||||
<p></p>
|
||||
<div class='debug-key'>
|
||||
<form method="POST" action="<?php echo esc_url(add_query_arg(array('sp-action' => 'action_debug_removeProcessorKey'),$debugUrl)) ?>"
|
||||
id="shortpixel-form-debug-stats">
|
||||
<?php wp_nonce_field($this->form_action, 'sp-nonce'); ?>
|
||||
<button class='button' type='submit'>Reset Processor Key</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div> <!-- tab-content -->
|
||||
</section>
|
@ -0,0 +1,395 @@
|
||||
<?php
|
||||
namespace ShortPixel;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
?>
|
||||
|
||||
<section id="tab-settings" class="<?php echo ($this->display_part == 'settings') ? 'sel-tab' :''; ?>" >
|
||||
<h2><a class='tab-link' href='javascript:void(0);' data-id="tab-settings">
|
||||
<?php esc_html_e('General','shortpixel-image-optimiser');?></a>
|
||||
</h2>
|
||||
|
||||
<div class="wp-shortpixel-options wp-shortpixel-tab-content" style="visibility: hidden">
|
||||
|
||||
|
||||
<table class="form-table">
|
||||
<tbody>
|
||||
<?php
|
||||
if (true === \wpSPIO()->env()->useTrustedMode())
|
||||
{
|
||||
?>
|
||||
<tr class="trusted-mode-warning">
|
||||
<td colspan='2'>
|
||||
<div class='compression-notice warning'>
|
||||
<p><?php
|
||||
_e('Trusted file mode is active. This means that ShortPixel will depend on the metadata and not check the fileystem while loading the UI. Information may be incorrect and error may occur during optimization ', 'shortpixel-image-optimiser');
|
||||
?></p>
|
||||
<?php if (true === \ShortPixel\Pantheon::IsActive())
|
||||
{
|
||||
echo '<p>'; _e('(You are on Pantheon. This setting was automatically activated)'); echo '</p>';
|
||||
}
|
||||
?>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<th scope="row"><label for="key"><?php esc_html_e('API Key:','shortpixel-image-optimiser');?></label></th>
|
||||
<td>
|
||||
|
||||
<?php
|
||||
$canValidate = false;
|
||||
// Several conditions for showing API key.
|
||||
if ($this->hide_api_key)
|
||||
$showApiKey = false;
|
||||
elseif($this->is_multisite && $this->is_constant_key)
|
||||
$showApiKey = false;
|
||||
else {
|
||||
$showApiKey = true; // is_mainsite, multisite, no constant.
|
||||
}
|
||||
|
||||
$editApiKey = (! $this->is_constant_key && $showApiKey) ? true : false; ;
|
||||
|
||||
if($showApiKey) {
|
||||
$canValidate = true;?>
|
||||
<input name="key" type="text" id="key" value="<?php echo esc_attr( $view->data->apiKey );?>"
|
||||
class="regular-text" <?php echo($editApiKey ? "" : 'disabled') ?> <?php echo $this->is_verifiedkey ? 'onkeyup="ShortPixel.apiKeyChanged()"' : '' ?>>
|
||||
<?php
|
||||
}
|
||||
elseif(defined("SHORTPIXEL_API_KEY")) {
|
||||
$canValidate = true;?>
|
||||
<input name="key" type="text" id="key" disabled="true" placeholder="<?php
|
||||
if( $this->hide_api_key ) {
|
||||
echo("********************");
|
||||
} else {
|
||||
esc_html_e('Multisite API Key','shortpixel-image-optimiser');
|
||||
}
|
||||
?>" class="regular-text">
|
||||
<?php } ?>
|
||||
<input type="hidden" name="validate" id="valid" value=""/>
|
||||
<span class="spinner" id="pluginemail_spinner" style="float:none;"></span>
|
||||
<button type="button" id="validate" class="button button-primary" title="<?php esc_html_e('Validate the provided API key','shortpixel-image-optimiser');?>"
|
||||
onclick="ShortPixel.validateKey(this)" <?php echo $canValidate ? "" : "disabled"?> <?php echo $this->is_verifiedkey ? 'style="display:none;"' : '' ?>>
|
||||
<?php esc_html_e('Save settings & validate','shortpixel-image-optimiser');?>
|
||||
</button>
|
||||
<span class="shortpixel-key-valid" <?php echo $this->is_verifiedkey ? '' : 'style="display:none;"' ?>>
|
||||
<span class="dashicons dashicons-yes"></span><?php esc_html_e('Your API key is valid.','shortpixel-image-optimiser');?>
|
||||
</span>
|
||||
<?php if($this->is_constant_key) { ?>
|
||||
<p class="settings-info"><?php esc_html_e('Key defined in wp-config.php.','shortpixel-image-optimiser');?></p>
|
||||
<?php } ?>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<?php if (! $this->is_verifiedkey) { //if invalid key we display the link to the API Key ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php } else { //if valid key we display the rest of the options ?>
|
||||
<tr>
|
||||
<th scope="row">
|
||||
<label for="compressionType"><?php esc_html_e('Compression type:','shortpixel-image-optimiser');?></label>
|
||||
</th>
|
||||
<td>
|
||||
<div class="spio-inline-help"><span class="dashicons dashicons-editor-help" title="Click for more info" data-link="https://shortpixel.com/knowledge-base/article/11-lossy-glossy-or-lossless-which-one-is-the-best-for-me"></span></div>
|
||||
|
||||
<input type="hidden" id="compressionType-database" value="<?php echo esc_attr($view->data->compressionType) ?>">
|
||||
<div class="shortpixel-compression">
|
||||
<div class="shortpixel-compression-options">
|
||||
<label class="lossy" title="<?php esc_html_e('This is the recommended option in most cases, producing results that look the same as the original to the human eye.','shortpixel-image-optimiser');?>">
|
||||
<input type="radio" class="shortpixel-radio-lossy" name="compressionType" value="1" <?php echo( $view->data->compressionType == 1 ? "checked" : "" );?>><span><?php esc_html_e('Lossy','shortpixel-image-optimiser');?></span>
|
||||
</label>
|
||||
|
||||
<label class="glossy" title="<?php esc_html_e('Best option for photographers and other professionals that use very high quality images on their sites and want best compression while keeping the quality untouched.','shortpixel-image-optimiser');?>">
|
||||
<input type="radio" class="shortpixel-radio-glossy" name="compressionType" value="2" <?php echo( $view->data->compressionType == 2 ? "checked" : "" );?>><span><?php esc_html_e('Glossy','shortpixel-image-optimiser');?></span>
|
||||
</label>
|
||||
|
||||
<label class="lossless" title="<?php esc_html_e('Make sure not a single pixel looks different in the optimized image compared with the original. In some rare cases you will need to use this type of compression. Some technical drawings or images from vector graphics are possible situations.','shortpixel-image-optimiser');?>">
|
||||
<input type="radio" class="shortpixel-radio-lossless" name="compressionType" value="0" <?php echo( $view->data->compressionType == 0 ? "checked" : "" );?>><span><?php esc_html_e('Lossless','shortpixel-image-optimiser');?></span>
|
||||
</label>
|
||||
|
||||
<?php printf(esc_html__('%s Run a few tests%s to help you decide.', 'shortpixel-image-optimiser'), '<a href="https://shortpixel.com/online-image-compression" style="margin-left:20px;" target="_blank">', '</a>'); ?>
|
||||
|
||||
|
||||
<p class="settings-info shortpixel-radio-info shortpixel-radio-lossy" <?php echo( $view->data->compressionType == 1 ? "" : 'style="display:none"' );?>>
|
||||
<?php printf(esc_html__('%sLossy SmartCompression (recommended): %s offers the best compression rate. %s What is SmartCompress? %s This is the recommended option for most users, producing results that look the same as the original to the human eye.','shortpixel-image-optimiser'),'<b>','</b>', '<a href="https://shortpixel.com/blog/introducing-smartcompress/" target="_blank" class="shortpixel-help-link"><span class="dashicons dashicons-editor-help"></span>', '</a><br />');?>
|
||||
</p>
|
||||
<p class="settings-info shortpixel-radio-info shortpixel-radio-glossy" <?php echo( $view->data->compressionType == 2 ? "" : 'style="display:none"' );?>>
|
||||
<?php printf(esc_html__('%sGlossy SmartCompression: %s creates images that are almost pixel-perfect identical with the originals. %s What is SmartCompress? %s Best option for photographers and other professionals that use very high quality images on their sites and want the best compression while keeping the quality untouched.','shortpixel-image-optimiser'), '<b>','</b>', '<a href="https://shortpixel.com/blog/introducing-smartcompress/" target="_blank" class="shortpixel-help-link"><span class="dashicons dashicons-editor-help"></span>', '</a><br>');?>
|
||||
|
||||
</p>
|
||||
<p class="settings-info shortpixel-radio-info shortpixel-radio-lossless" <?php echo( $view->data->compressionType == 0 ? "" : 'style="display:none"' );?>>
|
||||
<?php printf(esc_html__('%s Lossless compression: %s the resulting image is pixel-identical with the original image. %sMake sure not a single pixel looks different in the optimized image compared with the original.
|
||||
In some rare cases you will need to use this type of compression. Some technical drawings or images from vector graphics are possible situations.','shortpixel-image-optimiser'),'<b>','</b>', '<br>');?>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<script>
|
||||
<!-- @todo Inline JS -->
|
||||
function shortpixelCompressionLevelInfo() {
|
||||
jQuery(".shortpixel-compression p").css("display", "none");
|
||||
jQuery(".shortpixel-compression p." + jQuery(".shortpixel-compression-options input:radio:checked").attr('class')).css("display", "block");
|
||||
}
|
||||
jQuery(".shortpixel-compression-options input:radio").on('change', shortpixelCompressionLevelInfo);
|
||||
</script>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr class="compression-notice-row shortpixel-hide">
|
||||
<th scope="row"> </th>
|
||||
<td>
|
||||
<div class='compression-notice warning'>
|
||||
<p><?php printf(esc_html__('This compression type will apply only to new or unprocessed images. Images that were already processed will not be re-optimized. If you want to change the compression type of already optimized images, %s restore them from the backup %s first.', 'shortpixel-image-optimiser' ),'<a href="options-general.php?page=wp-shortpixel-settings&part=tools">', '</a>'); ?></p>
|
||||
<p><?php esc_html_e('The current optimization processes in the queue will be stopped.', 'shortpixel-image-optimiser'); ?></p>
|
||||
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row"><?php esc_html_e('Thumbnail compression:','shortpixel-image-optimiser');?></th>
|
||||
<td>
|
||||
<div class="spio-inline-help"><span class="dashicons dashicons-editor-help" title="Click for more info" data-link="https://shortpixel.com/knowledge-base/article/511-settings-also-include-thumbnails"></span></div>
|
||||
<div class='switch_button'>
|
||||
<label>
|
||||
<input type="checkbox" class="switch" name="processThumbnails" value="1" <?php checked($view->data->processThumbnails, '1');?>>
|
||||
<div class="the_switch"> </div>
|
||||
<?php printf(esc_html__('Apply compression also to %s image thumbnails.%s ','shortpixel-image-optimiser'), '<strong>', '</strong>'); ?>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<p class="settings-info">
|
||||
<?php printf(esc_html__('It is highly recommended that you optimize the thumbnails as they are usually the images most viewed by end users and can generate most traffic. %s Please note that thumbnails count up to your total quota.','shortpixel-image-optimiser'), '<br>'); ?>
|
||||
</p>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row"><?php esc_html_e('Enable SmartCrop:','shortpixel-image-optimiser');?></th>
|
||||
<td>
|
||||
<div class="spio-inline-help"><span class="dashicons dashicons-editor-help" title="Click for more info" data-link="https://shortpixel.com/knowledge-base/article/182-what-is-smart-cropping"></span></div>
|
||||
<div class='switch_button'>
|
||||
<label>
|
||||
<input type="checkbox" class="switch" name="useSmartcrop" value="1" <?php checked($view->data->useSmartcrop, '1');?>>
|
||||
<div class="the_switch"> </div>
|
||||
<?php printf(esc_html__('Enable %s Smart cropping %s of the images where applicable.','shortpixel-image-optimiser'), '<strong>', '</strong>'); ?>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<p class="settings-info">
|
||||
<?php printf(esc_html__('Generate subject-centered thumbnails using ShortPixel\'s AI engine (%sexample%s). The new thumbnails look sharper (and can be slightly bigger) than the ones created by WordPress. Ideal for e-commerce websites and blogs where the images sell the products/content.','shortpixel-image-optimiser'), '<a href="https://shortpixel.com/knowledge-base/article/182-what-is-smart-cropping" target="_blank">', '</a>'); ?>
|
||||
</p>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
$smartcrop = (true === \wpSPIO()->env()->plugin_active('s3-offload')) ? 1 : 0; ?>
|
||||
<tr class='smartcrop_warning view-notice-row' data-smartcrop="<?php echo esc_attr($smartcrop) ?>" >
|
||||
<th scope="row"> </th>
|
||||
<td>
|
||||
<div class='view-notice warning'><p>
|
||||
<?php esc_html_e('It looks like you have the Offload Media plugin enabled. Please note that SmartCropping will not work if you have set the Offload Media plugin to remove files from the server, and strange effects may occur! We recommend you to disable this option in this case.', 'shortpixel-image-optimiser'); ?>
|
||||
</p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row"><?php esc_html_e('Backup','shortpixel-image-optimiser');?></th>
|
||||
<td>
|
||||
|
||||
|
||||
<div class='switch_button'>
|
||||
|
||||
<label>
|
||||
<input type="checkbox" class="switch" name="backupImages" value="1" <?php checked($view->data->backupImages, '1');?>>
|
||||
<div class="the_switch"> </div>
|
||||
<?php esc_html_e('Create a backup of the original images, saved on your server in /wp-content/uploads/ShortpixelBackups/.','shortpixel-image-optimiser');?>
|
||||
</label>
|
||||
</div>
|
||||
<div class="spio-inline-help"><span class="dashicons dashicons-editor-help" title="Click for more info" data-link="https://shortpixel.com/knowledge-base/article/515-settings-image-backup"></span></div>
|
||||
<p class="settings-info"><?php esc_html_e('You can remove the backup folder at any moment but it is best to keep a local/cloud copy, in case you want to restore the optimized files to originals or re-optimize the images using a different compression type.','shortpixel-image-optimiser');?></p>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr class='view-notice-row backup_warning'>
|
||||
<th scope='row'> </th>
|
||||
<td><div class='view-notice warning'><p><?php esc_html_e('Make sure you have a backup in place. When optimizing, ShortPixel will overwrite your images without recovery, which may result in lost images.', 'shortpixel-image-optimiser') ?></p></div></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th scope="row"><?php esc_html_e('Remove EXIF','shortpixel-image-optimiser');?></th>
|
||||
<td>
|
||||
<div class="spio-inline-help"><span class="dashicons dashicons-editor-help" title="Click for more info" data-link="https://shortpixel.com/knowledge-base/article/483-spai-remove-exif"></span></div>
|
||||
<div class='switch_button'>
|
||||
<label>
|
||||
<input type="checkbox" class="switch" name="removeExif" value="1" <?php checked($view->data->keepExif, 0);?>>
|
||||
<div class="the_switch"> </div>
|
||||
<?php esc_html_e('Remove the EXIF tag of the image (recommended).','shortpixel-image-optimiser');?>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr class='exif_warning view-notice-row'>
|
||||
<th scope="row"> </th>
|
||||
<td>
|
||||
<div class='view-notice warning'><p><?php printf(esc_html__('Warning - Converting from PNG to JPG will %s not %s keep the EXIF information!'), "<strong>","</strong>"); ?></p></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<?php $imagick = (\wpSPIO()->env()->hasImagick()) ? 1 : 0; ?>
|
||||
<tr class='exif_imagick_warning view-notice-row' data-imagick="<?php echo esc_attr($imagick) ?>">
|
||||
<th scope="row"> </th>
|
||||
<td>
|
||||
<div class='view-notice warning'><p><?php printf(esc_html__('Warning - Imagick library not detected on server. WordPress will use another library to resize images, which may result in loss of EXIF information'), "<strong>","</strong>"); ?></p></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<?php $resizeDisabled = (! $this->view->data->resizeImages) ? 'disabled' : '';
|
||||
// @todo Inline styling here can be decluttered.
|
||||
?>
|
||||
<th scope="row"><?php esc_html_e('Resize large images','shortpixel-image-optimiser');?></th>
|
||||
<td>
|
||||
|
||||
<div class='switch_button'>
|
||||
<label>
|
||||
<input type="checkbox" class="switch" name="resizeImages" id='resize' value="1" <?php checked($view->data->resizeImages, true);?>>
|
||||
<div class="the_switch"> </div>
|
||||
<?php esc_html_e('to maximum','shortpixel-image-optimiser') ?>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<input type="number" min="1" max="20000" name="resizeWidth" id="width" style="width:80px" class="resize-sizes"
|
||||
value="<?php echo esc_attr( $view->data->resizeWidth > 0 ? $view->data->resizeWidth : min(1200, $view->minSizes['width']) );?>" <?php echo esc_attr( $resizeDisabled );?>/> <?php
|
||||
esc_html_e('pixels wide ×','shortpixel-image-optimiser');?>
|
||||
|
||||
<input type="number" min="1" max="20000" name="resizeHeight" id="height" class="resize-sizes" style="width:80px"
|
||||
value="<?php echo esc_attr( $view->data->resizeHeight > 0 ? $view->data->resizeHeight : min(1200, $view->minSizes['height']) );?>" <?php echo esc_attr( $resizeDisabled );?>/> <?php
|
||||
esc_html_e('pixels high (preserves the original aspect ratio and doesn\'t crop the image)','shortpixel-image-optimiser');?>
|
||||
|
||||
<input type="hidden" id="min-resizeWidth" value="<?php echo esc_attr($view->minSizes['width']);?>" data-nicename="<?php esc_html_e('Width', 'shortpixel-image-optimiser'); ?>" />
|
||||
|
||||
<input type="hidden" id="min-resizeHeight" value="<?php echo esc_attr($view->minSizes['height']);?>" data-nicename="<?php esc_html_e('Height', 'shortpixel-image-optimiser'); ?>"/>
|
||||
|
||||
<p class="settings-info">
|
||||
<?php esc_html_e('Recommended for large photos, like the ones taken with your phone. Saved space can go up to 80% or more after resizing. Please note that this option does not prevent thumbnails from being created that should be larger than the selected dimensions, but these thumbnails will also be resized to the dimensions selected here.','shortpixel-image-optimiser');?>
|
||||
|
||||
|
||||
</p>
|
||||
<?php if(false) { ?>
|
||||
<div style="margin-top: 10px;">
|
||||
<input type="radio" name="resizeType" id="resize_type_outer" value="outer" <?php echo($view->data->resizeType == 'inner' ? '' : 'checked') ?> style="margin: -50px 10px 60px 0;">
|
||||
<img alt="<?php esc_html_e('Resize outer','shortpixel-image-optimiser'); ?>" src="<?php echo esc_url(wpSPIO()->plugin_url('res/img/resize-outer.png' ));?>"
|
||||
srcset='<?php echo esc_url(wpSPIO()->plugin_url('res/img/resize-outer.png' ));?> 1x, <?php echo esc_url(wpSPIO()->plugin_url('res/img/resize-outer@2x.png' ));?> 2x'
|
||||
title="<?php esc_html_e('Sizes will be greater or equal to the corresponding value. For example, if you set the resize dimensions at 1000x1200, an image of 2000x3000px will be resized to 1000x1500px while an image of 3000x2000px will be resized to 1800x1200px','shortpixel-image-optimiser');?>">
|
||||
<input type="radio" name="resizeType" id="resize_type_inner" value="inner" <?php echo esc_attr($view->data->resizeType == 'inner' ? 'checked' : '') ?> style="margin: -50px 10px 60px 35px;">
|
||||
<img alt="<?php esc_html_e('Resize inner','shortpixel-image-optimiser'); ?>" src="<?php echo esc_url(wpSPIO()->plugin_url('res/img/resize-inner.png' ));?>"
|
||||
srcset='<?php echo esc_url(wpSPIO()->plugin_url('res/img/resize-inner.png' ));?> 1x, <?php echo esc_url(wpSPIO()->plugin_url('res/img/resize-inner@2x.png' ));?> 2x'
|
||||
title="<?php esc_html_e('Sizes will be smaller or equal to the corresponding value. For example, if you set the resize dimensions at 1000x1200, an image of 2000x3000px will be resized to 800x1200px while an image of 3000x2000px will be resized to 1000x667px','shortpixel-image-optimiser');?>">
|
||||
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<style>
|
||||
.presentation-wrap {
|
||||
padding: 10px;
|
||||
text-align: center;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
width: 600px;
|
||||
}
|
||||
@media(max-width: 1280px) {
|
||||
.presentation-wrap {
|
||||
width: 460px;
|
||||
}
|
||||
}
|
||||
@media(max-width: 1140px) {
|
||||
.presentation-wrap {
|
||||
width: 320px;
|
||||
}
|
||||
}
|
||||
.presentation-wrap img {
|
||||
margin-auto;
|
||||
}
|
||||
.spai-resize-frame {
|
||||
position: absolute;
|
||||
border: 2px dashed #fd1d1d;
|
||||
}
|
||||
.spai-resize-frame:after {
|
||||
font-size: 10px;
|
||||
font-weight: bold;
|
||||
position: absolute;
|
||||
bottom: -15px;
|
||||
right: 0;
|
||||
color: red;
|
||||
}
|
||||
.resize-options-wrap {
|
||||
margin: 10px 20px 0 20px;
|
||||
float: left;
|
||||
}
|
||||
.resize-type-wrap label {
|
||||
display: inline-block;
|
||||
padding: 15px 0 0 0;
|
||||
}
|
||||
</style>
|
||||
<div class="resize-type-wrap" <?php echo( $view->data->resizeImages ? '' : 'style="display:none;"' );?>>
|
||||
<div class="resize-options-wrap">
|
||||
<label title="<?php esc_html_e('Sizes will be greater or equal to the corresponding value. For example, if you set the resize dimensions at 1000x1200, an image of 2000x3000px will be resized to 1000x1500px while an image of 3000x2000px will be resized to 1800x1200px','shortpixel-image-optimiser');?>">
|
||||
<input type="radio" name="resizeType" id="resize_type_outer" value="outer" <?= $view->data->resizeType == 'inner' ? '' : 'checked'; ?>>
|
||||
<?= esc_html__( 'Cover', 'shortpixel-image-optimiser' ); ?>
|
||||
</label><br>
|
||||
<label title="<?php esc_html_e('Sizes will be smaller or equal to the corresponding value. For example, if you set the resize dimensions at 1000x1200, an image of 2000x3000px will be resized to 800x1200px while an image of 3000x2000px will be resized to 1000x667px','shortpixel-image-optimiser');?>">
|
||||
<input type="radio" name="resizeType" id="resize_type_inner" value="inner" <?= $view->data->resizeType == 'inner' ? 'checked' : ''; ?>>
|
||||
<?= esc_html__( 'Contain', 'shortpixel-image-optimiser' ); ?>
|
||||
</label><br>
|
||||
<div style="display:inline-block;margin-top: 15px;"><a href="https://shortpixel.com/knowledge-base/article/208-can-shortpixel-automatically-resize-new-image-uploads" class="shortpixel-help-link" target="_blank">
|
||||
|
||||
<span class="dashicons dashicons-editor-help"></span><?php esc_html_e('What is this?','shortpixel-image-optimiser');?></a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<?php
|
||||
$resize_width = (int) ( $view->data->resizeWidth > 0 ? $view->data->resizeWidth : min( 1200, $view->minSizes[ 'width' ] ) );
|
||||
$resize_height = (int) ( $view->data->resizeHeight > 0 ? $view->data->resizeHeight : min( 1200, $view->minSizes[ 'height' ] ) );
|
||||
$ratio = $resize_height / $resize_width;
|
||||
|
||||
$frame_style = 'padding-top:' . round( ( $ratio < 1.5 ? ( $ratio < 0.5 ? 0.5 : $ratio ) : 1.5 ) * 100, 0 ) . '%;';
|
||||
|
||||
$image_size = getimagesize( wpSPIO()->plugin_path( 'res/img/resize-type.png' ) );
|
||||
?>
|
||||
<div class="presentation-wrap">
|
||||
<div class="spai-resize-frame"></div>
|
||||
<img class="spai-resize-img" src="<?php echo esc_url(wpSPIO()->plugin_url('res/img/resize-type.png'));?>" data-width="300" data-height="160"
|
||||
srcset="<?php echo esc_url(wpSPIO()->plugin_url('res/img/resize-type@2x.png'));?> 2x" alt="">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
<?php } ?>
|
||||
<p class="submit">
|
||||
<input type="submit" name="save" id="save" class="button button-primary" title="<?php esc_attr_e('Save Changes','shortpixel-image-optimiser');?>" value="<?php esc_attr_e('Save Changes','shortpixel-image-optimiser');?>">
|
||||
<input type="submit" name="save_bulk" id="bulk" class="button button-primary" title="<?php esc_attr_e('Save and go to the Bulk Processing page','shortpixel-image-optimiser');?>" value="<?php esc_attr_e('Save and Go to Bulk Process','shortpixel-image-optimiser');?>">
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</section>
|
@ -0,0 +1,144 @@
|
||||
<?php
|
||||
namespace ShortPixel;
|
||||
use ShortPixel\Notices\NoticeController as Notice;
|
||||
use ShortPixel\ShortPixelLogger\ShortPixelLogger as Log;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
$canValidate = false;
|
||||
// Several conditions for showing API key.
|
||||
if ($this->hide_api_key)
|
||||
$showApiKey = false;
|
||||
elseif($this->is_multisite && $this->is_constant_key)
|
||||
$showApiKey = false;
|
||||
else {
|
||||
$showApiKey = true; // is_mainsite, multisite, no constant.
|
||||
}
|
||||
|
||||
$editApiKey = (! $this->is_constant_key && $showApiKey) ? true : false;
|
||||
|
||||
// Notices for fringe cases
|
||||
if (! $this->is_verifiedkey && $this->hide_api_key && ! $this->is_constant_key)
|
||||
{
|
||||
Notice::addError(__('wp-config.php is hiding the API key, but no API key was found. Remove the constant, or define the SHORTPIXEL_API_KEY constant as well', 'shortpixel-image-optimiser'));
|
||||
}
|
||||
elseif ($this->is_constant_key && ! $this->is_verifiedkey)
|
||||
{
|
||||
$dkey = ($this->hide_api_key) ? '' : '(' . SHORTPIXEL_API_KEY. ')';
|
||||
Notice::addError(sprintf(__('Constant API Key is not verified. Please check if this is a valid API key %s'),$dkey));
|
||||
}
|
||||
|
||||
$adminEmail = get_bloginfo('admin_email');
|
||||
|
||||
?>
|
||||
<section id="tab-settings" class="sel-tab" >
|
||||
<h2><a class='tab-link' href='javascript:void(0);' data-id="tab-settings">
|
||||
<?php esc_html_e('Join ShortPixel','shortpixel-image-optimiser');?></a>
|
||||
</h2>
|
||||
<div class="wp-shortpixel-options wp-shortpixel-tab-content">
|
||||
<?php if($showApiKey): ?>
|
||||
<!-- // @todo Inline CSS on whole page-->
|
||||
<h3><?php esc_html_e('Request an API Key:','shortpixel-image-optimiser');?></h3>
|
||||
<p style='font-size: 14px'><?php esc_html_e('If you don\'t have an API Key, you can request one for free. Just press the "Request Key" button after checking that the e-mail is correct.','shortpixel-image-optimiser');?></p>
|
||||
|
||||
<table class="form-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row"><label for="key"><?php esc_html_e('E-mail address:','shortpixel-image-optimiser');?></label></th>
|
||||
<td>
|
||||
<form method="POST" action="<?php echo esc_url(add_query_arg(array('noheader' => 'true', 'sp-action' => 'action_request_new_key'))) ?>"
|
||||
id="shortpixel-form-request-key">
|
||||
<?php wp_nonce_field($this->form_action, 'sp-nonce'); ?>
|
||||
|
||||
|
||||
<input name="pluginemail" type="text" id="pluginemail" value="<?php echo esc_attr( sanitize_email($adminEmail) );?>"
|
||||
class="regular-text">
|
||||
|
||||
<span class="spinner" id="pluginemail_spinner" style="float:none;"></span>
|
||||
|
||||
<button type="submit" id="request_key" class="button button-primary" title="<?php esc_html_e('Request a new API key','shortpixel-image-optimiser');?>"
|
||||
href="https://shortpixel.com/free-sign-up?pluginemail=<?php echo esc_attr( esc_url($adminEmail) );?>">
|
||||
<?php esc_html_e('Request Key','shortpixel-image-optimiser');?>
|
||||
</button>
|
||||
<p class="settings-info shortpixel-settings-error" style='display:none;' id='pluginemail-error'>
|
||||
<b><?php esc_html_e('Please provide a valid e-mail address.', 'shortpixel-image-optimiser');?></b>
|
||||
</p>
|
||||
<p class="settings-info" id='pluginemail-info'>
|
||||
<?php if($adminEmail) {
|
||||
printf(esc_html__('%s %s %s is the e-mail address in your WordPress Settings. You can use it, or change it to any valid e-mail address that you own.','shortpixel-image-optimiser'), '<b>', esc_html(sanitize_email($adminEmail)), '</b>');
|
||||
} else {
|
||||
esc_html_e('Please input your e-mail address and press the Request Key button.','shortpixel-image-optimiser');
|
||||
}
|
||||
?><p><span style="position:relative;">
|
||||
<input name="tos" type="checkbox" id="tos">
|
||||
<img id="tos-robo" alt="<?php esc_html_e('ShortPixel logo', 'shortpixel-image-optimiser'); ?>"
|
||||
src="<?php echo esc_url(wpSPIO()->plugin_url('res/img/slider.png' ));?>" style="position: absolute;left: -95px;bottom: -26px;display:none;">
|
||||
<img id="tos-hand" alt="<?php esc_html_e('Hand pointing', 'shortpixel-image-optimiser'); ?>"
|
||||
src="<?php echo esc_url(wpSPIO()->plugin_url('res/img/point.png' ));?>" style="position: absolute;left: -39px;bottom: -9px;display:none;">
|
||||
</span>
|
||||
<label for="tos"><?php printf(esc_html__('I have read and I agree to the %s Terms of Service %s and the %s Privacy Policy %s (%s GDPR compliant %s).','shortpixel-image-optimiser'), '<a href="https://shortpixel.com/tos" target="_blank">', '</a>', '<a href="https://shortpixel.com/privacy" target="_blank">', '</a>', '<a href="https://shortpixel.com/privacy#gdpr" target="_blank">', '</a>');
|
||||
?> </label></p>
|
||||
</p>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php endif; ?>
|
||||
<h3>
|
||||
<?php esc_html_e('Already have an API Key:','shortpixel-image-optimiser');?>
|
||||
</h3>
|
||||
<p style='font-size: 14px'>
|
||||
<?php esc_html_e('If you already have an API Key please input it below and press Validate.','shortpixel-image-optimiser');?>
|
||||
</p>
|
||||
|
||||
<form method="POST" action="<?php echo esc_url(add_query_arg(array('noheader' => 'true', 'sp-action' => 'action_addkey'))) ?>"
|
||||
id="shortpixel-form-nokey">
|
||||
<?php wp_nonce_field($this->form_action, 'sp-nonce'); ?>
|
||||
|
||||
<table class="form-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row"><label for="key"><?php esc_html_e('API Key:','shortpixel-image-optimiser');?></label></th>
|
||||
<td>
|
||||
<?php
|
||||
if($showApiKey) {
|
||||
|
||||
if (! $this->is_constant_key)
|
||||
$canValidate = true;
|
||||
|
||||
?>
|
||||
<input name="key" type="text" id="key" value="<?php echo esc_attr( $view->data->apiKey );?>"
|
||||
class="regular-text" <?php echo($editApiKey ? "" : 'disabled') ?> >
|
||||
<?php
|
||||
}
|
||||
elseif(defined("SHORTPIXEL_API_KEY")) {
|
||||
$canValidate = true;?>
|
||||
<input name="key" type="text" id="key" disabled="true" placeholder="<?php
|
||||
if( $this->hide_api_key ) {
|
||||
echo esc_html("********************");
|
||||
} else {
|
||||
esc_html_e('Multisite API Key','shortpixel-image-optimiser');
|
||||
}
|
||||
?>" class="regular-text">
|
||||
<?php } ?>
|
||||
<input type="hidden" name="validate" id="valid" value="validate"/>
|
||||
<span class="spinner" id="pluginemail_spinner" style="float:none;"></span>
|
||||
<button type="submit" id="validate" class="button button-primary" title="<?php esc_html_e('Validate the provided API key','shortpixel-image-optimiser');?>"
|
||||
>
|
||||
<?php esc_html_e('Validate','shortpixel-image-optimiser');?>
|
||||
</button>
|
||||
|
||||
<?php if($this->is_constant_key) { ?>
|
||||
<p class="settings-info"><?php esc_html_e('Key defined in wp-config.php.','shortpixel-image-optimiser');?></p>
|
||||
<?php } ?>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
</div> <!-- tab content -->
|
||||
</section>
|
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
namespace ShortPixel;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
$total_circle = 289.027;
|
||||
$total =round($view->averageCompression);
|
||||
|
||||
if( $total >0 ) {
|
||||
$total_circle = round($total_circle-($total_circle * $total /100));
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<div class="sp-bulk-summary">
|
||||
<span><?php esc_html_e('Average optimization', 'shortpixel-image-optimiser'); ?></span><br>
|
||||
<a title="<?php esc_html_e('Average optimization', 'shortpixel-image-optimiser'); ?>">
|
||||
<svg class="opt-circle-average" viewBox="-10 0 120 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="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: <?php echo esc_html($total_circle) ?>">
|
||||
</path>
|
||||
<text class="text" x="52" y="55"><?php echo esc_html($total) ?>%</text>
|
||||
</svg>
|
||||
</a>
|
||||
|
||||
</div>
|
@ -0,0 +1,171 @@
|
||||
<?php
|
||||
namespace ShortPixel;
|
||||
use \ShortPixel\Controller\BulkController as BulkController;
|
||||
use \ShortPixel\Helper\UiHelper as UiHelper;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
$url = esc_url_raw(remove_query_arg('part'));
|
||||
|
||||
$bulk = BulkController::getInstance();
|
||||
$queueRunning = $bulk->isAnyBulkRunning();
|
||||
|
||||
?>
|
||||
|
||||
<section id="tab-tools" class="clearfix <?php echo ($this->display_part == 'tools') ? ' sel-tab ' :''; ?> ">
|
||||
<h2><a class='tab-link' href='javascript:void(0);' data-id="tab-tools"><?php esc_html_e('Tools','shortpixel-image-optimiser');?></a></h2>
|
||||
|
||||
|
||||
<p><?php printf(esc_html__('The tools provided below are designed to make bulk changes to your image and optimization data. Therefore, it is %s very important %s that you back up your entire website before running them. ', 'shortpixel-image-optimiser'), '<b>', '</b>'); ?></p>
|
||||
|
||||
<div class='wp-shortpixel-options wp-shortpixel-tab-content'>
|
||||
|
||||
|
||||
|
||||
<?php if ($queueRunning === true): ?>
|
||||
<div class='option'>
|
||||
<div class='name'> </div>
|
||||
|
||||
<div class='field action queue-warning'>
|
||||
<?php esc_html_e('It looks like a bulk process is still active. Please note that bulk actions will reset running bulk processes. ', 'shortpixel-image-optimiser'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<div class='option'>
|
||||
<div class='name'><?php esc_html_e('Migrate data', 'shortpixel-image-optimiser'); ?></div>
|
||||
<div class='field'>
|
||||
<div class='option-content'>
|
||||
<div class="spio-inline-help"><span class="dashicons dashicons-editor-help" title="Click for more info" data-link="https://shortpixel.com/knowledge-base/article/539-spio-5-tells-me-to-convert-legacy-data-what-is-this">
|
||||
</span></div>
|
||||
<a href="<?php echo esc_url(add_query_arg(array('sp-action' => 'action_debug_redirectBulk', 'bulk' => 'migrate', 'noheader' => true), $url)); ?>" class="button">
|
||||
<?php esc_html_e('Search and Migrate All', 'shortpixel-image-optimiser'); ?>
|
||||
</a>
|
||||
</div>
|
||||
<p class='settings-info'><?php printf(esc_html__('ShortPixel Image Optimizer version 5.0 brings a new format for saving the image optimization information. If you have upgraded from a version prior to version 5.0, you may want to convert all your image data to the new format. This conversion will speed up the plugin and ensure that all data is preserved. %s Check your image data after doing the conversion! %s', 'shortpixel-image-optimiser'), '<br><b>', '</b>') ?> </p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class='option'>
|
||||
<div class='name'><?php esc_html_e('Clear Queue','shortpixel-image-optimiser'); ?></div>
|
||||
<div class='field'>
|
||||
|
||||
<a href="<?php echo esc_url(add_query_arg(array('sp-action' => 'action_debug_resetQueue', 'queue' => 'all', 'part' => 'tools', 'noheader' => true), $url)); ?>" class="button"><?php esc_html_e('Clear the Queue','shortpixel-image-optimiser'); ?></a>
|
||||
<p class='settings-info'><?php esc_html_e('Removes all items currently waiting or being processed from all queues. This stops all optimization processes in the entire installation.', 'shortpixel-image-optimiser'); ?> </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='option'>
|
||||
<div class='name'><?php esc_html_e('Clear Optimization Errors','shortpixel-image-optimiser'); ?></div>
|
||||
<div class='field'>
|
||||
|
||||
<a href="<?php echo esc_url(add_query_arg(array('sp-action' => 'action_debug_removePrevented', 'queue' => 'all', 'part' => 'tools', 'noheader' => true), $url)); ?>" class="button"><?php esc_html_e('Clear Optimization Errors','shortpixel-image-optimiser'); ?></a>
|
||||
<p class='settings-info'><?php printf(esc_html__('Removes the blocks from the items where the optimization failed for some reason. This usually happens when the plugin is not able to save the backups. %sImportant!%s The cause of the error should be fixed, otherwise data corruption may occur.','shortpixel-image-optimiser') , '<b>','</b>'); ?> </p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr />
|
||||
|
||||
<div class='danger-zone'>
|
||||
<h3><?php esc_html_e('Danger Zone - please read carefully!', 'shortpixel-image-optimiser'); ?></h3>
|
||||
<p><?php printf(esc_html__('The following actions are related to cleaning up and uninstalling the plugin. %s They cannot be undone %s. It is important that you create a new backup copy before performing any of these actions, as this may result in data loss.', 'shortpixel-image-optimiser'), '<strong>', '</strong>'); ?></p>
|
||||
<hr />
|
||||
|
||||
|
||||
<div class='option'>
|
||||
<div class='name'>Remove data</div>
|
||||
<div class='field'>
|
||||
<div class="option-content">
|
||||
<a href="<?php echo esc_url(add_query_arg(array('sp-action' => 'action_debug_redirectBulk', 'bulk' => 'restore', 'noheader' => true), $url)) ?>" class="button danger">Bulk Restore</a>
|
||||
|
||||
<div class="spio-inline-help"><span class="dashicons dashicons-editor-help" title="Click for more info" data-link="https://shortpixel.com/knowledge-base/article/14-can-i-restore-my-images-what-happens-with-the-originals"></span></div>
|
||||
</div>
|
||||
<p class='settings-info'><?php printf(esc_html__('%sUndoes%s all optimizations and restores all your backed-up images to their original state. Credits used will not be refunded and you will have to optimize your images again.', 'shortpixel-image-optimiser'), '<b>','</b>'); ?></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='option'>
|
||||
<div class='name'> </div>
|
||||
<div class='field'>
|
||||
<a href="<?php echo esc_url(add_query_arg(array('sp-action' => 'action_debug_redirectBulk', 'bulk' => 'removeLegacy', 'noheader' => true), $url)); ?>" class="button danger">Remove Legacy Data</a>
|
||||
|
||||
<p class='settings-info'><?php printf(esc_html__('%sRemoves Legacy Data%s (the old format for storing image optimization information in the database, which was used before version 5). This may result in data loss. It is not recommended to do this manually.', 'shortpixel-image-optimiser'), '<b>','</b>'); ?></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='option'>
|
||||
<div class='name'> </div>
|
||||
<div class='field'>
|
||||
<div class="option-content">
|
||||
<button type="button" class='button danger' data-action="open-modal" data-target="ToolsRemoveAll">
|
||||
<?php esc_html_e('Remove all ShortPixel Data', 'shortpixel-image-optimiser'); ?></button>
|
||||
|
||||
<div class="spio-inline-help"><span class="dashicons dashicons-editor-help" title="Click for more info" data-link="https://shortpixel.com/knowledge-base/article/81-remove-all-the-shortpixel-related-data-on-a-wp-website"></span></div>
|
||||
</div>
|
||||
<div class='remove-all modalTarget' id="ToolsRemoveAll">
|
||||
|
||||
<input type="hidden" name="screen_action" value="toolsRemoveAll" />
|
||||
<?php wp_nonce_field('remove-all', 'tools-nonce'); ?>
|
||||
|
||||
<p> </p>
|
||||
<p><?php esc_html_e('This will remove all ShortPixel Data including data about optimization and image backups.', 'shortpixel-image-optimiser'); ?></p>
|
||||
<?php esc_html_e('Type confirm to delete all ShortPixel data', 'shortpixel-image-optimiser'); ?>
|
||||
<input type="text" name="confirm" value="" data-required='confirm' />
|
||||
|
||||
<p><b><?php esc_html_e('I understand that all ShortPixel data will be removed.','shortpixel-image-optimiser'); ?></b></p>
|
||||
|
||||
<button type="button" class='button modal-send' name="uninstall" data-action='ajaxrequest'><?php esc_html_e('Remove all data', 'shortpixel-image-optimiser'); ?></button>
|
||||
|
||||
</div> <!-- modal -->
|
||||
<p class='settings-info'><?php printf(esc_html__('%sRemoves all ShortPixel data (including backups) %s and deactivates the plugin. Your images will not be changed (the optimized images will remain), but the next time ShortPixel is activated, it will no longer recognize previous optimizations.', 'shortpixel-image-optimiser'), '<b>','</b>'); ?></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="option">
|
||||
<div class='name'> </div>
|
||||
<div class='field'>
|
||||
<div class="backup-modal">
|
||||
<?php wp_nonce_field('empty-backup', 'tools-nonce'); ?>
|
||||
|
||||
<div class="option-content">
|
||||
<button type="button" class='button danger' data-action="open-modal" data-target="ToolsRemoveBackup">
|
||||
<?php esc_html_e('Remove backups', 'shortpixel-image-optimiser'); ?></button>
|
||||
|
||||
<div class="spio-inline-help"><span class="dashicons dashicons-editor-help" title="Click for more info" data-link="https://shortpixel.com/knowledge-base/article/83-how-to-remove-the-backed-up-images-in-wordpress"></span></div>
|
||||
|
||||
</div>
|
||||
<div class='remove-backup modalTarget' id="ToolsRemoveBackup">
|
||||
|
||||
<input type="hidden" name="screen_action" value="toolsRemoveBackup" />
|
||||
<?php wp_nonce_field('empty-backup', 'tools-nonce'); ?>
|
||||
|
||||
<p> </p>
|
||||
<p><?php esc_html_e('This will delete all the backup images. You won\'t be able to restore from backup or to reoptimize with different settings if you delete the backups.', 'shortpixel-image-optimiser'); ?></p>
|
||||
<?php esc_html_e('Type confirm to delete all ShortPixel backups', 'shortpixel-image-optimiser'); ?>
|
||||
<input type="text" name="confirm" value="" data-required='confirm' />
|
||||
|
||||
<p><b><?php esc_html_e('I understand that all Backups will be removed.','shortpixel-image-optimiser'); ?> </b></p>
|
||||
|
||||
<p class='center'>
|
||||
<button type="button" class='button modal-send' name="removebackups" data-action='ajaxrequest'><?php esc_html_e('Remove backups', 'shortpixel-image-optimiser'); ?></button>
|
||||
</p>
|
||||
</div>
|
||||
</div> <!-- backup modal -->
|
||||
|
||||
<p class='settings-info'><?php esc_html_e('When backups are enabled, original images are stored in a backup folder. If you remove the backup folder, you will not be able to restore or reoptimize the images. We strongly recommend that you keep a copy of the backup folder (/wp-content/uploads/ShortpixelBackups/) somewhere safe.','shortpixel-image-optimiser');?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div> <!-- danger zone -->
|
||||
</div> <!-- options tab content -->
|
||||
</section>
|
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
namespace ShortPixel;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
$bool = apply_filters('shortpixel/settings/no_banner', true);
|
||||
if (! $bool )
|
||||
return;
|
||||
|
||||
if ( defined('SHORTPIXEL_NO_BANNER') && SHORTPIXEL_NO_BANNER == true)
|
||||
return;
|
||||
|
||||
?>
|
||||
|
||||
<section class='wso banner'>
|
||||
<span class="image">
|
||||
<a href="https://fastpixel.io/?utm_source=SPIO" target="_blank">
|
||||
<img src="<?php echo \wpSPIO()->plugin_url() ?>res/img/fastpixel-logo.svg" />
|
||||
</a>
|
||||
</span>
|
||||
<span class="line"><h3>
|
||||
<?php printf(__('FAST%sPIXEL%s - the new website accelerator plugin from ShortPixel', 'shortpixel-image-optimiser'), '<span class="red">','</span>'); ?>
|
||||
</h3>
|
||||
</span>
|
||||
<!-- <span class="line"><h3>
|
||||
<?php printf(__('ALLOW ShortPixel SPECIALISTS TO %s FIND THE SOLUTION FOR YOU.', 'shortpixel-image-optimiser'), '<br>'); ?>
|
||||
</h3>
|
||||
</span> -->
|
||||
<span class="button-wrap">
|
||||
<a href="https://fastpixel.io/?utm_source=SPIO" target="_blank" class='button' ><?php _e('TRY NOW!', 'shortpixel-image-optimiser'); ?></a>
|
||||
</span>
|
||||
</section>
|
@ -0,0 +1,360 @@
|
||||
<?php
|
||||
namespace ShortPixel;
|
||||
use ShortPixel\ShortPixelLogger\ShortPixelLogger as Log;
|
||||
use ShortPixel\Controller\ApiKeyController as ApiKeyController;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
/**
|
||||
* User: simon
|
||||
* Date: 11.04.2018
|
||||
* @todo This whole thing needs redoing.
|
||||
*/
|
||||
class ShortPixelFeedback {
|
||||
|
||||
private $key;
|
||||
private $ctrl;
|
||||
private $plugin_file = '';
|
||||
private $plugin_name = '';
|
||||
|
||||
function __construct( $_plugin_file, $slug) {
|
||||
|
||||
$this->plugin_file = $_plugin_file;
|
||||
$this->plugin_name = $slug; //for translations
|
||||
|
||||
$apiControl = ApiKeyController::getInstance();
|
||||
$this->key = $apiControl->forceGetApiKey();
|
||||
|
||||
// Skip the feedback when constant.
|
||||
if (defined('SHORTPIXEL_SKIP_FEEDBACK') && true == SHORTPIXEL_SKIP_FEEDBACK)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// Deactivation
|
||||
add_filter( 'plugin_action_links_' . plugin_basename( $this->plugin_file ), array( $this, 'filterActionLinks') );
|
||||
add_filter('network_admin_plugin_action_links_' . plugin_basename( $this->plugin_file ), array( $this, 'filterActionLinks'));
|
||||
add_action( 'admin_footer-plugins.php', array( $this, 'goodbyeAjax') );
|
||||
add_action( 'wp_ajax_shortpixel_deactivate_plugin', array( $this, 'deactivatePluginCallback') );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the deactivation link to allow us to present a form when the user deactivates the plugin
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function filterActionLinks( $links ) {
|
||||
|
||||
if( isset( $links['deactivate'] ) ) {
|
||||
|
||||
$deactivation_link = $links['deactivate'];
|
||||
// Insert an onClick action to allow form before deactivating
|
||||
$deactivation_link = str_replace( '<a ',
|
||||
'<div class="shortpixel-deactivate-form-wrapper">
|
||||
<span class="shortpixel-deactivate-form" id="shortpixel-deactivate-form-' . esc_attr( $this->plugin_name ) . '"></span>
|
||||
</div><a id="shortpixel-deactivate-link-' . esc_attr( $this->plugin_name ) . '" ', $deactivation_link );
|
||||
$links['deactivate'] = $deactivation_link;
|
||||
}
|
||||
return $links;
|
||||
}
|
||||
|
||||
/**
|
||||
* Form text strings
|
||||
* These can be filtered
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function goodbyeAjax() {
|
||||
// Get our strings for the form
|
||||
$form = $this->getFormInfo();
|
||||
|
||||
// Build the HTML to go in the form
|
||||
$html = '<div class="shortpixel-deactivate-form-head"><strong>' . esc_html( $form['heading'] ) . '</strong></div>';
|
||||
$html .= '<div class="shortpixel-deactivate-form-body">';
|
||||
if( is_array( $form['options'] ) ) {
|
||||
$html .= '<div class="shortpixel-deactivate-options">';
|
||||
$html .= '<p><strong>' . esc_html( $form['body'] ) . '</strong></p><p>';
|
||||
foreach( $form['options'] as $key => $option ) {
|
||||
$html .= '<input type="radio" name="shortpixel-deactivate-reason" id="' . esc_attr( $key ) . '" value="' . esc_attr( $key ) . '"> <label for="' . esc_attr( $key ) . '">' . esc_attr( $option ) . '</label><br>';
|
||||
}
|
||||
$html .= '</p><label id="shortpixel-deactivate-details-label" for="shortpixel-deactivate-reasons"><strong>' . esc_html( $form['details'] ) .'</strong></label><textarea name="shortpixel-deactivate-details" id="shortpixel-deactivate-details" rows="2" style="width:100%"></textarea>';
|
||||
$html .= '</div><!-- .shortpixel-deactivate-options -->';
|
||||
}
|
||||
$html .= '<hr/>';
|
||||
$html .= '<span title="' . __( 'Un-check this if you don\\\'t plan to use ShortPixel in the future on this website. You might also want to run a Bulk Delete SP Metadata before removing the plugin (Media Library -> Bulk ShortPixel).', 'shortpixel-image-optimiser' )
|
||||
. '">'
|
||||
. sprintf(__( 'If you want to completely uninstall ShortPIxel from your site, please go to %s Settings → ShortPixel → Tools %s.', 'shortpixel-image-optimiser' ),'<a href="' . esc_url(admin_url('/options-general.php?page=wp-shortpixel-settings&part=tools')) . '">', '</a>') . '</span><br>';
|
||||
$html .= '<hr/>';
|
||||
$html .= '</div><!-- .shortpixel-deactivate-form-body -->';
|
||||
$html .= '<p class="deactivating-spinner"><span class="spinner"></span> ' . __( 'Submitting form', 'shortpixel-image-optimiser' ) . '</p>';
|
||||
$html .= '<div class="shortpixel-deactivate-form-footer"><p>';
|
||||
$html .= '<label for="anonymous" title="'
|
||||
. __("If you UNCHECK this then your email address will be sent along with your feedback. This can be used by ShortPixel to get back to you for more info or a solution.",'shortpixel-image-optimiser')
|
||||
. '"><input type="checkbox" name="shortpixel-deactivate-tracking" checked="checked" id="anonymous" value="1"> ' . esc_html__( 'Send anonymous', 'shortpixel-image-optimiser' ) . '</label><br>';
|
||||
$html .= '<a id="shortpixel-deactivate-submit-form" class="button button-primary" href="#">'
|
||||
. __( '<span>Submit and </span>Deactivate', 'shortpixel-image-optimiser' )
|
||||
. '</a>';
|
||||
$html .= '</p></div>';
|
||||
?>
|
||||
<div class="shortpixel-deactivate-form-bg"></div>
|
||||
<style type="text/css">
|
||||
.shortpixel-deactivate-form-active .shortpixel-deactivate-form-bg {
|
||||
background: rgba( 0, 0, 0, .5 );
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.shortpixel-deactivate-form-wrapper {
|
||||
position: relative;
|
||||
z-index: 999;
|
||||
display: none;
|
||||
}
|
||||
.shortpixel-deactivate-form-active .shortpixel-deactivate-form-wrapper {
|
||||
display: block;
|
||||
}
|
||||
.shortpixel-deactivate-form {
|
||||
display: none;
|
||||
}
|
||||
.shortpixel-deactivate-form-active .shortpixel-deactivate-form {
|
||||
position: absolute;
|
||||
bottom: 30px;
|
||||
left: 0;
|
||||
max-width: 500px;
|
||||
min-width: 360px;
|
||||
background: #fff;
|
||||
white-space: normal;
|
||||
}
|
||||
.shortpixel-deactivate-form-head {
|
||||
background: #4bbfcc;
|
||||
color: #fff;
|
||||
padding: 8px 18px;
|
||||
}
|
||||
.shortpixel-deactivate-form-body {
|
||||
padding: 8px 18px 0;
|
||||
color: #444;
|
||||
}
|
||||
.shortpixel-deactivate-form-body label[for="shortpixel-remove-settings"] {
|
||||
font-weight: bold;
|
||||
}
|
||||
.deactivating-spinner {
|
||||
display: none;
|
||||
}
|
||||
.deactivating-spinner .spinner {
|
||||
float: none;
|
||||
margin: 4px 4px 0 18px;
|
||||
vertical-align: bottom;
|
||||
visibility: visible;
|
||||
}
|
||||
.shortpixel-deactivate-form-footer {
|
||||
padding: 0 18px 8px;
|
||||
}
|
||||
.shortpixel-deactivate-form-footer label[for="anonymous"] {
|
||||
visibility: hidden;
|
||||
}
|
||||
.shortpixel-deactivate-form-footer p {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin: 0;
|
||||
}
|
||||
#shortpixel-deactivate-submit-form span {
|
||||
display: none;
|
||||
}
|
||||
.shortpixel-deactivate-form.process-response .shortpixel-deactivate-form-body,
|
||||
.shortpixel-deactivate-form.process-response .shortpixel-deactivate-form-footer {
|
||||
position: relative;
|
||||
}
|
||||
.shortpixel-deactivate-form.process-response .shortpixel-deactivate-form-body:after,
|
||||
.shortpixel-deactivate-form.process-response .shortpixel-deactivate-form-footer:after {
|
||||
content: "";
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba( 255, 255, 255, .5 );
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
jQuery(document).ready(function($){
|
||||
var deactivateURL = $("#shortpixel-deactivate-link-<?php echo esc_attr( $this->plugin_name ); ?>"),
|
||||
formID = '#shortpixel-deactivate-form-<?php echo esc_attr( $this->plugin_name ); ?>',
|
||||
formContainer = $(formID),
|
||||
deactivated = true,
|
||||
detailsStrings = {
|
||||
'setup' : '<?php esc_html_e( 'What was the dificult part ?', 'shortpixel-image-optimiser') ?>',
|
||||
'docs' : '<?php esc_html_e( 'What can we describe more ?', 'shortpixel-image-optimiser' ) ?>',
|
||||
'features' : '<?php esc_html_e( 'How could we improve ?', 'shortpixel-image-optimiser' ) ?>',
|
||||
'better-plugin' : '<?php esc_html_e( 'Can you mention it ?', 'shortpixel-image-optimiser' ) ?>',
|
||||
'incompatibility' : '<?php esc_html_e( 'With what plugin or theme is incompatible ?', 'shortpixel-image-optimiser' ) ?>',
|
||||
'maintenance' : '<?php esc_html_e( 'Please specify', 'shortpixel-image-optimiser') ?>',
|
||||
'temporary' : '',
|
||||
};
|
||||
|
||||
$( deactivateURL).attr('onclick', "javascript:event.preventDefault();");
|
||||
$( deactivateURL ).on("click", function(){
|
||||
|
||||
var SubmitFeedback = function(data, formContainer){
|
||||
data['action'] = 'shortpixel_deactivate_plugin';
|
||||
data['security'] = '<?php echo sanitize_key(wp_create_nonce("shortpixel_deactivate_plugin" )); ?>';
|
||||
data['dataType'] = 'json';
|
||||
data['keep-settings'] = formContainer.find('#shortpixel-keep-settings:checked').length;
|
||||
|
||||
// As soon as we click, the body of the form should disappear
|
||||
formContainer.addClass( 'process-response' );
|
||||
|
||||
// Fade in spinner
|
||||
formContainer.find(".deactivating-spinner").fadeIn();
|
||||
|
||||
$.post(
|
||||
ajaxurl,
|
||||
data,
|
||||
function(response){
|
||||
// Redirect to original deactivation URL
|
||||
window.location.href = url;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// We'll send the user to this deactivation link when they've completed or dismissed the form
|
||||
var url = deactivateURL.attr( 'href' );
|
||||
|
||||
$('body').toggleClass('shortpixel-deactivate-form-active');
|
||||
formContainer.fadeIn({complete: function(){
|
||||
var offset = formContainer.offset();
|
||||
if( offset.top < 50) {
|
||||
$(this).parent().css('top', (50 - offset.top) + 'px')
|
||||
}
|
||||
$('html,body').animate({ scrollTop: Math.max(0, offset.top - 50) });
|
||||
}});
|
||||
formContainer.html( '<?php echo $html; ?>');
|
||||
|
||||
formContainer.on( 'change', 'input[type=radio]', function(){
|
||||
|
||||
var detailsLabel = formContainer.find( '#shortpixel-deactivate-details-label strong' ),
|
||||
anonymousLabel = formContainer.find( 'label[for="anonymous"]' )[0],
|
||||
submitSpan = formContainer.find( '#shortpixel-deactivate-submit-form span' )[0],
|
||||
value = formContainer.find( 'input[name="shortpixel-deactivate-reason"]:checked' ).val();
|
||||
commentBox = formContainer.find('textarea[name="shortpixel-deactivate-details"]');
|
||||
|
||||
// console.log(detailsLabel);
|
||||
// console.log(commentBox);
|
||||
var the_detail = detailsStrings[ value ];
|
||||
// console.log(the_detail);
|
||||
if (the_detail == '')
|
||||
{
|
||||
detailsLabel.css('visibility','hidden');
|
||||
commentBox.css('visibility','hidden');
|
||||
}
|
||||
else
|
||||
{
|
||||
detailsLabel.css('visibility','visible');
|
||||
commentBox.css('visibility','visible');
|
||||
|
||||
}
|
||||
|
||||
detailsLabel.text( the_detail );
|
||||
anonymousLabel.style.visibility = "visible";
|
||||
submitSpan.style.display = "inline-block";
|
||||
if(deactivated) {
|
||||
deactivated = false;
|
||||
$('#shortpixel-deactivate-submit-form').removeAttr("disabled");
|
||||
formContainer.off('click', '#shortpixel-deactivate-submit-form');
|
||||
formContainer.on('click', '#shortpixel-deactivate-submit-form', function(e){
|
||||
e.preventDefault();
|
||||
var data = {
|
||||
reason: formContainer.find('input[name="shortpixel-deactivate-reason"]:checked').val(),
|
||||
details: formContainer.find('#shortpixel-deactivate-details').val()
|
||||
//anonymous: formContainer.find('#anonymous:checked').length,
|
||||
};
|
||||
if (formContainer.find('#anonymous').is(':checked'))
|
||||
data['anonymous'] = 1;
|
||||
else
|
||||
data['anonymous'] = 0;
|
||||
|
||||
SubmitFeedback(data, formContainer);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
formContainer.on('click', '#shortpixel-deactivate-submit-form', function(e){
|
||||
e.preventDefault();
|
||||
// if( formContainer.find('#shortpixel-keep-settings:checked').length ) {
|
||||
window.location.href = url;
|
||||
/* } else {
|
||||
SubmitFeedback({}, formContainer);
|
||||
} */
|
||||
});
|
||||
|
||||
// If we click outside the form, the form will close
|
||||
$('.shortpixel-deactivate-form-bg').on('click',function(){
|
||||
formContainer.fadeOut();
|
||||
$('body').removeClass('shortpixel-deactivate-form-active');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
<?php }
|
||||
|
||||
/*
|
||||
* Form text strings
|
||||
* These are non-filterable and used as fallback in case filtered strings aren't set correctly
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getFormInfo() {
|
||||
$form = array();
|
||||
$form['heading'] = __( 'Sorry to see you go', 'shortpixel-image-optimiser' );
|
||||
$form['body'] = __( 'Before you deactivate the plugin, would you quickly give us your reason for doing so?', 'shortpixel-image-optimiser' );
|
||||
$form['options'] = array(
|
||||
'temporary' => __('Temporary deactivation', 'shortpixel-image-optimiser'),
|
||||
'setup' => __( 'Set up is too difficult', 'shortpixel-image-optimiser' ),
|
||||
'docs' => __( 'Lack of documentation', 'shortpixel-image-optimiser' ),
|
||||
'features' => __( 'Not the features I wanted', 'shortpixel-image-optimiser' ),
|
||||
'better-plugin' => __( 'Found a better plugin', 'shortpixel-image-optimiser' ),
|
||||
'incompatibility' => __( 'Incompatible with theme or plugin', 'shortpixel-image-optimiser' ),
|
||||
'maintenance' => __( 'Other', 'shortpixel-image-optimiser' ),
|
||||
);
|
||||
$form['details'] = __( 'How could we improve ?', 'shortpixel-image-optimiser');
|
||||
return $form;
|
||||
}
|
||||
|
||||
public function deactivatePluginCallback() {
|
||||
|
||||
check_ajax_referer( 'shortpixel_deactivate_plugin', 'security' );
|
||||
|
||||
|
||||
Log::addDebug('Deactive Plugin Callback POST', $_POST);
|
||||
|
||||
if ( isset($_POST['reason']) && isset($_POST['details']) && isset($_POST['anonymous']) ) {
|
||||
require_once(\WPSPIO()->plugin_path() . 'class/view/shortpixel-plugin-request.php');
|
||||
$anonymous = (intval($_POST['anonymous']) == 1) ? true : false;
|
||||
$args = array(
|
||||
'key' => $this->key,
|
||||
'reason' => sanitize_text_field(wp_unslash($_POST['reason'])),
|
||||
'details' => sanitize_text_field(wp_unslash($_POST['details'])),
|
||||
'anonymous' => $anonymous
|
||||
);
|
||||
$request = new ShortPixelPluginRequest( $this->plugin_file, 'http://' . SHORTPIXEL_API . '/v2/feedback.php', $args );
|
||||
if ( $request->request_successful ) {
|
||||
echo json_encode( array(
|
||||
'status' => 'ok',
|
||||
) );
|
||||
}else{
|
||||
echo json_encode( array(
|
||||
'status' => 'nok',
|
||||
) );
|
||||
}
|
||||
}else{
|
||||
echo json_encode( array(
|
||||
'status' => 'OK',
|
||||
) );
|
||||
}
|
||||
|
||||
die();
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,225 @@
|
||||
<?php
|
||||
namespace ShortPixel;
|
||||
use ShortPixel\ShortPixelLogger\ShortPixelLogger as Log;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
/**
|
||||
* User: simon
|
||||
* Date: 11.04.2018
|
||||
*/
|
||||
// @todo This is used by feedback. Should be replaced a some point.
|
||||
class ShortPixelPluginRequest {
|
||||
|
||||
/**
|
||||
* Url for the request
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $url;
|
||||
/**
|
||||
* Api endpoint
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $data = array(
|
||||
'server' => array(),
|
||||
'user' => array(),
|
||||
'wordpress' => array(
|
||||
'deactivated_plugin' => array(),
|
||||
),
|
||||
);
|
||||
/**
|
||||
* Plugin file
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $plugin_file = '';
|
||||
|
||||
private $allow_tracking = 0;
|
||||
|
||||
public $request_successful = false;
|
||||
|
||||
function __construct( $_plugin_file, $url, $args ) {
|
||||
|
||||
$this->url = $url;
|
||||
// Set variables
|
||||
$this->allow_tracking = ($args['anonymous'] === false)? true : false;
|
||||
$this->plugin_file = $_plugin_file;
|
||||
$this->data['unique'] = md5( home_url() . get_bloginfo( 'admin_email' ) );
|
||||
if ($args['anonymous'] == false)
|
||||
$this->data['key'] = $args['key'];
|
||||
$this->data['wordpress']['deactivated_plugin']['uninstall_reason'] = $args['reason'];
|
||||
$this->data['wordpress']['deactivated_plugin']['uninstall_details'] = $args['details'];
|
||||
|
||||
// Start collecting data
|
||||
$this->_collect_data();
|
||||
$this->request_successful = $this->_send_request();
|
||||
}
|
||||
|
||||
/**
|
||||
* Collect all data for the request.
|
||||
*
|
||||
*/
|
||||
private function _collect_data() {
|
||||
|
||||
$current_plugin = get_plugin_data( $this->plugin_file );
|
||||
|
||||
// Plugin data
|
||||
$this->data['wordpress']['deactivated_plugin']['slug'] = $current_plugin['TextDomain'];
|
||||
$this->data['wordpress']['deactivated_plugin']['name'] = $current_plugin['Name'];
|
||||
$this->data['wordpress']['deactivated_plugin']['version'] = $current_plugin['Version'];
|
||||
$this->data['wordpress']['deactivated_plugin']['author'] = $current_plugin['AuthorName'];
|
||||
|
||||
if ( $this->allow_tracking ) {
|
||||
//$this->_collect_wordpress_data();
|
||||
//$this->_collect_server_data();
|
||||
$this->_collect_user_data();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Collect WordPress data.
|
||||
*
|
||||
*/
|
||||
private function _collect_wordpress_data() {
|
||||
$this->data['wordpress']['locale'] = ( get_bloginfo( 'version' ) >= 4.7 ) ? get_user_locale() : get_locale();
|
||||
$this->data['wordpress']['wp_version'] = get_bloginfo( 'version' );
|
||||
$this->data['wordpress']['multisite'] = is_multisite();
|
||||
|
||||
$this->data['wordpress']['themes'] = $this->get_themes();
|
||||
$this->data['wordpress']['plugins'] = $this->get_plugins();
|
||||
}
|
||||
|
||||
/**
|
||||
* Collect server data.
|
||||
*
|
||||
*/
|
||||
private function _collect_server_data() {
|
||||
$this->data['server']['server'] = isset( $_SERVER['SERVER_SOFTWARE'] ) ? sanitize_text_field(wp_unslash($_SERVER['SERVER_SOFTWARE'])) : '';
|
||||
$this->data['server']['php_version'] = phpversion();
|
||||
$this->data['server']['url'] = esc_url(home_url());
|
||||
}
|
||||
|
||||
/**
|
||||
* Collect user data.
|
||||
*
|
||||
*/
|
||||
private function _collect_user_data() {
|
||||
$admin = get_user_by( 'email', get_bloginfo( 'admin_email' ) );
|
||||
if ( ! $admin ) {
|
||||
$this->data['user']['email'] = '';
|
||||
$this->data['user']['first_name'] = '';
|
||||
$this->data['user']['last_name'] = '';
|
||||
}else{
|
||||
$this->data['user']['email'] = get_bloginfo( 'admin_email' );
|
||||
$this->data['user']['first_name'] = $admin->first_name;
|
||||
$this->data['user']['last_name'] = $admin->last_name;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current themes
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function get_themes() {
|
||||
$theme = wp_get_theme();
|
||||
|
||||
return array(
|
||||
'installed' => $this->_get_installed_themes(),
|
||||
'active' => array(
|
||||
'slug' => get_stylesheet(),
|
||||
'name' => $theme->get( 'Name' ),
|
||||
'version' => $theme->get( 'Version' ),
|
||||
'author' => $theme->get( 'Author' ),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array of installed themes
|
||||
*/
|
||||
private function _get_installed_themes() {
|
||||
$installed = wp_get_themes();
|
||||
$theme = get_stylesheet();
|
||||
$arr = array();
|
||||
|
||||
foreach ( $installed as $slug => $info ) {
|
||||
if ( $slug === $theme ) {
|
||||
continue;
|
||||
}
|
||||
$arr[ $slug ] = array(
|
||||
'slug' => $slug,
|
||||
'name' => $info->get( 'Name' ),
|
||||
'version' => $info->get( 'Version' ),
|
||||
'author' => $info->get( 'Author' )
|
||||
);
|
||||
};
|
||||
|
||||
return $arr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of installed plugins
|
||||
*/
|
||||
private function get_plugins() {
|
||||
if ( ! function_exists( 'get_plugins' ) ) {
|
||||
include ABSPATH . '/wp-admin/includes/plugin.php';
|
||||
}
|
||||
|
||||
$plugins = get_plugins();
|
||||
$option = get_option( 'active_plugins', array() );
|
||||
$active = array();
|
||||
$installed = array();
|
||||
foreach ( $plugins as $id => $info ) {
|
||||
if ( in_array( $id, $active ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$id = explode( '/', $id );
|
||||
$id = ucwords( str_replace( '-', ' ', $id[0] ) );
|
||||
|
||||
$installed[] = $id;
|
||||
}
|
||||
|
||||
foreach ( $option as $id ) {
|
||||
$id = explode( '/', $id );
|
||||
$id = ucwords( str_replace( '-', ' ', $id[0] ) );
|
||||
|
||||
$active[] = $id;
|
||||
}
|
||||
|
||||
return array(
|
||||
'installed' => $installed,
|
||||
'active' => $active,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send dat to server.
|
||||
*
|
||||
*/
|
||||
private function _send_request() {
|
||||
|
||||
$request = wp_remote_post( $this->url, array(
|
||||
'method' => 'POST',
|
||||
'timeout' => 20,
|
||||
'redirection' => 5,
|
||||
'httpversion' => '1.1',
|
||||
'blocking' => true,
|
||||
'body' => $this->data,
|
||||
'user-agent' => 'MT/EPSILON-CUSTOMER-TRACKING/' . esc_url( home_url() )
|
||||
) );
|
||||
|
||||
|
||||
if ( is_wp_error( $request ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
namespace ShortPixel;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- The image comparer -->
|
||||
|
||||
<div id="sp-modal-shade" class="sp-modal-shade"></div>
|
||||
<div id="spUploadCompare" class="shortpixel-modal shortpixel-hide">
|
||||
<div class="sp-modal-title">
|
||||
<button type="button" class="sp-close-button">×</button>
|
||||
<?php esc_html_e('Compare Images', 'shortpixel-image-optimiser');?>
|
||||
</div>
|
||||
<div class="sp-modal-body sptw-modal-spinner" style="height:400px;padding:0;">
|
||||
<div class="shortpixel-slider" style="z-index:2000;">
|
||||
<div class="twentytwenty-container" id="spCompareSlider">
|
||||
<img class="spUploadCompareOriginal"/>
|
||||
<img class="spUploadCompareOptimized"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="spUploadCompareSideBySide" class="shortpixel-modal shortpixel-hide">
|
||||
<div class="sp-modal-title">
|
||||
<button type="button" class="sp-close-button">×</button>
|
||||
Compare Images
|
||||
</div>
|
||||
<div class="sp-modal-body" style="height:400px;padding:0;">
|
||||
<div class="shortpixel-slider" style="text-align: center;">
|
||||
<div class="side-by-side" style="text-align: center; display:inline-block;">
|
||||
<img class="spUploadCompareOriginal" style="margin: 10px"/><br>
|
||||
Original
|
||||
</div>
|
||||
<div class="side-by-side" style="text-align: center; display:inline-block;">
|
||||
<img class="spUploadCompareOptimized" style="margin: 10px"/><br>
|
||||
Optimized
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
namespace ShortPixel;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
?>
|
||||
|
||||
<div id="spioHelpShade" class="spio-modal-shade" style="display:none;">
|
||||
<div id="spioHelp" class="spio-modal spio-hide" style="min-width:610px;margin-left:-305px;">
|
||||
<div class="spio-modal-title">
|
||||
<button type="button" class="spio-close-help-button" onclick="jQuery.spioHelpClose()">×</button>
|
||||
</div>
|
||||
<div class="spio-modal-body" style="height:auto;min-height:400px;padding:0;">
|
||||
<iframe src="about:blank" width="100%" height="400" style="border:none"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript" id="spio_help_js">
|
||||
jQuery(document).ready(function($)
|
||||
{
|
||||
|
||||
$.spioHelpInit = function(){
|
||||
jQuery('div.spio-inline-help span').on('click', function(elm){ jQuery.spioHelpOpen(elm)});
|
||||
jQuery('div.spio-modal-shade').on('click', function(elm){ jQuery.spioHelpClose()});
|
||||
}
|
||||
|
||||
$.spioHelpOpen = function(evt) {
|
||||
//$("#shortPixelProposeUpgrade .spio-modal-body").html("");
|
||||
$("#spioHelpShade").css("display", "block");
|
||||
$("#spioHelp .spio-modal-body iframe").attr('src', evt.target.dataset.link);
|
||||
$("#spioHelp").removeClass('spio-hide');
|
||||
}
|
||||
|
||||
$.spioHelpClose = function(){
|
||||
jQuery("#spioHelpShade").css("display", "none");
|
||||
$("#spioHelp .spio-modal-body iframe").attr('src', 'about:blank');
|
||||
jQuery("#spioHelp").addClass('spio-hide');
|
||||
}
|
||||
jQuery.spioHelpInit()
|
||||
|
||||
;});
|
||||
</script>
|
||||
</div>
|
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
namespace ShortPixel;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
?>
|
||||
|
||||
<div id="spioSettingsModalShade" class="spio-modal-shade" style="display:none;"></div>
|
||||
<div id="spioSettingsModal" class="spio-modal spio-hide" style="min-width:610px;margin-left:-305px;">
|
||||
<div class="spio-modal-title">
|
||||
<button type="button" class="spio-close-help-button" onclick="jQuery.spioHelpClose()">×</button>
|
||||
</div>
|
||||
<div class="spio-modal-body" style="height:auto;min-height:400px;padding:0;">
|
||||
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
foreach($this->view->actions as $actionName => $action):
|
||||
|
||||
$layout = isset($action['layout']) ? $action['layout'] : false;
|
||||
|
||||
|
||||
if (isset($action['display']))
|
||||
{
|
||||
$display = $action['display'];
|
||||
$classes = $actionName;
|
||||
switch($display)
|
||||
{
|
||||
case 'button':
|
||||
$classes = " button-smaller button-primary $actionName ";
|
||||
break;
|
||||
case 'button-secondary':
|
||||
$classes = " button-smaller button $actionName ";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$link = ($action['type'] == 'js') ? 'javascript:' . $action['function'] : $action['function'];
|
||||
|
||||
$title = isset($action['title']) ? ' title="' . $action['title'] . '" ' : '';
|
||||
|
||||
if ($layout && $layout == 'paragraph')
|
||||
{
|
||||
echo "<P>";
|
||||
}
|
||||
?>
|
||||
<a href="<?php echo $link ?>" <?php echo $title ?> class="<?php echo esc_attr($classes) ?>"><?php echo esc_html($action['text']) ?></a>
|
||||
|
||||
<?php
|
||||
if ($layout && $layout == 'paragraph')
|
||||
{
|
||||
echo "</P>";
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
<?php
|
||||
endforeach;
|
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
namespace ShortPixel;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
?>
|
||||
|
||||
<svg version="1.1" class="svg-loader" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 100 50" enable-background="new 0 0 0 0" xml:space="preserve">
|
||||
<circle fill="#1cbecb" stroke="none" cx="6" cy="25" r="6">
|
||||
<animateTransform
|
||||
attributeName="transform"
|
||||
dur="1s"
|
||||
type="translate"
|
||||
values="0 15 ; 0 -15; 0 15"
|
||||
repeatCount="indefinite"
|
||||
begin="0.1"/>
|
||||
</circle>
|
||||
<circle fill="#1cbecb" stroke="none" cx="30" cy="27" r="6">
|
||||
<animateTransform
|
||||
attributeName="transform"
|
||||
dur="1s"
|
||||
type="translate"
|
||||
values="0 10 ; 0 -10; 0 10"
|
||||
repeatCount="indefinite"
|
||||
begin="0.2"/>
|
||||
</circle>
|
||||
<circle fill="#1cbecb" stroke="none" cx="54" cy="29" r="6">
|
||||
<animateTransform
|
||||
attributeName="transform"
|
||||
dur="1s"
|
||||
type="translate"
|
||||
values="0 5 ; 0 -5; 0 5"
|
||||
repeatCount="indefinite"
|
||||
begin="0.3"/>
|
||||
</circle>
|
||||
</svg>
|
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
namespace ShortPixel;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
?>
|
||||
|
||||
<div id="shortPixelProposeUpgradeShade" class="sp-modal-shade" style="display:none;"></div>
|
||||
|
||||
<div id="shortPixelProposeUpgrade" class="shortpixel-modal shortpixel-hide" style="min-width:650px;margin-left:-305px;">
|
||||
<div class="sp-modal-title">
|
||||
<button type="button" class="sp-close-upgrade-button" onclick="ShortPixel.closeProposeUpgrade()">×</button>
|
||||
<?php __('Upgrade your ShortPixel account', 'shortpixel-image-optimiser') ?>
|
||||
</div>
|
||||
<div class="sp-modal-body sptw-modal-spinner" style="height:auto;min-height:400px;padding:0;">
|
||||
</div>
|
||||
|
||||
</div>
|
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
namespace ShortPixel;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="shortpixel-bulk-wrapper">
|
||||
<h1><?php esc_html_e('ShortPixel Bulk Processing', 'shortpixel-image-optimiser'); ?></h1>
|
||||
|
||||
<div id="processPaused" class="processor-paused" data-action="ResumeBulk"><span class='dashicons dashicons-controls-pause' data-action="ResumeBulk"></span>
|
||||
<?php esc_html_e('The Bulk Processing is paused, please click to resume','shortpixel-image-optimiser'); ?></div>
|
||||
|
||||
<div id="processorOverQuota" class="processor-overquota">
|
||||
<h3><?php esc_html_e('There are no credits left. The Bulk Processing is paused.','shortpixel-image-optimiser'); ?></h3>
|
||||
<p><a href="javascript:window.location.reload()"><?php esc_html_e('Click to reload page after adding credits','shortpixel-image-optimiser'); ?></a></p>
|
||||
</div>
|
||||
|
||||
<div class="screen-wrapper">
|
||||
|
||||
<?php
|
||||
$this->loadview('bulk/part-dashboard');
|
||||
$this->loadView('bulk/part-selection');
|
||||
$this->loadView('bulk/part-summary');
|
||||
$this->loadView('bulk/part-process');
|
||||
$this->loadView('bulk/part-finished');
|
||||
|
||||
$this->loadView('bulk/part-bulk-special');
|
||||
|
||||
?>
|
||||
|
||||
</div>
|
||||
|
||||
</div> <!-- wrapper -->
|
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
namespace ShortPixel;
|
||||
use ShortPixel\ShortPixelLogger\ShortPixelLogger as Log;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
?>
|
||||
<div id='sp-msg-<?php echo( esc_attr($view->id) );?>' class='column-wp-shortPixel view-edit-media'>
|
||||
<?php // Debug Data
|
||||
if (! is_null($view->debugInfo) && is_array($view->debugInfo) && count($view->debugInfo) > 0 ): ?>
|
||||
<div class='debugInfo' id='debugInfo'>
|
||||
<a class='debugModal' data-modal="debugInfo" ><?php esc_html_e('Debug Window', 'shortpixel-image-optimiser') ?></a>
|
||||
<div class='content wrapper'>
|
||||
<?php foreach($view->debugInfo as $index => $item): ?>
|
||||
<ul class="debug-<?php echo esc_attr($index) ?>">
|
||||
<li><strong><?php echo $item[0]; ?></strong>
|
||||
<?php
|
||||
if (is_array($item[1]) || is_object($item[1]))
|
||||
echo "<PRE>" . print_r($item[1], true) . "</PRE>";
|
||||
else
|
||||
echo $item[1];
|
||||
?>
|
||||
</li>
|
||||
</ul>
|
||||
<?php endforeach; ?>
|
||||
<p> </p>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (property_exists($this->view, 'text')): ?>
|
||||
<div class='sp-column-info'>
|
||||
<?php
|
||||
// burger if needed.
|
||||
echo '<p>' . $this->view->list_actions . '</p>'; ?>
|
||||
<p><?php echo $this->view->text; ?></p></div>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
|
||||
<div class='sp-column-stats'>
|
||||
<?php
|
||||
// single actions
|
||||
if (isset($this->view->actions)):
|
||||
$this->loadView('snippets/part-single-actions', false);
|
||||
|
||||
endif;
|
||||
|
||||
?>
|
||||
|
||||
<?php if (property_exists($view, 'stats') && count($view->stats) > 0): ?>
|
||||
<ul class='edit-media-stats'>
|
||||
<?php foreach($view->stats as $index => $data)
|
||||
{ ?>
|
||||
<li><span><?php echo $data[0] ?></span> <span><?php echo $data[1] ?></span></li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="sp-message-<?php echo( esc_attr($this->view->id) ); ?>" class='spio-message'>
|
||||
<?php if (! is_null($view->status_message)): ?>
|
||||
<?php echo esc_html($view->status_message); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<div id='shortpixel-errorbox' class="errorbox"> </div>
|
||||
|
||||
<?php $this->loadView('snippets/part-comparer'); ?>
|
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
namespace ShortPixel;
|
||||
use ShortPixel\ShortPixelLogger\ShortPixelLogger as Log;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<div class='sp-column-info' id='sp-msg-<?php echo esc_attr($this->view->id );?>'>
|
||||
<?php if (isset($this->view->list_actions))
|
||||
{
|
||||
echo $this->view->list_actions;
|
||||
}
|
||||
?>
|
||||
<?php if (property_exists($this->view,'text') && strlen($this->view->text) > 0): ?>
|
||||
<p><?php echo $this->view->text; ?></p>
|
||||
<?php endif;
|
||||
|
||||
if (isset($this->view->actions)):
|
||||
$this->loadView('snippets/part-single-actions', false);
|
||||
|
||||
|
||||
endif;
|
||||
|
||||
?>
|
||||
</div>
|
@ -0,0 +1,93 @@
|
||||
<?php
|
||||
|
||||
namespace ShortPixel;
|
||||
use ShortPixel\ShortPixelLogger\ShortPixelLogger as Log;
|
||||
use ShortPixel\Notices\NoticeController as Notices;
|
||||
|
||||
use ShortPixel\Helper\UiHelper as UiHelper;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- This is not a form
|
||||
if ( isset($_GET['noheader']) ) {
|
||||
require_once(ABSPATH . 'wp-admin/admin-header.php');
|
||||
}
|
||||
|
||||
|
||||
$this->loadView('custom/part-othermedia-top');
|
||||
|
||||
?>
|
||||
|
||||
<!--- add Custom Folder -->
|
||||
<div class='addCustomFolder'>
|
||||
|
||||
<p class='add-folder-text'><strong><?php esc_html_e('Add a custom folder', 'shortpixel-image-optimiser'); ?></strong></p>
|
||||
<input type="text" name="addCustomFolderView" id="addCustomFolderView" class="regular-text" value="" disabled style="">
|
||||
|
||||
<a class="button open-selectfolder-modal" title="<?php esc_html_e('Select the images folder on your server.','shortpixel-image-optimiser');?>" href="javascript:void(0);">
|
||||
<?php esc_html_e('Select','shortpixel-image-optimiser');?>
|
||||
</a>
|
||||
<input type="submit" name="save" id="saveAdvAddFolder" class="button button-primary hidden" title="<?php esc_html_e('Add this Folder','shortpixel-image-optimiser');?>" value="<?php esc_html_e('Add this Folder','shortpixel-image-optimiser');?>">
|
||||
<p class="settings-info">
|
||||
<?php printf(esc_html__('Use the Select... button to select site folders. ShortPixel will optimize images and PDFs from the specified folders and their subfolders. In the %s Custom Media list %s, under the Media menu, you can see the optimization status for each image or PDF in these folders.','shortpixel-image-optimiser'), '<a href="upload.php?page=wp-short-pixel-custom">', '</a>');?>
|
||||
</p>
|
||||
|
||||
<div class="sp-modal-shade sp-folder-picker-shade" ></div>
|
||||
<div class="shortpixel-modal modal-folder-picker shortpixel-hide">
|
||||
<div class="sp-modal-title"><?php esc_html_e('Select the images folder','shortpixel-image-optimiser');?></div>
|
||||
<div class="sp-folder-picker">
|
||||
|
||||
</div>
|
||||
<input type="button" class="button button-info select-folder-cancel" value="<?php esc_html_e('Cancel','shortpixel-image-optimiser');?>" style="margin-right: 30px;">
|
||||
<input type="button" class="button button-primary select-folder" value="<?php esc_html_e('Add','shortpixel-image-optimiser');?>" disabled>
|
||||
|
||||
<span class='sp-folder-picker-selected'> </span>
|
||||
<div class="folder-message hidden "> </div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class='add-folder-message'>
|
||||
|
||||
</div>
|
||||
</div> <!-- end of AddCustomFolder -->
|
||||
|
||||
|
||||
<div class='list-overview'>
|
||||
<div class='heading'>
|
||||
<?php foreach($this->view->headings as $hname => $heading):
|
||||
|
||||
$title_context = (isset($heading['title_context'])) ? ' title="'. esc_attr($heading['title_context']) . '"' : '';
|
||||
?>
|
||||
<span class='heading <?php echo esc_attr($hname);?>' <?php echo $title_context ?> >
|
||||
<?php echo $this->getDisplayHeading($heading); ?>
|
||||
</span>
|
||||
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
<?php if (count($this->view->items) == 0) : ?>
|
||||
<div class='no-items'> <p>
|
||||
<?php
|
||||
if ($this->search === false):
|
||||
printf(esc_html__('No folders available. ','shortpixel-image-optimiser'), '<a href="options-general.php?page=wp-shortpixel-settings&part=adv-settings">', '</a>');
|
||||
else:
|
||||
echo esc_html__('Your search query didn\'t result in any images. ', 'shortpixel-image-optimiser');
|
||||
endif; ?>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php
|
||||
foreach($view->items as $index => $item) {
|
||||
$this->view->current_item = $item; // not the best pass
|
||||
$this->loadView('custom/part-single-folder', false);
|
||||
|
||||
}?>
|
||||
</div> <!-- shortpixel-folders-list -->
|
||||
|
||||
<?php // view -> customerFolders
|
||||
|
||||
$this->loadView('custom/part-othermedia-bottom');
|
@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
namespace ShortPixel;
|
||||
use ShortPixel\ShortPixelLogger\ShortPixelLogger as Log;
|
||||
use ShortPixel\Notices\NoticeController as Notices;
|
||||
|
||||
use ShortPixel\Helper\UiHelper as UiHelper;
|
||||
|
||||
use ShortPixel\Controller\OtherMediaController as OtherMediaController;
|
||||
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- This is not a form
|
||||
if ( isset($_GET['noheader']) ) {
|
||||
require_once(ABSPATH . 'wp-admin/admin-header.php');
|
||||
}
|
||||
|
||||
$this->loadView('custom/part-othermedia-top');
|
||||
|
||||
$folder_url = esc_url(add_query_arg('part', 'folders', $this->url));
|
||||
|
||||
$otherMediaController = OtherMediaController::getInstance();
|
||||
?>
|
||||
|
||||
<div class='scan-area'>
|
||||
|
||||
<div class='scan-actions'>
|
||||
<h2><?php _e('Actions', 'shortpixel-image-optimiser') ?></h2>
|
||||
<p><?php printf(__('Scan folders for images that are not yet included in custom media. If you only want to check specific folders, you can do this in the %sFolders tab%s.', 'shortpixel-image-optimiser'), '<a href="' . $folder_url . '">', '</a>'); ?>
|
||||
</p>
|
||||
|
||||
<div class='action-scan'>
|
||||
<button type="button" name="scan" class='scan-button button button-primary'>
|
||||
<?php _e('Refresh all folders', 'shortpixel-image-optimiser'); ?>
|
||||
</button>
|
||||
<label><?php _e('Refresh all folders since the last refresh time. This is faster.', 'shortpixel-image-optimiser'); ?>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class='action-scan'>
|
||||
<button type="button" name="fullscan" class='scan-button full button button-primary' data-mode="force">
|
||||
<?php _e('Full scan of all folders', 'shortpixel-image-optimiser'); ?>
|
||||
</button>
|
||||
<label>
|
||||
<?php _e('Fully scan all folders and check all files again.', 'shortpixel-image-optimiser'); ?>
|
||||
</label>
|
||||
|
||||
</div>
|
||||
|
||||
<div class='action-stop not-visible' >
|
||||
<button type="button" name="stop" class="stop-button button">
|
||||
<?php _e('Stop Scanning', 'shortpixel-image-optimiser'); ?>
|
||||
</button>
|
||||
<label>
|
||||
<?php _e('Stop current scan process', 'shortpixel-image-optimiser'); ?>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='output result not-visible'>
|
||||
<h2><?php _e('Results', 'shortpixel-image-optimiser'); ?></h2>
|
||||
<div class='result-table'>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='scan-help'>
|
||||
<p><?php printf(__('If new images are regularly added to your Custom Media folders from outside WordPress (e.g. via (S)FTP or SSH), you must manually click on "Refresh all folders" so that the new images are recognized and optimized. Alternatively, you can also set up a regular cron job as described in our %s Knowledge Base %s.', 'shortpixel-image-optimiser'),
|
||||
'<a href="https://shortpixel.com/knowledge-base/article/543-how-to-schedule-a-cron-event-to-run-shortpixel-image-optimizer" target="_blank">', '</a>'
|
||||
); ?></p>
|
||||
</div>
|
||||
|
||||
|
||||
</div> <!-- / scan-area -->
|
||||
|
||||
</div> <!--- wrap from othermedia-top -->
|
@ -0,0 +1,194 @@
|
||||
<?php
|
||||
namespace ShortPixel;
|
||||
use ShortPixel\ShortPixelLogger\ShortPixelLogger as Log;
|
||||
use ShortPixel\Notices\NoticeController as Notices;
|
||||
|
||||
use ShortPixel\Helper\UiHelper as UiHelper;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
$fs = \wpSPIO()->filesystem();
|
||||
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- This is not a form
|
||||
if ( isset($_GET['noheader']) ) {
|
||||
require_once(ABSPATH . 'wp-admin/admin-header.php');
|
||||
}
|
||||
|
||||
$this->loadView('custom/part-othermedia-top');
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<div class='extra-heading top'>
|
||||
<span> </span>
|
||||
<span>
|
||||
<select name='bulk-actions'>
|
||||
<option><?php _e('Bulk Actions', 'shortpixel-image-optimiser'); ?></option>
|
||||
<option value='optimize'><?php _e('Optimize','shortpixel-image-optimiser'); ?></option>
|
||||
<option value='restore'><?php _e('Restore', 'shortpixel-image-optimiser'); ?></option>
|
||||
<option value="mark-completed"><?php _e('Mark completed', 'shortpixel-image-optimiser'); ?></option>
|
||||
</select> <button class='button' type='button' name='doBulkAction'><?php _e('Apply', 'shortpixel-image-optimiser'); ?></button>
|
||||
</span>
|
||||
|
||||
<span class='custom-filter'>
|
||||
<form method="get" action="<?php echo $this->url ?>" >
|
||||
<input type='hidden' name='page' value='wp-short-pixel-custom'>
|
||||
<?php $this->printFilter(); ?>
|
||||
<button class='button' type='submit'><?php _e('Filter', 'shortpixel-image-optimiser'); ?></button>
|
||||
</form>
|
||||
</span>
|
||||
|
||||
</div>
|
||||
<div class='list-overview'>
|
||||
|
||||
|
||||
<div class='heading'>
|
||||
<?php foreach($this->view->headings as $hname => $heading):
|
||||
$isSortable = $heading['sortable'];
|
||||
?>
|
||||
<span class='heading <?php echo esc_attr($hname) ?>'>
|
||||
<?php echo $this->getDisplayHeading($heading); ?>
|
||||
</span>
|
||||
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
<?php if (count($this->view->items) == 0) : ?>
|
||||
<div class='no-items'> <p>
|
||||
<?php
|
||||
|
||||
if (true === $view->hasSearch)
|
||||
{
|
||||
echo esc_html__('Your search query didn\'t result in any images. ', 'shortpixel-image-optimiser');
|
||||
}
|
||||
elseif (true === $view->hasFilter )
|
||||
{
|
||||
printf(esc_html__('Filter didn\'t yield any results. %s Show all Items %s ', 'shortpixel-image-optimiser'), "<a href='$this->url'>",'</a>');
|
||||
}
|
||||
else
|
||||
{
|
||||
$folder_url = esc_url(add_query_arg('part', 'folders', $this->url));
|
||||
|
||||
printf(esc_html__('No images available. Go to %s Folders %s to configure additional folders to be optimized.','shortpixel-image-optimiser'), '<a href="'. esc_url($folder_url) . '">', '</a>');
|
||||
|
||||
} ?>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php
|
||||
$folders = $this->view->folders;
|
||||
|
||||
foreach($this->view->items as $item):
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<div class='item item-<?php echo esc_attr($item->get('id')) ?>'>
|
||||
<?php
|
||||
|
||||
$allActions = array_merge(UiHelper::getActions($item), UiHelper::getListActions($item));
|
||||
|
||||
$checkBoxActions = array();
|
||||
if (array_key_exists('optimize', $allActions))
|
||||
{
|
||||
$checkBoxActions[] = 'is-optimizable';
|
||||
}
|
||||
if (array_key_exists('restore', $allActions))
|
||||
{
|
||||
$checkBoxActions[] = 'is-restorable';
|
||||
}
|
||||
|
||||
$filesize = $item->getFileSize();
|
||||
$display_date = $this->getDisplayDate($item);
|
||||
$folder_id = $item->get('folder_id');
|
||||
|
||||
$rowActions = $this->getRowActions($item);
|
||||
|
||||
|
||||
$folder = isset($folders[$folder_id]) ? $folders[$folder_id] : false;
|
||||
$media_type = ($folder && $folder->get('is_nextgen')) ? __('Nextgen', 'shortpixel-image-optimiser') : __('Custom', 'shortpixel_image_optimiser');
|
||||
$img_url = $fs->pathToUrl($item);
|
||||
$is_heavy = ($filesize >= 500000 && $filesize > 0);
|
||||
|
||||
$item_class = '';
|
||||
if (count($checkBoxActions) > 0)
|
||||
$item_class = ' class="' . implode(' ', $checkBoxActions) . '" ';
|
||||
|
||||
?>
|
||||
<span><input type='checkbox' name='select[]' value="<?php echo $item->get('id'); ?>" <?php echo $item_class ?>/></span>
|
||||
<span><a href="<?php echo esc_attr($img_url); ?>" target="_blank">
|
||||
<div class='thumb' <?php if($is_heavy)
|
||||
{
|
||||
echo('title="' . esc_attr__('This image is heavy and it would slow this page down if displayed here. Click to open it in a new browser tab.', 'shortpixel-image-optimiser') . '"');
|
||||
}
|
||||
?> style="background-image:url('<?php echo($is_heavy ? esc_url(wpSPIO()->plugin_url('res/img/heavy-image@2x.png')) : esc_url($img_url)) ?>')">
|
||||
</div>
|
||||
</a></span>
|
||||
<span class='filename'><?php echo esc_html($item->getFileName()) ?>
|
||||
|
||||
<div class="row-actions">
|
||||
<span class='item-id'>#<?php echo esc_attr($item->get('id')); ?></span>
|
||||
|
||||
<?php
|
||||
if (isset($rowActions)):
|
||||
$i = 0;
|
||||
foreach($rowActions as $actionName => $action):
|
||||
|
||||
|
||||
$classes = ''; // ($action['display'] == 'button') ? " button-smaller button-primary $actionName " : "$actionName";
|
||||
$link = ($action['type'] == 'js') ? 'javascript:' . $action['function'] : $action['function'];
|
||||
$newtab = ($actionName == 'extendquota' || $actionName == 'view') ? 'target="_blank"' : '';
|
||||
|
||||
if ($i > 0)
|
||||
echo "|";
|
||||
?>
|
||||
<a href="<?php echo $link ?>" <?php echo esc_attr($newtab); ?> class="<?php echo $classes ?>"><?php echo $action['text'] ?></a>
|
||||
<?php
|
||||
$i++;
|
||||
endforeach;UiHelper::getActions($item);
|
||||
|
||||
endif;
|
||||
?>
|
||||
</div>
|
||||
</span>
|
||||
<span class='folderpath'><?php echo esc_html( (string) $item->getFileDir()); ?></span>
|
||||
<span class='mediatype'><?php echo esc_html($media_type) ?></span>
|
||||
<span class="date"><?php echo esc_html($display_date) ?></span>
|
||||
|
||||
<span >
|
||||
<?php $this->doActionColumn($item); ?>
|
||||
</span>
|
||||
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
|
||||
<div class='pagination tablenav bottom'>
|
||||
<div class="view_switch">
|
||||
<?php if ($this->has_hidden_items || $this->show_hidden):
|
||||
|
||||
if ($this->show_hidden)
|
||||
{
|
||||
printf('<a href="%s">%s</a>', esc_url(add_query_arg('show_hidden',false)), esc_html__('Back to normal items', 'shortpixel-image-optimiser'));
|
||||
}
|
||||
else
|
||||
{
|
||||
printf('<a href="%s">%s</a>', esc_url(add_query_arg('show_hidden',true)), esc_html__('Show hidden items', 'shortpixel-image-optimiser'));
|
||||
}
|
||||
|
||||
endif; ?>
|
||||
</div>
|
||||
<div class='tablenav-pages'>
|
||||
<?php echo $this->view->pagination; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div> <!-- wrap -->
|
||||
|
||||
<?php $this->loadView('snippets/part-comparer'); ?>
|
@ -0,0 +1,110 @@
|
||||
<?php
|
||||
namespace ShortPixel;
|
||||
use ShortPixel\ShortPixelLogger\ShortPixelLogger as Log;
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit; // Exit if accessed directly.
|
||||
}
|
||||
|
||||
// #Todo Move this to some env or more appropiate place.
|
||||
$is_unlimited= (!is_null($this->quotaData) && $this->quotaData->unlimited) ? true : false;
|
||||
|
||||
?>
|
||||
<div class="wrap is-shortpixel-settings-page">
|
||||
<h1>
|
||||
<?php esc_html_e('ShortPixel Plugin Settings','shortpixel-image-optimiser');?>
|
||||
</h1>
|
||||
<div class='top-menu'>
|
||||
|
||||
<div class='links'>
|
||||
|
||||
<?php if (! $is_unlimited): ?>
|
||||
<a href="https://shortpixel.com/<?php
|
||||
echo esc_attr(($view->data->apiKey ? "login/". $view->data->apiKey . '/spio-unlimited': "pricing"));
|
||||
?>" target="_blank"><?php esc_html_e( 'Buy credits', 'shortpixel-image-optimiser' );?></a> |
|
||||
<?php endif; ?>
|
||||
|
||||
<a href="https://shortpixel.com/knowledge-base/" target="_blank"><?php esc_html_e('Knowledge Base','shortpixel-image-optimiser');?></a> |
|
||||
<a href="https://shortpixel.com/contact" target="_blank"><?php esc_html_e('Contact Support','shortpixel-image-optimiser');?></a> |
|
||||
<a href="https://shortpixel.com/<?php
|
||||
echo esc_attr(($view->data->apiKey ? "login/". $view->data->apiKey . "/dashboard" : "login"));
|
||||
?>" target="_blank">
|
||||
<?php esc_html_e('ShortPixel account','shortpixel-image-optimiser');?>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<?php if ( round($view->averageCompression) > 20 ): ?>
|
||||
<div class="spio-status-box">
|
||||
<?php if ( round($view->averageCompression) > 20): ?>
|
||||
<div class='pie-wrapper'><?php $this->loadView('settings/part-optpie'); ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!is_null($this->quotaData)): ?>
|
||||
<div class='quota-remaining'>
|
||||
<a href="https://shortpixel.com/<?php
|
||||
echo esc_attr(($view->data->apiKey ? "login/". $view->data->apiKey . "/dashboard" : "login"));
|
||||
?>" target="_blank">
|
||||
<?php if ($is_unlimited)
|
||||
{
|
||||
printf(esc_html__('ShortPixel Unlimited', 'shortpixel-image-optimiser'));
|
||||
}
|
||||
else
|
||||
{
|
||||
printf(esc_html__('%s Credits remaining', 'shortpixel-image-optimiser'), esc_html($this->formatNumber(max(0, $this->quotaData->total->remaining), 0)));
|
||||
}
|
||||
?>
|
||||
</a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<hr class='wp-header-end'>
|
||||
|
||||
|
||||
<article id="shortpixel-settings-tabs" class="sp-tabs">
|
||||
<?php if (! $this->is_verifiedkey)
|
||||
{
|
||||
$this->loadView('settings/part-nokey');
|
||||
} ?>
|
||||
|
||||
<?php
|
||||
if ($this->is_verifiedkey):
|
||||
?>
|
||||
<div class='section-wrapper'>
|
||||
<form name='wp_shortpixel_options' action='<?php echo esc_url(add_query_arg('noheader', 'true')) ?>' method='post' id='wp_shortpixel_options'>
|
||||
<input type='hidden' name='display_part' value="<?php echo esc_attr($this->display_part) ?>" />
|
||||
<?php wp_nonce_field($this->form_action, 'sp-nonce'); ?>
|
||||
|
||||
<?php
|
||||
$this->loadView('settings/part-general');
|
||||
$this->loadView('settings/part-advanced');
|
||||
if (! $this->view->cloudflare_constant)
|
||||
{
|
||||
$this->loadView('settings/part-cloudflare');
|
||||
}
|
||||
if ($view->averageCompression !== null)
|
||||
{
|
||||
// $this->loadView('settings/part-statistics');
|
||||
}
|
||||
$this->loadView('settings/part-tools');
|
||||
|
||||
?>
|
||||
</form>
|
||||
<?php
|
||||
if (Log::debugIsActive())
|
||||
{
|
||||
$this->loadView('settings/part-debug');
|
||||
}
|
||||
?>
|
||||
</div> <!-- wrappur -->
|
||||
<?php
|
||||
endif;
|
||||
?>
|
||||
|
||||
</article>
|
||||
<?php $this->loadView('settings/part-wso'); ?>
|
||||
|
||||
<?php $this->loadView('snippets/part-inline-help'); ?>
|
||||
<?php $this->loadView('snippets/part-inline-modal'); ?>
|
Reference in New Issue
Block a user