• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP ewwwio_debug_message函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中ewwwio_debug_message函数的典型用法代码示例。如果您正苦于以下问题:PHP ewwwio_debug_message函数的具体用法?PHP ewwwio_debug_message怎么用?PHP ewwwio_debug_message使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了ewwwio_debug_message函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: 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;
 }
开发者ID:agiper,项目名称:wordpress,代码行数:23,代码来源:nextgen2-integration.php


示例2: handle

 protected function handle()
 {
     session_write_close();
     if (empty($_POST['ewwwio_test_verify'])) {
         return;
     }
     $item = $_POST['ewwwio_test_verify'];
     ewwwio_debug_message("testing async handling, received {$item}");
     if (ewww_image_optimizer_detect_wpsf_location_lock()) {
         ewwwio_debug_message('detected location lock, not enabling background opt');
         ewww_image_optimizer_debug_log();
         return;
     }
     if ($item != '949c34123cf2a4e4ce2f985135830df4a1b2adc24905f53d2fd3f5df5b162932') {
         ewwwio_debug_message('wrong item received, not enabling background opt');
         ewww_image_optimizer_debug_log();
         return;
     }
     ewww_image_optimizer_set_option('ewww_image_optimizer_background_optimization', true);
     ewww_image_optimizer_debug_log();
 }
开发者ID:kanei,项目名称:vantuch.cz,代码行数:21,代码来源:background.php


示例3: ewww_image_optimizer_dynamic_image_debug

function ewww_image_optimizer_dynamic_image_debug()
{
    ewwwio_debug_message('<b>' . __FUNCTION__ . '()</b>');
    echo "<div class='wrap'><h1>" . esc_html__('Dynamic Image Debugging', EWWW_IMAGE_OPTIMIZER_DOMAIN) . "</h1>";
    global $wpdb;
    $debug_images = $wpdb->get_results("SELECT path,updates,updated,trace FROM {$wpdb->ewwwio_images} WHERE trace IS NOT NULL ORDER BY updated DESC LIMIT 100");
    if (count($debug_images) != 0) {
        foreach ($debug_images as $image) {
            $trace = unserialize($image->trace);
            echo '<p><b>' . esc_html__('File path', EWWW_IMAGE_OPTIMIZER_DOMAIN) . ': ' . $image->path . '</b><br>';
            echo esc_html__('Number of attempted optimizations', EWWW_IMAGE_OPTIMIZER_DOMAIN) . ': ' . $image->updates . '<br>';
            echo esc_html__('Last attempted', EWWW_IMAGE_OPTIMIZER_DOMAIN) . ': ' . $image->updated . '<br>';
            echo esc_html__('PHP trace', EWWW_IMAGE_OPTIMIZER_DOMAIN) . ':<br>';
            $i = 0;
            foreach ($trace as $function) {
                if (!empty($function['file']) && !empty($function['line'])) {
                    echo "#{$i} {$function['function']}() called at {$function['file']}:{$function['line']}<br>";
                } else {
                    echo "#{$i} {$function['function']}() called<br>";
                }
                $i++;
            }
            echo '</p>';
        }
    }
    echo '</div>';
    return;
}
开发者ID:amprog,项目名称:ewww-image-optimizer,代码行数:28,代码来源:common.php


示例4: ewww_added_new_image_slow

 function ewww_added_new_image_slow($image)
 {
     ewwwio_debug_message('<b>' . __FUNCTION__ . '()</b>');
     // make sure the image path is set
     if (isset($image->imagePath)) {
         // optimize the full size
         $res = ewww_image_optimizer($image->imagePath, 3, false, false, true);
         // optimize the web optimized version
         $wres = ewww_image_optimizer($image->webimagePath, 3, false, true);
         // optimize the thumbnail
         $tres = ewww_image_optimizer($image->thumbPath, 3, false, true);
         if (!class_exists('flagMeta')) {
             require_once FLAG_ABSPATH . 'lib/meta.php';
         }
         // retrieve the metadata for the image ID
         $pid = $image->pid;
         $meta = new flagMeta($pid);
         //			ewwwio_debug_message( print_r( $meta->image->meta_data, TRUE ) );
         $meta->image->meta_data['ewww_image_optimizer'] = $res[1];
         if (!empty($meta->image->meta_data['webview'])) {
             $meta->image->meta_data['webview']['ewww_image_optimizer'] = $wres[1];
         }
         $meta->image->meta_data['thumbnail']['ewww_image_optimizer'] = $tres[1];
         // update the image metadata in the db
         flagdb::update_image_meta($pid, $meta->image->meta_data);
     }
     ewww_image_optimizer_debug_log();
 }
