本文整理汇总了PHP中ewww_image_optimizer_aux_images_table_count函数的典型用法代码示例。如果您正苦于以下问题:PHP ewww_image_optimizer_aux_images_table_count函数的具体用法?PHP ewww_image_optimizer_aux_images_table_count怎么用?PHP ewww_image_optimizer_aux_images_table_count使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ewww_image_optimizer_aux_images_table_count函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: ewww_image_optimizer_bulk_script
function ewww_image_optimizer_bulk_script($hook)
{
global $ewww_debug;
// make sure we are being called from the bulk optimization page
if ('media_page_ewww-image-optimizer-bulk' != $hook) {
return;
}
// initialize the $attachments variable
$attachments = null;
// check to see if we are supposed to reset the bulk operation and verify we are authorized to do so
if (!empty($_REQUEST['ewww_reset']) && wp_verify_nonce($_REQUEST['ewww_wpnonce'], 'ewww-image-optimizer-bulk')) {
// set the 'bulk resume' option to an empty string to reset the bulk operation
update_option('ewww_image_optimizer_bulk_resume', '');
}
// check to see if we are supposed to reset the bulk operation and verify we are authorized to do so
if (!empty($_REQUEST['ewww_reset_aux']) && wp_verify_nonce($_REQUEST['ewww_wpnonce'], 'ewww-image-optimizer-aux-images')) {
// set the 'bulk resume' option to an empty string to reset the bulk operation
update_option('ewww_image_optimizer_aux_resume', '');
}
// check to see if we are supposed to convert the auxiliary images table and verify we are authorized to do so
if (!empty($_REQUEST['ewww_convert']) && wp_verify_nonce($_REQUEST['ewww_wpnonce'], 'ewww-image-optimizer-aux-images')) {
ewww_image_optimizer_aux_images_convert();
}
// check the 'bulk resume' option
$resume = get_option('ewww_image_optimizer_bulk_resume');
// see if we were given attachment IDs to work with via GET/POST
if (!empty($_REQUEST['ids'])) {
$ids = explode(',', $_REQUEST['ids']);
$ewww_debug .= "gallery ids: " . print_r($ids, true) . "<br>";
$ewww_debug .= "post_type: " . get_post_type($ids[0]) . "<br>";
if ('ims_gallery' == get_post_type($ids[0])) {
$attachments = array();
foreach ($ids as $gid) {
$ewww_debug .= "gallery id: {$gid}<br>";
$ims_images = get_posts(array('numberposts' => -1, 'post_type' => 'ims_image', 'post_status' => 'any', 'post_mime_type' => 'image', 'post_parent' => $gid, 'fields' => 'ids'));
$attachments = array_merge($attachments, $ims_images);
$ewww_debug .= "attachment ids: " . print_r($attachments, true) . "<br>";
}
} else {
// retrieve post IDs correlating to the IDs submitted to make sure they are all valid
$attachments = get_posts(array('numberposts' => -1, 'include' => $ids, 'post_type' => array('attachment', 'ims_image'), 'post_status' => 'any', 'post_mime_type' => 'image', 'fields' => 'ids'));
}
// unset the 'bulk resume' option since we were given specific IDs to optimize
update_option('ewww_image_optimizer_bulk_resume', '');
// check if there is a previous bulk operation to resume
} else {
if (!empty($resume)) {
// retrieve the attachment IDs that have not been finished from the 'bulk attachments' option
$attachments = get_option('ewww_image_optimizer_bulk_attachments');
// since we aren't resuming, and weren't given a list of IDs, we will optimize everything
} else {
// load up all the image attachments we can find
$attachments = get_posts(array('numberposts' => -1, 'post_type' => array('attachment', 'ims_image'), 'post_status' => 'any', 'post_mime_type' => 'image', 'fields' => 'ids'));
}
}
// store the attachment IDs we retrieved in the 'bulk_attachments' option so we can keep track of our progress in the database
update_option('ewww_image_optimizer_bulk_attachments', $attachments);
wp_enqueue_script('ewwwbulkscript', plugins_url('/eio.js', __FILE__), array('jquery', 'jquery-ui-slider', 'jquery-ui-progressbar'));
$image_count = ewww_image_optimizer_aux_images_table_count();
// submit a couple variables to the javascript to work with
$attachments = json_encode($attachments);
wp_localize_script('ewwwbulkscript', 'ewww_vars', array('_wpnonce' => wp_create_nonce('ewww-image-optimizer-bulk'), 'attachments' => $attachments, 'image_count' => $image_count, 'count_string' => sprintf(__('%d images', EWWW_IMAGE_OPTIMIZER_DOMAIN), $image_count), 'scan_fail' => __('Operation timed out, you may need to increase the max_execution_time for PHP', EWWW_IMAGE_OPTIMIZER_DOMAIN), 'license_exceeded' => __('License Exceeded', EWWW_IMAGE_OPTIMIZER_DOMAIN), 'operation_stopped' => __('Optimization stopped, reload page to resume.', EWWW_IMAGE_OPTIMIZER_DOMAIN), 'operation_interrupted' => __('Operation Interrupted', EWWW_IMAGE_OPTIMIZER_DOMAIN), 'temporary_failure' => __('Temporary failure, seconds left to retry:', EWWW_IMAGE_OPTIMIZER_DOMAIN), 'remove_failed' => __('Could not remove image from table.', EWWW_IMAGE_OPTIMIZER_DOMAIN)));
// load the stylesheet for the jquery progressbar
wp_enqueue_style('jquery-ui-progressbar', plugins_url('jquery-ui-1.10.1.custom.css', __FILE__));
ewwwio_memory(__FUNCTION__);
}
开发者ID:Rudchyk,项目名称:wp-framework,代码行数:66,代码来源:bulk.php
示例2: ewww_image_optimizer_aux_images
function ewww_image_optimizer_aux_images()
{
global $ewww_debug;
global $wpdb;
$ewww_debug .= "<b>ewww_image_optimizer_aux_images()</b><br>";
// Retrieve the value of the 'aux resume' option and set the button text for the form to use
$aux_resume = get_option('ewww_image_optimizer_aux_resume');
if (empty($aux_resume)) {
$button_text = __('Scan and optimize', EWWW_IMAGE_OPTIMIZER_DOMAIN);
} else {
$button_text = __('Resume previous optimization', EWWW_IMAGE_OPTIMIZER_DOMAIN);
}
// find out if the auxiliary image table has anything in it
$already_optimized = ewww_image_optimizer_aux_images_table_count();
// see if the auxiliary image table needs converting from md5sums to image sizes
$convert_query = "SELECT image_md5 FROM {$wpdb->ewwwio_images} WHERE image_md5 <> ''";
$db_convert = $wpdb->get_results($convert_query, ARRAY_N);
// generate the WP spinner image for display
$loading_image = plugins_url('/wpspin.gif', __FILE__);
// check the last time the auxiliary optimizer was run
$lastaux = get_option('ewww_image_optimizer_aux_last');
// set the timezone according to the blog settings
$site_timezone = get_option('timezone_string');
if (empty($site_timezone)) {
$site_timezone = 'UTC';
}
date_default_timezone_set($site_timezone);
?>
<h3><?php
_e('Optimize Everything Else', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
</h3>
<div id="aux-forms"><p class="bulk-info"><?php
_e('Use this tool to optimize images outside of the Media Library and galleries where we have full integration. Examples: theme images, BuddyPress, WP Symposium, and any folders that you have specified on the settings page.', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
</p>
<?php
if (!empty($db_convert)) {
?>
<p class="bulk-info"><?php
_e('The database schema has changed, you need to convert to the new format.', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
</p>
<form method="post" id="aux-convert" class="bulk-form" action="">
<?php
wp_nonce_field('ewww-image-optimizer-aux-images', '_wpnonce');
?>
<input type="hidden" name="convert" value="1">
<button id="table-convert" type="submit" class="button-secondary action"><?php
_e('Convert Table', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
</button>
</form>
<?php
}
?>
<p id="ewww-nothing" class="bulk-info" style="display:none"><?php
_e('There are no images to optimize.', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
</p>
<p id="ewww-scanning" class="bulk-info" style="display:none"><?php
_e('Scanning, this could take a while', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
<img src='<?php
echo $loading_image;
?>
' alt='loading'/></p>
<?php
if (!empty($lastaux)) {
?>
<p id="ewww-lastaux" class="bulk-info"><?php
printf(__('Last optimization was completed on %1$s at %2$s and optimized %3$d images', EWWW_IMAGE_OPTIMIZER_DOMAIN), date(get_option('date_format'), $lastaux[0]), date(get_option('time_format'), $lastaux[0]), $lastaux[1]);
?>
</p>
<?php
}
?>
<form id="aux-start" class="bulk-form" method="post" action="">
<input id="aux-first" type="submit" class="button-secondary action" value="<?php
echo $button_text;
?>
" />
<input id="aux-again" type="submit" class="button-secondary action" style="display:none" value="<?php
_e('Optimize Again', EWWW_IMAGE_OPTIMIZER_DOMAIN);
?>
" />
</form>
<?php
// if the 'bulk resume' option was not empty, offer to reset it so the user can start back from the beginning
if (!empty($aux_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>
<form id="aux-reset" class="bulk-form" method="post" action="">
<?php
wp_nonce_field('ewww-image-optimizer-aux-images', '_wpnonce');
?>
//.........这里部分代码省略.........
开发者ID:LacieNat,项目名称:Access-Comm-Project,代码行数:101,代码来源:aux-optimize.php
示例3: ewww_image_optimizer_bulk_script
function ewww_image_optimizer_bulk_script($hook)
{
ewwwio_debug_message('<b>' . __FUNCTION__ . '()</b>');
// make sure we are being called from the bulk optimization page
if ('media_page_ewww-image-optimizer-bulk' != $hook) {
return;
}
// initialize the $attachments variable
$attachments = array();
// check to see if we are supposed to reset the bulk operation and verify we are authorized to do so
if (!empty($_REQUEST['ewww_reset']) && wp_verify_nonce($_REQUEST['ewww_wpnonce'], 'ewww-image-optimizer-bulk-reset')) {
// set the 'bulk resume' option to an empty string to reset the bulk operation
update_option('ewww_image_optimizer_bulk_resume', '');
}
// check to see if we are supposed to reset the bulk operation and verify we are authorized to do so
if (!empty($_REQUEST['ewww_reset_aux']) && wp_verify_nonce($_REQUEST['ewww_wpnonce'], 'ewww-image-optimizer-aux-images-reset')) {
// set the 'bulk resume' option to an empty string to reset the bulk operation
update_option('ewww_image_optimizer_aux_resume', '');
}
// check to see if we are supposed to convert the auxiliary images table and verify we are authorized to do so
if (!empty($_REQUEST['ewww_convert']) && wp_verify_nonce($_REQUEST['ewww_wpnonce'], 'ewww-image-optimizer-aux-images-convert')) {
ewww_image_optimizer_aux_images_convert();
}
global $wpdb;
// check the 'bulk resume' option
$resume = get_option('ewww_image_optimizer_bulk_resume');
// see if we were given attachment IDs to work with via GET/POST
if (!empty($_REQUEST['ids']) && preg_match('/^[\\d,]+$/', $_REQUEST['ids'], $request_ids)) {
$ids = explode(',', $request_ids[0]);
$sample_post_type = get_post_type($ids[0]);
//ewwwio_debug_message( "ids: " . $request_ids[0] );
ewwwio_debug_message("post type (checking for ims_gallery): {$sample_post_type}");
if ('ims_gallery' == $sample_post_type) {
$attachments = array();
foreach ($ids as $gid) {
ewwwio_debug_message("gallery id: {$gid}");
$ims_images = $wpdb->get_col("SELECT ID FROM {$wpdb->posts} WHERE post_type = 'ims_image' AND post_mime_type LIKE '%%image%%' AND post_parent = {$gid} ORDER BY ID DESC");
$attachments = array_merge($attachments, $ims_images);
}
} else {
// retrieve post IDs correlating to the IDs submitted to make sure they are all valid
$attachments = $wpdb->get_col("SELECT ID FROM {$wpdb->posts} WHERE (post_type = 'attachment' OR post_type = 'ims_image') AND (post_mime_type LIKE '%%image%%' OR post_mime_type LIKE '%%pdf%%') AND ID IN ({$request_ids[0]}) ORDER BY ID DESC");
}
// unset the 'bulk resume' option since we were given specific IDs to optimize
update_option('ewww_image_optimizer_bulk_resume', '');
// check if there is a previous bulk operation to resume
} elseif (!empty($resume)) {
// retrieve the attachment IDs that have not been finished from the 'bulk attachments' option
$attachments = get_option('ewww_image_optimizer_bulk_attachments');
// since we aren't resuming, and weren't given a list of IDs, we will optimize everything
} else {
// load up all the image attachments we can find
$attachments = $wpdb->get_col("SELECT ID FROM {$wpdb->posts} WHERE (post_type = 'attachment' OR post_type = 'ims_image') AND (post_mime_type LIKE '%%image%%' OR post_mime_type LIKE '%%pdf%%') ORDER BY ID DESC");
}
// store the attachment IDs we retrieved in the 'bulk_attachments' option so we can keep track of our progress in the database
update_option('ewww_image_optimizer_bulk_attachments', $attachments);
wp_enqueue_script('ewwwbulkscript', plugins_url('/includes/eio.js', __FILE__), array('jquery', 'jquery-ui-slider', 'jquery-ui-progressbar', 'postbox', 'dashboard'));
// number of images in the ewwwio_table (previously optimized images)
$image_count = ewww_image_optimizer_aux_images_table_count();
// number of image attachments to be optimized
$attachment_count = count($attachments);
// submit a couple variables to the javascript to work with
wp_localize_script('ewwwbulkscript', 'ewww_vars', array('_wpnonce' => wp_create_nonce('ewww-image-optimizer-bulk'), 'attachments' => $attachment_count, 'image_count' => $image_count, 'count_string' => sprintf(esc_html__('%d images', EWWW_IMAGE_OPTIMIZER_DOMAIN), $image_count), 'scan_fail' => esc_html__('Operation timed out, you may need to increase the max_execution_time for PHP', EWWW_IMAGE_OPTIMIZER_DOMAIN), 'operation_stopped' => esc_html__('Optimization stopped, reload page to resume.', EWWW_IMAGE_OPTIMIZER_DOMAIN), 'operation_interrupted' => esc_html__('Operation Interrupted', EWWW_IMAGE_OPTIMIZER_DOMAIN), 'temporary_failure' => esc_html__('Temporary failure, seconds left to retry:', EWWW_IMAGE_OPTIMIZER_DOMAIN), 'remove_failed' => esc_html__('Could not remove image from table.', EWWW_IMAGE_OPTIMIZER_DOMAIN), 'optimized' => esc_html__('Optimized', EWWW_IMAGE_OPTIMIZER_DOMAIN)));
// load the stylesheet for the jquery progressbar
wp_enqueue_style('jquery-ui-progressbar', plugins_url('/includes/jquery-ui-1.10.1.custom.css', __FILE__));
ewwwio_memory(__FUNCTION__);
}
开发者ID:crazyyy,项目名称:bessarabia,代码行数:67,代码来源:bulk.php
示例4: ewww_image_optimizer_bulk_script
function ewww_image_optimizer_bulk_script($hook)
{
global $ewww_debug;
global $wpdb;
// make sure we are being called from the bulk optimization page
if ('media_page_ewww-image-optimizer-bulk' != $hook) {
return;
}
// $ewww_debug .= "starting memory usage: " . memory_get_usage(true) . "<br>";
// initialize the $attachments variable
$attachments = null;
// check to see if we are supposed to reset the bulk operation and verify we are authorized to do so
if (!empty($_REQUEST['reset']) && wp_verify_nonce($_REQUEST['_wpnonce'], 'ewww-image-optimizer-bulk')) {
// set the 'bulk resume' option to an empty string to reset the bulk operation
update_option('ewww_image_optimizer_bulk_resume', '');
}
// check to see if we are supposed to reset the bulk operation and verify we are authorized to do so
if (!empty($_REQUEST['reset-aux']) && wp_verify_nonce($_REQUEST['_wpnonce'], 'ewww-image-optimizer-aux-images')) {
// set the 'bulk resume' option to an empty string to reset the bulk operation
update_option('ewww_image_optimizer_aux_resume', '');
}
// check to see if we are supposed to empty the auxiliary images table and verify we are authorized to do so
if (!empty($_REQUEST['empty']) && wp_verify_nonce($_REQUEST['_wpnonce'], 'ewww-image-optimizer-aux-images')) {
// empty the ewwwio_images table to allow re-optimization
$wpdb->query("TRUNCATE {$wpdb->ewwwio_images}");
update_option('ewww_image_optimizer_aux_last', '');
update_option('ewww_image_optimizer_imported', '');
}
// check to see if we are supposed to convert the auxiliary images table and verify we are authorized to do so
if (!empty($_REQUEST['convert']) && wp_verify_nonce($_REQUEST['_wpnonce'], 'ewww-image-optimizer-aux-images')) {
ewww_image_optimizer_aux_images_convert();
}
// check the 'bulk resume' option
$resume = get_option('ewww_image_optimizer_bulk_resume');
// see if we were given attachment IDs to work with via GET/POST
if (!empty($_REQUEST['ids'])) {
$ids = explode(',', $_REQUEST['ids']);
$ewww_debug .= "gallery ids: " . print_r($ids, true) . "<br>";
$ewww_debug .= "post_type: " . get_post_type($ids[0]) . "<br>";
if ('ims_gallery' == get_post_type($ids[0])) {
$attachments = array();
foreach ($ids as $gid) {
$ewww_debug .= "gallery id: {$gid}<br>";
$ims_images = get_posts(array('numberposts' => -1, 'post_type' => 'ims_image', 'post_status' => 'any', 'post_mime_type' => 'image', 'post_parent' => $gid, 'fields' => 'ids'));
$attachments = array_merge($attachments, $ims_images);
$ewww_debug .= "attachment ids: " . print_r($attachments, true) . "<br>";
}
} else {
// retrieve post IDs correlating to the IDs submitted to make sure they are all valid
$attachments = get_posts(array('numberposts' => -1, 'include' => $ids, 'post_type' => array('attachment', 'ims_image'), 'post_status' => 'any', 'post_mime_type' => 'image', 'fields' => 'ids'));
}
// unset the 'bulk resume' option since we were given specific IDs to optimize
update_option('ewww_image_optimizer_bulk_resume', '');
// check if there is a previous bulk operation to resume
} else {
if (!empty($resume)) {
// retrieve the attachment IDs that have not been finished from the 'bulk attachments' option
$attachments = get_option('ewww_image_optimizer_bulk_attachments');
// since we aren't resuming, and weren't given a list of IDs, we will optimize everything
} else {
// load up all the image attachments we can find
$attachments = get_posts(array('numberposts' => -1, 'post_type' => array('attachment', 'ims_image'), 'post_status' => 'any', 'post_mime_type' => 'image', 'fields' => 'ids'));
}
}
// store the attachment IDs we retrieved in the 'bulk_attachments' option so we can keep track of our progress in the database
update_option('ewww_image_optimizer_bulk_attachments', $attachments);
wp_enqueue_script('ewwwbulkscript', plugins_url('/eio.js', __FILE__), array('jquery', 'jquery-ui-slider', 'jquery-ui-progressbar'));
$image_count = ewww_image_optimizer_aux_images_table_count();
// submit a couple variables to the javascript to work with
$attachments = json_encode($attachments);
wp_localize_script('ewwwbulkscript', 'ewww_vars', array('_wpnonce' => wp_create_nonce('ewww-image-optimizer-bulk'), 'attachments' => $attachments, 'image_count' => $image_count));
// load the stylesheet for the jquery progressbar
wp_enqueue_style('jquery-ui-progressbar', plugins_url('jquery-ui-1.10.1.custom.css', __FILE__));
}
开发者ID:aim-web-projects,项目名称:kobe-chuoh,代码行数:74,代码来源:bulk.php
注:本文中的ewww_image_optimizer_aux_images_table_count函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论