Plugin Directory

Changeset 2714583

Timestamp:
04/26/2022 01:18:41 AM (2 years ago)
Author:
increaserev
Message:
  • Version 1.0.1 Release
  • Image WebP fallout fix.
  • Ajax requests fix.
  • Mobile Image dimension fix
Location:
gowebp/trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • gowebp/trunk/gowebp.php

    r2703673 r2714583  
    11<?php
    22/*
    3 * Plugin Name: GOWEBP
    4 * Plugin URI: https://increaserev.com/admanager/
    5 * Author: Increase Rev LLC
    6 * Version: 1.0
    7 * Description: Using GOWEBP,You can optimize your website to it's potential by optimizing all images. Optimizing images will drastically improved your site speed as  images will load faster.
     3* Plugin Name: GP
     4* Plugin URI: https://
     5* Author:
     6* Version: 1.0
     7* Description: Using GP,You can optimize your website to it's potential by optimizing all images. Optimizing images will drastically improved your site speed as  images will load faster.
    88*/
    99if ( ! defined( 'ABSPATH' ) ) exit;
     
    1414require_once(dirname(__FILE__).'/gowebp_worker.php');
    1515require_once(dirname(__FILE__).'/store.php');
    16 
    17 
    1816class GoWEBP_IR extends GOWEBP_WORKER{
    1917
    2018    private static $instance;
    21 
    2219    private function __construct(){
    23         // global $store;
    2420        add_action('init', [$this, 'gowebp_admin_init'],0);
    2521        add_action( 'admin_enqueue_scripts', [$this, 'ir_mngr_add_style_and_script'] );
     
    2723        add_action('activated_plugin', [$this, 'ir_webp_start']);
    2824        if($this->ir_check_active()){
     25
    2926            add_action("publish_post",[$this, "ir_after_publish"]);
    3027            add_action("publish_page",[$this, "ir_after_publish"]);
     
    5451            });
    5552        }else{
    56             wp_enqueue_style('trial_style',plugin_dir_url( __FILE__) ."lib/css/trial.css", array(), time());
    57             wp_enqueue_style('buttons_style',plugin_dir_url( __FILE__) ."lib/css/buttons.css", array(), time());
    58             wp_enqueue_style('setting_style',plugin_dir_url( __FILE__) ."lib/css/setting_style.css", array(), time());
    59             wp_enqueue_style('form_style',plugin_dir_url( __FILE__) ."lib/css/form.css", array(), time());
    60            
    61             wp_enqueue_style( 'myboot', plugin_dir_url( __FILE__) .'lib/css/myboot.bootstrap.min.css' );
    62             wp_enqueue_script( 'myboot-script', plugin_dir_url( __FILE__) .'lib/js/myboot.bootstrap.bundle.min.js', array(), null, true );
    63             wp_enqueue_script( "swal",plugin_dir_url( __FILE__) ."lib/js/swal.js", ["jquery"], null, true);
    64             wp_enqueue_script( "knobs",plugin_dir_url( __FILE__) ."lib/js/jquery.knob.min.js", ["jquery"], null, true);
    65             wp_enqueue_style( 'load-fa', plugin_dir_url( __FILE__) .'lib/css/fontawesome.css');
    66             wp_enqueue_style( 'google-fonts', plugin_dir_url( __FILE__) .'lib/css/fonts.css');
     53
     54            if (isset($_GET['page']) && ($_GET['page'] == 'go-webp/gowebp_option2.php')) {
     55                wp_enqueue_style('trial_style',plugin_dir_url( __FILE__) ."lib/css/trial.css", array(), time());
     56                wp_enqueue_style('buttons_style',plugin_dir_url( __FILE__) ."lib/css/buttons.css", array(), time());
     57                wp_enqueue_style('setting_style',plugin_dir_url( __FILE__) ."lib/css/setting_style.css", array(), time());
     58                wp_enqueue_style('form_style',plugin_dir_url( __FILE__) ."lib/css/form.css", array(), time());
     59               
     60                wp_enqueue_style( 'myboot', 'https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.2/css/bootstrap.min.css' );
     61                wp_enqueue_script( 'myboot-script', 'https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.2/js/bootstrap.bundle.min.js', array(), null, true );
     62                wp_enqueue_script( "swal","//cdn.jsdelivr.net/npm/sweetalert2@11", ["jquery"], null, true);
     63                wp_enqueue_script( "knobs","https://cdnjs.cloudflare.com/ajax/libs/jQuery-Knob/1.2.13/jquery.knob.min.js", ["jquery"], null, true);
     64                wp_enqueue_style( 'load-fa', 'https://use.fontawesome.com/releases/v5.5.0/css/all.css');
     65                wp_enqueue_style( 'google-fonts', 'https://fonts.googleapis.com/css2?family=Raleway&display=swap');
     66            }
     67             
    6768
    6869        }
     
    7879
    7980    function gowebp_admin_init(){ 
     81
    8082        if(is_admin()){
    81 
     83            $GLOBALS['progressbar_show']="hide";
    8284            // For Checking and updating status from server (once per day)
    8385            $this->ir_check_once();
    84 
    8586            wp_enqueue_script( "jquery-form" );
    86            
    8787            // On settings page
    8888            if($this->ir_check_optStarted() && check_theme_switched() && $this->ir_check_theme_img_status()){
     
    9393                    $this->ir_optimize_theme_images();
    9494            }
    95            
    96             }else{
     95       
     96           
    9797            if($this->ir_check_active()){
    9898                add_filter("the_content",[$this, "ir_add_lazyload"]);
    9999                add_filter("post_thumbnail_html",[$this, "ir_add_lazyload_thumbnail"]);
     100
    100101                add_action('wp_footer', [$this, "ir_compiler_funcs"],10000000000);
    101102                if($this->ir_check_optStarted()){
     103
    102104                    add_filter('wp_calculate_image_srcset',[$this, 'ir_update_post_images_url']);
    103105                    add_filter( 'wp_get_attachment_image_src',[$this, 'ir_update_featured_images_url'], 10, 4);
     106
     107
     108
    104109                }
    105110            }
     111
    106112        }
    107113    }
    108114}
    109115
     116
    110117$gowebp_ir = GoWEBP_IR::getInstance();
    111118remove_action('shutdown','wp_ob_end_flush_all',1);
  • gowebp/trunk/gowebp_option2.php

    r2703673 r2714583  
    22if ( ! defined( 'ABSPATH' ) ) exit;
    33
     4
    45if(!$gowebp_ir->ir_check_server() && $gowebp_ir->ir_check_active()){
    56   
     
    6263    $desktop_dimension = isset($ir_form_data["ir_desktop_dimension"][0]) ? 100-(int)$ir_form_data["ir_desktop_dimension"][0] : 25;
    6364    $desktop_dimension = isset($ir_form_data["ir_desktop_dimension"][0])? 100-(int)$ir_form_data["ir_desktop_dimension"][0] : 25;
    64     $tablet_dimension = isset($ir_form_data["ir_tablet_dimension"][0]) ? 100-(int)$ir_form_data["ir_tablet_dimension"][0] : 50;
    65     $mobile_dimension = isset($ir_form_data["ir_mobile_dimension"][0]) ? 100-(int)$ir_form_data["ir_mobile_dimension"][0] : 65;
     65    $tablet_dimension = isset($ir_form_data["ir_tablet_dimension"][0]) ? 100-(int)$ir_form_data["ir_tablet_dimension"][0] : ;
     66    $mobile_dimension = isset($ir_form_data["ir_mobile_dimension"][0]) ? 100-(int)$ir_form_data["ir_mobile_dimension"][0] : ;
    6667    $thumbnail_dimension = isset($ir_form_data["ir_thumbnail_dimension"][0]) ? 100-(int)$ir_form_data["ir_thumbnail_dimension"][0] : 80;
    6768   
     
    243244}
    244245.circlePercent > .counter {
    245 
    246246  position: absolute;
    247247    box-sizing: border-box;
     
    252252    margin-left: -1px;
    253253    border-radius: 50%;
     254
    254255    border: 4px solid #e2e1e1;
    255256 
     
    292293  --progress-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2) inset;
    293294  --progress-flll-shadow: var(--progress-shadow);
     295
    294296  --fill-color: linear-gradient(to right,#fffc00 -15%, #00d119 60%,orange 66%, red 95%);
    295297  --thumb-shadow: 0 0 4px rgba(0, 0, 0, 0.3),
     
    609611.btn-submit:hover{
    610612    color: #fff !important;
    611     /*background: var(--ir-green) !important;*/
    612613    background: green !important;
    613614    box-shadow: 1px 1px 5px rgba(0,0,0,0.5);
     
    615616}
    616617.btn-submit:focus{
    617     /*border:3px solid #7a0099;*/
    618618    box-shadow:  1px 1px 7px rgba(122, 0, 153, 0.5)
    619619
     
    621621
    622622.fa-info-circle{
    623     /*color: var(--ir-pink);*/
    624623    color: rgba(0,0,0,0.4);
    625624    opacity:0.5;
     
    772771}
    773772
     773
     774
     775
     776
     777
     778
     779
     780
     781
     782
     783
     784
     785
     786
     787
     788
     789
     790
     791
     792
     793
     794
     795
     796
     797
     798
     799
     800
     801
     802
     803
     804
     805
     806
     807
     808
     809
     810
     811
     812
     813
     814
     815
     816
     817
     818
     819
     820
     821
     822
     823
     824
     825
     826
     827
     828
     829
     830
     831
    774832 </style>
    775833<div class="wrap" id="ir_blur">
     
    781839<!-- Registration Form Start -->
    782840<div style="<?=$display?>" class="reg_form_div">
     841
    783842    <form id="reg_form">
    784843      <input type="hidden" name="action" value="ir_submit" >
     
    795854        </div>
    796855        <div class="input-field get_key_div">
    797           <a href="https://gowebp.com/#pricing?domain=<?=$domain ?>" target="_blank" class="btn btn-key get_key_link" >
     856          <a href="https://gowebp.com/domain=<?=$domain ?>" target="_blank" class="btn btn-key get_key_link" >
    798857              <strong> Get Key </strong>
    799858          </a>
     
    807866        <section class="ftco-section">
    808867            <div class="container">
     868
    809869            <div class="row <?php if(!$status){ ?> justify-content-center <?php } ?>">
    810870                <div class="col-md-12">
     
    842902                                    <div class="d-flex align-items-center py-2">
    843903                                        <h5 style="padding-right:40px;font-size:18px;">Opt lvl</h5>
    844                                            
    845904                                                <div id="rangePath" class="range-slider grad" style='--min:0; --max:10000; --step:100; --value:<?=$ir_optimize_level*100?>; --text-value:"200"; --prefix:"$"; width:260px;'>
    846905                                                    <input name="rangeValOpt" id="rangeValOpt" value="<?=$ir_optimize_level*100?>" type="range" min="0" max="10000" step="500" oninput="this.parentNode.style.setProperty('--value',this.value); this.parentNode.style.setProperty('--text-value', JSON.stringify((+this.value).toLocaleString()))">
     
    871930                                        <span class="gowebp-slider round"></span>
    872931                                        </label>
    873                                         <!-- <span class="text-muted">( Viewport is enabled ! )</span> -->
    874932                                        <span data-toggle="tooltip" data-placement="top" title="Progressive load requests low resolution images at initial i.e: 50x50 then it loads images as per screen size." class="rounded-circle border-0 text-dark t-1 p-2" style="cursor:pointer; "> <i class="fas fa-info-circle" style="font-size:20px;"></i></span>
    875933                                        <span class="amp_support" ><?=$amp_msg?></span>
     
    10051063                                            <input type="number" step="0.1" value="<?=$shadow_opacity ?>" class='mw-75' name="shadow_opacity" min="0" max="1" >
    10061064                                        </td>
    1007                                         <!-- <td></td> -->
    10081065                                    </tr>
    10091066                                    <tr class="subShadow mt-2">
     
    10571114                                            <td style="color:darkblue">&nbsp;%</td>
    10581115                                        </tr>
    1059                                        
    10601116                                    </table>
    10611117                                    <label for="basic-url" class="text-dark form-label mt-4">Additional/Custom path for images</label>
     
    10811137                                    <div class='col-md-8 d-flex'>
    10821138                                        <button type="button" style="font-size:20px;box-shadow: 0 4px 2px -2px gray;" id="optimizationFormSubmit" class="btn btn-submit px-3" > <strong> Save & Optimize </strong></button>
    1083                                     <!-- Loader Start -->
    10841139                                        <div style="position:relative; margin-top:6px; margin-left:10px;">
    1085                                             <div id="loader" style="display:none" class="circlePercent">
    1086                                                 <div class="counter" data-percent="0"></div>
    1087                                                 <div class="progress"></div>
    1088                                                 <div class="progressEnd"></div>
    1089                                             </div>
     1140
     1141                                          <div class="lds-ellipsis" id="myloader1"><div></div><div></div><div></div><div></div></div>
    10901142                                        </div>
    10911143                                    </div>
     
    11021154                                        <h3>Status</h3>
    11031155                                        <div class="ir_section_divider"></div>
    1104                                        
    11051156                                        <div>
    11061157                                            <label class="ir_total">
     
    11251176                                            <div style="left:-20px" class="dot-flashing mt-2 d-inline-block img-count-loader"></div>
    11261177                                        </div>
    1127                                      
    11281178                                        <div>
    11291179                                            <label class="ir_total">
     
    11451195                                        <div class="ir_section_divider" ></div>
    11461196                                    </div>
    1147                              
    11481197                                    <div id="previewImage" class="w-100 img" >
    11491198                                    </div>
     
    12171266jQuery(document).ready(function($){
    12181267   
    1219     let optimize_started = <?=$optimize_started?>;
    1220     let optimization_status = <?=$optimize_progress?>;
     1268    // let optimize_started = <?=$optimize_started?>;
     1269    // let optimization_status = <?=$optimize_progress?>;
     1270    let optimize_started = 1;
     1271    let optimization_status =1;
    12211272    if(optimize_started==1) {
    12221273        $('#optimizationFormSubmit').prop('disabled', true);
     
    12241275    if(optimization_status==1){
    12251276        $("#loader").css("display","block");
    1226         startOptimizationLoader();
     1277        startOptimizationLoader();
    12271278        // Don't run this function below
    1228 
    1229     }
    1230    
    1231    
     1279        // handleError();
     1280
     1281   
     1282   
    12321283    // Fade in error messages/For paid version msg
    12331284    $('.err_trigger_class').click(function(){
     
    14251476    let before_img_size = 0;
    14261477    let img_size_unit = "mb";
    1427     // let pre_status = '<?=$ir_premi_status ?>';
    1428     irGetImgStats();
    1429 
    14301478    // Image Shadow
    14311479    if($("input[name=ir_image_shadow]").is(":checked")){
     
    14841532    let a = $("input[name=ir_progload_status]").is(":checked");
    14851533   
    1486 
    14871534    // Before Optimization Image Size End
    14881535
     
    15031550            }, 800);
    15041551            // change here
    1505             // $("#viewport_id").click();
    15061552            $("input[name=ir_viewport_status]").prop("checked",true);
    15071553        }
    1508         // else{
    1509         //     $("#viewport_id").click();
    1510         // }
    15111554    });
    15121555    // Progressive Load Toggle End
     
    15631606                        // Place upload progress bar visibility code here
    15641607                        $(".ir_progress_loader").fadeIn();
    1565                         // $("#ir_progress_bar").animate({"width":percentComplete+"%"},{duration:1000});
    15661608                        $("#ir_progress_bar").animate({"width":"50%"},{duration:1000});
    15671609                    }
     
    16301672                            $("#loader").fadeIn();
    16311673                           
    1632                             setTimeout(startOptimizationLoader, 1000);
     1674                            );
    16331675                        },
    16341676                        success:function(response){
    16351677                            $("#loader").fadeOut();
    1636                             // $("#loaderOpt").toggleClass("d-none");
    16371678                            if(response == "Limit Reached"){
    16381679                                Swal.fire({
     
    16571698
    16581699                            $('#optimizationFormSubmit').prop('disabled', false);
    1659                             // optimize_started = 0;
     1700                            ;
    16601701                        },
    16611702                        error: function(request, status, err){
    16621703                            handleError();
    1663                             // $('#optimizationFormSubmit').prop('disabled', false);
    16641704
    16651705                        }
     
    18181858              }
    18191859              else{
    1820                 // window.location = response;
    18211860                window.location.reload();
    18221861              }
     
    20362075                loader.hide();
    20372076                jQuery("#loadCustomPath").show();
    2038                 irGetImgStats();
     2077                irGetImgStats();
    20392078            },
    20402079            error: function(data){
     
    20702109                    data: {action:"del_custom_paths", path},
    20712110                    success: function(data){
    2072                        
    20732111                    },
    20742112                    error: function(data){
     
    21052143       
    21062144    }
     2145
     2146
     2147
     2148
     2149
     2150
     2151
     2152
     2153
     2154
     2155
     2156
     2157
     2158
     2159
     2160
     2161
     2162
     2163
     2164
     2165
     2166
     2167
     2168
     2169
     2170
     2171
     2172
     2173
     2174
     2175
     2176
     2177
     2178
     2179
     2180
     2181
     2182
     2183
     2184
     2185
     2186
     2187
     2188
     2189
     2190
     2191
     2192
     2193
    21072194
    21082195</script>
    21092196<script src="<?=plugin_dir_url( __FILE__ )."lib/js/option.js" ?>"></script>
     2197
     2198
     2199
     2200
     2201
     2202
     2203
     2204
     2205
    21102206
    21112207<?php
     
    21132209<div class="wrap" id="notfound">
    21142210    <div class="notfound">
    2115        
     2211        <!-- <div class="notfound-404">
     2212            <h1></h1>
     2213        </div> -->
    21162214        <div style="position:relative;top:-50px">
    21172215            <img width=400px src="<?=plugin_dir_url( __FILE__ )."/lib/img/gowebp-logo.png" ?>" alt="">
     
    21252223<?php
    21262224}else{
    2127  $domain = sanitize_text_field( $_SERVER["HTTP_HOST"] );
     2225$domain = sanitize_text_field( $_SERVER["HTTP_HOST"] );
    21282226$domain = str_replace(['http://','https://','www.'],'',$domain);
    21292227?>
     
    21392237</div>
    21402238<?php } ?>
     2239
  • gowebp/trunk/gowebp_worker.php

    r2703673 r2714583  
    8282            $ext = pathinfo($img_name, PATHINFO_EXTENSION);
    8383            if($ext == "gif") continue;
    84 
    85            
    86 
    8784            $suffix = "lg";
    8885            [$is_mobile, $is_tablet] = $this->ir_is_mobile_tablet();
     
    9693            if($ir_progload_status == true){
    9794                $img_name2 = str_replace("-holder","_".$suffix,$old_source2);
    98              
    99                 $i->setAttribute("src","");
     95                $i->setAttribute("src",plugin_dir_url( __FILE__) ."lib/img/emptyloader.png");
    10096                $i->setAttribute("srcset","");
    10197                $i->setAttribute("data-original",$old_source2);
     
    104100            }
    105101            elseif($ir_viewport_status == true){
    106 
    107                
    108                 $i->setAttribute("src","");
     102                $i->setAttribute("src",plugin_dir_url( __FILE__) ."lib/img/emptyloader.png");
    109103                $i->setAttribute("srcset","");
    110104                $i->setAttribute("data-original",$old_source2);
    111105            }
    112            
    113 
    114106            // Changes for Post Images
    115107            if($shadow_on_post==true ){
     
    161153            $old_source = $i->getAttribute("src");
    162154            $img_name = $old_source;
    163            
    164155            $index = $this->ir_getExtIndex($img_name);
    165156
     
    171162            }elseif($is_tablet){
    172163                $suffix = "md";
    173             }
    174 
     164            }else{
     165                $suffix = "lg";
     166            }
     167            // $suffix = "sm";
    175168            if($ir_progload_status == true){
    176169                $img_name2 = str_replace("-holder","_".$suffix,$img_name);
    177                
    178                 $i->setAttribute("src","");
     170                $i->setAttribute("src",plugin_dir_url( __FILE__) ."lib/img/emptyloader.png");
    179171                $i->setAttribute("srcset","");
    180172                $i->setAttribute("data-original",$old_source);
     
    182174                if($this->ir_check_exists($img_name2))
    183175                    $i->setAttribute("data-responsive",$img_name2);
    184                 // $i->setAttribute("data-responsive",$new_src2);
    185            
    186176            }
    187177
    188178            elseif($ir_viewport_status == true){
    189                
    190                 $i->setAttribute("src","");
     179                $i->setAttribute("src",plugin_dir_url( __FILE__) ."lib/img/emptyloader.png");
    191180                $i->setAttribute("srcset","");
    192                 // $i->setAttribute("data-original",$new_src);
    193181                $i->setAttribute("data-original",$old_source);
    194 
    195182            }
    196183            else{
    197                
    198184                $i->setAttribute("src",$old_source);
    199185                $i->setAttribute("srcset",$old_source);
    200 
    201186            }
    202187
     
    220205           
    221206        }
    222        
    223207        $newHtml = preg_replace('/^<!DOCTYPE.+?>/', '', str_replace( array('<html>', '</html>', '<body>', '</body>'), array('', '', '', ''), $dom->saveHTML()));
    224208        return $newHtml;
    225209    }
    226210   
    227    
    228211    function ir_check_exists($url, $gowebp=true){
    229212        $server = $gowebp==true ?wp_upload_dir()["basedir"]."/_gowebp_/" : wp_upload_dir()["path"] ;
     
    270253            if($total>0){
    271254                $counter = 0;
     255
    272256                foreach($ir_images as $image){
     257
     258
    273259                    $id = $image["id"];
    274260                    $image = $image["url"];
     
    276262                    $filename = substr($image,strrpos($image,"/")+1);
    277263                    if($this->ir_is_image($filename)){
    278                         if(file_exists($image)){   
     264                        if(file_exists($image)){
     265
     266                        if($counter>=1000 && !$this->ir_check_feature_pre()){
     267                            $this->gowebp_clear_cache();
     268                        }else{
    279269                            $this->ir_compressor($path,$filename);
    280270                            $this->ir_update_url_array($id,$img_to_webp_ir,$ir_optimize_level);
    281271                            $counter++;
    282272                            update_user_meta(1,"ir_done_opt_prog",$counter);
     273
    283274                        }
    284275                    }
     
    319310        $ir_exif_status = $ir_exif_status == 1 ? true : false;
    320311
    321         // $ir_optimize_level = $ir_form_data["ir_optimize_level"][0] == "" ? 65 : $ir_form_data["ir_optimize_level"][0];
    322312        $ir_optimize_level = isset($ir_form_data["ir_optimize_level"][0]) ? $ir_form_data["ir_optimize_level"][0] : 35;
    323313        $ir_optimize_level = (int) $ir_optimize_level;
    324         // $ir_to_webp = $ir_form_data["ir_to_webp"][0] == 0 ?  false : true;
    325314        $ir_to_webp = $ir_form_data["ir_to_webp"][0] ?? 1;
    326315        $ir_to_webp = $ir_to_webp==1 ? true: false;
     
    353342        }
    354343
    355         $response1 = wp_remote_get( $from );
    356         $body1     = wp_remote_retrieve_body( $response1 );
    357         $response2 = wp_remote_get( $to );
    358         $body2     = wp_remote_retrieve_body( $response2 );
    359         $data = new PelDataWindow($body1);
    360         $data2 = new PelDataWindow($body2);
     344        $data = new PelDataWindow(file_get_contents($from));
     345        $data2 = new PelDataWindow(file_get_contents($to));
    361346        $tiff = null;
    362347        $file = null;
     
    444429       
    445430        $ir_form_data = get_user_meta(1);
    446         $desktop_dimension = $ir_form_data["ir_desktop_dimension"][0] ?? 85;
    447         $tablet_dimension = $ir_form_data["ir_tablet_dimension"][0] ?? 50;
    448         $mobile_dimension = $ir_form_data["ir_mobile_dimension"][0] ?? 35;
     431        $desktop_dimension = $ir_form_data["ir_desktop_dimension"][0] ?? 5;
     432        $tablet_dimension = $ir_form_data["ir_tablet_dimension"][0] ?? ;
     433        $mobile_dimension = $ir_form_data["ir_mobile_dimension"][0] ?? ;
    449434        $thumbnail_dimension = $ir_form_data["ir_thumbnail_dimension"][0] ?? 20;
    450435       
     
    463448                imagejpeg($img_resized, $destination, $ir_optimize_level);
    464449                // For Different Screen Size
    465                 imagejpeg($img_resized_lg, $lg_destination, $ir_optimize_level);
    466                 imagejpeg($img_resized_md, $md_destination, $ir_optimize_level);
    467                 imagejpeg($img_resized_sm, $sm_destination, $ir_optimize_level);
    468                 imagejpeg($img_resized_xs, $xs_destination, $ir_optimize_level);
     450                imagejpeg($img_resized_lg, $lg_destination, $ir_optimize_level);
     451                imagejpeg($img_resized_md, $md_destination, $ir_optimize_level);
     452                imagejpeg($img_resized_sm, $sm_destination, $ir_optimize_level);
     453                imagejpeg($img_resized_xs, $xs_destination, $ir_optimize_level);
    469454               
    470455            }
    471456            elseif ($info['mime'] == 'image/png') {
    472457                if($image){
    473                    
    474458                    $arr1 = [
    475459                        $img_resized,
     
    488472                    // foreach($arr as $key => $value){
    489473                    for($i=0; $i<sizeof($arr1); $i++){
    490                         $width = imagesx($arr1[$i]);
    491                         $height = imagesy($arr1[$i]);
    492                         $new_image = imagecreatetruecolor($width,$height);
    493                         imagealphablending($new_image,false);
    494                         imagesavealpha($new_image,true);
    495                         imagecopyresampled($new_image,$arr1[$i],0,0,0,0,$width, $height, $width, $height);
    496                         imagepng($new_image, $arr2[$i], floor($ir_optimize_level/10.0));
     474                        $width = imagesx($arr1[$i]);
     475                        $height = imagesy($arr1[$i]);
     476                        $new_image = imagecreatetruecolor($width,$height);
     477                        imagealphablending($new_image,false);
     478                        imagesavealpha($new_image,true);
     479                        imagecopyresampled($new_image,$arr1[$i],0,0,0,0,$width, $height, $width, $height);
     480                        imagepng($new_image, $arr2[$i], floor($ir_optimize_level/10.0));
    497481       
    498482                    }
     
    734718
    735719    function ir_is_mobile_tablet() {
    736         include_once ( plugin_dir_path(__FILE__) . '/Mobile_Detect.php');
    737         $detect = new Mobile_Detect;
    738         if( $detect->isTablet() ) {
    739             return [false,true];
    740         } elseif($detect->isMobile()) {
     720        // include_once ( plugin_dir_path(__FILE__) . '/Mobile_Detect.php');
     721        // $detect = new Mobile_Detect;
     722        // if( $detect->isTablet() ) {
     723        //     return [false,true];
     724        // } elseif($detect->isMobile()) {
     725        //     return [true,false];
     726        // }else {
     727        //     return [false,false];
     728        // }
     729        if( wp_is_mobile() ) {
    741730            return [true,false];
    742731        }else {
     
    804793        if($this->ir_is_image($filename)){
    805794            $this->ir_insert_single_image_url($path.date("Y/m")."/".$filename );
     795
    806796        }
    807797        return $override;
     
    816806
    817807    function ir_save_cropped_image($context, $attachment_id, $file_path){
     808
    818809        $this->ir_insert_single_image_url($file_path);
    819810        $this->ir_doOptimize();
     
    821812
    822813    function ir_compiler_funcs(){
     814
    823815            $this->remove_all_scripts_ir();
    824816            $this->load_compress_img_ir();
     817
    825818       
    826819    }
     
    851844    {
    852845   
    853        
    854 
    855846        if(strpos($source['url'],substr($path,1)) == false){
    856847            continue;
     
    865856        {   
    866857            $img_name = substr($source['url'],strrpos($source['url'],"/")+1);
    867            
    868 
    869            
    870858            $ext = pathinfo($img_name, PATHINFO_EXTENSION);
    871859            $regex = "/-\d\d\dx\d\d\d\.(jpg|jpeg|png|gif|webp|bmp)$/";
     
    896884            }
    897885            // Change url if it exists // fallback
     886
    898887            if($this->ir_check_exists($path."/_gowebp_/".$img_name)) $source['url'] = $path."/_gowebp_/".$img_name;
    899888        }
     
    931920    // Testing
    932921    $path2 = wp_upload_dir()["basedir"];
    933 
    934922    $ir_form_data = get_user_meta(1);
    935923    $img_to_webp_ir = $ir_form_data["ir_to_webp"][0] ?? 1 ;
     
    996984    $ir_optimize_status = $ir_form_data["ir_start_optimization"][0] ?? 0;
    997985    $ir_optimize_status = $ir_optimize_status == 1 ? true : false;
    998 
    999986    $img_to_webp_ir = $ir_form_data["ir_to_webp"][0] ?? 1;
    1000987    $img_to_webp_ir = $img_to_webp_ir == 1 ? true: false ;
     
    10421029        var img = document.getElementsByTagName("img");
    10431030
    1044         let ir_optimize_status = "<?php echo esc_js($ir_optimize_status); ?>";
    1045         let ir_to_webp = '<?php echo esc_js($img_to_webp_ir); ?>';
    1046         let border_status = "<?php echo esc_js($ir_border_status); ?>";
    1047         let shadow_status = "<?php echo esc_js($ir_shadow_status); ?>";
    1048         let progload_status = "<?php echo esc_js($ir_progload_status); ?>";
    1049         let viewport_status = "<?php echo esc_js($ir_viewport_status); ?>";
     1031        let ir_optimize_status = "<?php echo ?>";
     1032        let ir_to_webp = '<?php echo ?>';
     1033        let border_status = "<?php echo ?>";
     1034        let shadow_status = "<?php echo ?>";
     1035        let progload_status = "<?php echo ?>";
     1036        let viewport_status = "<?php echo ?>";
    10501037        let screen_size = window.innerWidth;
    1051         let avatar_url = "<?php echo esc_js(get_avatar_url(1)); ?>";
    1052         let ir_path = "<?php echo esc_js(wp_upload_dir()["baseurl"]); ?>";
     1038        let avatar_url = "<?php echo ?>";
     1039        let ir_path = "<?php echo ?>";
    10531040        for(i of img){
    10541041            let source = i.src;
     
    10861073                index = source.indexOf(".bmp");
    10871074            }
    1088             i.style.height = i.getAttribute("height")+"px";
    1089 
    1090        
    1091             let border_size = "<?php echo esc_js($border_size); ?>";
    1092             let border_color = "<?php echo esc_js($border_color); ?>";
    1093             let border_radius = "<?php echo esc_js($border_radius); ?>";
     1075            let border_size = "<?php echo $border_size ?>";
     1076            let border_color = "<?php echo $border_color ?>";
     1077            let border_radius = "<?php echo $border_radius ?>";
    10941078            if(border_status == "1" && i.hasAttribute("gowebp-border") ){
    10951079                i.style.border = `${border_size}px solid`;
     
    10981082            }
    10991083           
    1100             let shadow_size = "<?php echo esc_js($shadow_size); ?>";
    1101             let shadow_color = convertToRGB("<?php echo esc_js($shadow_color); ?>");
    1102             let shadow_opacity = "<?php echo esc_js($shadow_opacity); ?>";
     1084            let shadow_size = "<?php echo ?>";
     1085            let shadow_color = convertToRGB("<?php echo ?>");
     1086            let shadow_opacity = "<?php echo ?>";
    11031087            if(shadow_status=="1" && i.hasAttribute("gowebp-shadow")){
    11041088                if(shadow_opacity>1){
     
    11431127            image.setAttribute("src",image.getAttribute("data-responsive"));
    11441128            src = image.getAttribute("data-responsive");
     1129
    11451130            if(src!=null) image.setAttribute("srcset",src);
    11461131            if(src!=null) image.setAttribute("src",src);
    11471132            image.onload = ()=>{
     1133
    11481134                image.removeAttribute("data-responsive");
    11491135               
     
    11721158        let source = img.getAttribute("data-original");
    11731159        img.setAttribute("src",source);
    1174         img.style.height = img.height+"px";
     1160        img.style.height = img.height+"px";
    11751161       
    11761162    }
     
    12651251            <script>
    12661252
    1267                 let allTheScripts = document.getElementsByTagName("script");
    1268                 let allTheIframes = document.getElementsByTagName("iframe");
     1253                let allTheScripts = document.getElementsByTagName("script");
     1254                let allTheIframes = document.getElementsByTagName("iframe");
    12691255                const scriptsSrcArr = [];
    12701256                const iframesSrcArr = [];
     
    13421328        }
    13431329        // $insert=true;
    1344         $abc_="content";
    13451330        @update_user_meta(1,"ir_url_insert_date",$date);
    13461331        $path = wp_upload_dir()["basedir"];
    1347         $b = strpos($path, 'wp-'.$abc_.'/')+11;
     1332        $b = strpos($path, 'wp-/')+11;
    13481333        $path = substr($path,0,$b);
    13491334        $this->ir_custom_images_iterator($path,$ir_images,$totalsize,$imageCounter);
    1350        
     1335
     1336        krsort($ir_images);
     1337       
     1338        if(count($ir_images)>=1000 && !$this->ir_check_feature_pre()){
     1339            $ir_images=array_slice($ir_images, 0, 1000);
     1340        }
    13511341        // For Custom paths images Start
    13521342        if($this->ir_check_feature_pre()){
     
    13631353            $this->ir_insert_images_url($ir_images);
    13641354        }
     1355
    13651356        $optImageCounter = $this->ir_get_opt_img_count();
    13661357
     
    13681359            $optImageCounter = $imageCounter;
    13691360        }
    1370         if($optImageCounter>1000 && !$this->ir_check_feature_pre()){
     1361        if($optImageCounter>1000 && !$this->ir_check_feature_pre()){
    13711362            $optImageCounter = 1000;
    13721363            update_user_meta(1,"ir_limit_reached","1");
     
    13751366        if($optImageCounter>$imageCounter)
    13761367            $optImageCounter = $imageCounter;
     1368
     1369
     1370
     1371
     1372
     1373
     1374
     1375
     1376
     1377
     1378
     1379
     1380
     1381
     1382
     1383
     1384
     1385
     1386
     1387
     1388
     1389
     1390
     1391
     1392
     1393
     1394
     1395
     1396
     1397
     1398
     1399
    13771400
    13781401        return [
    13791402            "total_size"=>$totalsize,
    13801403            "image_count"=>round($imageCounter/4),
    1381             "optimized_image_count"=>round($optImageCounter/4),
     1404            // "optimized_image_count"=>round($optImageCounter/4)."=".$optImgCount,
     1405            "optimized_image_count"=>$optImgCount,
    13821406            "pre"=>$this->ir_check_feature_pre()
    13831407        ];
     
    14171441                    continue;
    14181442                }
    1419                 $ir_images[$file->getMTime()][] =$file->getPathname();
     1443                $ir_images[$file->getMTime()][] =$file->getPathname();
    14201444                $size += $file->getSize();
    14211445                $count++;
     
    14251449
    14261450}
     1451
     1452
    14271453
    14281454// Custom Path End
  • gowebp/trunk/gowebp_worker_premium.php

    r2703673 r2714583  
    1616    public static $re_optimization = false;
    1717    protected static $ir_urls = __DIR__.'/includes/gowebp_urls.json';
    18     // protected static $ir_settings = __DIR__.'/includes/gowebp_settings.json';
    1918    protected static $thumbnail_w;
    2019    protected static $thumbnail_h;
     
    8281            $ext = pathinfo($img_name, PATHINFO_EXTENSION);
    8382            if($ext == "gif") continue;
    84 
    85 
    8683            $suffix = "lg";
    8784            [$is_mobile, $is_tablet] = $this->ir_is_mobile_tablet();
     
    9592            if($ir_progload_status == true){
    9693                $img_name2 = str_replace("-holder","_".$suffix,$old_source2);
    97                
    98                 $i->setAttribute("src","");
     94                $i->setAttribute("src",plugin_dir_url( __FILE__) ."lib/img/imgloader.gif");
    9995                $i->setAttribute("srcset","");
    10096                $i->setAttribute("data-original",$old_source2);
     
    10399            }
    104100            elseif($ir_viewport_status == true){
    105 
    106                
    107                 $i->setAttribute("src","");
     101                $i->setAttribute("src",plugin_dir_url( __FILE__) ."lib/img/imgloader.gif");
    108102                $i->setAttribute("srcset","");
    109103                $i->setAttribute("data-original",$old_source2);
    110104            }
    111 
    112105            // Changes for Post Images
    113106            if($shadow_on_post==true ){
     
    159152            $old_source = $i->getAttribute("src");
    160153            $img_name = $old_source;
    161            
    162154            $index = $this->ir_getExtIndex($img_name);
    163155
     
    169161            }elseif($is_tablet){
    170162                $suffix = "md";
     163
     164
    171165            }
    172166
    173167            if($ir_progload_status == true){
    174168                $img_name2 = str_replace("-holder","_".$suffix,$img_name);
    175                
    176                 $i->setAttribute("src","");
     169                $i->setAttribute("src",plugin_dir_url( __FILE__) ."lib/img/imgloader.gif");
    177170                $i->setAttribute("srcset","");
    178171                $i->setAttribute("data-original",$old_source);
     
    184177
    185178            elseif($ir_viewport_status == true){
    186                
    187                 $i->setAttribute("src","");
     179                $i->setAttribute("src",plugin_dir_url( __FILE__) ."lib/img/imgloader.gif");
    188180                $i->setAttribute("srcset","");
    189181                $i->setAttribute("data-original",$old_source);
     
    191183            }
    192184            else{
    193                
    194185                $i->setAttribute("src",$old_source);
    195186                $i->setAttribute("srcset",$old_source);
    196 
    197187            }
    198188
     
    216206           
    217207        }
    218        
    219208        $newHtml = preg_replace('/^<!DOCTYPE.+?>/', '', str_replace( array('<html>', '</html>', '<body>', '</body>'), array('', '', '', ''), $dom->saveHTML()));
    220209        return $newHtml;
    221210    }
    222211   
    223    
    224212   
    225213    function ir_check_exists($url, $gowebp=true){
     
    348336        }
    349337
    350         $response1 = wp_remote_get( $from );
    351         $body1     = wp_remote_retrieve_body( $response1 );
    352         $response2 = wp_remote_get( $to );
    353         $body2     = wp_remote_retrieve_body( $response2 );
    354         $data = new PelDataWindow($body1);
    355         $data2 = new PelDataWindow($body2);
     338        $data = new PelDataWindow(file_get_contents($from));
     339        $data2 = new PelDataWindow(file_get_contents($to));
    356340        $tiff = null;
    357341        $file = null;
     
    436420
    437421        $img_resized = imagescale($image,$width,$height);
    438         // // For Different Screen Size
    439422       
    440423        $ir_form_data = get_user_meta(1);
    441         $desktop_dimension = $ir_form_data["ir_desktop_dimension"][0] ?? 85;
    442         $tablet_dimension = $ir_form_data["ir_tablet_dimension"][0] ?? 50;
    443         $mobile_dimension = $ir_form_data["ir_mobile_dimension"][0] ?? 35;
     424        $desktop_dimension = $ir_form_data["ir_desktop_dimension"][0] ?? 5;
     425        $tablet_dimension = $ir_form_data["ir_tablet_dimension"][0] ?? ;
     426        $mobile_dimension = $ir_form_data["ir_mobile_dimension"][0] ?? ;
    444427        $thumbnail_dimension = $ir_form_data["ir_thumbnail_dimension"][0] ?? 20;
    445428       
     
    466449            elseif ($info['mime'] == 'image/png') {
    467450                if($image){
    468                    
    469451                    $arr1 = [
    470452                        $img_resized,
     
    481463                        $xs_destination
    482464                    ];
     465
    483466                    for($i=0; $i<sizeof($arr1); $i++){
    484467                        $width = imagesx($arr1[$i]);
     
    673656    //  Theme Images Optimization End
    674657
    675    
    676 
    677658    // Utility Functions Start
    678659    function ir_is_image($path){
     
    727708
    728709    function ir_is_mobile_tablet() {
    729         include_once ( plugin_dir_path(__FILE__) . '/Mobile_Detect.php');
    730         $detect = new Mobile_Detect;
    731         if( $detect->isTablet() ) {
    732             return [false,true];
    733         } elseif($detect->isMobile()) {
     710        if( wp_is_mobile() ) {
    734711            return [true,false];
    735712        }else {
     
    813790            $this->remove_all_scripts_ir();
    814791            $this->load_compress_img_ir();
    815        
    816792    }
    817793
     
    841817    {
    842818   
    843 
    844819        if(strpos($source['url'],substr($path,1)) == false){
    845820            continue;
     
    854829        {   
    855830            $img_name = substr($source['url'],strrpos($source['url'],"/")+1);
    856            
    857831            $ext = pathinfo($img_name, PATHINFO_EXTENSION);
    858832            $regex = "/-\d\d\dx\d\d\d\.(jpg|jpeg|png|gif|webp|bmp)$/";
     
    916890   
    917891    $path = wp_upload_dir()["baseurl"];
    918  
    919892   
    920893    $path2 = wp_upload_dir()["basedir"];
    921    
    922894
    923895    $ir_form_data = get_user_meta(1);
     
    10311003        var img = document.getElementsByTagName("img");
    10321004
    1033         let ir_optimize_status = "<?php echo esc_js($ir_optimize_status); ?>";
    1034         let ir_to_webp = '<?php echo esc_js($img_to_webp_ir); ?>';
    1035         let border_status = "<?php echo esc_js($ir_border_status); ?>";
    1036         let shadow_status = "<?php echo esc_js($ir_shadow_status); ?>";
    1037         let progload_status = "<?php echo esc_js($ir_progload_status); ?>";
    1038         let viewport_status = "<?php echo esc_js($ir_viewport_status); ?>";
     1005        let ir_optimize_status = "<?php echo ?>";
     1006        let ir_to_webp = '<?php echo ?>';
     1007        let border_status = "<?php echo ?>";
     1008        let shadow_status = "<?php echo ?>";
     1009        let progload_status = "<?php echo ?>";
     1010        let viewport_status = "<?php echo ?>";
    10391011        let screen_size = window.innerWidth;
    1040         let avatar_url = "<?php echo esc_js(get_avatar_url(1)); ?>";
    1041         let ir_path = "<?php echo esc_js(wp_upload_dir()["baseurl"]); ?>";
     1012        let avatar_url = "<?php echo ?>";
     1013        let ir_path = "<?php echo ?>";
    10421014        for(i of img){
    10431015            let source = i.src;
     
    10751047                index = source.indexOf(".bmp");
    10761048            }
    1077             i.style.height = i.getAttribute("height")+"px";
    1078 
    1079 
    1080             // might change
    1081        
    1082             let border_size = "<?php echo esc_js($border_size); ?>";
    1083             let border_color = "<?php echo esc_js($border_color); ?>";
    1084             let border_radius = "<?php echo esc_js($border_radius); ?>";
     1049            let border_size = "<?php echo $border_size ?>";
     1050            let border_color = "<?php echo $border_color ?>";
     1051            let border_radius = "<?php echo $border_radius ?>";
    10851052            if(border_status == "1" && i.hasAttribute("gowebp-border") ){
    10861053                i.style.border = `${border_size}px solid`;
     
    10891056            }
    10901057           
    1091             let shadow_size = "<?php echo esc_js($shadow_size); ?>";
    1092             let shadow_color = convertToRGB("<?php echo esc_js($shadow_color); ?>");
    1093             let shadow_opacity = "<?php echo esc_js($shadow_opacity); ?>";
     1058            let shadow_size = "<?php echo ?>";
     1059            let shadow_color = convertToRGB("<?php echo ?>");
     1060            let shadow_opacity = "<?php echo ?>";
    10941061            if(shadow_status=="1" && i.hasAttribute("gowebp-shadow")){
    10951062                if(shadow_opacity>1){
     
    10991066            }
    11001067        }
    1101         // Setting Compressed image url End
    1102 
    11031068        function convertToRGB(hex) {
    11041069            var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
     
    11101075                }
    11111076            }
    1112 
    1113 
    1114        
    11151077    let lazyImg = document.querySelectorAll("img[data-src]");
    11161078    let lazyImg2 = document.querySelectorAll("img[data-original]");
     
    11341096            image.setAttribute("src",image.getAttribute("data-responsive"));
    11351097            src = image.getAttribute("data-responsive");
    1136             // image.setAttribute("src",image.getAttribute("data-src"));
    11371098            if(src!=null) image.setAttribute("srcset",src);
    11381099            if(src!=null) image.setAttribute("src",src);
    11391100            image.onload = ()=>{
    1140                 // image.removeAttribute("data-src");
    11411101                image.removeAttribute("data-responsive");
    11421102               
     
    11651125        let source = img.getAttribute("data-original");
    11661126        img.setAttribute("src",source);
    1167         img.style.height = img.height+"px";
    1168        
    11691127    }
    11701128
     
    12591217
    12601218                let allTheScripts = document.getElementsByTagName("script");
    1261                 let allTheIframes = document.getElementsByTagName("iframe");
     1219                let allTheIframes = document.getElementsByTagName("iframe");
    12621220                const scriptsSrcArr = [];
    12631221                const iframesSrcArr = [];
     
    13201278
    13211279    // Size Calculation Start
     1280
    13221281    function ir_calculate_all_images_size(){
    13231282        // bytes
     
    13341293            $insert=false;
    13351294        }
     1295
    13361296        @update_user_meta(1,"ir_url_insert_date",$date);
    13371297        $path = wp_upload_dir()["basedir"];
     
    13391299        $path = substr($path,0,$b);
    13401300        $this->ir_custom_images_iterator($path,$ir_images,$totalsize,$imageCounter);
     1301
     1302
     1303
     1304
     1305
     1306
    13411307        // For Custom paths images Start
    13421308        if($this->ir_check_feature_pre()){
     
    13531319            $this->ir_insert_images_url($ir_images);
    13541320        }
     1321
    13551322        $optImageCounter = $this->ir_get_opt_img_count();
    13561323
     
    13581325            $optImageCounter = $imageCounter;
    13591326        }
    1360         if($optImageCounter>1000 && !$this->ir_check_feature_pre()){
     1327        if($optImageCounter>1000 && !$this->ir_check_feature_pre()){
    13611328            $optImageCounter = 1000;
    13621329            update_user_meta(1,"ir_limit_reached","1");
     
    13651332        if($optImageCounter>$imageCounter)
    13661333            $optImageCounter = $imageCounter;
     1334
     1335
     1336
     1337
     1338
     1339
     1340
     1341
     1342
     1343
     1344
     1345
     1346
     1347
     1348
     1349
     1350
     1351
     1352
     1353
     1354
     1355
     1356
     1357
     1358
     1359
     1360
     1361
     1362
     1363
     1364
     1365
    13671366
    13681367        return [
    13691368            "total_size"=>$totalsize,
    13701369            "image_count"=>round($imageCounter/4),
    1371             "optimized_image_count"=>round($optImageCounter/4),
     1370            "optimized_image_count"=>,
    13721371            "pre"=>$this->ir_check_feature_pre()
    13731372        ];
     
    14301429    $logo = get_theme_mod( 'custom_logo' );
    14311430    $a = json_encode($logo);
    1432     // echo "<script>console.log('$a')</script>";
    14331431    $image = wp_get_attachment_image_src( $logo , 'full' );
    14341432    $image_url = $image[0];
    1435     // echo "<script>console.log('$image_url')</script>";
    14361433    $image_width = $image[1];
    14371434    $image_height = $image[2];
  • gowebp/trunk/gowebp_worker_trial.php

    r2703673 r2714583  
    1616    public static $re_optimization = false;
    1717    protected static $ir_urls = __DIR__.'/includes/gowebp_urls.json';
    18     // protected static $ir_settings = __DIR__.'/includes/gowebp_settings.json';
    1918    protected static $thumbnail_w;
    2019    protected static $thumbnail_h;
     
    8281            $ext = pathinfo($img_name, PATHINFO_EXTENSION);
    8382            if($ext == "gif") continue;
    84 
    8583            $suffix = "lg";
    8684            [$is_mobile, $is_tablet] = $this->ir_is_mobile_tablet();
     
    9492            if($ir_progload_status == true){
    9593                $img_name2 = str_replace("-holder","_".$suffix,$old_source2);
    96                
    97                 $i->setAttribute("src","");
     94                $i->setAttribute("src",plugin_dir_url( __FILE__) ."lib/img/imgloader.gif");
    9895                $i->setAttribute("srcset","");
    9996                $i->setAttribute("data-original",$old_source2);
     
    10299            }
    103100            elseif($ir_viewport_status == true){
    104 
    105              
    106                 $i->setAttribute("src","");
     101                $i->setAttribute("src",plugin_dir_url( __FILE__) ."lib/img/imgloader.gif");
    107102                $i->setAttribute("srcset","");
    108103                $i->setAttribute("data-original",$old_source2);
    109104            }
    110            
    111 
    112105            // Changes for Post Images
    113106            if($shadow_on_post==true ){
     
    159152            $old_source = $i->getAttribute("src");
    160153            $img_name = $old_source;
    161            
    162154            $index = $this->ir_getExtIndex($img_name);
    163155
     
    173165            if($ir_progload_status == true){
    174166                $img_name2 = str_replace("-holder","_".$suffix,$img_name);
    175                
    176                 $i->setAttribute("src","");
     167                $i->setAttribute("src",plugin_dir_url( __FILE__) ."lib/img/imgloader.gif");
    177168                $i->setAttribute("srcset","");
    178169                $i->setAttribute("data-original",$old_source);
     
    180171                if($this->ir_check_exists($img_name2))
    181172                    $i->setAttribute("data-responsive",$img_name2);
    182            
    183173            }
    184174
    185175            elseif($ir_viewport_status == true){
    186                
    187                 $i->setAttribute("src","");
     176                $i->setAttribute("src",plugin_dir_url( __FILE__) ."lib/img/imgloader.gif");
    188177                $i->setAttribute("srcset","");
    189178                $i->setAttribute("data-original",$old_source);
     
    191180            }
    192181            else{
    193                
    194182                $i->setAttribute("src",$old_source);
    195183                $i->setAttribute("srcset",$old_source);
     
    216204           
    217205        }
    218        
    219206        $newHtml = preg_replace('/^<!DOCTYPE.+?>/', '', str_replace( array('<html>', '</html>', '<body>', '</body>'), array('', '', '', ''), $dom->saveHTML()));
    220207        return $newHtml;
     
    241228
    242229    function ir_doOptimize($img_path=""){
    243 
     230       
    244231        $limit = get_user_meta(1, "ir_limit_reached",true) ?? 0;
    245232        if($limit==1){
     
    269256                    $id = $image["id"];
    270257                    $image = $image["url"];
     258
     259
     260
    271261                    $path = substr($image,0,strrpos($image,"/"));
    272262                    $filename = substr($image,strrpos($image,"/")+1);
     
    311301        $ir_reset_status = $ir_form_data["ir_reOptimize"][0] ?? 0 ;
    312302        $ir_reset_status = $ir_reset_status == 1 ? true : false;
    313 
    314303        $ir_exif_status = $ir_form_data["ir_exif_status"][0] ?? 0 ;
    315304        $ir_exif_status = $ir_exif_status == 1 ? true : false;
    316 
    317305        $ir_optimize_level = isset($ir_form_data["ir_optimize_level"][0]) ? $ir_form_data["ir_optimize_level"][0] : 35;
    318306        $ir_optimize_level = (int) $ir_optimize_level;
     
    340328    }
    341329
    342 
    343    
    344 
    345330    function resize_img_ir($source, $destination, $ir_optimize_level, $width,$height,$webp=false, $ir_exif_status) {
    346331        $info = getimagesize($source);
     
    365350
    366351        $img_resized = imagescale($image,$width,$height);
    367         // // For Different Screen Size
    368        
    369352        $ir_form_data = get_user_meta(1);
    370353        $desktop_dimension = $ir_form_data["ir_desktop_dimension"][0] ?? 85;
     
    395378            elseif ($info['mime'] == 'image/png') {
    396379                if($image){
    397                    
    398380                    $arr1 = [
    399381                        $img_resized,
     
    410392                        $xs_destination
    411393                    ];
     394
    412395                    for($i=0; $i<sizeof($arr1); $i++){
    413396                        $width = imagesx($arr1[$i]);
     
    567550            $img_path = $path.$img_path;
    568551            // For test
    569            
    570552            $img_edited = $path.$img_edited;
    571553            $this->ir_insert_single_image_url($img_path);
     
    657639        {   
    658640            $img_name = substr($source['url'],strrpos($source['url'],"/")+1);
    659            
    660641            $ext = pathinfo($img_name, PATHINFO_EXTENSION);
    661642            $regex = "/-\d\d\dx\d\d\d\.(jpg|jpeg|png|gif|webp|bmp)$/";
     
    720701    $path = wp_upload_dir()["baseurl"];
    721702    // Testing
    722    
    723703    $path2 = wp_upload_dir()["basedir"];
    724 
    725704    $ir_form_data = get_user_meta(1);
    726705    $img_to_webp_ir = $ir_form_data["ir_to_webp"][0] ?? 1 ;
     
    833812        var img = document.getElementsByTagName("img");
    834813
    835         let ir_optimize_status = "<?php echo esc_js($ir_optimize_status); ?>";
    836         let ir_to_webp = '<?php echo esc_js($img_to_webp_ir); ?>';
    837         let border_status = "<?php echo esc_js($ir_border_status); ?>";
    838         let shadow_status = "<?php echo esc_js($ir_shadow_status); ?>";
    839         let progload_status = "<?php echo esc_js($ir_progload_status); ?>";
    840         let viewport_status = "<?php echo esc_js($ir_viewport_status); ?>";
     814        let ir_optimize_status = "<?php echo ?>";
     815        let ir_to_webp = '<?php echo ?>';
     816        let border_status = "<?php echo ?>";
     817        let shadow_status = "<?php echo ?>";
     818        let progload_status = "<?php echo ?>";
     819        let viewport_status = "<?php echo ?>";
    841820        let screen_size = window.innerWidth;
    842         let avatar_url = "<?php echo esc_js(get_avatar_url(1)); ?>";
    843         let ir_path = "<?php echo esc_js(wp_upload_dir()["baseurl"]); ?>";
     821        let avatar_url = "<?php echo ?>";
     822        let ir_path = "<?php echo ?>";
    844823        for(i of img){
    845824            let source = i.src;
     
    877856                index = source.indexOf(".bmp");
    878857            }
    879             i.style.height = i.getAttribute("height")+"px";
    880 
    881        
    882             let border_size = "<?php echo esc_js($border_size); ?>";
    883             let border_color = "<?php echo esc_js($border_color); ?>";
    884             let border_radius = "<?php echo esc_js($border_radius); ?>";
     858            let border_size = "<?php echo $border_size ?>";
     859            let border_color = "<?php echo $border_color ?>";
     860            let border_radius = "<?php echo $border_radius ?>";
    885861            if(border_status == "1" && i.hasAttribute("gowebp-border") ){
    886862                i.style.border = `${border_size}px solid`;
     
    889865            }
    890866           
    891             let shadow_size = "<?php echo esc_js($shadow_size); ?>";
    892             let shadow_color = convertToRGB("<?php echo esc_js($shadow_color); ?>");
    893             let shadow_opacity = "<?php echo esc_js($shadow_opacity); ?>";
     867            let shadow_size = "<?php echo ?>";
     868            let shadow_color = convertToRGB("<?php echo ?>");
     869            let shadow_opacity = "<?php echo ?>";
    894870            if(shadow_status=="1" && i.hasAttribute("gowebp-shadow")){
    895871                if(shadow_opacity>1){
     
    963939        let source = img.getAttribute("data-original");
    964940        img.setAttribute("src",source);
    965         img.style.height = img.height+"px";
    966941       
    967942    }
     
    10571032
    10581033                let allTheScripts = document.getElementsByTagName("script");
    1059                 let allTheIframes = document.getElementsByTagName("iframe");
     1034                let allTheIframes = document.getElementsByTagName("iframe");
    10601035                const scriptsSrcArr = [];
    10611036                const iframesSrcArr = [];
     
    11331108        }
    11341109        // $insert=true;
    1135         $abc_="content";
    11361110        @update_user_meta(1,"ir_url_insert_date",$date);
    11371111        $path = wp_upload_dir()["basedir"];
    1138         $b = strpos($path, 'wp-'.$abc_.'/')+11;
     1112        $b = strpos($path, 'wp-/')+11;
    11391113        $path = substr($path,0,$b);
    11401114        $this->ir_custom_images_iterator($path,$ir_images,$totalsize,$imageCounter);
     
    11531127            $this->ir_insert_images_url($ir_images);
    11541128        }
     1129
    11551130        $optImageCounter = $this->ir_get_opt_img_count();
    11561131
     
    11611136            $optImageCounter = 1000;
    11621137            update_user_meta(1,"ir_limit_reached","1");
     1138
    11631139        }
    11641140
  • gowebp/trunk/includes/helper.php

    r2703673 r2714583  
    88        global $wpdb;
    99        $dir = wp_upload_dir()["baseurl"].'/_gowebp_';
    10        
    1110        if(file_exists($dir)){
    1211            $this->ir_empty_dir($dir);
     
    3736        , "ir_viewport_status", "ir_start_optimization", "ir_to_webp", "ir_optimize_level", "border_radius"
    3837        ,"border_color", "border_size", "ir_theme_image_status","ir_start_date","ir_original_img_count","ir_end_date"
    39         ,"ir_gowebp_status","ir_features_status"];
     38        ,"ir_gowebp_status","ir_features_status"];
    4039   
    4140        foreach($ir_metas as $meta){
     
    6261        $domain = sanitize_text_field( $_SERVER["HTTP_HOST"] );
    6362        $domain = str_replace("www.","",$domain);
    64    
    6563       
    66         $response = wp_remote_post( 'https://gowebp.com/requests_handler/gowebp_key_validation.php',array('domain_check' => $domain) );
    67         $body     = wp_remote_retrieve_body( $response );
    68         return $body;
     64        $args = array('body'=> array('domain_check'=> $domain,"admin_email"=>get_option( 'admin_email' )));
     65        $response = wp_remote_post( 'https://gowebp.com/requests_handler/gowebp_key_validation.php', $args );
     66        // $response = wp_remote_post( 'https://project.increaserev.com/gowebp-site/requests_handler/gowebp_key_validation.php', $args );
     67        $response     = wp_remote_retrieve_body( $response );
     68        return json_decode($response,true);
    6969    }
    7070    // Server Functions End
    7171   
    7272    function ir_check_active(){
    73        
     73        // Check Localhost
     74        if($this->ir_check_server()){
     75            file_put_contents(dirname(plugin_dir_path(__FILE__))."/gowebp_functions.php","
     76            <?php
     77            class GOWEBP_WORKER{
     78                use Helper\Traits\GoWEBP_Revert;
     79                use Helper\Traits\GoWEBP_Checker;
     80                use Helper\Traits\GoWEBP_Updater;
     81            }
     82            ");
     83            return false;
     84        }
     85
     86        $data = get_user_meta(1);
     87        $today = date("Y-m-d");
     88        $end_date = $data["ir_end_date"][0] ?? null;
     89        $status = $data["ir_gowebp_status"][0] ?? null;
     90        if($status == null){
     91            $resp = $this->ir_send_req_to_server();
     92            $status = $resp["status"];
     93        }
     94        if( strtotime($today)>strtotime($end_date) || $status !="active" ){
     95            $r = $this->ir_send_req_to_server();
     96           
     97
     98
     99            if($r["status"]=="active"){
     100                $this->ir_update_record("active");
     101                return true;
     102            }
     103   
     104            file_put_contents(dirname(plugin_dir_path(__FILE__))."/goweb_worker.php","
     105            <?php
     106            class GOWEBP_WORKER{
     107                use Helper\Traits\GoWEBP_Revert;
     108                use Helper\Traits\GoWEBP_Checker;
     109                use Helper\Traits\GoWEBP_Updater;
     110            }
     111            ");
     112            return false;
     113        }
    74114        return true;
    75115    }
    76116   
    77117    function gowebp_clear_cache(){
    78         $irmngr_dir = content_url().'/cache';
    79        
     118         $irmngr_dir = WP_CONTENT_DIR.'/cache';
    80119        $this->ir_menage_emptyDir($irmngr_dir);
     120
     121
     122
     123
     124
     125
     126
    81127   
    82128    }
     
    98144                    }
    99145                }
     146
    100147        }
    101148    }
     
    153200        if($total==0){
    154201            echo 100;
     202
    155203            die();
    156204        }
     
    159207        if($total==0){
    160208            echo 100;
     209
    161210        }else{
    162211            echo round(($done/$total)*100);
    163212        }
     213
    164214        die();
    165215    }
    166216
    167217    function ir_check_server(){
    168         $domain = sanitize_text_field( $_SERVER["SERVER_NAME"] );
    169         return $domain=="localhost";
     218        return $_SERVER["SERVER_NAME"]=="localhost";
    170219    }
    171220
     
    184233   
    185234            $this->ir_update_record("deactive");
    186 
    187             file_put_contents(plugin_dir_path(__FILE__)."/goweb_worker.php","
     235            file_put_contents(dirname(plugin_dir_path(__FILE__))."/goweb_worker.php","
    188236            <?php
    189237            class GOWEBP_WORKER{
     
    262310        $wpdb->insert($table, $data4, $format);
    263311
     312
     313
     314
     315
     316
     317
     318
     319
     320
     321
     322
     323
     324
     325
     326
    264327        $method = $arr["method"] ?? "";
    265328        $plan = $arr["plan"] ?? "";
     
    267330        @update_user_meta( 1, "ir_pay_plan", $plan);
    268331        if($method !="" || $method != null)
    269             @file_put_contents(plugin_dir_path(__FILE__)."/goweb_worker.php",$arr["content"]);
     332            @file_put_contents()."/goweb_worker.php",$arr["content"]);
    270333    }
    271334
     
    290353        return false;
    291354    }
     355
     356
     357
     358
     359
     360
     361
     362
     363
     364
     365
     366
     367
    292368    // TO save images url from uploads
    293369    function ir_insert_images_url($ir_images){
    294         // Retrieving Json file urls in array
    295370        $data = $this->ir_get_urls_array();
    296         ksort($ir_images);
     371        ksort($ir_images);
    297372        foreach($ir_images as $key=>$images){
    298373            if(is_array($images)){
     
    304379                        continue;
    305380                    }
     381
     382
    306383                    $add_arr = array(
    307384                        'id' =>rand(),
    308385                        'url' => $image,
    309386                        'webp'=>0,
    310                         'legacy'=>0
     387                        'legacy'=>0,
     388                        'legacy2'=>0
    311389                        );
    312390                    $data[] = $add_arr;
     
    344422
    345423    function ir_delete_trash_url($extension,$level){
    346        
    347     }
    348 
    349    
     424        // global $wpdb;
     425        // $table = $this->ir_table();
     426        // if($extension=='webp'){
     427        //     $query = "DELETE FROM $table WHERE webp='$level' and status='false'";
     428        // }else{
     429        //     $query = "DELETE FROM $table WHERE legacy='$level' and status='false'";
     430        // }
     431        // $wpdb->query($query);
     432    }
    350433
    351434    function ir_get_urls_array(){
     
    353436        $data = [];
    354437        if(file_exists($output)){
    355 
    356             $response1 = wp_remote_get( $from );
    357         $body1     = wp_remote_retrieve_body( $response1 );
    358         $response2 = wp_remote_get( $to );
    359         $body2     = wp_remote_retrieve_body( $response2 );
    360         $data = new PelDataWindow($body1);
    361         $data2 = new PelDataWindow($body2);
    362 
    363             $data = wp_remote_get( $output );
    364             $data     = wp_remote_retrieve_body( $data );
     438            $data = file_get_contents($output);
    365439            $data = json_decode($data, true);
    366440            $data = is_array($data) ? $data : [];
     
    375449        $data = json_encode($data, JSON_PRETTY_PRINT);
    376450        file_put_contents($output, $data);
     451
    377452        }else{
     453
    378454        }
    379455    }
  • gowebp/trunk/ir_footer.php

    r2703673 r2714583  
    11 
    22 <?php if ( ! defined( 'ABSPATH' ) ) exit; ?>
    3 <footer class="text-center" id="footer">Copyright © <?php echo " ".date("Y")."  ";  ?><a href="https://increaserev.com" target="_blank" style="color:#DCAE1D; text-decoration: none;">Increase Rev</a>. All rights reserved.</footer>
     3<footer class="text-center" id="footer">Copyright © <?php echo " ".date("Y")."  ";  ?>.</footer>
  • gowebp/trunk/readme.txt

    r2703673 r2714583  
    44Tags: Optimize image, lazyload, image viewport, Progressive load, webP
    55Requires at least: 3.9
    6 Tested up to: 5.9.2
    7 Stable tag: 1.0.0
     6Tested up to: 5.9.
     7Stable tag: 1.0.
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    8282
    8383
     84
     85
     86
     87
     88
     89
    8490= Version 1.0.0 =
    8591
  • gowebp/trunk/store.php

    r2703673 r2714583  
    99        $prev_exif_status = $previous_settings["ir_exif_status"][0] ?? 0;
    1010        $prev_desktop_dimension = $previous_settings["ir_desktop_dimension"][0] ?? 75;
    11         $prev_tablet_dimension = $previous_settings["ir_tablet_dimension"][0] ?? 40;
     11        $prev_tablet_dimension = $previous_settings["ir_tablet_dimension"][0] ?? ;
    1212        $prev_mobile_dimension = $previous_settings["ir_mobile_dimension"][0] ?? 50;
    1313        $prev_to_webp = $previous_settings["ir_to_webp"][0] ?? 0;
     
    113113        update_user_meta( 1, "border_on_post", sanitize_text_field($border_on_post));
    114114        update_user_meta( 1, "ir_amp_status", sanitize_text_field($ir_amp_status));
    115    
    116      
     115       
     116
     117        file_put_contents(dirname(plugin_dir_path(__FILE__))."/go-webp/includes/gowebp_urls3.txt","");
     118
     119         $this->gowebp_clear_cache2();
    117120        $this->ir_start_optimization();
     121
    118122        $totalImgCount = get_user_meta(1,'ir_original_img_count',true);
    119123        $optImgCount = $this->ir_get_opt_img_count();
    120124        $optImgCount =$optImgCount>$totalImgCount ? $totalImgCount:$optImgCount;
    121         die();
     125        echo round($optImgCount/4);
     126        die();
     127    }
     128
     129function gowebp_clear_cache2(){
     130         $irmngr_dir = WP_CONTENT_DIR.'/cache';
     131        $this->ir_menage_emptyDir2($irmngr_dir);
     132
     133          $dir2 = wp_upload_dir()["basedir"].'/litespeed/';
     134          $this->ir_menage_emptyDir2($dir2);
     135        $dir3=WP_CONTENT_DIR."/cache";
     136        $this->ir_menage_emptyDir2($dir3);
     137        $dir4=WP_CONTENT_DIR."/litespeed";
     138        $this->ir_menage_emptyDir2($dir4);
     139   
     140    }
     141   
     142   
     143    function ir_menage_emptyDir2($dir) {
     144        if (is_dir($dir)) {
     145           
     146            $scn = scandir($dir);
     147                foreach ($scn as $files) {
     148
     149                    if ($files !== '.') {
     150                        if ($files !== '..') {
     151                            if (!is_dir($dir . '/' . $files)) {
     152                                unlink($dir . '/' . $files);
     153                            } else {
     154                                $this->ir_menage_emptyDir2($dir . '/' . $files);
     155                                rmdir($dir . '/' . $files);
     156                            }
     157                        }
     158                    }
     159                }
     160                @rmdir($dir);
     161        }
    122162    }
    123163
    124164    function ir_start_optimization(){
     165
     166
    125167        $check = get_user_meta(1);
    126168        $ir_theme_image_status  = $check["ir_theme_image_status"][0] ?? 0;
     
    128170        $opt_status = $check["ir_start_optimization"][0] ?? null;
    129171   
    130         if($opt_status != null){ 
    131             $this->ir_doOptimize();
     172        if($opt_status != null){
     173            $this->ir_doOptimize();
    132174            if($ir_theme_image_status){
    133175                $this->ir_optimize_theme_images();
     
    154196   
    155197    function ir_send_key($key){
    156         $domain = sanitize_text_field( $_SERVER["HTTP_HOST"] );
     198        $domain = sanitize_text_field( $_SERVER["HTTP_HOST"] );
    157199        $domain = str_replace("www.","",$domain);
    158        
    159         $response = wp_remote_post( 'https://gowebp.com/requests_handler/gowebp_key_validation.php',array('domain' => $domain, 'key'=>$key) );
    160         $body     = wp_remote_retrieve_body( $response );
    161         return $body;
     200
     201        $args = array('body'=> array('domain'=> $domain,'key'=>$key));
     202        $response = wp_remote_post( 'https://gowebp.com/requests_handler/gowebp_key_validation.php', $args );
     203        // $response = wp_remote_post( 'https://project.increaserev.com/gowebp-site/requests_handler/gowebp_key_validation.php', $args );
     204        $response     = wp_remote_retrieve_body( $response );
     205   
     206        return json_decode($response, true);
    162207    }
    163208   
     
    212257        $domain = str_replace(["https://","http://","www."],"",$SERVER_NAME);
    213258   
    214        
    215 
    216         $response = wp_remote_post( 'https://gowebp.com/requests_handler/gowebp_key_validation.php',array("unsubscribe"=>1,'domain' => $domain,"sub_id"=>$sub_id) );
     259       
     260        $response = wp_remote_post( 'https://gowebp.com/requests_handler/gowebp_key_validation.php', $args );
     261        );
    217262        $response     = wp_remote_retrieve_body( $response );
    218 
    219263        if($response["gowebp_unsub"]==true){
    220264            delete_user_meta(1,"ir_pay_method");
     
    251295    }
    252296
    253     // External Url Ajax Start
    254 
    255 
    256     // External Url Ajax End
    257297
    258298    // Custom Path Ajax Start
     
    273313        }else{
    274314            echo "invalid";
     315
    275316        }
    276317        die();
     
    286327    function del_custom_paths(){
    287328        $path_ = sanitize_text_field( $_POST['path'] );
    288         $path = $path_;
     329        $path = $path_;
    289330        delete_user_meta(1,"ir_custom_img_paths",$path);
    290331        // Delete that path's images from db
     
    310351            }
    311352            update_user_meta(1,'ir_reOptimize',0);
     353
    312354            $this->ir_doOptimize();
     355
    313356        }
    314357       
     
    318361
    319362
     363
     364
     365
     366
     367
     368
     369
     370
     371
     372
     373
     374
     375
     376
     377
     378
     379
     380
     381
     382
     383
     384
     385
     386
     387
     388
     389
     390
     391
     392
     393
     394
     395
     396
     397
     398
     399
     400
     401
     402
     403
     404
     405
     406
     407
     408
     409
     410
     411
     412
     413
     414
     415
     416
     417
     418
     419
     420
     421
     422
     423
     424
     425
     426
     427
     428
     429
     430
     431
     432
     433
     434
     435
     436
     437
     438
     439
     440
     441
     442
     443
     444
     445
     446
     447
     448
     449
     450
     451
     452
     453
     454
     455
     456
     457
     458
     459
     460
     461
     462
     463
     464
     465
     466
     467
     468
     469
     470
     471
     472
    320473}
    321474
    322475$store = new GoWEBP_STORE;
     476
     477
     478
     479
     480
     481
    323482
    324483add_action( "wp_ajax_irOptimizeAjax", [$store, "irOptimizeAjax"]);
  • gowebp/trunk/uninstall.php

    r2703673 r2714583  
    44require_once(dirname(__FILE__).'/gowebp_worker.php');
    55require_once(dirname(__FILE__).'/store.php');
    6 
     6use DirectoryIterator;
    77class GoWEBP_Revert extends GOWEBP_WORKER{
    88    function ir_revert_gowebp(){
    99        global $wpdb;
    10         $dir = wp_upload_dir()["baseurl"].'/_gowebp_';
    11         if(file_exists($dir)){
     10        $dir = wp_upload_dir()["basedir"].'/_gowebp_/';
     11        $dir2 = wp_upload_dir()["basedir"].'/litespeed/';
     12        $dir3=WP_CONTENT_DIR."/cache";
     13        $dir4=WP_CONTENT_DIR."/litespeed";
    1214            $this->ir_empty_dir($dir);
    13             rmdir($dir);
    14         }
     15            $this->ir_empty_dir($dir2);
     16            $this->ir_empty_dir($dir3);
     17            $this->ir_empty_dir($dir4);
    1518        $this->ir_delete_metas();
    1619        $this->ir_revert_theme_images();
     
    1821    }
    1922    function ir_empty_dir($path){
     23
     24
     25
    2026        $dir = new DirectoryIterator($path);
     27
    2128        foreach($dir as $file){
    2229            if(!$file->isDot()){
     
    2936            }
    3037        }
     38
     39
     40
    3141    }
    3242   
     
    3949        ,"ir_gowebp_status","ir_features_status","ir_done_opt_prog","ir_total_opt_prog","border_on_post","border_on_featured"
    4050        ,"border_on_thumbnail","shadow_on_post","shadow_on_featured","shadow_on_thumbnail","ir_exif_status","ir_url_insert_date"
    41         ,"ir_pay_plan","ir_pay_method"];
     51        ,"ir_pay_plan","ir_pay_method"];
    4252   
    4353        foreach($ir_metas as $meta){
  • gowebp/trunk/vendor/lsolesen/pel/make-image-test.php

    r2703673 r2714583  
    114114
    115115    if (strlen($ifd->getThumbnailData()) > 0) {
    116         // println('$thumb_data = file_get_contents(dirname(__FILE__) .');
     116        println('$thumb_data = file_get_contents(dirname(__FILE__) .');
    117117        println('                                \'/%s\');', $GLOBALS['thumb_filename']);
    118118        println('$this->assertEquals(%s%d->getThumbnailData(), $thumb_data);', $name, $number);
Note: See TracChangeset for help on using the changeset viewer.