本文整理汇总了PHP中ewww_image_optimizer_cloud_verify函数的典型用法代码示例。如果您正苦于以下问题:PHP ewww_image_optimizer_cloud_verify函数的具体用法?PHP ewww_image_optimizer_cloud_verify怎么用?PHP ewww_image_optimizer_cloud_verify使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ewww_image_optimizer_cloud_verify函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ewww_image_optimizer_options
function ewww_image_optimizer_options()
{
global $ewww_debug;
$ewww_debug .= '<b>ewww_image_optimizer_options()</b><br>';
$output = array();
if (isset($_REQUEST['ewww_pngout'])) {
if ($_REQUEST['ewww_pngout'] == 'success') {
$output[] = "<div id='ewww-image-optimizer-pngout-success' class='updated fade'>\n";
$output[] = '<p>' . __('Pngout was successfully installed, check the Plugin Status area for version information.', EWWW_IMAGE_OPTIMIZER_DOMAIN) . "</p>\n";
$output[] = "</div>\n";
}
if ($_REQUEST['ewww_pngout'] == 'failed') {
$output[] = "<div id='ewww-image-optimizer-pngout-failure' class='error'>\n";
$output[] = '<p>' . sprintf(__('Pngout was not installed: %1$s. Make sure this folder is writable: %2$s', EWWW_IMAGE_OPTIMIZER_DOMAIN), sanitize_text_field($_REQUEST['ewww_error']), EWWW_IMAGE_OPTIMIZER_TOOL_PATH) . "</p>\n";
$output[] = "</div>\n";
}
}
$output[] = "<script type='text/javascript'>\n" . 'jQuery(document).ready(function($) {$(".fade").fadeTo(5000,1).fadeOut(3000);$(".updated").fadeTo(5000,1).fadeOut(3000);});' . "\n" . "</script>\n";
$output[] = "<style>\n" . ".ewww-tab a { font-size: 15px; font-weight: 700; color: #555; text-decoration: none; line-height: 36px; padding: 0 10px; }\n" . ".ewww-tab a:hover { color: #464646; }\n" . ".ewww-tab { margin: 0 0 0 5px; padding: 0px; border-width: 1px 1px 1px; border-style: solid solid none; border-image: none; border-color: #ccc; display: inline-block; background-color: #e4e4e4 }\n" . ".ewww-tab:hover { background-color: #fff }\n" . ".ewww-selected { background-color: #f1f1f1; margin-bottom: -1px; border-bottom: 1px solid #f1f1f1 }\n" . ".ewww-selected a { color: #000; }\n" . ".ewww-selected:hover { background-color: #f1f1f1; }\n" . ".ewww-tab-nav { list-style: none; margin: 10px 0 0; padding-left: 5px; border-bottom: 1px solid #ccc; }\n" . "</style>\n";
$output[] = "<div class='wrap'>\n";
$output[] = "<h2>EWWW Image Optimizer</h2>\n";
$output[] = "<div id='ewww-container-left' style='float: left; margin-right: 225px;'>\n";
$output[] = "<p><a href='https://wordpress.org/extend/plugins/ewww-image-optimizer/'>" . __('Plugin Home Page', EWWW_IMAGE_OPTIMIZER_DOMAIN) . "</a> | " . "<a href='https://wordpress.org/extend/plugins/ewww-image-optimizer/installation/'>" . __('Installation Instructions', EWWW_IMAGE_OPTIMIZER_DOMAIN) . "</a> | " . "<a href='https://wordpress.org/support/plugin/ewww-image-optimizer'>" . __('Plugin Support', EWWW_IMAGE_OPTIMIZER_DOMAIN) . "</a> | " . "<a href='https://ewww.io/status/'>" . __('Cloud Status', EWWW_IMAGE_OPTIMIZER_DOMAIN) . "</a></p>\n";
if (function_exists('is_plugin_active_for_network') && is_plugin_active_for_network(EWWW_IMAGE_OPTIMIZER_PLUGIN_FILE_REL)) {
$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>';
}
$output[] = "<p>" . sprintf(__('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>\n";
if (EWWW_IMAGE_OPTIMIZER_CLOUD) {
$collapsed = '';
} else {
$collapsed = "\$('#ewww-status').toggleClass('closed');\n";
}
$output[] = "<div id='ewww-widgets' class='metabox-holder'><div class='meta-box-sortables'><div id='ewww-status' class='postbox'>\n" . "<div class='handlediv' title='" . esc_attr__('Click to toggle') . "'><br></div>" . "<h3 class='hndle'>" . __('Plugin Status', EWWW_IMAGE_OPTIMIZER_DOMAIN) . " " . "<span id='ewww-status-ok' style='display: none; color: green;'>" . __('All Clear', EWWW_IMAGE_OPTIMIZER_DOMAIN) . "</span>" . "<span id='ewww-status-attention' style='color: red;'>" . __('Requires Attention', EWWW_IMAGE_OPTIMIZER_DOMAIN) . "</span>" . "</h3>\n" . "<div class='inside'>" . "<b>" . __('Total Savings:', EWWW_IMAGE_OPTIMIZER_DOMAIN) . "</b> <span id='ewww-total-savings'>" . size_format(ewww_image_optimizer_savings(), 2) . "</span><br>";
if (ewww_image_optimizer_get_option('ewww_image_optimizer_cloud_key')) {
$output[] = '<p><b>' . __('Cloud optimization API Key', EWWW_IMAGE_OPTIMIZER_DOMAIN) . ":</b> ";
$verify_cloud = ewww_image_optimizer_cloud_verify(false);
if (preg_match('/great/', $verify_cloud)) {
$output[] = '<span style="color: green">' . __('Verified,', EWWW_IMAGE_OPTIMIZER_DOMAIN) . ' </span>' . ewww_image_optimizer_cloud_quota();
} elseif (preg_match('/exceeded/', $verify_cloud)) {
$output[] = '<span style="color: orange">' . __('Verified,', EWWW_IMAGE_OPTIMIZER_DOMAIN) . ' </span>' . ewww_image_optimizer_cloud_quota();
} else {
$output[] = '<span style="color: red">' . __('Not Verified', EWWW_IMAGE_OPTIMIZER_DOMAIN) . '</span>';
}
$output[] = "</p>\n";
}
$collapsible = true;
if (!EWWW_IMAGE_OPTIMIZER_CLOUD) {
/* $output[] = "<div id='ewww-status-expand' style='display: none;'><a href='#'>" . __('Expand', EWWW_IMAGE_OPTIMIZER_DOMAIN) . "</a></div>\n" .
"<div id='ewww-status-collapse' style='display: none;'><a href='#'>" . __('Collapse', EWWW_IMAGE_OPTIMIZER_DOMAIN) . "</a></div>\n" .
"<div id='ewww-collapsible-status'>\n";*/
// $output[] = "<div id='ewww-collapsible-status'>\n";
}
if (ewww_image_optimizer_get_option('ewww_image_optimizer_skip_bundle') && !EWWW_IMAGE_OPTIMIZER_CLOUD && !EWWW_IMAGE_OPTIMIZER_NOEXEC) {
$output[] = "<p>" . __('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 />\n" . "<i>*" . __('Updates are optional, but may contain increased optimization or security patches', EWWW_IMAGE_OPTIMIZER_DOMAIN) . "</i></p>\n";
} elseif (!EWWW_IMAGE_OPTIMIZER_CLOUD && !EWWW_IMAGE_OPTIMIZER_NOEXEC) {
$output[] = "<p>" . sprintf(__('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 />\n" . "<i>*" . __('Updates are optional, but may contain increased optimization or security patches', EWWW_IMAGE_OPTIMIZER_DOMAIN) . "</i></p>\n";
}
if (!EWWW_IMAGE_OPTIMIZER_CLOUD && !EWWW_IMAGE_OPTIMIZER_NOEXEC) {
list($jpegtran_src, $optipng_src, $gifsicle_src, $jpegtran_dst, $optipng_dst, $gifsicle_dst) = ewww_image_optimizer_install_paths();
}
$output[] = "<p>\n";
if (!ewww_image_optimizer_get_option('ewww_image_optimizer_disable_jpegtran') && !ewww_image_optimizer_get_option('ewww_image_optimizer_cloud_jpg') && !EWWW_IMAGE_OPTIMIZER_NOEXEC) {
$output[] = "<b>jpegtran:</b> ";
$jpegtran_installed = ewww_image_optimizer_tool_found(EWWW_IMAGE_OPTIMIZER_JPEGTRAN, 'j');
if (!empty($jpegtran_installed)) {
$output[] = '<span style="color: green; font-weight: bolder">' . __('Installed', EWWW_IMAGE_OPTIMIZER_DOMAIN) . '</span> ' . __('version', EWWW_IMAGE_OPTIMIZER_DOMAIN) . ': ' . $jpegtran_installed . "<br />\n";
} else {
$output[] = '<span style="color: red; font-weight: bolder">' . __('Missing', EWWW_IMAGE_OPTIMIZER_DOMAIN) . '</span><br />' . "\n";
$collapsible = false;
}
}
if (!ewww_image_optimizer_get_option('ewww_image_optimizer_disable_optipng') && !ewww_image_optimizer_get_option('ewww_image_optimizer_cloud_png') && !EWWW_IMAGE_OPTIMIZER_NOEXEC) {
$output[] = "<b>optipng:</b> ";
$optipng_version = ewww_image_optimizer_tool_found(EWWW_IMAGE_OPTIMIZER_OPTIPNG, 'o');
if (!empty($optipng_version)) {
$output[] = '<span style="color: green; font-weight: bolder">' . __('Installed', EWWW_IMAGE_OPTIMIZER_DOMAIN) . '</span> ' . __('version', EWWW_IMAGE_OPTIMIZER_DOMAIN) . ': ' . $optipng_version . "<br />\n";
} else {
$output[] = '<span style="color: red; font-weight: bolder">' . __('Missing', EWWW_IMAGE_OPTIMIZER_DOMAIN) . '</span><br />' . "\n";
$collapsible = false;
}
}
if (!ewww_image_optimizer_get_option('ewww_image_optimizer_disable_gifsicle') && !ewww_image_optimizer_get_option('ewww_image_optimizer_cloud_gif') && !EWWW_IMAGE_OPTIMIZER_NOEXEC) {
$output[] = "<b>gifsicle:</b> ";
$gifsicle_version = ewww_image_optimizer_tool_found(EWWW_IMAGE_OPTIMIZER_GIFSICLE, 'g');
if (!empty($gifsicle_version) && preg_match('/LCDF Gifsicle/', $gifsicle_version)) {
$output[] = '<span style="color: green; font-weight: bolder">' . __('Installed', EWWW_IMAGE_OPTIMIZER_DOMAIN) . '</span> ' . __('version', EWWW_IMAGE_OPTIMIZER_DOMAIN) . ': ' . $gifsicle_version . "<br />\n";
} else {
$output[] = '<span style="color: red; font-weight: bolder">' . __('Missing', EWWW_IMAGE_OPTIMIZER_DOMAIN) . '</span><br />' . "\n";
$collapsible = false;
}
}
if (!ewww_image_optimizer_get_option('ewww_image_optimizer_disable_pngout') && !ewww_image_optimizer_get_option('ewww_image_optimizer_cloud_png') && !EWWW_IMAGE_OPTIMIZER_NOEXEC) {
$output[] = "<b>pngout:</b> ";
$pngout_version = ewww_image_optimizer_tool_found(EWWW_IMAGE_OPTIMIZER_PNGOUT, 'p');
if (!empty($pngout_version) && preg_match('/PNGOUT/', $pngout_version)) {
$output[] = '<span style="color: green; font-weight: bolder">' . __('Installed', EWWW_IMAGE_OPTIMIZER_DOMAIN) . '</span> ' . __('version', EWWW_IMAGE_OPTIMIZER_DOMAIN) . ': ' . preg_replace('/PNGOUT \\[.*\\)\\s*?/', '', $pngout_version) . "<br />\n";
} else {
$output[] = '<span style="color: red; font-weight: bolder">' . __('Missing', EWWW_IMAGE_OPTIMIZER_DOMAIN) . '</span> <b>' . __('Install', EWWW_IMAGE_OPTIMIZER_DOMAIN) . ' <a href="admin.php?action=ewww_image_optimizer_install_pngout">' . __('automatically', EWWW_IMAGE_OPTIMIZER_DOMAIN) . '</a> | <a href="http://advsys.net/ken/utils.htm">' . __('manually', EWWW_IMAGE_OPTIMIZER_DOMAIN) . '</a></b> - ' . __('Pngout is free closed-source software that can produce drastically reduced filesizes for PNGs, but can be very time consuming to process images', EWWW_IMAGE_OPTIMIZER_DOMAIN) . "<br />\n";
//.........这里部分代码省略.........
示例2: handle
protected function handle()
{
session_write_close();
ewww_image_optimizer_cloud_verify(false);
ewww_image_optimizer_debug_log();
}
示例3: ewww_flag_bulk
function ewww_flag_bulk()
{
// if there is POST data, make sure bulkaction and doaction are the values we want
if (!empty($_POST) && empty($_REQUEST['reset'])) {
// 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;
}
if (!preg_match('/^bulk_optimize/', $_REQUEST['bulkaction'])) {
return;
}
}
list($fullsize_count, $unoptimized_count, $resize_count, $unoptimized_resize_count) = ewww_image_optimizer_count_optimized('flag');
// bail-out if there aren't any images to optimize
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>GRAND FlAGallery <?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_flag_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="bulk-loading"></div>
<div id="bulk-progressbar"></div>
<div id="bulk-counter"></div>
<form id="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="bulk-status"></div>
<form class="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>
<!-- <p><label for="ewww-interval" style="font-weight: bold"><?php
_e('Choose how many images should be processed before each delay', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
</label> <input type="text" id="ewww-interval" name="ewww-interval" value="<?php
if ($interval = ewww_image_optimizer_get_option('ewww_image_optimizer_interval')) {
echo $interval;
} else {
echo 1;
}
?>
"></p>
<div id="ewww-interval-slider" style="width:50%"></div>-->
</form>
<div id="bulk-forms">
<p class="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="bulk-start" class="bulk-form" method="post" action="">
<input type="submit" class="button-secondary action" value="<?php
echo $button_text;
?>
" />
</form>
<?php
// if there was a previous operation, offer the option to reset the option in the db
if (!empty($resume)) {
?>
<p class="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>
//.........这里部分代码省略.........
示例4: 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')) {
$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>
<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);
?>
//.........这里部分代码省略.........
示例5: 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);
?>
//.........这里部分代码省略.........
示例6: ewww_image_optimizer_bulk_quota_update
function ewww_image_optimizer_bulk_quota_update()
{
// 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(esc_html__('Access token has expired, please reload the page.', EWWW_IMAGE_OPTIMIZER_DOMAIN));
}
if (ewww_image_optimizer_get_option('ewww_image_optimizer_cloud_key')) {
ewww_image_optimizer_cloud_verify();
echo esc_html__('Image credits available:', EWWW_IMAGE_OPTIMIZER_DOMAIN) . ' ' . ewww_image_optimizer_cloud_quota();
}
ewwwio_memory(__FUNCTION__);
die;
}
示例7: 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
//.........这里部分代码省略.........
示例8: ewww_image_optimizer_options
function ewww_image_optimizer_options()
{
ewwwio_debug_message('<b>' . __FUNCTION__ . '()</b>');
ewwwio_debug_message('ABSPATH: ' . ABSPATH);
ewwwio_debug_message('WP_CONTENT_DIR: ' . WP_CONTENT_DIR);
ewwwio_debug_message('home url: ' . get_home_url());
ewwwio_debug_message('site url: ' . get_site_url());
if (!function_exists('is_plugin_active_for_network') && is_multisite()) {
// need to include the plugin library for the is_plugin_active function
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
$output = array();
if (isset($_REQUEST['ewww_pngout'])) {
if ($_REQUEST['ewww_pngout'] == 'success') {
$output[] = "<div id='ewww-image-optimizer-pngout-success' class='updated fade'>\n";
$output[] = '<p>' . esc_html__('Pngout was successfully installed, check the Plugin Status area for version information.', EWWW_IMAGE_OPTIMIZER_DOMAIN) . "</p>\n";
$output[] = "</div>\n";
}
if ($_REQUEST['ewww_pngout'] == 'failed') {
$output[] = "<div id='ewww-image-optimizer-pngout-failure' class='error'>\n";
$output[] = '<p>' . sprintf(esc_html__('Pngout was not installed: %1$s. Make sure this folder is writable: %2$s', EWWW_IMAGE_OPTIMIZER_DOMAIN), sanitize_text_field($_REQUEST['ewww_error']), EWWW_IMAGE_OPTIMIZER_TOOL_PATH) . "</p>\n";
$output[] = "</div>\n";
}
}
$output[] = "<script type='text/javascript'>\n" . 'jQuery(document).ready(function($) {$(".fade").fadeTo(5000,1).fadeOut(3000);$(".updated").fadeTo(5000,1).fadeOut(3000);});' . "\n" . "</script>\n";
$output[] = "<style>\n" . ".ewww-tab a { font-size: 15px; font-weight: 700; color: #555; text-decoration: none; line-height: 36px; padding: 0 10px; }\n" . ".ewww-tab a:hover { color: #464646; }\n" . ".ewww-tab { margin: 0 0 0 5px; padding: 0px; border-width: 1px 1px 1px; border-style: solid solid none; border-image: none; border-color: #ccc; display: inline-block; background-color: #e4e4e4 }\n" . ".ewww-tab:hover { background-color: #fff }\n" . ".ewww-selected { background-color: #f1f1f1; margin-bottom: -1px; border-bottom: 1px solid #f1f1f1 }\n" . ".ewww-selected a { color: #000; }\n" . ".ewww-selected:hover { background-color: #f1f1f1; }\n" . ".ewww-tab-nav { list-style: none; margin: 10px 0 0; padding-left: 5px; border-bottom: 1px solid #ccc; }\n" . "</style>\n";
$output[] = "<div class='wrap'>\n";
$output[] = "<h1>EWWW Image Optimizer</h1>\n";
$output[] = "<div id='ewww-container-left' style='float: left; margin-right: 225px;'>\n";
$output[] = "<p><a href='https://wordpress.org/extend/plugins/ewww-image-optimizer/'>" . esc_html__('Plugin Home Page', EWWW_IMAGE_OPTIMIZER_DOMAIN) . "</a> | " . "<a href='https://wordpress.org/extend/plugins/ewww-image-optimizer/installation/'>" . esc_html__('Installation Instructions', EWWW_IMAGE_OPTIMIZER_DOMAIN) . "</a> | " . "<a href='https://wordpress.org/support/plugin/ewww-image-optimizer'>" . esc_html__('Plugin Support', EWWW_IMAGE_OPTIMIZER_DOMAIN) . "</a> | " . "<a href='https://ewww.io/status/'>" . esc_html__('Cloud Status', EWWW_IMAGE_OPTIMIZER_DOMAIN) . "</a> | " . "<a href='https://ewww.io/downloads/s3-image-optimizer/'>" . esc_html__('S3 Image Optimizer', EWWW_IMAGE_OPTIMIZER_DOMAIN) . "</a></p>\n";
if (is_multisite() && is_plugin_active_for_network(EWWW_IMAGE_OPTIMIZER_PLUGIN_FILE_REL)) {
$bulk_link = esc_html__('Media Library', EWWW_IMAGE_OPTIMIZER_DOMAIN) . ' -> ' . esc_html__('Bulk Optimize', EWWW_IMAGE_OPTIMIZER_DOMAIN);
} else {
$bulk_link = '<a href="upload.php?page=ewww-image-optimizer-bulk">' . esc_html__('Bulk Optimize', EWWW_IMAGE_OPTIMIZER_DOMAIN) . '</a>';
}
$output[] = "<p>" . wp_kses(sprintf(__('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), array('a' => array('href' => array()))) . " " . wp_kses(__('Images stored in an Amazon S3 bucket can be optimized using our <a href="https://ewww.io/downloads/s3-image-optimizer/">S3 Image Optimizer</a>.'), array('a' => array('href' => array()))) . "</p>\n";
//if ( EWWW_IMAGE_OPTIMIZER_CLOUD ) {
if (ewww_image_optimizer_full_cloud()) {
$collapsed = '';
} else {
$collapsed = "\$('#ewww-status').toggleClass('closed');\n";
}
$output[] = "<div id='ewww-widgets' class='metabox-holder'><div class='meta-box-sortables'><div id='ewww-status' class='postbox'>\n" . "<button type='button' class='handlediv button-link' aria-expanded='true'>" . "<span class='screen-reader-text'>" . esc_html__('Click to toggle', EWWW_IMAGE_OPTIMIZER_DOMAIN) . "</span>" . "<span class='toggle-indicator' aria-hidden='true'></span>" . "</button>" . "<h2 class='hndle'>" . esc_html__('Plugin Status', EWWW_IMAGE_OPTIMIZER_DOMAIN) . " " . "<span id='ewww-status-ok' style='display: none; color: green;'>" . esc_html__('All Clear', EWWW_IMAGE_OPTIMIZER_DOMAIN) . "</span>" . "<span id='ewww-status-attention' style='color: red;'>" . esc_html__('Requires Attention', EWWW_IMAGE_OPTIMIZER_DOMAIN) . "</span>" . "</h2>\n" . "<div class='inside'>" . "<b>" . esc_html__('Total Savings:', EWWW_IMAGE_OPTIMIZER_DOMAIN) . "</b> <span id='ewww-total-savings'>" . size_format(ewww_image_optimizer_savings(), 2) . "</span><br>";
$collapsible = true;
if (ewww_image_optimizer_get_option('ewww_image_optimizer_cloud_key')) {
$output[] = '<p><b>' . esc_html__('Cloud optimization API Key', EWWW_IMAGE_OPTIMIZER_DOMAIN) . ":</b> ";
$verify_cloud = ewww_image_optimizer_cloud_verify();
if (preg_match('/great/', $verify_cloud)) {
$output[] = '<span style="color: green">' . esc_html__('Verified,', EWWW_IMAGE_OPTIMIZER_DOMAIN) . ' </span>' . ewww_image_optimizer_cloud_quota();
} elseif (preg_match('/exceeded/', $verify_cloud)) {
$output[] = '<span style="color: orange">' . esc_html__('Verified,', EWWW_IMAGE_OPTIMIZER_DOMAIN) . ' </span>' . ewww_image_optimizer_cloud_quota();
$collapsible = false;
} else {
$output[] = '<span style="color: red">' . esc_html__('Not Verified', EWWW_IMAGE_OPTIMIZER_DOMAIN) . '</span>';
$collapsible = false;
}
$output[] = "</p>\n";
$disable_level = '';
} else {
if (EWWW_IMAGE_OPTIMIZER_DOMAIN == 'ewww-image-optimizer-cloud') {
$collapsible = false;
}
$disable_level = "disabled='disabled'";
}
if (ewww_image_optimizer_detect_wpsf_location_lock()) {
$output = '<p><span style="color: orange">' . esc_html__('WARNING:', EWWW_IMAGE_OPTIMIZER_DOMAIN) . '</span> ' . esc_html__("You are using Shield's Lock to Location feature, which prevents the use of Background & Parallel Optimization for faster processing time.", EWWW_IMAGE_OPTIMIZER_DOMAIN) . '</p>';
// this one inactive
$output2[] = '<p><span style="color: orange">' . esc_html__('NOTICE:', EWWW_IMAGE_OPTIMIZER_DOMAIN) . '</span> ' . esc_html__("You are using Shield's User Management feature, which prevents the use of Background & Parallel Optimization for faster processing time.", EWWW_IMAGE_OPTIMIZER_DOMAIN) . '</p>';
$collapsible = false;
}
if (ewww_image_optimizer_get_option('ewww_image_optimizer_skip_bundle') && !ewww_image_optimizer_full_cloud() && !EWWW_IMAGE_OPTIMIZER_NOEXEC) {
$output[] = "<p>" . esc_html__('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 />\n" . "<i>*" . esc_html__('Updates are optional, but may contain increased optimization or security patches', EWWW_IMAGE_OPTIMIZER_DOMAIN) . "</i></p>\n";
} elseif (!ewww_image_optimizer_full_cloud() && !EWWW_IMAGE_OPTIMIZER_NOEXEC) {
$output[] = "<p>" . sprintf(esc_html__('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 />\n" . "<i>*" . esc_html__('Updates are optional, but may contain increased optimization or security patches', EWWW_IMAGE_OPTIMIZER_DOMAIN) . "</i></p>\n";
}
if (!ewww_image_optimizer_full_cloud() && !EWWW_IMAGE_OPTIMIZER_NOEXEC) {
list($jpegtran_src, $optipng_src, $gifsicle_src, $jpegtran_dst, $optipng_dst, $gifsicle_dst) = ewww_image_optimizer_install_paths();
}
$skip = ewww_image_optimizer_skip_tools();
$output[] = "<p>\n";
if (!$skip['jpegtran'] && !EWWW_IMAGE_OPTIMIZER_NOEXEC) {
$output[] = "<b>jpegtran:</b> ";
if (EWWW_IMAGE_OPTIMIZER_JPEGTRAN) {
$jpegtran_installed = ewww_image_optimizer_tool_found(EWWW_IMAGE_OPTIMIZER_JPEGTRAN, 'j');
if (!$jpegtran_installed) {
$jpegtran_installed = ewww_image_optimizer_tool_found(EWWW_IMAGE_OPTIMIZER_JPEGTRAN, 'jb');
}
}
if (!empty($jpegtran_installed)) {
$output[] = '<span style="color: green; font-weight: bolder">' . esc_html__('Installed', EWWW_IMAGE_OPTIMIZER_DOMAIN) . '</span> ' . esc_html__('version', EWWW_IMAGE_OPTIMIZER_DOMAIN) . ': ' . $jpegtran_installed . "<br />\n";
} else {
$output[] = '<span style="color: red; font-weight: bolder">' . esc_html__('Missing', EWWW_IMAGE_OPTIMIZER_DOMAIN) . '</span><br />' . "\n";
$collapsible = false;
}
}
if (!$skip['optipng'] && !EWWW_IMAGE_OPTIMIZER_NOEXEC) {
$output[] = "<b>optipng:</b> ";
if (EWWW_IMAGE_OPTIMIZER_OPTIPNG) {
$optipng_version = ewww_image_optimizer_tool_found(EWWW_IMAGE_OPTIMIZER_OPTIPNG, 'o');
if (!$optipng_version) {
//.........这里部分代码省略.........
示例9: ewww_image_optimizer_bulk_preview
function ewww_image_optimizer_bulk_preview()
{
global $ewww_debug;
$ewww_debug .= "<b>ewww_image_optimizer_bulk_preview()</b><br>";
ewww_image_optimizer_cloud_verify(false);
// retrieve the attachment IDs that were pre-loaded in the database
list($fullsize_count, $unoptimized_count, $resize_count, $unoptimized_resize_count) = ewww_image_optimizer_count_optimized('media');
$upload_import = get_option('ewww_image_optimizer_imported');
?>
<div class="wrap">
<div id="icon-upload" class="icon32"><br /></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_resume');
if (empty($resume)) {
$button_text = __('Start optimizing', EWWW_IMAGE_OPTIMIZER_DOMAIN);
} else {
$button_text = __('Resume previous bulk operation', EWWW_IMAGE_OPTIMIZER_DOMAIN);
}
$loading_image = plugins_url('/wpspin.gif', __FILE__);
// create the html for the bulk optimize form and status divs
?>
<div id="bulk-loading">
<p id="ewww-loading" class="bulk-info" style="display:none"><?php
_e('Importing', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
<img src='<?php
echo $loading_image;
?>
' /></p>
</div>
<div id="bulk-progressbar"></div>
<div id="bulk-counter"></div>
<form id="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="bulk-status"></div>
<?php
if (empty($upload_import)) {
?>
<p class="bulk-info"><?php
_e('You should import Media Library images into the table to prevent duplicate optimization.', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
</p>
<form id="import-start" class="bulk-form" method="post" action="">
<input type="submit" class="button-secondary action" value="<?php
_e('Import Images', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
" />
</form>
<?php
return;
}
?>
<form class="bulk-form">
<p><label for="ewww-force" style="font-weight: bold"><?php
_e('Force re-optimize for Media Library', 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>
<!-- <p><label for="ewww-interval" style="font-weight: bold"><?php
_e('Choose how many images should be processed before each delay', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
</label> <input type="text" id="ewww-interval" name="ewww-interval" value="<?php
if ($interval = ewww_image_optimizer_get_option('ewww_image_optimizer_interval')) {
echo $interval;
} else {
echo 1;
}
?>
"></p>
<div id="ewww-interval-slider" style="width:50%"></div>-->
</form>
<h3><?php
_e('Optimize Media Library', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
</h3>
<?php
if ($fullsize_count < 1) {
echo '<p>' . __('You do not appear to have uploaded any images yet.', EWWW_IMAGE_OPTIMIZER_DOMAIN) . '</p>';
} else {
?>
<div id="bulk-forms">
//.........这里部分代码省略.........