Plugin Directory

Changeset 1813807


Ignore:
Timestamp:
02/01/2018 11:50:55 PM (7 years ago)
Author:
ihorsl
Message:

version 0.95

Location:
opti-mozjpeg-guetzli-webp/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • opti-mozjpeg-guetzli-webp/trunk/class_wpmjgu_batch_optimization_dialog.php

    r1807378 r1813807  
    188188    if ($ALL_WPMJGU_SETTINGS['wpmjgu_mode'] === "guetzli")
    189189    {
    190         print "<p>Notice: Google Guetzli is terribly slow. Be patient and wait until first output appears on the console.</p>\n";
     190        print "<p id='lable_guetzli_slow'>Notice: Google Guetzli is terribly slow. Be patient and wait until first output appears on the console.</p>\n";
    191191    }
    192     else
    193     {
    194         print "<br>\n";
    195     }   
    196192?>
     193
     194<script src="<?php print plugins_url('/other_includes/FileSaver.js', __FILE__ ); ?>"></script>
     195<input type="button" class="button" id="button_save_log" value="Save console log" onclick="js_save_log();">
     196
    197197<div id="console"></div>
    198198<script>
     
    376376    document.getElementById("batch_optimization_status").innerHTML = "Complete";
    377377    window.onbeforeunload = null;
     378   
     379    js_console("<br>\n<br>\n<br>\n---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n<br>\n<br>\n");
     380    js_console("Batch optimization finished at " + new Date().toLocaleString());
     381    js_console("<br>\n<br>\n<br>\n");
    378382       
    379383<?php
     
    430434}
    431435
     436function js_save_log()
     437{
     438    var js_tag_console = document.getElementById("console");
     439    var js_console_text = js_tag_console.innerText;
     440    js_console_text = js_console_text.replace(/\n/g , '\r\n');
     441    var js_blob = new Blob([js_console_text], {type: "text/plain;charset=utf-8"});
     442    saveAs(js_blob, "wpmjgu_batch_optimization_log.txt");
     443}
     444
     445js_console('Batch optimization started at ' + new Date().toLocaleString());
    432446js_batch_continue_optimization();
    433447
  • opti-mozjpeg-guetzli-webp/trunk/class_wpmjgu_batch_optimization_worker.php

    r1807378 r1813807  
    116116       
    117117       
    118        
     118        delete_post_meta(ATTACHMENT_ID, 'wpmjgu_optimized');
    119119        $r = $this->create_compressed_or_optimized_image();
    120120        print $r['out'];
     
    129129        $wpmjgu_func->url_file->delete_attachment_thumbnails(CURRENT_PATH);
    130130        $wpmjgu_func->url_file->delete_webp_duplicates(CURRENT_PATH);       
     131        delete_post_meta(ATTACHMENT_ID, 'wpmjgu_webp_duplicate');
    131132       
    132133        if (CURRENT_PATH !== $new_path)
     
    567568
    568569        $wpmjgu_func->url_file->delete_webp_duplicates(CURRENT_PATH);
     570        delete_post_meta(ATTACHMENT_ID, 'wpmjgu_webp_duplicate');
    569571       
    570572        $size = getimagesize(ORIGINAL_PATH);       
  • opti-mozjpeg-guetzli-webp/trunk/class_wpmjgu_batch_revert_dialog.php

    r1807378 r1813807  
    121121</tbody>   
    122122</table>
    123 <br><br><br>
     123<br><br>
     124
     125<script src="<?php print plugins_url('/other_includes/FileSaver.js', __FILE__ ); ?>"></script>
     126<input type="button" class="button" id="button_save_log" value="Save console log" onclick="js_save_log();">
     127
    124128<div id="console"></div>
    125129<script>
     
    217221    js_tag_button.style.visibility = "hidden";
    218222    document.getElementById("batch_revert_status").innerHTML = "Complete";
     223   
     224    js_console("<br>\n<br>\n<br>\n---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n<br>\n<br>\n");
     225    js_console("Batch revert finished at " + new Date().toLocaleString());
     226    js_console("<br>\n<br>\n<br>\n");
    219227}
    220228
     
    228236}
    229237
     238function js_save_log()
     239{
     240    var js_tag_console = document.getElementById("console");
     241    var js_console_text = js_tag_console.innerText;
     242    js_console_text = js_console_text.replace(/\n/g , '\r\n');
     243    var js_blob = new Blob([js_console_text], {type: "text/plain;charset=utf-8"});
     244    saveAs(js_blob, "wpmjgu_batch_revert_log.txt");
     245}
     246
     247js_console('Batch revert started at ' + new Date().toLocaleString());
    230248js_batch_continue_revert();
    231249
  • opti-mozjpeg-guetzli-webp/trunk/class_wpmjgu_image.php

    r1796589 r1813807  
    237237                $this->sshc = new \phpseclib\Net\SSH2($ALL_WPMJGU_SETTINGS['wpmjgu_ssh_server'], $ALL_WPMJGU_SETTINGS['wpmjgu_ssh_port']);
    238238
    239                 if (! @$this->sshc->login($ALL_WPMJGU_SETTINGS['wpmjgu_ssh_username'], $ALL_WPMJGU_SETTINGS['wpmjgu_ssh_password'] ))
     239                $attept = 1;               
     240                while (! @$this->sshc->login($ALL_WPMJGU_SETTINGS['wpmjgu_ssh_username'], $ALL_WPMJGU_SETTINGS['wpmjgu_ssh_password'] ))
    240241                {
    241                     $ret['out'] .= "Can`t connect to ssh server or bad login\n";
    242                     $ret['error'] = true;
    243                     return $ret;
     242                    if ($attept > 5) {
     243                        $ret['out'] .= "Can`t connect to ssh server or bad login\n";
     244                        $ret['error'] = true;
     245                        return $ret;
     246                    } else {
     247                        sleep(30);
     248                        $attept++;
     249                    }                   
    244250                }         
    245251            }
     
    248254            {   
    249255                $this->sftp = new \phpseclib\Net\SFTP($ALL_WPMJGU_SETTINGS['wpmjgu_ssh_server'], $ALL_WPMJGU_SETTINGS['wpmjgu_ssh_port']);
    250                 if (! @$this->sftp->login($ALL_WPMJGU_SETTINGS['wpmjgu_ssh_username'],  $ALL_WPMJGU_SETTINGS['wpmjgu_ssh_password']))
     256               
     257                $attept = 1;
     258                while (! @$this->sftp->login($ALL_WPMJGU_SETTINGS['wpmjgu_ssh_username'],  $ALL_WPMJGU_SETTINGS['wpmjgu_ssh_password']))
    251259                {
    252                     $ret['out'] .= "Can`t connect to sftp server\n";
    253                     $ret['error'] = true;
    254                     return $ret;           
     260                    if ($attept > 5) {
     261                        $ret['out'] .= "Can`t connect to sftp server\n";
     262                        $ret['error'] = true;
     263                        return $ret;
     264                    } else {
     265                        sleep(30);
     266                        $attept++;
     267                    }
    255268                }         
    256269            }
     
    346359            }
    347360
     361            if ($this->sshc->isTimeout())
     362            {
     363                $ret['out'] .= "Ssh server error: Encoder timeout\n";
     364                $ret['error'] = true;
     365                return $ret;                 
     366            }               
     367           
    348368            if (! $this->sftp->delete($source_file_ssh_path))
    349369            {
     
    351371                $ret['error'] = true;
    352372                return $ret;           
    353             }   
     373            } 
    354374
    355375            if (! $this->sftp->file_exists($dest_file_ssh_path))
    356376            {
    357                 $ret['out'] .= "Ssh server error: Output file $dest_file_ssh_path not created\n";
    358                 $ret['error'] = true;
    359                 return $ret;           
    360             }           
    361 
     377                sleep(15);
     378                if (! $this->sftp->file_exists($dest_file_ssh_path))
     379                {
     380                    $ret['out'] .= "Ssh server error: Output file $dest_file_ssh_path not created\n";
     381                    $ret['error'] = true;
     382                    return $ret;           
     383                }           
     384            }
     385           
    362386            if (! $this->sftp->get($dest_file_ssh_path, $dest_file_path))
    363387            {
  • opti-mozjpeg-guetzli-webp/trunk/opti-mozjpeg-guetzli-webp.php

    r1807384 r1813807  
    44Plugin Name: Opti MozJpeg Guetzli WebP
    55Plugin URI: http://ihorsl.com/en/wordpress-opti-mozjpeg-guetzli-webp/home/
    6 Version: 0.91
     6Version: 0.95
    77Author: Ihor Slyva
    88Author uri: http://ihorsl.com
     
    5353<div class="wrap">
    5454<div id="icon-options-general" class="icon32"></div>
    55 <h1 id="wpmjgu-title">Opti MozJpeg Guetzli WebP (v0.91)</h1>
     55<h1 id="wpmjgu-title">Opti MozJpeg Guetzli WebP (v0.95)</h1>
    5656
    5757
     
    192192    if (! current_user_can('edit_files') ) { die("You don't have enough privileges to pefrom this task\n\n"); }
    193193   
    194     set_time_limit(3600);
     194    set_time_limit(7200);
    195195    $wpmjgu_batch_optimization_worker = new \wpmjgu\class_wpmjgu_batch_optimization_worker();
    196196    $wpmjgu_batch_optimization_worker->the_html();
  • opti-mozjpeg-guetzli-webp/trunk/readme.txt

    r1807384 r1813807  
    44Donate link: http://ihorsl.com/en/wordpress-opti-mozjpeg-guetzli-webp/home/#donate-wpmjgu
    55Requires at least: 4.7
    6 Tested up to: 4.9.1
     6Tested up to: 4.9.2
    77Requires PHP: 5.4
    8 Stable tag: 0.91
     8Stable tag: 0.95
    99License: GPLv2
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    1717This plugin uses flowing image encoders: Mozilla MozJpeg, Google Guetzli and Google WebP. But don't worry. There is no necessity to install them into your hosting. The plugin has built-in ssh client. It can access encoders remotely via ssh tunnel.
    1818
    19 Plugin's author created a virtual machine for Oracle VirtualBox. It contains Linux, ssh server and Mozilla MozJpeg, Google Guetzli and Google WebP. Simply run this virtual machine on your computer, establish ssh connection between the plugin and the virtual machine and optimize your images for free without any limitations.
     19Plugin's author created a virtual machine for Oracle VirtualBox. It contains Linux, ssh server and Mozilla MozJpeg, Google Guetzli and Google WebP. Simply run this virtual machine in your computer, establish ssh connection between the plugin and the virtual machine and optimize your images for free without any limitations.
    2020
    2121Of course the plugin can use locally installed encoders too.
     
    3838== Changelog ==
    3939
     40= 0.95 =
     41* Added "Save console log" button
     42
     43= 0.6 =
     44* Added "Intensive resources consumption mode" in Batch optimization
     45
    4046= 0.5 =
    4147* First plugin release
    42  
    43 = 0.6 =
    44 * Added "Intensive resources consumption mode" in Batch optimization
     48
  • opti-mozjpeg-guetzli-webp/trunk/style.css

    r1784228 r1813807  
    187187    font-style: italic;
    188188}
     189
     190#button_save_log {
     191    float: right;
     192    margin-bottom: 10px;
     193    margin-right: 30px;
     194}
     195
     196#lable_guetzli_slow {
     197    float: left;
     198}
Note: See TracChangeset for help on using the changeset viewer.