开发者ID:ChrisSargent,项目名称:moodesignz,代码行数:28,代码来源:flag-integration.php


示例5: ewww_image_optimizer_bulk_loop

function ewww_image_optimizer_bulk_loop()
{
    ewwwio_debug_message('<b>' . __FUNCTION__ . '()</b>');
    global $ewww_exceed;
    global $ewww_defer;
    $ewww_defer = false;
    // 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(__('Access token has expired, please reload the page.', 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')) {
        global $ewww_debug;
        echo '<div style="background-color:#ffff99;">' . $ewww_debug . '</div>';
    }
    ewww_image_optimizer_debug_log();
    ewwwio_memory(__FUNCTION__);
    die;
}
开发者ID:ashenkar,项目名称:sanga,代码行数:71,代码来源:bulk.php


示例6: ewww_added_new_image

 function ewww_added_new_image($image)
 {
     ewwwio_debug_message('<b>' . __FUNCTION__ . '()</b>');
     global $ewww_defer;
     // make sure the image path is set
     if (isset($image->imagePath)) {
         // get the image ID
         $pid = $image->pid;
         if ($ewww_defer && ewww_image_optimizer_get_option('ewww_image_optimizer_defer')) {
             ewww_image_optimizer_add_deferred_attachment("flag,{$pid}");
             return;
         }
         // optimize the full size
         $res = ewww_image_optimizer($image->imagePath, 3, false, false, true);
         // optimize the web optimized version
         $wres = ewww_image_optimizer($image->webimagePath, 3, false, true);
         // optimize the thumbnail
         $tres = ewww_image_optimizer($image->thumbPath, 3, false, true);
         // retrieve the metadata for the image ID
         $meta = new flagMeta($pid);
         ewwwio_debug_message(print_r($meta->image->meta_data, TRUE));
         $meta->image->meta_data['ewww_image_optimizer'] = $res[1];
         if (!empty($meta->image->meta_data['webview'])) {
             $meta->image->meta_data['webview']['ewww_image_optimizer'] = $wres[1];
         }
         $meta->image->meta_data['thumbnail']['ewww_image_optimizer'] = $tres[1];
         // update the image metadata in the db
         flagdb::update_image_meta($pid, $meta->image->meta_data);
     }
     ewww_image_optimizer_debug_log();
 }
开发者ID:agiper,项目名称:wordpress,代码行数:31,代码来源:flag-integration.php


示例7: ewww_image_optimizer_install_pngout

