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

PHP ewww_image_optimizer_install_paths函数代码示例

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

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



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

示例1: ewww_image_optimizer_options


//.........这里部分代码省略.........
            echo ewww_image_optimizer_cloud_quota();
        } elseif (preg_match('/exceeded/', $verify_cloud)) {
            echo '<span style="color: orange">' . __('Verified,', EWWW_IMAGE_OPTIMIZER_DOMAIN) . ' </span>';
            echo ewww_image_optimizer_cloud_quota();
        } else {
            echo '<span style="color: red">' . __('Not Verified', EWWW_IMAGE_OPTIMIZER_DOMAIN) . '</span>';
        }
        echo '</p>';
    }
    if (ewww_image_optimizer_get_option('ewww_image_optimizer_skip_bundle') && !EWWW_IMAGE_OPTIMIZER_CLOUD && !EWWW_IMAGE_OPTIMIZER_NOEXEC) {
        ?>
				<p><?php 
        _e('If updated versions are available below you may either download the newer versions and install them yourself, or uncheck "Use System Paths" and use the bundled tools.', EWWW_IMAGE_OPTIMIZER_DOMAIN);
        ?>
<br />
				<i>*<?php 
        _e('Updates are optional, but may contain increased optimization or security patches', EWWW_IMAGE_OPTIMIZER_DOMAIN);
        ?>
</i></p>
			<?php 
    } elseif (!EWWW_IMAGE_OPTIMIZER_CLOUD && !EWWW_IMAGE_OPTIMIZER_NOEXEC) {
        ?>
				<p><?php 
        printf(__('If updated versions are available below, you may need to enable write permission on the %s folder to use the automatic installs.', EWWW_IMAGE_OPTIMIZER_DOMAIN), '<i>' . EWWW_IMAGE_OPTIMIZER_TOOL_PATH . '</i>');
        ?>
<br />
				<i>*<?php 
        _e('Updates are optional, but may contain increased optimization or security patches', EWWW_IMAGE_OPTIMIZER_DOMAIN);
        ?>
</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)) {
开发者ID:LacieNat,项目名称:Access-Comm-Project,代码行数:67,代码来源:ewww-image-optimizer.php


示例2: 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


示例3: ewww_image_optimizer_install_tools

function ewww_image_optimizer_install_tools()
{
    global $ewww_debug;
    //	global $ewww_admin;
    $ewww_debug .= "<b>ewww_image_optimizer_install_tools()</b><br>";
    /*	if ( $ewww_admin ) {
    		$ewww_debug .= 'we are in the admin, feel free to shout<br>';
    	} else {
    		$ewww_debug .= 'no admin, be quiet<br>';
    	}*/
    $ewww_debug .= "Checking/Installing tools in " . EWWW_IMAGE_OPTIMIZER_TOOL_PATH . "<br>";
    $toolfail = false;
    if (!is_dir(EWWW_IMAGE_OPTIMIZER_TOOL_PATH)) {
        $ewww_debug .= "Folder doesn't exist, creating...<br>";
        if (!mkdir(EWWW_IMAGE_OPTIMIZER_TOOL_PATH)) {
            echo "<div id='ewww-image-optimizer-warning-tool-install' class='error'><p><strong>" . __('EWWW Image Optimizer could not create the tool folder', EWWW_IMAGE_OPTIMIZER_DOMAIN) . ": " . htmlentities(EWWW_IMAGE_OPTIMIZER_TOOL_PATH) . ".</strong> " . __('Please adjust permissions or create the folder', EWWW_IMAGE_OPTIMIZER_DOMAIN) . ".</p></div>";
            $ewww_debug .= "Couldn't create folder<br>";
            return;
        }
    } else {
        if (!is_writable(EWWW_IMAGE_OPTIMIZER_TOOL_PATH)) {
            $ewww_debug .= 'wp-content/ewww is not writable, not installing anything<br>';
            return;
        }
        $ewww_perms = substr(sprintf('%o', fileperms(EWWW_IMAGE_OPTIMIZER_TOOL_PATH)), -4);
        $ewww_debug .= "wp-content/ewww permissions: {$ewww_perms} <br>";
    }
    list($jpegtran_src, $optipng_src, $gifsicle_src, $pngquant_src, $webp_src, $jpegtran_dst, $optipng_dst, $gifsicle_dst, $pngquant_dst, $webp_dst) = ewww_image_optimizer_install_paths();
    if (!file_exists($jpegtran_dst) || filesize($jpegtran_dst) != filesize($jpegtran_src)) {
        $ewww_debug .= 'jpegtran not found or different size, installing<br>';
        //$ewww_debug .= "jpegtran found, different size, attempting to replace<br>";
        if (!copy($jpegtran_src, $jpegtran_dst)) {
            $toolfail = true;
            $ewww_debug .= "Couldn't copy jpegtran<br>";
        }
    }
    // install 32-bit jpegtran at jpegtran-alt for some weird 64-bit hosts
    $arch_type = php_uname('m');
    if (PHP_OS == 'Linux' && $arch_type == 'x86_64') {
        $ewww_debug .= "64-bit linux detected while installing tools<br>";
        $jpegtran32_src = substr($jpegtran_src, 0, -2);
        $jpegtran32_dst = $jpegtran_dst . '-alt';
        if (!file_exists($jpegtran32_dst) || ewww_image_optimizer_md5check($jpegtran32_dst) && filesize($jpegtran32_dst) != filesize($jpegtran32_src)) {
            $ewww_debug .= "copying {$jpegtran32_src} to {$jpegtran32_dst}<br>";
            if (!copy($jpegtran32_src, $jpegtran32_dst)) {
                // this isn't a fatal error, besides we'll see it in the debug if needed
                $ewww_debug .= "Couldn't copy 32-bit jpegtran to jpegtran-alt<br>";
            }
            $jpegtran32_perms = substr(sprintf('%o', fileperms($jpegtran32_dst)), -4);
            $ewww_debug .= "jpegtran-alt (32-bit) permissions: {$jpegtran32_perms}<br>";
            if ($jpegtran32_perms != '0755') {
                if (!chmod($jpegtran32_dst, 0755)) {
                    $ewww_debug .= "couldn't set jpegtran-alt permissions<br>";
                }
            }
        }
    }
    if (!file_exists($gifsicle_dst) || filesize($gifsicle_dst) != filesize($gifsicle_src)) {
        $ewww_debug .= "gifsicle not found or different size, installing<br>";
        //$ewww_debug .= "gifsicle found, different size, attempting to replace<br>";
        if (!copy($gifsicle_src, $gifsicle_dst)) {
            $toolfail = true;
            $ewww_debug .= "Couldn't copy gifsicle<br>";
        }
    }
    if (!file_exists($optipng_dst) || filesize($optipng_dst) != filesize($optipng_src)) {
        $ewww_debug .= "optipng not found or different size, installing<br>";
        if (!copy($optipng_src, $optipng_dst)) {
            $toolfail = true;
            $ewww_debug .= "Couldn't copy optipng<br>";
        }
    }
    if (!file_exists($pngquant_dst) || filesize($pngquant_dst) != filesize($pngquant_src)) {
        $ewww_debug .= "pngquant not found or different size, installing<br>";
        if (!copy($pngquant_src, $pngquant_dst)) {
            $toolfail = true;
            $ewww_debug .= "Couldn't copy pngquant<br>";
        }
    }
    if (!file_exists($webp_dst) || filesize($webp_dst) != filesize($webp_src)) {
        $ewww_debug .= "webp not found or different size, installing<br>";
        if (!copy($webp_src, $webp_dst)) {
            $toolfail = true;
            $ewww_debug .= "Couldn't copy webp<br>";
        }
    }
    // install special version of cwebp for Mac OSX 10.8 systems
    if (PHP_OS == 'Darwin') {
        $webp8_dst = $webp_dst . '-alt';
        $webp8_src = str_replace('mac9', 'mac8', $webp_src);
        if (!file_exists($webp8_dst) || ewww_image_optimizer_md5check($webp8_dst) && filesize($webp8_dst) != filesize($webp8_src)) {
            $ewww_debug .= "copying {$webp8_src} to {$webp8_dst}<br>";
            if (!copy($webp8_src, $webp8_dst)) {
                // this isn't a fatal error, besides we'll see it in the debug if needed
                $ewww_debug .= "Couldn't copy OSX 10.8 cwebp to cwebp-alt<br>";
            }
            $webp8_perms = substr(sprintf('%o', fileperms($webp8_dst)), -4);
            $ewww_debug .= "cwebp8-alt (OSX 10.8) permissions: {$webp8_perms}<br>";
            if ($webp8_perms != '0755') {
                if (!chmod($webp8_dst, 0755)) {
//.........这里部分代码省略.........
开发者ID:Rudchyk,项目名称:wp-framework,代码行数:101,代码来源:ewww-image-optimizer.php


示例4: ewww_image_optimizer_install_tools

function ewww_image_optimizer_install_tools()
{
    ewwwio_debug_message('<b>' . __FUNCTION__ . '()</b>');
    ewwwio_debug_message("Checking/Installing tools in " . EWWW_IMAGE_OPTIMIZER_TOOL_PATH);
    $toolfail = false;
    if (!is_dir(EWWW_IMAGE_OPTIMIZER_TOOL_PATH) && is_writable(WP_CONTENT_DIR)) {
        ewwwio_debug_message('folder does not exist, creating...');
        if (!mkdir(EWWW_IMAGE_OPTIMIZER_TOOL_PATH)) {
            ewwwio_debug_message('could not create folder');
            return;
        }
    } elseif (is_dir(EWWW_IMAGE_OPTIMIZER_TOOL_PATH)) {
        if (!is_writable(EWWW_IMAGE_OPTIMIZER_TOOL_PATH)) {
            ewwwio_debug_message('wp-content/ewww is not writable, not installing anything');
            return;
        }
        $ewww_perms = substr(sprintf('%o', fileperms(EWWW_IMAGE_OPTIMIZER_TOOL_PATH)), -4);
        ewwwio_debug_message("wp-content/ewww permissions: {$ewww_perms}");
    } else {
        ewwwio_debug_message('wp-content is not writable, and the ewww folder does not exist');
        return;
    }
    list($jpegtran_src, $optipng_src, $gifsicle_src, $pngquant_src, $webp_src, $jpegtran_dst, $optipng_dst, $gifsicle_dst, $pngquant_dst, $webp_dst) = ewww_image_optimizer_install_paths();
    $skip = ewww_image_optimizer_skip_tools();
    if (!$skip['jpegtran'] && (!file_exists($jpegtran_dst) || filesize($jpegtran_dst) != filesize($jpegtran_src))) {
        ewwwio_debug_message('jpegtran not found or different size, installing');
        if (!copy($jpegtran_src, $jpegtran_dst)) {
            $toolfail = true;
            ewwwio_debug_message('could not copy jpegtran');
        }
    }
    if (!$skip['gifsicle'] && (!file_exists($gifsicle_dst) || filesize($gifsicle_dst) != filesize($gifsicle_src))) {
        ewwwio_debug_message('gifsicle not found or different size, installing');
        if (!copy($gifsicle_src, $gifsicle_dst)) {
            $toolfail = true;
            ewwwio_debug_message('could not copy gifsicle');
        }
    }
    if (!$skip['optipng'] && (!file_exists($optipng_dst) || filesize($optipng_dst) != filesize($optipng_src))) {
        ewwwio_debug_message('optipng not found or different size, installing');
        if (!copy($optipng_src, $optipng_dst)) {
            $toolfail = true;
            ewwwio_debug_message('could not copy optipng');
        }
    }
    if (!$skip['pngquant'] && (!file_exists($pngquant_dst) || filesize($pngquant_dst) != filesize($pngquant_src))) {
        ewwwio_debug_message('pngquant not found or different size, installing');
        if (!copy($pngquant_src, $pngquant_dst)) {
            $toolfail = true;
            ewwwio_debug_message('could not copy pngquant');
        }
    }
    if (!$skip['webp'] && (!file_exists($webp_dst) || filesize($webp_dst) != filesize($webp_src))) {
        ewwwio_debug_message('webp not found or different size, installing');
        if (!copy($webp_src, $webp_dst)) {
            $toolfail = true;
            ewwwio_debug_message('could not copy webp');
        }
    }
    // install special version of cwebp for Mac OSX 10.8 systems
    if (PHP_OS == 'Darwin' && !$skip['webp']) {
        $webp8_dst = $webp_dst . '-alt';
        $webp8_src = str_replace('mac9', 'mac8', $webp_src);
        if (!file_exists($webp8_dst) || ewww_image_optimizer_md5check($webp8_dst) && filesize($webp8_dst) != filesize($webp8_src)) {
            ewwwio_debug_message("copying {$webp8_src} to {$webp8_dst}");
            if (!copy($webp8_src, $webp8_dst)) {
                // this isn't a fatal error, besides we'll see it in the debug if needed
                ewwwio_debug_message('could not copy OSX 10.8 cwebp to cwebp-alt');
            }
            if (!ewww_image_optimizer_check_permissions($webp8_dst, 'rwxr-xr-x')) {
                if (!chmod($webp8_dst, 0755)) {
                    ewwwio_debug_message('could not set cwebp8-alt permissions');
                }
            }
        }
    }
    if (PHP_OS != 'WINNT' && !$toolfail) {
        ewwwio_debug_message('Linux/UNIX style OS, checking permissions');
        if (!$skip['jpegtran'] && !ewww_image_optimizer_check_permissions($jpegtran_dst, 'rwxr-xr-x')) {
            if (!chmod($jpegtran_dst, 0755)) {
                $toolfail = true;
                ewwwio_debug_message('could not set jpegtran permissions');
            }
        }
        if (!$skip['gifsicle'] && !ewww_image_optimizer_check_permissions($gifsicle_dst, 'rwxr-xr-x')) {
            if (!chmod($gifsicle_dst, 0755)) {
                $toolfail = true;
                ewwwio_debug_message('could not set gifsicle permissions');
            }
        }
        if (!$skip['optipng'] && !ewww_image_optimizer_check_permissions($optipng_dst, 'rwxr-xr-x')) {
            if (!chmod($optipng_dst, 0755)) {
                $toolfail = true;
                ewwwio_debug_message('could not set optipng permissions');
            }
        }
        if (!$skip['pngquant'] && !ewww_image_optimizer_check_permissions($pngquant_dst, 'rwxr-xr-x')) {
            if (!chmod($pngquant_dst, 0755)) {
                $toolfail = true;
                ewwwio_debug_message('could not set pngquant permissions');
//.........这里部分代码省略.........
开发者ID:kanei,项目名称:vantuch.cz,代码行数:101,代码来源:ewww-image-optimizer.php


示例5: ewww_image_optimizer_install_tools

function ewww_image_optimizer_install_tools()
{
    ewwwio_debug_message('<b>' . __FUNCTION__ . '()</b>');
    ewwwio_debug_message("Checking/Installing tools in " . EWWW_IMAGE_OPTIMIZER_TOOL_PATH);
    $toolfail = false;
    if (!is_dir(EWWW_IMAGE_OPTIMIZER_TOOL_PATH)) {
        ewwwio_debug_message('folder does not exist, creating...');
        if (!mkdir(EWWW_IMAGE_OPTIMIZER_TOOL_PATH)) {
            echo "<div id='ewww-image-optimizer-warning-tool-install' class='error'><p><strong>" . __('EWWW Image Optimizer could not create the tool folder', EWWW_IMAGE_OPTIMIZER_DOMAIN) . ": " . htmlentities(EWWW_IMAGE_OPTIMIZER_TOOL_PATH) . ".</strong> " . __('Please adjust permissions or create the folder', EWWW_IMAGE_OPTIMIZER_DOMAIN) . ".</p></div>";
            ewwwio_debug_message('could not create folder');
            return;
        }
    } else {
        if (!is_writable(EWWW_IMAGE_OPTIMIZER_TOOL_PATH)) {
            ewwwio_debug_message('wp-content/ewww is not writable, not installing anything');
            return;
        }
        $ewww_perms = substr(sprintf('%o', fileperms(EWWW_IMAGE_OPTIMIZER_TOOL_PATH)), -4);
        ewwwio_debug_message("wp-content/ewww permissions: {$ewww_perms}");
    }
    list($jpegtran_src, $optipng_src, $gifsicle_src, $pngquant_src, $webp_src, $jpegtran_dst, $optipng_dst, $gifsicle_dst, $pngquant_dst, $webp_dst) = ewww_image_optimizer_install_paths();
    if (!file_exists($jpegtran_dst) || filesize($jpegtran_dst) != filesize($jpegtran_src)) {
        ewwwio_debug_message('jpegtran not found or different size, installing');
        if (!copy($jpegtran_src, $jpegtran_dst)) {
            $toolfail = true;
            ewwwio_debug_message('could not copy jpegtran');
        }
    }
    // install 32-bit jpegtran at jpegtran-alt for some weird 64-bit hosts
    $arch_type = php_uname('m');
    if (PHP_OS == 'Linux' && $arch_type == 'x86_64') {
        ewwwio_debug_message('64-bit linux detected while installing tools');
        $jpegtran32_src = substr($jpegtran_src, 0, -2);
        $jpegtran32_dst = $jpegtran_dst . '-alt';
        if (!file_exists($jpegtran32_dst) || ewww_image_optimizer_md5check($jpegtran32_dst) && filesize($jpegtran32_dst) != filesize($jpegtran32_src)) {
            ewwwio_debug_message("copying {$jpegtran32_src} to {$jpegtran32_dst}");
            if (!copy($jpegtran32_src, $jpegtran32_dst)) {
                // this isn't a fatal error, besides we'll see it in the debug if needed
                ewwwio_debug_message('could not copy 32-bit jpegtran to jpegtran-alt');
            }
            $jpegtran32_perms = substr(sprintf('%o', fileperms($jpegtran32_dst)), -4);
            ewwwio_debug_message("jpegtran-alt (32-bit) permissions: {$jpegtran32_perms}");
            if ($jpegtran32_perms != '0755') {
                if (!chmod($jpegtran32_dst, 0755)) {
                    ewwwio_debug_message('could not set jpegtran-alt permissions');
                }
            }
        }
    }
    if (!file_exists($gifsicle_dst) || filesize($gifsicle_dst) != filesize($gifsicle_src)) {
        ewwwio_debug_message('gifsicle not found or different size, installing');
        if (!copy($gifsicle_src, $gifsicle_dst)) {
            $toolfail = true;
            ewwwio_debug_message('could not copy gifsicle');
        }
    }
    if (!file_exists($optipng_dst) || filesize($optipng_dst) != filesize($optipng_src)) {
        ewwwio_debug_message('optipng not found or different size, installing');
        if (!copy($optipng_src, $optipng_dst)) {
            $toolfail = true;
            ewwwio_debug_message('could not copy optipng');
        }
    }
    if (!file_exists($pngquant_dst) || filesize($pngquant_dst) != filesize($pngquant_src)) {
        ewwwio_debug_message('pngquant not found or different size, installing');
        if (!copy($pngquant_src, $pngquant_dst)) {
            $toolfail = true;
            ewwwio_debug_message('could not copy pngquant');
        }
    }
    if (!file_exists($webp_dst) || filesize($webp_dst) != filesize($webp_src)) {
        ewwwio_debug_message('webp not found or different size, installing');
        if (!copy($webp_src, $webp_dst)) {
            $toolfail = true;
            ewwwio_debug_message('could not copy webp');
        }
    }
    // install special version of cwebp for Mac OSX 10.8 systems
    if (PHP_OS == 'Darwin') {
        $webp8_dst = $webp_dst . '-alt';
        $webp8_src = str_replace('mac9', 'mac8', $webp_src);
        if (!file_exists($webp8_dst) || ewww_image_optimizer_md5check($webp8_dst) && filesize($webp8_dst) != filesize($webp8_src)) {
            ewwwio_debug_message("copying {$webp8_src} to {$webp8_dst}");
            if (!copy($webp8_src, $webp8_dst)) {
                // this isn't a fatal error, besides we'll see it in the debug if needed
                ewwwio_debug_message('could not copy OSX 10.8 cwebp to cwebp-alt');
            }
            $webp8_perms = substr(sprintf('%o', fileperms($webp8_dst)), -4);
            ewwwio_debug_message("cwebp8-alt (OSX 10.8) permissions: {$webp8_perms}");
            if ($webp8_perms != '0755') {
                if (!chmod($webp8_dst, 0755)) {
                    ewwwio_debug_message('could not set cwebp8-alt permissions');
                }
            }
        }
    }
    // install libjpeg6 version of cwebp for older systems
    if (PHP_OS == 'Linux') {
        $webp6_dst = $webp_dst . '-alt';
        $webp6_src = str_replace('linux8', 'linux6', $webp_src);
//.........这里部分代码省略.........
开发者ID:crazyyy,项目名称:octagram,代码行数:101,代码来源:ewww-image-optimizer.php


示例6: 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


示例7: 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; fon 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

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