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

PHP ewww_image_optimizer_tool_found函数代码示例

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

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



在下文中一共展示了ewww_image_optimizer_tool_found函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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) . "&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>" . "</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>&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) {
        $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>&emsp;' . __('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>&emsp;<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";
//.........这里部分代码省略.........
开发者ID:goodbayscott,项目名称:wwr-temp,代码行数:101,代码来源:common.php


示例2: ewww_image_optimizer_options


//.........这里部分代码省略.........
        } 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);
        ?>
</i></p>
			<?php 
    }
    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();
    }
    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) {
        echo "\n", '<b>jpegtran: </b>';
        $jpegtran_installed = ewww_image_optimizer_tool_found(EWWW_IMAGE_OPTIMIZER_JPEGTRAN, 'j');
        if (!empty($jpegtran_installed)) {
            echo '<span style="color: green; font-weight: bolder">OK</span>&emsp;version: ' . $jpegtran_installed . '<br />';
        } else {
            echo '<span style="color: red; font-weight: bolder">MISSING</span><br />';
        }
    }
    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) {
        echo "\n", '<b>optipng:</b> ';
        $optipng_version = ewww_image_optimizer_tool_found(EWWW_IMAGE_OPTIMIZER_OPTIPNG, 'o');
        if (!empty($optipng_version)) {
            echo '<span style="color: green; font-weight: bolder">OK</span>&emsp;version: ' . $optipng_version . '<br />';
        } else {
            echo '<span style="color: red; font-weight: bolder">MISSING</span><br />';
        }
    }
    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) {
        echo "\n", '<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)) {
            echo '<span style="color: green; font-weight: bolder">OK</span>&emsp;version: ' . $gifsicle_version . '<br />';
        } else {
            echo '<span style="color: red; font-weight: bolder">MISSING</span><br />';
        }
    }
    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) {
        echo "\n", '<b>pngout:</b> ';
        $pngout_version = ewww_image_optimizer_tool_found(EWWW_IMAGE_OPTIMIZER_PNGOUT, 'p');
        if (!empty($pngout_version) && preg_match('/PNGOUT/', $pngout_version)) {
            echo '<span style="color: green; font-weight: bolder">OK</span>&emsp;version: ' . preg_replace('/PNGOUT \\[.*\\)\\s*?/', '', $pngout_version) . '<br />';
        } else {
            echo '<span style="color: red; font-weight: bolder">MISSING</span>&emsp;<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 />';
        }
开发者ID:LacieNat,项目名称:Access-Comm-Project,代码行数:67,代码来源:ewww-image-optimizer.php


示例3: 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) . "&emsp;" . "<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>&emsp;' . 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) {
//.........这里部分代码省略.........
开发者ID:crazyyy,项目名称:bessarabia,代码行数:101,代码来源:common.php


示例4: ewww_image_optimizer_install_pngout

function ewww_image_optimizer_install_pngout()
{
    global $ewww_debug;
    $ewww_debug .= '<b>ewww_image_optimizer_install_pngout()</b><br>';
    $permissions = apply_filters('ewww_image_optimizer_admin_permissions', '');
    if (FALSE === current_user_can($permissions)) {
        wp_die(__('You don\'t have permission to install image optimizer utilities.', EWWW_IMAGE_OPTIMIZER_DOMAIN));
    }
    if (PHP_OS != 'WINNT') {
        $tar = ewww_image_optimizer_find_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_PLUGIN_PATH) . ' pngout-' . $latest . '-' . $os_string . '-static/' . $arch_type . '/pngout-static');
                if (!rename(EWWW_IMAGE_OPTIMIZER_PLUGIN_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');
            }
        }
        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_PLUGIN_PATH) . ' pngout-' . $latest . '-darwin/pngout');
                if (!rename(EWWW_IMAGE_OPTIMIZER_PLUGIN_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');
            }
        }
    }
    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:Rudchyk,项目名称:wp-framework,代码行数:85,代码来源:ewww-image-optimizer.php


示例5: ewww_image_optimizer_options