function ewww_image_optimizer_install_pngout()
{
    ewwwio_debug_message('<b>' . __FUNCTION__ . '()</b>');
    $permissions = apply_filters('ewww_image_optimizer_admin_permissions', '');
    if (FALSE === current_user_can($permissions)) {
        wp_die(esc_html__('You do not have permission to install image optimizer utilities.', EWWW_IMAGE_OPTIMIZER_DOMAIN));
    }
    if (PHP_OS != 'WINNT') {
        $tar = ewww_image_optimizer_find_nix_binary('tar', 't');
    }
    if (empty($tar) && PHP_OS != 'WINNT') {
        $pngout_error = __('tar command not found', EWWW_IMAGE_OPTIMIZER_DOMAIN);
    }
    if (PHP_OS == 'Linux') {
        $os_string = 'linux';
    }
    if (PHP_OS == 'FreeBSD') {
        $os_string = 'bsd';
    }
    $latest = '20150319';
    if (empty($pngout_error)) {
        if (PHP_OS == 'Linux' || PHP_OS == 'FreeBSD') {
            $download_result = ewww_image_optimizer_escapeshellarg(download_url('http://static.jonof.id.au/dl/kenutils/pngout-' . $latest . '-' . $os_string . '-static.tar.gz'));
            if (is_wp_error($download_result)) {
                $pngout_error = $download_result->get_error_message();
            } else {
                $arch_type = php_uname('m');
                exec("{$tar} xzf {$download_result} -C " . ewww_image_optimizer_escapeshellarg(EWWW_IMAGE_OPTIMIZER_BINARY_PATH) . ' pngout-' . $latest . '-' . $os_string . '-static/' . $arch_type . '/pngout-static');
                if (file_exists(EWWW_IMAGE_OPTIMIZER_BINARY_PATH . 'pngout-' . $latest . '-' . $os_string . '-static/' . $arch_type . '/pngout-static')) {
                    if (!rename(EWWW_IMAGE_OPTIMIZER_BINARY_PATH . 'pngout-' . $latest . '-' . $os_string . '-static/' . $arch_type . '/pngout-static', EWWW_IMAGE_OPTIMIZER_TOOL_PATH . 'pngout-static')) {
                        if (empty($pngout_error)) {
                            $pngout_error = __("could not move pngout", EWWW_IMAGE_OPTIMIZER_DOMAIN);
                        }
                    }
                    if (!chmod(EWWW_IMAGE_OPTIMIZER_TOOL_PATH . 'pngout-static', 0755)) {
                        if (empty($pngout_error)) {
                            $pngout_error = __("could not set permissions", EWWW_IMAGE_OPTIMIZER_DOMAIN);
                        }
                    }
                    $pngout_version = ewww_image_optimizer_tool_found(ewww_image_optimizer_escapeshellarg(EWWW_IMAGE_OPTIMIZER_TOOL_PATH) . 'pngout-static', 'p');
                } else {
                    $pngout_error = __('extraction of files failed', EWWW_IMAGE_OPTIMIZER_DOMAIN);
                }
            }
        }
        if (PHP_OS == 'Darwin') {
            $download_result = ewww_image_optimizer_escapeshellarg(download_url('http://static.jonof.id.au/dl/kenutils/pngout-' . $latest . '-darwin.tar.gz'));
            if (is_wp_error($download_result)) {
                $pngout_error = $download_result->get_error_message();
            } else {
                exec("{$tar} xzf {$download_result} -C " . ewww_image_optimizer_escapeshellarg(EWWW_IMAGE_OPTIMIZER_BINARY_PATH) . ' pngout-' . $latest . '-darwin/pngout');
                if (file_exists(EWWW_IMAGE_OPTIMIZER_BINARY_PATH . 'pngout-' . $latest . '-' . $os_string . '-static/' . $arch_type . '/pngout-static')) {
                    if (!rename(EWWW_IMAGE_OPTIMIZER_BINARY_PATH . 'pngout-' . $latest . '-darwin/pngout', EWWW_IMAGE_OPTIMIZER_TOOL_PATH . 'pngout-static')) {
                        if (empty($pngout_error)) {
                            $pngout_error = __('could not move pngout', EWWW_IMAGE_OPTIMIZER_DOMAIN);
                        }
                    }
                    if (!chmod(EWWW_IMAGE_OPTIMIZER_TOOL_PATH . 'pngout-static', 0755)) {
                        if (empty($pngout_error)) {
                            $pngout_error = __('could not set permissions', EWWW_IMAGE_OPTIMIZER_DOMAIN);
                        }
                    }
                    $pngout_version = ewww_image_optimizer_tool_found(ewww_image_optimizer_escapeshellarg(EWWW_IMAGE_OPTIMIZER_TOOL_PATH) . 'pngout-static', 'p');
                } else {
                    $pngout_error = __('extraction of files failed', EWWW_IMAGE_OPTIMIZER_DOMAIN);
                }
            }
        }
    }
    if (PHP_OS == 'WINNT') {
        $download_result = download_url('http://advsys.net/ken/util/pngout.exe');
        if (is_wp_error($download_result)) {
            $pngout_error = $download_result->get_error_message();
        } else {
            if (!rename($download_result, EWWW_IMAGE_OPTIMIZER_TOOL_PATH . 'pngout.exe')) {
                if (empty($pngout_error)) {
                    $pngout_error = __("could not move pngout", EWWW_IMAGE_OPTIMIZER_DOMAIN);
                }
            }
            $pngout_version = ewww_image_optimizer_tool_found('"' . EWWW_IMAGE_OPTIMIZER_TOOL_PATH . 'pngout.exe"', 'p');
        }
    }
    if (!empty($pngout_version)) {
        $sendback = add_query_arg('ewww_pngout', 'success', remove_query_arg(array('ewww_pngout', 'ewww_error'), wp_get_referer()));
    }
    if (!isset($sendback)) {
        $sendback = add_query_arg(array('ewww_pngout' => 'failed', 'ewww_error' => urlencode($pngout_error)), remove_query_arg(array('ewww_pngout', 'ewww_error'), wp_get_referer()));
    }
    wp_redirect(esc_url_raw($sendback));
    ewwwio_memory(__FUNCTION__);
    exit(0);
}
开发者ID:kanei,项目名称:vantuch.cz,代码行数:92,代码来源:ewww-image-optimizer.php


