本文整理汇总了PHP中ewww_image_optimizer_get_option函数的典型用法代码示例。如果您正苦于以下问题:PHP ewww_image_optimizer_get_option函数的具体用法?PHP ewww_image_optimizer_get_option怎么用?PHP ewww_image_optimizer_get_option使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ewww_image_optimizer_get_option函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ewwwngg
function ewwwngg()
{
add_action('admin_init', array(&$this, 'admin_init'));
add_filter('ngg_manage_images_columns', array(&$this, 'ewww_manage_images_columns'));
add_action('ngg_manage_image_custom_column', array(&$this, 'ewww_manage_image_custom_column'), 10, 2);
if (!ewww_image_optimizer_get_option('ewww_image_optimizer_noauto')) {
add_action('ngg_added_new_image', array(&$this, 'ewww_added_new_image'));
}
add_action('admin_action_ewww_ngg_manual', array(&$this, 'ewww_ngg_manual'));
add_action('admin_menu', array(&$this, 'ewww_ngg_bulk_menu'));
$i18ngg = strtolower(_n('Gallery', 'Galleries', 1, 'nggallery'));
add_action('admin_head-' . $i18ngg . '_page_nggallery-manage-gallery', array(&$this, 'ewww_ngg_bulk_actions_script'));
add_action('admin_enqueue_scripts', array(&$this, 'ewww_ngg_bulk_script'));
add_action('wp_ajax_bulk_ngg_preview', array(&$this, 'ewww_ngg_bulk_preview'));
add_action('wp_ajax_bulk_ngg_init', array(&$this, 'ewww_ngg_bulk_init'));
add_action('wp_ajax_bulk_ngg_filename', array(&$this, 'ewww_ngg_bulk_filename'));
add_action('wp_ajax_bulk_ngg_loop', array(&$this, 'ewww_ngg_bulk_loop'));
add_action('wp_ajax_bulk_ngg_cleanup', array(&$this, 'ewww_ngg_bulk_cleanup'));
add_action('wp_ajax_ewww_ngg_thumbs', array(&$this, 'ewww_ngg_thumbs_only'));
add_action('ngg_after_new_images_added', array(&$this, 'ewww_ngg_new_thumbs'), 10, 2);
}
示例2: ewww_image_optimizer_options
function ewww_image_optimizer_options()
{
global $ewww_debug;
$ewww_debug .= "<b>ewww_image_optimizer_options()</b><br>";
if (isset($_REQUEST['pngout'])) {
if ($_REQUEST['pngout'] == 'success') {
?>
<div id='ewww-image-optimizer-pngout-success' class='updated fade'>
<p><?php
_e('Pngout was successfully installed, check the Plugin Status area for version information.', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
</p>
</div>
<?php
}
if ($_REQUEST['pngout'] == 'failed') {
?>
<div id='ewww-image-optimizer-pngout-failure' class='error'>
<p><?php
printf(__('Pngout was not installed: %1$s. Make sure this folder is writable: %2$s', EWWW_IMAGE_OPTIMIZER_DOMAIN), $_REQUEST['error'], EWWW_IMAGE_OPTIMIZER_TOOL_PATH);
?>
</p>
</div>
<?php
}
}
?>
<script type='text/javascript'>
jQuery(document).ready(function($) {$('.fade').fadeTo(5000,1).fadeOut(3000);});
</script>
<div class="wrap">
<div id="icon-options-general" class="icon32"><br /></div>
<h2>EWWW <?php
_e('Image Optimizer Settings', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
</h2>
<p><a href="http://wordpress.org/extend/plugins/ewww-image-optimizer/"><?php
_e('Plugin Home Page', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
</a> |
<a href="http://wordpress.org/extend/plugins/ewww-image-optimizer/installation/"><?php
_e('Installation Instructions', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
</a> |
<a href="http://wordpress.org/support/plugin/ewww-image-optimizer"><?php
_e('Plugin Support', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
</a> |
<a href="http://stats.pingdom.com/w89y81bhecp4"><?php
_e('Cloud Status', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
</a></p>
<?php
if (function_exists('is_plugin_active_for_network') && is_plugin_active_for_network('ewww-image-optimizer/ewww-image-optimizer.php')) {
$bulk_link = __('Media Library') . ' -> ' . __('Bulk Optimize', EWWW_IMAGE_OPTIMIZER_DOMAIN);
} else {
$bulk_link = '<a href="upload.php?page=ewww-image-optimizer-bulk">' . __('Bulk Optimize', EWWW_IMAGE_OPTIMIZER_DOMAIN) . '</a>';
}
?>
<p><?php
printf(__('New images uploaded to the Media Library will be optimized automatically. If you have existing images you would like to optimize, you can use the %s tool.', EWWW_IMAGE_OPTIMIZER_DOMAIN), $bulk_link);
?>
</p>
<div id="status" style="border: 1px solid #ccc; padding: 0 8px; border-radius: 12px;">
<h3>Plugin Status</h3>
<?php
if (ewww_image_optimizer_get_option('ewww_image_optimizer_cloud_key')) {
echo '<p><b>Cloud API Key:</b> ';
$verify_cloud = ewww_image_optimizer_cloud_verify(false);
if (preg_match('/great/', $verify_cloud)) {
echo '<span style="color: green">' . __('Verified,', EWWW_IMAGE_OPTIMIZER_DOMAIN) . ' </span>';
echo ewww_image_optimizer_cloud_quota();
} elseif (preg_match('/exceeded/', $verify_cloud)) {
echo '<span style="color: orange">' . __('Verified,', EWWW_IMAGE_OPTIMIZER_DOMAIN) . ' </span>';
echo ewww_image_optimizer_cloud_quota();
} else {
echo '<span style="color: red">' . __('Not Verified', EWWW_IMAGE_OPTIMIZER_DOMAIN) . '</span>';
}
echo '</p>';
}
if (ewww_image_optimizer_get_option('ewww_image_optimizer_skip_bundle') && !EWWW_IMAGE_OPTIMIZER_CLOUD && !EWWW_IMAGE_OPTIMIZER_NOEXEC) {
?>
<p><?php
_e('If updated versions are available below you may either download the newer versions and install them yourself, or uncheck "Use System Paths" and use the bundled tools.', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
<br />
<i>*<?php
_e('Updates are optional, but may contain increased optimization or security patches', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
</i></p>
<?php
} elseif (!EWWW_IMAGE_OPTIMIZER_CLOUD && !EWWW_IMAGE_OPTIMIZER_NOEXEC) {
?>
<p><?php
printf(__('If updated versions are available below, you may need to enable write permission on the %s folder to use the automatic installs.', EWWW_IMAGE_OPTIMIZER_DOMAIN), '<i>' . EWWW_IMAGE_OPTIMIZER_TOOL_PATH . '</i>');
?>
<br />
<i>*<?php
_e('Updates are optional, but may contain increased optimization or security patches', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
//.........这里部分代码省略.........
示例3: ewww_image_optimizer_bulk_loop
function ewww_image_optimizer_bulk_loop()
{
global $ewww_debug;
global $ewww_exceed;
// verify that an authorized user has started the optimizer
$permissions = apply_filters('ewww_image_optimizer_bulk_permissions', '');
if (!wp_verify_nonce($_REQUEST['ewww_wpnonce'], 'ewww-image-optimizer-bulk') || !current_user_can($permissions)) {
wp_die(__('Cheatin’ eh?', EWWW_IMAGE_OPTIMIZER_DOMAIN));
}
if (!empty($_REQUEST['ewww_sleep'])) {
sleep($_REQUEST['ewww_sleep']);
}
// retrieve the time when the optimizer starts
$started = microtime(true);
// get the attachment ID of the current attachment
$attachment = $_POST['ewww_attachment'];
// get the 'bulk attachments' with a list of IDs remaining
$attachments = get_option('ewww_image_optimizer_bulk_attachments');
$meta = wp_get_attachment_metadata($attachment, true);
// do the optimization for the current attachment (including resizes)
$meta = ewww_image_optimizer_resize_from_meta_data($meta, $attachment, false);
if (!empty($ewww_exceed)) {
echo '-9exceeded';
die;
}
if (!empty($meta['file'])) {
// output the filename (and path relative to 'uploads' folder)
printf("<p>" . __('Optimized image:', EWWW_IMAGE_OPTIMIZER_DOMAIN) . " <strong>%s</strong><br>", esc_html($meta['file']));
} else {
printf("<p>" . __('Skipped image, ID:', EWWW_IMAGE_OPTIMIZER_DOMAIN) . " <strong>%s</strong><br>", $attachment);
}
if (!empty($meta['ewww_image_optimizer'])) {
// tell the user what the results were for the original image
printf(__('Full size – %s', EWWW_IMAGE_OPTIMIZER_DOMAIN) . "<br>", $meta['ewww_image_optimizer']);
}
// check to see if there are resized version of the image
if (isset($meta['sizes']) && is_array($meta['sizes'])) {
// cycle through each resize
foreach ($meta['sizes'] as $size) {
if (!empty($size['ewww_image_optimizer'])) {
// output the results for the current resized version
printf("%s – %s<br>", $size['file'], $size['ewww_image_optimizer']);
}
}
}
// calculate how much time has elapsed since we started
$elapsed = microtime(true) - $started;
// output how much time has elapsed since we started
printf(__('Elapsed: %.3f seconds', EWWW_IMAGE_OPTIMIZER_DOMAIN) . "</p>", $elapsed);
global $ewww_attachment;
$ewww_attachment['id'] = $attachment;
$ewww_attachment['meta'] = $meta;
add_filter('w3tc_cdn_update_attachment_metadata', 'ewww_image_optimizer_w3tc_update_files');
// update the metadata for the current attachment
wp_update_attachment_metadata($attachment, $meta);
// remove the first element from the $attachments array
if (!empty($attachments)) {
array_shift($attachments);
}
// store the updated list of attachment IDs back in the 'bulk_attachments' option
update_option('ewww_image_optimizer_bulk_attachments', $attachments);
if (ewww_image_optimizer_get_option('ewww_image_optimizer_debug')) {
echo '<div style="background-color:#ffff99;">' . $ewww_debug . '</div>';
}
ewww_image_optimizer_debug_log();
ewwwio_memory(__FUNCTION__);
die;
}
示例4: ewww_image_optimizer_webp_create
function ewww_image_optimizer_webp_create($file, $orig_size, $type, $tool)
{
global $ewww_debug;
$ewww_debug .= '<b>ewww_image_optimizer_webp_create()</b><br>';
// change the file extension
$webpfile = $file . '.webp';
if (file_exists($webpfile) || !ewww_image_optimizer_get_option('ewww_image_optimizer_webp')) {
return;
}
if (empty($tool)) {
ewww_image_optimizer_cloud_optimizer($file, $type, false, $webpfile, 'image/webp');
} else {
// check to see if 'nice' exists
$nice = ewww_image_optimizer_find_binary('nice', 'n');
switch ($type) {
case 'image/jpeg':
exec("{$nice} " . $tool . " -q 85 -quiet " . ewww_image_optimizer_escapeshellarg($file) . " -o " . ewww_image_optimizer_escapeshellarg($webpfile) . ' 2>&1', $cli_output);
break;
case 'image/png':
exec("{$nice} " . $tool . " -lossless -quiet " . ewww_image_optimizer_escapeshellarg($file) . " -o " . ewww_image_optimizer_escapeshellarg($webpfile) . ' 2>&1', $cli_output);
break;
}
}
if (file_exists($webpfile) && $orig_size < filesize($webpfile)) {
$ewww_debug .= 'webp file was too big, deleting<br>';
unlink($webpfile);
}
ewwwio_memory(__FUNCTION__);
}
示例5: ewww_ngg_bulk_preview
function ewww_ngg_bulk_preview()
{
if (!empty($_REQUEST['doaction'])) {
// if there is no requested bulk action, do nothing
if (empty($_REQUEST['bulkaction'])) {
return;
}
// if there is no media to optimize, do nothing
if (empty($_REQUEST['doaction']) || !is_array($_REQUEST['doaction'])) {
return;
}
}
list($fullsize_count, $unoptimized_count, $resize_count, $unoptimized_resize_count) = ewww_image_optimizer_count_optimized('ngg');
// make sure there are some attachments to process
if ($fullsize_count < 1) {
echo '<p>' . esc_html__('You do not appear to have uploaded any images yet.', EWWW_IMAGE_OPTIMIZER_DOMAIN) . '</p>';
return;
}
?>
<div class="wrap">
<h1><?php
esc_html_e('Bulk Optimize', EWWW_IMAGE_OPTIMIZER_DOMAIN);
if (ewww_image_optimizer_get_option('ewww_image_optimizer_cloud_key')) {
ewww_image_optimizer_cloud_verify();
echo '<a id="ewww-bulk-credits-available" target="_blank" class="page-title-action" style="float:right;" href="https://ewww.io/my-account/">' . esc_html__('Image credits available:', EWWW_IMAGE_OPTIMIZER_DOMAIN) . ' ' . ewww_image_optimizer_cloud_quota() . '</a>';
}
echo '</h1>';
// Retrieve the value of the 'bulk resume' option and set the button text for the form to use
$resume = get_option('ewww_image_optimizer_bulk_ngg_resume');
if (empty($resume)) {
$button_text = esc_attr__('Start optimizing', EWWW_IMAGE_OPTIMIZER_DOMAIN);
} else {
$button_text = esc_attr__('Resume previous bulk operation', EWWW_IMAGE_OPTIMIZER_DOMAIN);
}
?>
<div id="ewww-bulk-loading"></div>
<div id="ewww-bulk-progressbar"></div>
<div id="ewww-bulk-counter"></div>
<form id="ewww-bulk-stop" style="display:none;" method="post" action="">
<br /><input type="submit" class="button-secondary action" value="<?php
esc_attr_e('Stop Optimizing', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
" />
</form>
<div id="ewww-bulk-widgets" class="metabox-holder" style="display:none">
<div class="meta-box-sortables">
<div id="ewww-bulk-last" class="postbox">
<button type="button" class="handlediv button-link" aria-expanded="true">
<span class="screen-reader-text"><?php
esc_html_e('Click to toggle', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
</span>
<span class="toggle-indicator" aria-hidden="true"></span>
</button>
<h2 class="hndle"><span><?php
esc_html_e('Last Image Optimized', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
</span></h2>
<div class="inside"></div>
</div>
</div>
<div class="meta-box-sortables">
<div id="ewww-bulk-status" class="postbox">
<button type="button" class="handlediv button-link" aria-expanded="true">
<span class="screen-reader-text"><?php
esc_html_e('Click to toggle', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
</span>
<span class="toggle-indicator" aria-hidden="true"></span>
</button>
<h2 class="hndle"><span><?php
esc_html_e('Optimization Log', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
</span></h2>
<div class="inside"></div>
</div>
</div>
</div>
<form class="ewww-bulk-form">
<p><label for="ewww-force" style="font-weight: bold"><?php
esc_html_e('Force re-optimize', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
</label> <input type="checkbox" id="ewww-force" name="ewww-force"></p>
<p><label for="ewww-delay" style="font-weight: bold"><?php
esc_html_e('Choose how long to pause between images (in seconds, 0 = disabled)', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
</label> <input type="text" id="ewww-delay" name="ewww-delay" value="<?php
if ($delay = ewww_image_optimizer_get_option('ewww_image_optimizer_delay')) {
echo $delay;
} else {
echo 0;
}
?>
"></p>
<div id="ewww-delay-slider" style="width:50%"></div>
</form>
<div id="ewww-bulk-forms">
<p class="ewww-bulk-info"><?php
printf(esc_html__('%1$d images have been selected (%2$d unoptimized), with %3$d resizes (%4$d unoptimized).', EWWW_IMAGE_OPTIMIZER_DOMAIN), $fullsize_count, $unoptimized_count, $resize_count, $unoptimized_resize_count);
?>
//.........这里部分代码省略.........
示例6: task
protected function task($item)
{
session_write_close();
$max_attempts = 15;
if (empty($item['attempts'])) {
$item['attempts'] = 0;
}
$id = $item['id'];
ewwwio_debug_message("background processing nextgen2: {$id}");
// creating the 'registry' object for working with nextgen
$registry = C_Component_Registry::get_instance();
// creating a database storage object from the 'registry' object
$storage = $registry->get_utility('I_Gallery_Storage');
// get an image object
$image = $storage->object->_image_mapper->find($id);
if (!is_object($image) && $item['attempts'] < $max_attempts) {
$item['attempts']++;
sleep(4);
ewwwio_debug_message("could not retrieve image, requeueing {$item['attempts']}");
ewww_image_optimizer_debug_log();
return $item;
} elseif (empty($image)) {
ewwwio_debug_message("could not retrieve image, out of attempts");
ewww_image_optimizer_debug_log();
delete_transient('ewwwio-background-in-progress-ngg-' . $id);
return false;
}
global $ewwwngg;
$ewwwngg->ewww_added_new_image($image, $storage);
delete_transient('ewwwio-background-in-progress-ngg-' . $id);
sleep(ewww_image_optimizer_get_option('ewww_image_optimizer_delay'));
ewww_image_optimizer_debug_log();
return false;
}
示例7: generate_image_size
function generate_image_size($image, $size, $params = null, $skip_defaults = false)
{
ewwwio_debug_message('<b>' . __FUNCTION__ . '()</b>');
global $ewww_defer;
if (!defined('EWWW_IMAGE_OPTIMIZER_CLOUD')) {
ewww_image_optimizer_init();
}
$success = $this->call_parent('generate_image_size', $image, $size, $params, $skip_defaults);
if ($success) {
$filename = $success->fileName;
if ($ewww_defer && ewww_image_optimizer_get_option('ewww_image_optimizer_defer')) {
ewww_image_optimizer_add_deferred_attachment("file,{$filename}");
return $saved;
}
ewww_image_optimizer($filename);
ewwwio_debug_message("nextgen dynamic thumb saved: {$filename}");
$image_size = ewww_image_optimizer_filesize($filename);
ewwwio_debug_message("optimized size: {$image_size}");
}
ewww_image_optimizer_debug_log();
ewwwio_memory(__FUNCTION__);
return $success;
}
示例8: ewww_manage_image_custom_column
function ewww_manage_image_custom_column($column_name, $id)
{
// check to make sure we're outputing our custom column
if ($column_name == 'ewww_image_optimizer') {
// get the metadata
$meta = new flagMeta($id);
if (ewww_image_optimizer_get_option('ewww_image_optimizer_debug')) {
$print_meta = print_r($meta->image->meta_data, TRUE);
$print_meta = preg_replace(array('/ /', '/\\n+/'), array(' ', '<br />'), $print_meta);
echo '<div style="background-color:#ffff99;font-size: 10px;padding: 10px;margin:-10px -10px 10px;line-height: 1.1em">' . $print_meta . '</div>';
}
// grab the image status from the meta
$status = $meta->image->meta_data['ewww_image_optimizer'];
$msg = '';
// get the image path from the meta
$file_path = $meta->image->imagePath;
// get the mimetype
$type = ewww_image_optimizer_mimetype($file_path, 'i');
// get the file size
$file_size = size_format(filesize($file_path), 2);
$file_size = str_replace('B ', 'B', $file_size);
$valid = true;
// if we don't have a valid tool for the image type, output the appropriate message
switch ($type) {
case 'image/jpeg':
if (!EWWW_IMAGE_OPTIMIZER_JPEGTRAN && !EWWW_IMAGE_OPTIMIZER_CLOUD) {
$valid = false;
$msg = '<br>' . sprintf(__('%s is missing', EWWW_IMAGE_OPTIMIZER_DOMAIN), '<em>jpegtran</em>');
}
break;
case 'image/png':
if (!EWWW_IMAGE_OPTIMIZER_PNGOUT && !EWWW_IMAGE_OPTIMIZER_OPTIPNG && !EWWW_IMAGE_OPTIMIZER_CLOUD) {
$valid = false;
$msg = '<br>' . sprintf(__('%s is missing', EWWW_IMAGE_OPTIMIZER_DOMAIN), '<em>optipng/pngout</em>');
}
break;
case 'image/gif':
if (!EWWW_IMAGE_OPTIMIZER_GIFSICLE && !EWWW_IMAGE_OPTIMIZER_CLOUD) {
$valid = false;
$msg = '<br>' . sprintf(__('%s is missing', EWWW_IMAGE_OPTIMIZER_DOMAIN), '<em>gifsicle</em>');
}
break;
default:
$valid = false;
}
// let user know if the file type is unsupported
if ($valid == false) {
_e('Unsupported file type', EWWW_IMAGE_OPTIMIZER_DOMAIN);
return;
}
// output the image status if we know it
if (!empty($status)) {
echo $status;
echo "<br>" . sprintf(__('Image Size: %s', EWWW_IMAGE_OPTIMIZER_DOMAIN), $file_size);
printf("<br><a href=\"admin.php?action=ewww_flag_manual&force=1&attachment_ID=%d\">%s</a>", $id, __('Re-optimize', EWWW_IMAGE_OPTIMIZER_DOMAIN));
// otherwise, tell the user that they can optimize the image now
} else {
_e('Not processed', EWWW_IMAGE_OPTIMIZER_DOMAIN);
echo "<br>" . sprintf(__('Image Size: %s', EWWW_IMAGE_OPTIMIZER_DOMAIN), $file_size);
printf("<br><a href=\"admin.php?action=ewww_flag_manual&attachment_ID=%d\">%s</a>", $id, __('Optimize now!', EWWW_IMAGE_OPTIMIZER_DOMAIN));
}
}
}
示例9: ewww_ngg_bulk_preview
function ewww_ngg_bulk_preview()
{
global $ewww_debug;
if (!empty($_POST['doaction'])) {
// if there is no requested bulk action, do nothing
if (empty($_REQUEST['bulkaction'])) {
return;
}
// if there is no media to optimize, do nothing
if (empty($_REQUEST['doaction']) || !is_array($_REQUEST['doaction'])) {
return;
}
}
list($fullsize_count, $unoptimized_count, $resize_count, $unoptimized_resize_count) = ewww_image_optimizer_count_optimized('ngg');
// make sure there are some attachments to process
if ($fullsize_count < 1) {
echo '<p>' . __('You do not appear to have uploaded any images yet.', EWWW_IMAGE_OPTIMIZER_DOMAIN) . '</p>';
return;
}
// ewww_image_optimizer_cloud_verify(false);
?>
<div class="wrap">
<div id="icon-upload" class="icon32"></div><h2><?php
_e('Bulk Optimize', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
</h2>
<?php
// Retrieve the value of the 'bulk resume' option and set the button text for the form to use
$resume = get_option('ewww_image_optimizer_bulk_ngg_resume');
if (empty($resume)) {
$button_text = __('Start optimizing', EWWW_IMAGE_OPTIMIZER_DOMAIN);
} else {
$button_text = __('Resume previous bulk operation', EWWW_IMAGE_OPTIMIZER_DOMAIN);
}
?>
<div id="ewww-bulk-loading"></div>
<div id="ewww-bulk-progressbar"></div>
<div id="ewww-bulk-counter"></div>
<form id="ewww-bulk-stop" style="display:none;" method="post" action="">
<br /><input type="submit" class="button-secondary action" value="<?php
_e('Stop Optimizing', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
" />
</form>
<div id="ewww-bulk-status"></div>
<form class="ewww-bulk-form">
<p><label for="ewww-force" style="font-weight: bold"><?php
_e('Force re-optimize', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
</label> <input type="checkbox" id="ewww-force" name="ewww-force"></p>
<p><label for="ewww-delay" style="font-weight: bold"><?php
_e('Choose how long to pause between images (in seconds, 0 = disabled)', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
</label> <input type="text" id="ewww-delay" name="ewww-delay" value="<?php
if ($delay = ewww_image_optimizer_get_option('ewww_image_optimizer_delay')) {
echo $delay;
} else {
echo 0;
}
?>
"></p>
<div id="ewww-delay-slider" style="width:50%"></div>
</form>
<div id="ewww-bulk-forms">
<p class="ewww-bulk-info"><?php
printf(__('%1$d images have been selected (%2$d unoptimized), with %3$d resizes (%4$d unoptimized).', EWWW_IMAGE_OPTIMIZER_DOMAIN), $fullsize_count, $unoptimized_count, $resize_count, $unoptimized_resize_count);
?>
<br />
<?php
_e('Previously optimized images will be skipped by default.', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
</p>
<form id="ewww-bulk-start" class="ewww-bulk-form" method="post" action="">
<input type="submit" class="button-secondary action" value="<?php
echo $button_text;
?>
" />
</form>
<?php
// if there is a previous bulk operation to resume, give the user the option to reset the resume flag
if (!empty($resume)) {
?>
<p class="ewww-bulk-info"><?php
_e('If you would like to start over again, press the Reset Status button to reset the bulk operation status.', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
</p>
<form id="ewww-bulk-reset" class="ewww-bulk-form" method="post" action="">
<?php
wp_nonce_field('ewww-image-optimizer-bulk-reset', 'ewww_wpnonce');
?>
<input type="hidden" name="ewww_reset" value="1">
<input type="submit" class="button-secondary action" value="<?php
_e('Reset Status', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
" />
</form>
<?php
}
echo '</div></div>';
if (ewww_image_optimizer_get_option('ewww_image_optimizer_debug')) {
//.........这里部分代码省略.........
示例10: ewww_image_optimizer_aux_images_script
function ewww_image_optimizer_aux_images_script($hook)
{
// make sure we are being called from the proper page
if ('ewww-image-optimizer-auto' !== $hook && empty($_REQUEST['scan'])) {
return;
}
global $ewww_debug;
global $wpdb;
$ewww_debug .= "<b>ewww_image_optimizer_aux_images_script()</b><br>";
// initialize the $attachments variable for auxiliary images
$attachments = null;
// check the 'bulk resume' option
$resume = get_option('ewww_image_optimizer_aux_resume');
// check if there is a previous bulk operation to resume
if (!empty($resume)) {
// retrieve the attachment IDs that have not been finished from the 'bulk attachments' option
$attachments = get_option('ewww_image_optimizer_aux_attachments');
} else {
// collect a list of images from the current theme
$child_path = get_stylesheet_directory();
$parent_path = get_template_directory();
$attachments = ewww_image_optimizer_image_scan($child_path);
if ($child_path !== $parent_path) {
$attachments = array_merge($attachments, ewww_image_optimizer_image_scan($parent_path));
}
// collect a list of images in auxiliary folders provided by user
if ($aux_paths = ewww_image_optimizer_get_option('ewww_image_optimizer_aux_paths')) {
foreach ($aux_paths as $aux_path) {
$attachments = array_merge($attachments, ewww_image_optimizer_image_scan($aux_path));
}
}
// collect a list of images for buddypress
if (is_plugin_active('buddypress/bp-loader.php') || function_exists('is_plugin_active_for_network') && is_plugin_active_for_network('buddypress/bp-loader.php')) {
// get the value of the wordpress upload directory
$upload_dir = wp_upload_dir();
// scan the 'avatars' and 'group-avatars' folders for images
$attachments = array_merge($attachments, ewww_image_optimizer_image_scan($upload_dir['basedir'] . '/avatars'), ewww_image_optimizer_image_scan($upload_dir['basedir'] . '/group-avatars'));
}
if (is_plugin_active('buddypress-activity-plus/bpfb.php') || function_exists('is_plugin_active_for_network') && is_plugin_active_for_network('buddypress-activity-plus/bpfb.php')) {
// get the value of the wordpress upload directory
$upload_dir = wp_upload_dir();
// scan the 'avatars' and 'group-avatars' folders for images
$attachments = array_merge($attachments, ewww_image_optimizer_image_scan($upload_dir['basedir'] . '/bpfb'));
}
if (is_plugin_active('wp-symposium/wp-symposium.php') || function_exists('is_plugin_active_for_network') && is_plugin_active_for_network('wp-symposium/wp-symposium.php')) {
$attachments = array_merge($attachments, ewww_image_optimizer_image_scan(get_option('symposium_img_path')));
}
if (is_plugin_active('ml-slider/ml-slider.php') || function_exists('is_plugin_active_for_network') && is_plugin_active_for_network('ml-slider/ml-slider.php')) {
$slide_paths = array();
$sliders = get_posts(array('numberposts' => -1, 'post_type' => 'ml-slider', 'post_status' => 'any', 'fields' => 'ids'));
foreach ($sliders as $slider) {
$slides = get_posts(array('numberposts' => -1, 'orderby' => 'menu_order', 'order' => 'ASC', 'post_type' => 'attachment', 'post_status' => 'inherit', 'fields' => 'ids', 'tax_query' => array(array('taxonomy' => 'ml-slider', 'field' => 'slug', 'terms' => $slider))));
foreach ($slides as $slide) {
$backup_sizes = get_post_meta($slide, '_wp_attachment_backup_sizes', true);
$type = get_post_meta($slide, 'ml-slider_type', true);
$type = $type ? $type : 'image';
// backwards compatibility, fall back to 'image'
if ($type === 'image') {
foreach ($backup_sizes as $backup_size => $meta) {
if (preg_match('/resized-/', $backup_size)) {
$path = $meta['path'];
$image_size = filesize($path);
$query = $wpdb->prepare("SELECT id FROM {$wpdb->ewwwio_images} WHERE BINARY path LIKE %s AND image_size LIKE '{$image_size}'", $path);
$already_optimized = $wpdb->get_results($query);
$mimetype = ewww_image_optimizer_mimetype($path, 'i');
if (preg_match('/^image\\/(jpeg|png|gif)/', $mimetype) && empty($already_optimized)) {
$slide_paths[] = $path;
}
}
}
}
}
}
$attachments = array_merge($attachments, $slide_paths);
}
// store the filenames we retrieved in the 'bulk_attachments' option so we can keep track of our progress in the database
update_option('ewww_image_optimizer_aux_attachments', $attachments);
}
ewww_image_optimizer_debug_log();
// submit a couple variables to the javascript to work with
$attachments = json_encode($attachments);
if (!empty($_REQUEST['scan'])) {
if (empty($attachments)) {
_e('Nothing to optimize', EWWW_IMAGE_OPTIMIZER_DOMAIN);
} else {
echo $attachments;
}
die;
} else {
return;
}
}
示例11: ewww_image_optimizer_aux_images_script
function ewww_image_optimizer_aux_images_script($hook)
{
ewwwio_debug_message('<b>' . __FUNCTION__ . '()</b>');
// make sure we are being called from the proper page
if ('ewww-image-optimizer-auto' !== $hook && empty($_REQUEST['ewww_scan'])) {
return;
}
session_write_close();
global $wpdb;
if (!empty($_REQUEST['ewww_force'])) {
ewwwio_debug_message('forcing re-optimize: true');
}
// initialize the $attachments variable for auxiliary images
$attachments = null;
// check the 'bulk resume' option
$resume = get_option('ewww_image_optimizer_aux_resume');
// check if there is a previous bulk operation to resume
if (!empty($resume)) {
ewwwio_debug_message('resuming from where we left off, no scanning needed');
// retrieve the attachment IDs that have not been finished from the 'bulk attachments' option
$attachments = get_option('ewww_image_optimizer_aux_attachments');
} else {
ewwwio_debug_message('getting fresh list of files to optimize');
$attachments = array();
// collect a list of images from the current theme
$child_path = get_stylesheet_directory();
$parent_path = get_template_directory();
$attachments = ewww_image_optimizer_image_scan($child_path);
if ($child_path !== $parent_path) {
$attachments = array_merge($attachments, ewww_image_optimizer_image_scan($parent_path));
}
if (!function_exists('is_plugin_active')) {
// need to include the plugin library for the is_plugin_active function
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
// collect a list of images for buddypress
if (is_plugin_active('buddypress/bp-loader.php') || is_plugin_active_for_network('buddypress/bp-loader.php')) {
// get the value of the wordpress upload directory
$upload_dir = wp_upload_dir();
// scan the 'avatars' and 'group-avatars' folders for images
$attachments = array_merge($attachments, ewww_image_optimizer_image_scan($upload_dir['basedir'] . '/avatars'), ewww_image_optimizer_image_scan($upload_dir['basedir'] . '/group-avatars'));
}
if (is_plugin_active('buddypress-activity-plus/bpfb.php') || is_plugin_active_for_network('buddypress-activity-plus/bpfb.php')) {
// get the value of the wordpress upload directory
$upload_dir = wp_upload_dir();
// scan the 'avatars' and 'group-avatars' folders for images
$attachments = array_merge($attachments, ewww_image_optimizer_image_scan($upload_dir['basedir'] . '/bpfb'));
}
if (is_plugin_active('grand-media/grand-media.php') || is_plugin_active_for_network('grand-media/grand-media.php')) {
// scan the grand media folder for images
$attachments = array_merge($attachments, ewww_image_optimizer_image_scan(WP_CONTENT_DIR . '/grand-media'));
}
if (is_plugin_active('wp-symposium/wp-symposium.php') || is_plugin_active_for_network('wp-symposium/wp-symposium.php')) {
$attachments = array_merge($attachments, ewww_image_optimizer_image_scan(get_option('symposium_img_path')));
}
if (is_plugin_active('ml-slider/ml-slider.php') || is_plugin_active_for_network('ml-slider/ml-slider.php')) {
$slide_paths = array();
$slides = $wpdb->get_col("\n\t\t\t\tSELECT wpposts.ID \n\t\t\t\tFROM {$wpdb->posts} wpposts \n\t\t\t\tINNER JOIN {$wpdb->term_relationships} term_relationships\n\t\t\t\t\t\tON wpposts.ID = term_relationships.object_id\n\t\t\t\tINNER JOIN {$wpdb->terms} wpterms \n\t\t\t\t\t\tON term_relationships.term_taxonomy_id = wpterms.term_id\n\t\t\t\tINNER JOIN {$wpdb->term_taxonomy} term_taxonomy\n\t\t\t\t\t\tON wpterms.term_id = term_taxonomy.term_id\n\t\t\t\tWHERE \tterm_taxonomy.taxonomy = 'ml-slider'\n\t\t\t\t\tAND wpposts.post_type = 'attachment'\n\t\t\t\t");
foreach ($slides as $slide) {
$backup_sizes = get_post_meta($slide, '_wp_attachment_backup_sizes', true);
$type = get_post_meta($slide, 'ml-slider_type', true);
$type = $type ? $type : 'image';
// backwards compatibility, fall back to 'image'
if ($type === 'image') {
foreach ($backup_sizes as $backup_size => $meta) {
if (preg_match('/resized-/', $backup_size)) {
$path = $meta['path'];
$image_size = ewww_image_optimizer_filesize($path);
if (!$image_size) {
continue;
}
$already_optimized = ewww_image_optimizer_find_already_optimized($path);
$mimetype = ewww_image_optimizer_mimetype($path, 'i');
if (preg_match('/^image\\/(jpeg|png|gif)/', $mimetype) && empty($already_optimized)) {
$slide_paths[] = $path;
}
}
}
}
}
$attachments = array_merge($attachments, $slide_paths);
}
// collect a list of images in auxiliary folders provided by user
if ($aux_paths = ewww_image_optimizer_get_option('ewww_image_optimizer_aux_paths')) {
foreach ($aux_paths as $aux_path) {
$attachments = array_merge($attachments, ewww_image_optimizer_image_scan($aux_path));
}
}
// scan images in two most recent media library folders if the option is enabled, and this is a scheduled optimization
if ('ewww-image-optimizer-auto' == $hook && ewww_image_optimizer_get_option('ewww_image_optimizer_include_media_paths')) {
// retrieve the location of the wordpress upload folder
$upload_dir = wp_upload_dir();
// retrieve the path of the upload folder
$upload_path = $upload_dir['basedir'];
$this_month = date('m');
$this_year = date('Y');
$attachments = array_merge($attachments, ewww_image_optimizer_image_scan("{$upload_path}/{$this_year}/{$this_month}/"));
if (class_exists('DateTime')) {
$date = new DateTime();
$date->sub(new DateInterval('P1M'));
//.........这里部分代码省略.........
示例12: ewww_ngg_bulk_preview
function ewww_ngg_bulk_preview()
{
if (!empty($_REQUEST['doaction'])) {
// if there is no requested bulk action, do nothing
if (empty($_REQUEST['bulkaction'])) {
return;
}
// if there is no media to optimize, do nothing
if (empty($_REQUEST['doaction']) || !is_array($_REQUEST['doaction'])) {
return;
}
}
// retrieve the attachments array from the db
$attachments = get_option('ewww_image_optimizer_bulk_ngg_attachments');
// make sure there are some attachments to process
if (count($attachments) < 1) {
echo '<p>' . esc_html__('You do not appear to have uploaded any images yet.', EWWW_IMAGE_OPTIMIZER_DOMAIN) . '</p>';
return;
}
?>
<div class="wrap">
<h1><?php
esc_html_e('Bulk Optimize', EWWW_IMAGE_OPTIMIZER_DOMAIN);
if (ewww_image_optimizer_get_option('ewww_image_optimizer_cloud_key')) {
$verify_cloud = ewww_image_optimizer_cloud_verify(false);
echo '<a id="ewww-bulk-credits-available" target="_blank" class="page-title-action" style="float:right;" href="https://ewww.io/my-account/">' . esc_html__('Image credits available:', EWWW_IMAGE_OPTIMIZER_DOMAIN) . ' ' . ewww_image_optimizer_cloud_quota() . '</a>';
}
echo '</h1>';
// Retrieve the value of the 'bulk resume' option and set the button text for the form to use
$resume = get_option('ewww_image_optimizer_bulk_ngg_resume');
if (empty($resume)) {
$button_text = esc_attr__('Start optimizing', EWWW_IMAGE_OPTIMIZER_DOMAIN);
} else {
$button_text = esc_attr__('Resume previous bulk operation', EWWW_IMAGE_OPTIMIZER_DOMAIN);
}
?>
<div id="ewww-bulk-loading"></div>
<div id="ewww-bulk-progressbar"></div>
<div id="ewww-bulk-counter"></div>
<form id="ewww-bulk-stop" style="display:none;" method="post" action="">
<br /><input type="submit" class="button-secondary action" value="<?php
esc_attr_e('Stop Optimizing', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
" />
</form>
<div id="ewww-bulk-widgets" class="metabox-holder" style="display:none">
<div class="meta-box-sortables">
<div id="ewww-bulk-last" class="postbox">
<button type="button" class="handlediv button-link" aria-expanded="true">
<span class="screen-reader-text"><?php
esc_html_e('Click to toggle', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
</span>
<span class="toggle-indicator" aria-hidden="true"></span>
</button>
<h2 class="hndle"><span><?php
esc_html_e('Last Image Optimized', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
</span></h2>
<div class="inside"></div>
</div>
</div>
<div class="meta-box-sortables">
<div id="ewww-bulk-status" class="postbox">
<button type="button" class="handlediv button-link" aria-expanded="true">
<span class="screen-reader-text"><?php
esc_html_e('Click to toggle', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
</span>
<span class="toggle-indicator" aria-hidden="true"></span>
</button>
<h2 class="hndle"><span><?php
esc_html_e('Optimization Log', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
</span></h2>
<div class="inside"></div>
</div>
</div>
</div>
<div id="ewww-bulk-forms">
<p class="ewww-bulk-info"><?php
printf(esc_html__('We have %d images to optimize.', EWWW_IMAGE_OPTIMIZER_DOMAIN), count($attachments));
?>
<br />
<?php
esc_html_e('Previously optimized images will be skipped by default.', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
</p>
<form id="ewww-bulk-start" class="ewww-bulk-form" method="post" action="">
<input type="hidden" id="ewww-delay" name="ewww-delay" value="0">
<input type="submit" class="button-secondary action" value="<?php
echo $button_text;
?>
" />
</form>
<?php
// if there is a previous bulk operation to resume, give the user the option to reset the resume flag
if (!empty($resume)) {
?>
<p class="ewww-bulk-info"><?php
//.........这里部分代码省略.........
示例13: ewww_image_optimizer_aux_images_script
function ewww_image_optimizer_aux_images_script($hook)
{
// make sure we are being called from the proper page
if ('ewww-image-optimizer-auto' !== $hook && empty($_REQUEST['ewww_scan'])) {
return;
}
global $ewww_debug;
global $wpdb;
$ewww_debug .= "<b>ewww_image_optimizer_aux_images_script()</b><br>";
if (!empty($_REQUEST['ewww_force'])) {
$ewww_debug .= "forcing re-optimize: true<br>";
}
// initialize the $attachments variable for auxiliary images
$attachments = null;
// check the 'bulk resume' option
$resume = get_option('ewww_image_optimizer_aux_resume');
// check if there is a previous bulk operation to resume
if (!empty($resume)) {
// retrieve the attachment IDs that have not been finished from the 'bulk attachments' option
$attachments = get_option('ewww_image_optimizer_aux_attachments');
} else {
$attachments = array();
// collect a list of images from the current theme
$child_path = get_stylesheet_directory();
$parent_path = get_template_directory();
$attachments = ewww_image_optimizer_image_scan($child_path);
if ($child_path !== $parent_path) {
$attachments = array_merge($attachments, ewww_image_optimizer_image_scan($parent_path));
}
if (!function_exists('is_plugin_active')) {
// need to include the plugin library for the is_plugin_active function
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
// collect a list of images for buddypress
if (is_plugin_active('buddypress/bp-loader.php') || function_exists('is_plugin_active_for_network') && is_plugin_active_for_network('buddypress/bp-loader.php')) {
// get the value of the wordpress upload directory
$upload_dir = wp_upload_dir();
// scan the 'avatars' and 'group-avatars' folders for images
$attachments = array_merge($attachments, ewww_image_optimizer_image_scan($upload_dir['basedir'] . '/avatars'), ewww_image_optimizer_image_scan($upload_dir['basedir'] . '/group-avatars'));
}
if (is_plugin_active('buddypress-activity-plus/bpfb.php') || function_exists('is_plugin_active_for_network') && is_plugin_active_for_network('buddypress-activity-plus/bpfb.php')) {
// get the value of the wordpress upload directory
$upload_dir = wp_upload_dir();
// scan the 'avatars' and 'group-avatars' folders for images
$attachments = array_merge($attachments, ewww_image_optimizer_image_scan($upload_dir['basedir'] . '/bpfb'));
}
if (is_plugin_active('grand-media/grand-media.php') || function_exists('is_plugin_active_for_network') && is_plugin_active_for_network('grand-media/grand-media.php')) {
// scan the grand media folder for images
$attachments = array_merge($attachments, ewww_image_optimizer_image_scan(WP_CONTENT_DIR . '/grand-media'));
}
if (is_plugin_active('wp-symposium/wp-symposium.php') || function_exists('is_plugin_active_for_network') && is_plugin_active_for_network('wp-symposium/wp-symposium.php')) {
$attachments = array_merge($attachments, ewww_image_optimizer_image_scan(get_option('symposium_img_path')));
}
if (is_plugin_active('ml-slider/ml-slider.php') || function_exists('is_plugin_active_for_network') && is_plugin_active_for_network('ml-slider/ml-slider.php')) {
$slide_paths = array();
$sliders = get_posts(array('numberposts' => -1, 'post_type' => 'ml-slider', 'post_status' => 'any', 'fields' => 'ids'));
foreach ($sliders as $slider) {
$slides = get_posts(array('numberposts' => -1, 'orderby' => 'menu_order', 'order' => 'ASC', 'post_type' => 'attachment', 'post_status' => 'inherit', 'fields' => 'ids', 'tax_query' => array(array('taxonomy' => 'ml-slider', 'field' => 'slug', 'terms' => $slider))));
foreach ($slides as $slide) {
$backup_sizes = get_post_meta($slide, '_wp_attachment_backup_sizes', true);
$type = get_post_meta($slide, 'ml-slider_type', true);
$type = $type ? $type : 'image';
// backwards compatibility, fall back to 'image'
if ($type === 'image') {
foreach ($backup_sizes as $backup_size => $meta) {
if (preg_match('/resized-/', $backup_size)) {
$path = $meta['path'];
$image_size = filesize($path);
$query = $wpdb->prepare("SELECT id FROM {$wpdb->ewwwio_images} WHERE path LIKE %s AND image_size LIKE '{$image_size}'", $path);
$optimized_query = $wpdb->get_results($query, ARRAY_A);
if (!empty($optimized_query)) {
foreach ($optimized_query as $image) {
if ($image['path'] != $path) {
$ewww_debug .= "{$image['path']} does not match {$path}, continuing our search<br>";
} else {
$already_optimized = $image;
}
}
}
$mimetype = ewww_image_optimizer_mimetype($path, 'i');
if (preg_match('/^image\\/(jpeg|png|gif)/', $mimetype) && empty($already_optimized)) {
$slide_paths[] = $path;
}
}
}
}
}
}
$attachments = array_merge($attachments, $slide_paths);
}
// collect a list of images in auxiliary folders provided by user
if ($aux_paths = ewww_image_optimizer_get_option('ewww_image_optimizer_aux_paths')) {
foreach ($aux_paths as $aux_path) {
$attachments = array_merge($attachments, ewww_image_optimizer_image_scan($aux_path));
}
}
// scan images in two most recent media library folders if the option is enabled, and this is a scheduled optimization
if ('ewww-image-optimizer-auto' == $hook && ewww_image_optimizer_get_option('ewww_image_optimizer_include_media_paths')) {
// retrieve the location of the wordpress upload folder
$upload_dir = wp_upload_dir();
//.........这里部分代码省略.........
示例14: ewwwio_debug_message
function ewwwio_debug_message($message)
{
if (ewww_image_optimizer_get_option('ewww_image_optimizer_debug')) {
global $ewww_debug;
$ewww_debug .= "{$message}<br>";
}
}
示例15: ewww_ngg_bulk_loop
function ewww_ngg_bulk_loop()
{
if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'ewww-image-optimizer-bulk') || !current_user_can('edit_others_posts')) {
wp_die(__('Cheatin’ eh?', EWWW_IMAGE_OPTIMIZER_DOMAIN));
}
// need this file to work with metadata
require_once WP_CONTENT_DIR . '/plugins/nextgen-gallery/lib/meta.php';
// find out what time we started, in microseconds
$started = microtime(true);
$id = $_POST['attachment'];
// get the metadata
$meta = new nggMeta($id);
// retrieve the filepath
$file_path = $meta->image->imagePath;
// run the optimizer on the current image
$fres = ewww_image_optimizer($file_path, 2, false, false, ewww_image_optimizer_get_option('ewww_image_optimizer_lossy_skip_full'));
// update the metadata of the optimized image
nggdb::update_image_meta($id, array('ewww_image_optimizer' => $fres[1]));
// output the results of the optimization
printf("<p>" . __('Optimized image:', EWWW_IMAGE_OPTIMIZER_DOMAIN) . " <strong>%s</strong><br>", $meta->image->filename);
printf(__('Full size - %s', EWWW_IMAGE_OPTIMIZER_DOMAIN) . "<br>", $fres[1]);
// get the filepath of the thumbnail image
$thumb_path = $meta->image->thumbPath;
// run the optimization on the thumbnail
$tres = ewww_image_optimizer($thumb_path, 2, false, true);
// output the results of the thumb optimization
printf(__('Thumbnail - %s', EWWW_IMAGE_OPTIMIZER_DOMAIN) . "<br>", $tres[1]);
// outupt how much time we spent
$elapsed = microtime(true) - $started;
printf(__('Elapsed: %.3f seconds', EWWW_IMAGE_OPTIMIZER_DOMAIN) . "</p>", $elapsed);
// get the list of attachments remaining from the db
$attachments = get_option('ewww_image_optimizer_bulk_ngg_attachments');
// remove the first item
if (!empty($attachments)) {
array_shift($attachments);
}
// and store the list back in the db
update_option('ewww_image_optimizer_bulk_ngg_attachments', $attachments);
die;
}