function ewww_image_optimizer_options()
{
    global $ewww_debug;
    $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>pngout was successfully installed, check the Plugin Status area for version information.</p>
			</div>
<?php 
        }
        if ($_REQUEST['pngout'] == 'failed') {
            ?>
			<div id='ewww-image-optimizer-pngout-failure' class='error'>
				<p>pngout was not installed, <?php 
            echo $_REQUEST['error'];
            ?>
. Make sure the wp-content/ewww folder is writable.</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 Image Optimizer Settings</h2>
		<p><a href="http://wordpress.org/extend/plugins/ewww-image-optimizer/">Plugin Home Page</a> |
		<a href="http://wordpress.org/extend/plugins/ewww-image-optimizer/installation/">Installation Instructions</a> | 
		<a href="http://wordpress.org/support/plugin/ewww-image-optimizer">Plugin Support</a> | 
		Debug - see the new Debugging option below</p>
		<p>I recommend hosting your Wordpress site with <a href=http://www.dreamhost.com/r.cgi?132143">Dreamhost.com</a> or <a href="http://www.bluehost.com/track/nosilver4u">Bluehost.com</a>. Using these referral links will allow you to support future development of this plugin: <a href=http://www.dreamhost.com/r.cgi?132143">Dreamhost</a> | <a href="http://www.bluehost.com/track/nosilver4u">Bluehost</a>. Alternatively, you can contribute directly by <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QFXCW38HE24NY">donating with Paypal</a>.</p>
		<div id="status" style="border: 1px solid #ccc; padding: 0 8px; border-radius: 12px;">
			<h3>Plugin Status</h3>
			<?php 
    if (get_site_option('ewww_image_optimizer_skip_bundle')) {
        ?>
				<p>If updated versions are available below you may either download the newer versions and install them yourself, or uncheck "Use system paths" and install them automatically.<br />
			<?php 
    } else {
        ?>
				<p>If updated versions are available below, you may need to enable write permission on the <i>wp-content/ewww</i> folder to use the automatic installs.<br />
			<?php 
    }
    ?>
			<i>*Updates are optional, but may contain increased optimization or security patches</i></p>
			<?php 
    list($jpegtran_src, $optipng_src, $gifsicle_src, $jpegtran_dst, $optipng_dst, $gifsicle_dst) = ewww_image_optimizer_install_paths();
    if (!get_site_option('ewww_image_optimizer_disable_jpegtran')) {
        echo "\n";
        echo '<b>jpegtran: </b>';
        $jpegtran_installed = ewww_image_optimizer_tool_found(EWWW_IMAGE_OPTIMIZER_JPEGTRAN, 'j');
        if (!empty($jpegtran_installed) && preg_match('/version 8|9/', $jpegtran_installed)) {
            echo '<span style="color: green; font-weight: bolder">OK</span>&emsp;version: ' . $jpegtran_installed . '<br />';
        } elseif (!empty($jpegtran_installed)) {
            echo '<span style="color: orange; font-weight: bolder">UPDATE AVAILABLE</span>*&emsp;<b>Copy</b> executable from ' . $jpegtran_src . ' to ' . $jpegtran_dst . ' or to a system path (like /usr/local/bin), OR <a href="http://www.ijg.org/"><b>Download</b> jpegtran source</a>&emsp;<b>version:</b> ' . $jpegtran_installed . '<br />';
        } else {
            echo '<span style="color: red; font-weight: bolder">MISSING</span>&emsp;<b>Copy</b> executable from ' . $jpegtran_src . ' to ' . $jpegtran_dst . ' or a system path (like /usr/local/bin), OR <a href="http://www.ijg.org/"><b>Download</b> jpegtran source</a><br />';
        }
    }
    echo "\n";
    if (!get_site_option('ewww_image_optimizer_disable_optipng')) {
        echo "\n";
        echo '<b>optipng:</b> ';
        $optipng_version = ewww_image_optimizer_tool_found(EWWW_IMAGE_OPTIMIZER_OPTIPNG, 'o');
        if (!empty($optipng_version) && preg_match('/0.7.4/', $optipng_version)) {
            echo '<span style="color: green; font-weight: bolder">OK</span>&emsp;version: ' . $optipng_version . '<br />';
        } elseif (!empty($optipng_version)) {
            echo '<span style="color: orange; font-weight: bolder">UPDATE AVAILABLE</span>*&emsp;<b>Copy</b> binary from ' . $optipng_src . ' to ' . $optipng_dst . ' or to a system path (like /usr/local/bin), OR <a href="http://prdownloads.sourceforge.net/optipng/optipng-0.7.4.tar.gz?download"><b>Download</b> optipng source</a>&emsp;<b>version:</b> ' . $optipng_version . '<br />';
        } else {
            echo '<span style="color: red; font-weight: bolder">MISSING</span>&emsp;<b>Copy</b> binary from ' . $optipng_src . ' to ' . $optipng_dst . ' or to a system path (like /usr/local/bin), OR <a href="http://prdownloads.sourceforge.net/optipng/optipng-0.7.4.tar.gz?download"><b>Download</b> optipng source</a><br />';
        }
    }
    echo "\n";
    if (!get_site_option('ewww_image_optimizer_disable_gifsicle')) {
        echo "\n";
        echo '<b>gifsicle:</b> ';
        $gifsicle_version = ewww_image_optimizer_tool_found(EWWW_IMAGE_OPTIMIZER_GIFSICLE, 'g');
        if (!empty($gifsicle_version) && preg_match('/1.70/', $gifsicle_version)) {
            echo '<span style="color: green; font-weight: bolder">OK</span>&emsp;version: ' . $gifsicle_version . '<br />';
        } elseif (!empty($gifsicle_version) && preg_match('/LCDF Gifsicle/', $gifsicle_version)) {
            echo '<span style="color: orange; font-weight: bolder">UPDATE AVAILABLE</span>*&emsp;<b>Copy</b> binary from ' . $gifsicle_src . ' to ' . $gifsicle_dst . ' or to a system path (like /usr/local/bin), OR <a href="http://www.lcdf.org/gifsicle/gifsicle-1.70.tar.gz"><b>Download</b> gifsicle source</a>&emsp;<b>version:</b> ' . $gifsicle_version . '<br />';
        } else {
            echo '<span style="color: red; font-weight: bolder">MISSING</span>&emsp;<b>Copy</b> binary from ' . $gifsicle_src . ' to ' . $gifsicle_dst . ' or to a system path (like /usr/local/bin), OR <a href="http://www.lcdf.org/gifsicle/gifsicle-1.70.tar.gz"><b>Download</b> gifsicle source</a><br />';
        }
    }
    echo "\n";
    if (!get_site_option('ewww_image_optimizer_disable_pngout')) {
        echo "\n";
        echo '<b>pngout:</b> ';
        $pngout_version = ewww_image_optimizer_tool_found(EWWW_IMAGE_OPTIMIZER_PNGOUT, 'p');
        if (!empty($pngout_version) && preg_match('/Feb 2(0|1) 2013/', $pngout_version)) {
            echo '<span style="color: green; font-weight: bolder">OK</span>&emsp;version: ' . preg_replace('/PNGOUT \\[.*\\)\\s*?/', '', $pngout_version) . '<br />';
        } elseif (!empty($pngout_version) && preg_match('/PNGOUT/', $pngout_version)) {
            echo '<span style="color: orange; font-weight: bolder">UPDATE AVAILABLE</span>*&emsp;<b>Install</b> <a href="admin.php?action=ewww_image_optimizer_install_pngout">automatically</a> | <a href="http://advsys.net/ken/utils.htm">manually</a>&emsp;<b>version:</b> ' . preg_replace('/PNGOUT \\[.*\\)\\s*?/', '', $pngout_version) . '<br />';
        } else {
            echo '<span style="color: red; font-weight: bolder">MISSING</span>&emsp;<b>Install <a href="admin.php?action=ewww_image_optimizer_install_pngout">automatically</a> | <a href="http://advsys.net/ken/utils.htm">manually</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<br />';
//.........这里部分代码省略.........
开发者ID:Creative-Srijon,项目名称:top10bestwp,代码行数:101,代码来源:ewww-image-optimizer.php



注:本文中的ewww_image_optimizer_tool_found函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP ewwwio_debug_message函数代码示例发布时间:2022-05-15
下一篇:
PHP ewww_image_optimizer_stl_check函数代码示例发布时间: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