示例8: ewww_image_optimizer_bulk_loop

function ewww_image_optimizer_bulk_loop()
{
    ewwwio_debug_message('<b>' . __FUNCTION__ . '()</b>');
    global $ewww_defer;
    $ewww_defer = false;
    $output = array();
    // 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)) {
        $output['error'] = esc_html__('Access token has expired, please reload the page.', EWWW_IMAGE_OPTIMIZER_DOMAIN);
        echo json_encode($output);
        die;
    }
    session_write_close();
    // retrieve the time when the optimizer starts
    $started = microtime(true);
    if (ewww_image_optimizer_stl_check() && ini_get('max_execution_time')) {
        set_time_limit(0);
    }
    // find out if our nonce is on it's last leg/tick
    $tick = wp_verify_nonce($_REQUEST['ewww_wpnonce'], 'ewww-image-optimizer-bulk');
    if ($tick === 2) {
        $output['new_nonce'] = wp_create_nonce('ewww-image-optimizer-bulk');
    } else {
        $output['new_nonce'] = '';
    }
    // get the 'bulk attachments' with a list of IDs remaining
    $attachments = get_option('ewww_image_optimizer_bulk_attachments');
    $attachment = array_shift($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);
    $ewww_status = get_transient('ewww_image_optimizer_cloud_status');
    if (!empty($ewww_status) && preg_match('/exceeded/', $ewww_status)) {
        $output['error'] = esc_html__('License Exceeded', EWWW_IMAGE_OPTIMIZER_DOMAIN);
        echo json_encode($output);
        die;
    }
    if (!empty($meta['file'])) {
        // output the filename (and path relative to 'uploads' folder)
        $output['results'] = sprintf("<p>" . esc_html__('Optimized', EWWW_IMAGE_OPTIMIZER_DOMAIN) . " <strong>%s</strong><br>", esc_html($meta['file']));
    } else {
        $output['results'] = sprintf("<p>" . esc_html__('Skipped image, ID:', EWWW_IMAGE_OPTIMIZER_DOMAIN) . " <strong>%s</strong><br>", esc_html($attachment));
    }
    if (!empty($meta['ewww_image_optimizer'])) {
        // tell the user what the results were for the original image
        $output['results'] .= sprintf(esc_html__('Full size – %s', EWWW_IMAGE_OPTIMIZER_DOMAIN) . "<br>", esc_html($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
                $output['results'] .= sprintf("%s – %s<br>", esc_html($size['file']), esc_html($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
    $output['results'] .= sprintf(esc_html__('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);
    // 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')) {
        global $ewww_debug;
        $output['results'] .= '<div style="background-color:#ffff99;">' . $ewww_debug . '</div>';
    }
    if (!empty($attachments)) {
        $next_attachment = array_shift($attachments);
        $next_file = ewww_image_optimizer_bulk_filename($next_attachment);
        // generate the WP spinner image for display
        $loading_image = plugins_url('/images/wpspin.gif', __FILE__);
        if ($next_file) {
            $output['next_file'] = "<p>" . esc_html__('Optimizing', EWWW_IMAGE_OPTIMIZER_DOMAIN) . " <b>{$next_file}</b>&nbsp;<img src='{$loading_image}' /></p>";
        } else {
            $output['next_file'] = "<p>" . esc_html__('Optimizing', EWWW_IMAGE_OPTIMIZER_DOMAIN) . "&nbsp;<img src='{$loading_image}' /></p>";
        }
    }
    echo json_encode($output);
    ewww_image_optimizer_debug_log();
    ewwwio_memory(__FUNCTION__);
    die;
}
开发者ID:crazyyy,项目名称:bessarabia,代码行数:90,代码来源:bulk.php


示例9: ewww_image_optimizer_aux_images_cleanup

function ewww_image_optimizer_aux_images_cleanup($auto = false)
{
    ewwwio_debug_message('<b>' . __FUNCTION__ . '()</b>');
    // verify that an authorized user has started the optimizer
    $permissions = apply_filters('ewww_image_optimizer_bulk_permissions', '');
    if (!$auto && (!wp_verify_nonce($_REQUEST['ewww_wpnonce'], 'ewww-image-optimizer-bulk') || !current_user_can($permissions))) {
        wp_die(esc_html__('Access denied.', EWWW_IMAGE_OPTIMIZER_DOMAIN));
    }
    $stored_last = get_option('ewww_image_optimizer_aux_last');
    update_option('ewww_image_optimizer_aux_last', array(time(), $stored_last[1]));
    // all done, so we can update the bulk options with empty values
    update_option('ewww_image_optimizer_aux_resume', '');
    update_option('ewww_image_optimizer_aux_attachments', '');
    if (!$auto) {
        // and let the user know we are done
        echo '<p><b>' . esc_html__('Finished', EWWW_IMAGE_OPTIMIZER_DOMAIN) . '</b></p>';
        ewwwio_memory(__FUNCTION__);
        die;
    }
}
开发者ID:kanei,项目名称:vantuch.cz,代码行数:20,代码来源:aux-optimize.php


示例10: ewww_ngg_bulk_script

 function ewww_ngg_bulk_script($hook)
 {
     ewwwio_debug_message('<b>' . __FUNCTION__ . '()</b>');
     //		$i18ngg = strtolower ( _n( 'Gallery', 'Galleries', 1, 'nggallery' ) );
     $i18ngg = strtolower(__('Galleries', 'nggallery'));
     ewwwio_debug_message("i18n string for galleries: {$i18ngg}");
     // make sure we are on a legitimate page and that we have the proper POST variables if necessary
     if ($hook != $i18ngg . '_page_ewww-ngg-bulk' && $hook != $i18ngg . '_page_nggallery-manage-gallery') {
         return;
     }
     if ($hook == $i18ngg . '_page_nggallery-manage-gallery' && (empty($_REQUEST['bulkaction']) || $_REQUEST['bulkaction'] != 'bulk_optimize')) {
         return;
     }
     if ($hook == $i18ngg . '_page_nggallery-manage-gallery' && (empty($_REQUEST['doaction']) || !is_array($_REQUEST['doaction']))) {
         return;
     }
     $images = null;
     // see if the user wants to reset the previous bulk status
     if (!empty($_REQUEST['ewww_reset']) && wp_verify_nonce($_REQUEST['ewww_wpnonce'], 'ewww-image-optimizer-bulk-reset')) {
         update_option('ewww_image_optimizer_bulk_ngg_resume', '');
     }
     // see if there is a previous operation to resume
     $resume = get_option('ewww_image_optimizer_bulk_ngg_resume');
     // if we've been given a bulk action to perform
     if (!empty($_REQUEST['doaction'])) {
         // if we are optimizing a specific group of images
         if ($_REQUEST['page'] == 'manage-images' && $_REQUEST['bulkaction'] == 'bulk_optimize') {
             ewwwio_debug_message('optimizing a group of images');
             check_admin_referer('ngg_updategallery');
             // reset the resume status, not allowed here
             update_option('ewww_image_optimizer_bulk_ngg_resume', '');
             // retrieve the image IDs from POST
             $images = array_map('intval', $_REQUEST['doaction']);
         }
         // if we are optimizing a specific group of galleries
         if ($_REQUEST['page'] == 'manage-galleries' && $_REQUEST['bulkaction'] == 'bulk_optimize') {
             ewwwio_debug_message('optimizing a group of galleries');
             check_admin_referer('ngg_bulkgallery');
             global $nggdb;
             // reset the resume status, not allowed here
             update_option('ewww_image_optimizer_bulk_ngg_resume', '');
             $ids = array();
             // for each gallery we are given
             foreach ($_REQUEST['doaction'] as $gid) {
                 // get a list of IDs
                 $gallery_list = $nggdb->get_gallery($gid);
                 // for each ID
                 foreach ($gallery_list as $image) {
                     // add it to the array
                     $images[] = $image->pid;
                 }
             }
         }
         // otherwise, if we have an operation to resume
     } elseif (!empty($resume)) {
         ewwwio_debug_message('resuming a previous operation (maybe)');
         // get the list of attachment IDs from the db
         $images = get_option('ewww_image_optimizer_bulk_ngg_attachments');
         // otherwise, if we are on the standard bulk page, get all the images in the db
     } elseif ($hook == $i18ngg . '_page_ewww-ngg-bulk') {
         ewwwio_debug_message('starting from scratch, grabbing all the images');
         global $wpdb;
         $images = $wpdb->get_col("SELECT pid FROM {$wpdb->nggpictures} ORDER BY sortorder ASC");
     } else {
         ewwwio_debug_message($hook);
     }
     // store the image IDs to process in the db
     update_option('ewww_image_optimizer_bulk_ngg_attachments', $images);
     // add the EWWW IO script
     wp_enqueue_script('ewwwbulkscript', plugins_url('/eio.js', __FILE__), array('jquery', 'jquery-ui-progressbar', 'jquery-ui-slider'));
     // replacing the built-in nextgen styling rules for progressbar
     wp_register_style('ngg-jqueryui', plugins_url('jquery-ui-1.10.1.custom.css', __FILE__));
     // enqueue the progressbar styling
     wp_enqueue_style('ngg-jqueryui');
     //, plugins_url('jquery-ui-1.10.1.custom.css', __FILE__));
     // prep the $images for use by javascript
     $images = json_encode($images);
     // include all the vars we need for javascript
     wp_localize_script('ewwwbulkscript', 'ewww_vars', array('_wpnonce' => wp_create_nonce('ewww-image-optimizer-bulk'), 'gallery' => 'nextgen', 'attachments' => $images, '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)));
 }
开发者ID:AgilData,项目名称:WordPress-Skeleton,代码行数:80,代码来源:nextcellent-integration.php


示例11: ewww_image_optimizer_options

function ewww_image_optimizer_options()
{
    ewwwio_debug_message('<b>' . __FUNCTION__ . '()</b>');
    ewwwio_debug_message('ABSPATH: ' . ABSPATH);
    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
        ewww_image_optimizer_require(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>' . __('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[] = "<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/'>" . __('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> | " . "<a href='https://ewww.io/downloads/s3-image-optimizer/'>" . __('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 = __('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) . " " . __('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>.') . "</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>" . "<h2 class='hndle'>" . __('Plugin Status', EWWW_IMAGE_OPTIMIZER_DOMAIN) . "&emsp;" . "<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>" . "</h2>\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>&emsp;' . __('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>&emsp;' . __('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>&emsp;' . __('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) {
//.........这里部分代码省略.........
开发者ID:vanbungkring,项目名称:24custom,代码行数:101,代码来源:common.php


示例12: ewww_image_optimizer_webp_loop

function ewww_image_optimizer_webp_loop()
{
    ewwwio_debug_message('<b>' . __FUNCTION__ . '()</b>');
    $permissions = apply_filters('ewww_image_optimizer_admin_permissions', '');
    if (!wp_verify_nonce($_REQUEST['ewww_wpnonce'], 'ewww-image-optimizer-webp') || !current_user_can($permissions)) {
        wp_die(esc_html__('Access token has expired, please reload the page.', EWWW_IMAGE_OPTIMIZER_DOMAIN));
    }
    // retrieve the time when the migration starts
    $started = microtime(true);
    // allow 50 seconds for each loop
    set_time_limit(50);
    $images = array();
    ewwwio_debug_message('renaming images now');
    $images_processed = 0;
    $images_skipped = '';
    $images = get_option('ewww_image_optimizer_webp_images');
    if ($images) {
        printf(esc_html__('%d Webp images left to rename.', EWWW_IMAGE_OPTIMIZER_DOMAIN), count($images));
        echo "<br>";
    }
    while ($images) {
        $images_processed++;
        ewwwio_debug_message("processed {$images_processed} images so far");
        if ($images_processed > 1000) {
            ewwwio_debug_message('hit 1000, breaking loop');
            break;
        }
        $image = array_pop($images);
        $replace_base = '';
        $skip = true;
        $pngfile = preg_replace('/webp$/', 'png', $image);
        $PNGfile = preg_replace('/webp$/', 'PNG', $image);
        $jpgfile = preg_replace('/webp$/', 'jpg', $image);
        $jpegfile = preg_replace('/webp$/', 'jpeg', $image);
        $JPGfile = preg_replace('/webp$/', 'JPG', $image);
        if (file_exists($pngfile)) {
            $replace_base = $pngfile;
            $skip = false;
        }
        if (file_exists($PNGfile)) {
            if (empty($replace_base)) {
                $replace_base = $PNGfile;
                $skip = false;
            } else {
                $skip = true;
            }
        }
        if (file_exists($jpgfile)) {
            if (empty($replace_base)) {
                $replace_base = $jpgfile;
                $skip = false;
            } else {
                $skip = true;
            }
        }
        if (file_exists($jpegfile)) {
            if (empty($replace_base)) {
                $replace_base = $jpegfile;
                $skip = false;
            } else {
                $skip = true;
            }
        }
        if (file_exists($JPGfile)) {
            if (empty($replace_base)) {
                $replace_base = $JPGfile;
                $skip = false;
            } else {
                $skip = true;
            }
        }
        if ($skip) {
            if ($replace_base) {
                ewwwio_debug_message("multiple replacement options for {$image}, not renaming");
            } else {
                ewwwio_debug_message("no match found for {$image}, strange...");
            }
            $images_skipped .= "{$image}<br>";
        } else {
            ewwwio_debug_message("renaming {$image} with match of {$replace_base}");
            rename($image, $replace_base . '.webp');
        }
    }
    if ($images_skipped) {
        update_option('ewww_image_optimizer_webp_skipped', get_option('ewww_image_optimizer_webp_skipped') . $images_skipped);
    }
    // calculate how much time has elapsed since we started
    $elapsed = microtime(true) - $started;
    ewwwio_debug_message("took {$elapsed} seconds this time around");
    // store the updated list of images back in the database
    update_option('ewww_image_optimizer_webp_images', $images);
    ewww_image_optimizer_debug_log();
    die;
}
开发者ID:agiper,项目名称:wordpress,代码行数:94,代码来源:mwebp.php


示例13: cancel_process

 /**
  * Cancel Process
  *
  * Stop processing queue items, clear cronjob and delete batch.
  *
  */
 public function cancel_process()
 {
     ewwwio_debug_message('cancelling background process');
     if (!$this->is_queue_empty()) {
         $batch = $this->get_batch();
         ewwwio_debug_message('retrieved key ' . $batch->key);
         $this->delete($batch->key);
         wp_clear_scheduled_hook($this->cron_hook_identifier);
     }
     ewww_image_optimizer_debug_log();
 }
开发者ID:crazyyy,项目名称:bessarabia,代码行数:17,代码来源:wp-background-process.php


示例14: handle

 protected function handle()
 {
     session_write_close();
     if (empty($_POST['ewwwio_size'])) {
         $size = '';
     } else {
         $size = $_POST['ewwwio_size'];
     }
     if (!empty($_POST['ewwwio_path']) && $size == 'full') {
         $file_path = ABSPATH . $_POST['ewwwio_path'];
         ewwwio_debug_message('processing async optimization request');
         list($file, $msg, $conv, $original) = ewww_image_optimizer($file_path, 1, false, false, true);
     } elseif (!empty($_POST['ewwwio_path'])) {
         $file_path = ABSPATH . $_POST['ewwwio_path'];
         ewwwio_debug_message('processing async optimization request');
         list($file, $msg, $conv, $original) = ewww_image_optimizer($file_path);
     } else {
         ewwwio_debug_message('ignored async optimization request');
         return;
     }
     ewwwio_debug_message('checking for: ' . $file_path . '.processing');
     if (is_file($file_path . '.processing')) {
         ewwwio_debug_message('removing ' . $file_path . '.processing');
         unlink($file_path . '.processing');
     }
     ewww_image_optimizer_debug_log();
 }
开发者ID:recetasdemama,项目名称:wordpress,代码行数:27,代码来源:background.php


示例15: ewww_image_optimizer_image_queue_debug


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP ewwwio_memory函数代码示例发布时间:2022-05-15
下一篇:
PHP ewww_image_optimizer_tool_found函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap