Plugin Directory

Changeset 3468181


Ignore:
Timestamp:
02/24/2026 03:10:34 AM (12 days ago)
Author:
rermis
Message:

v1.1.14 = * Improved messaging. Added clear history functionality. Improved caching of processed images.

Location:
extended-folder-compression/tags/1.1.14
Files:
4 copied

Legend:

Unmodified
Added
Removed
  • extended-folder-compression/tags/1.1.14/efc_functions.php

    r3310749 r3468181  
    66Author URI: https://richardlerma.com/contact/
    77Requires Plugins: tiny-compress-images
    8 Version: 1.1.12
     8Version: 1.1.14
    99Text Domain: extended-folder-compression
    10 Copyright: (c) 2019-2025 rldd.net - All Rights Reserved
     10Copyright: (c) 2019-2026 rldd.net - All Rights Reserved
    1111License: GPLv3 or later
    1212License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    8585  $default_folder=$upload_dir['basedir'];
    8686
    87   if($_SERVER['REQUEST_METHOD']=='POST'&&(isset($_POST['efctin_optimize'])||isset($_POST['continue'])||isset($_POST['efctin_save_auto']))){
     87  if($_SERVER['REQUEST_METHOD']=='POST'&&(isset($_POST['efctin_optimize'])||isset($_POST['continue'])||isset($_POST['efctin_save_auto'])||isset($_POST['efctin_clear_history']))){
    8888    if(!isset($_POST['efctin_nonce'])||!wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['efctin_nonce'])),'efctin_optimize')){
    8989      echo "<div class='error notice'><p>".esc_html('Security check failed.')."</p></div>";return;
    9090    }
    9191   
     92    if(isset($_POST['efctin_clear_history'])){
     93      update_option('efctin_processed_images',array());
     94      update_option('efctin_log','');
     95      update_option('efctin_log_ct',0);
     96      update_option('efctin_log_mb',0);
     97      echo "<div class='updated notice'><p>Compression history cleared. All images will be treated as unprocessed on the next run.</p></div>";
     98    }
    9299    if(!isset($_POST['continue'])){
    93100      $days=isset($_POST['days'])?intval(wp_unslash($_POST['days'])):30;
     
    136143    </td>
    137144  </tr>
    138   </table>";
    139   submit_button('Run Optimization','primary','efctin_optimize');
     145  </table>
     146  <p class='submit' style='overflow:hidden'>
     147    <button type='submit' name='efctin_clear_history' class='button' style='float:right' onclick=\"return confirm('This will permanently delete all compression history. All images will be treated as new and may be recompressed on the next run. Continue?');\">Clear Compression History</button>
     148    <button type='submit' name='efctin_optimize' class='button button-primary'>Run Optimization</button>
     149  </p>";
    140150  echo "</form>";
    141151
     
    177187      if($ct>0)echo "<div id='efctin_result'><div style='font-size:1.2em;margin-bottom:1em;font-weight:bold'>Process Complete. </div> <b>".esc_html($ct)."</b> Images Compressed. <b> ".esc_html($mb)."</b> MB Saved.\n\n".wp_kses_post($log)."</div>";
    178188      elseif(!empty($log))echo "<div id='efctin_result'>".wp_kses_post($log)."</div>";
    179       else echo "<div id='efctin_result'>".sprintf(esc_html__('No unprocessed images modified in last %1$s days found in %2$s folder.','extended-folder-compression'),esc_html($days),esc_html($base_folder))."</div>";
     189      else{
     190        if(basename($target_folder)==='uploads')echo "<div id='efctin_result'>No images processed. This tool intentionally skips standard WordPress year folders inside /uploads. Set Target Folder to a specific year/month folder like /uploads/2026/02.</div>";
     191        else echo "<div id='efctin_result'>".sprintf(esc_html__('No unprocessed images modified in last %1$s days found in %2$s folder.','extended-folder-compression'),esc_html($days),esc_html($base_folder))."</div>";
     192      }
    180193    }
    181194  }
     
    196209  }
    197210}
     211
    198212
    199213function efctin_compression($dir,$batch_timeout,&$processed,$start_time=null){
     
    218232        $img=basename($path);
    219233        $relativePath="/$parent/$img";
    220         $hash=hash('crc32b',$relativePath);
     234        $hash_old=hash('crc32b',$relativePath);
     235        $hash=hash('crc32b',$relativePath.'|'.filesize($path));
    221236        if(isset($processed[$hash]))continue;
     237        if(isset($processed[$hash_old])){$processed[$hash]=true;continue;}
    222238        $origSize=filesize($path);
    223239        if($origSize>100){
     
    240256          }
    241257        }else efctin_log("Permanently skipped $origSize byte file. $relativePath\n");
     258        $processed[$hash_old]=true;
    242259        $processed[$hash]=true;
    243260        flush();
     
    247264  return true;
    248265}
     266
    249267
    250268add_action('init',function(){
  • extended-folder-compression/tags/1.1.14/readme.txt

    r3310749 r3468181  
    33Tags: tinypng, directory, folder compression, image optimization
    44Requires at least: 6.0
    5 Tested up to: 6.8
    6 Stable tag: 1.1.12
     5Tested up to: 6.9
     6Stable tag: 1.1.14
    77License: GNU General Public License v3.0
    88License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    3838
    3939== Changelog ==
     40= 1.1.14 = * Improved messaging. Added clear history functionality. Improved caching of processed images.
    4041= 1.1.12 = * Use timezone offset for file date display
    4142= 1.1.11 = * Improve auto compression
Note: See TracChangeset for help on using the changeset viewer.