Plugin Directory

Changeset 710036


Ignore:
Timestamp:
05/08/2013 06:34:26 PM (13 years ago)
Author:
ChrisHurst
Message:

2.3.10

  • more improvements to the edit-media page, condensed form to display better on the insert media sidebar
  • fixed typos in readme
Location:
transparent-image-watermark-plugin/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • transparent-image-watermark-plugin/trunk/readme.txt

    r709903 r710036  
    55Requires at least: 3.3
    66Tested up to: 3.5.1
    7 Stable tag: 2.3.9
     7Stable tag: 2.3.10
    88Donate link: http://MyWebsiteAdvisor.com/donations/
    99
     
    2020The watermark preview feature allows for easy testing of the plugin settings.
    2121The watermark size is controlled as a percentage of the target image, 50% means the watermark will be half the width of the target image.
     22Watermarks are now removable with the new backup system, any images watermarked while the new backup system is enabled are able to be restored to the original image.
    2223
    2324
     
    203204== Changelog ==
    204205
     206= 2.3.10 =
     207* more improvements to the edit-media page, condensed form to display better on the insert media sidebar
     208* fixed typos in readme
     209
    205210
    206211= 2.3.9 =
    207212* fixed issue causing error message when deleting non-watermarked image.
    208213* fixed ereg_replace depricated message
    209 * updated the edit media page to display the image size names, rahter than the image dimensions
     214* updated the edit media page to display the image size names, rather than the image dimensions
    210215
    211216
  • transparent-image-watermark-plugin/trunk/transparent-watermark-loader.php

    r709903 r710036  
    44Plugin URI: http://MyWebsiteAdvisor.com/tools/wordpress-plugins/transparent-image-watermark/
    55Description: Add transparent PNG image watermark to your uploaded images.
    6 Version: 2.3.9
     6Version: 2.3.10
    77Author: MyWebsiteAdvisor
    88Author URI: http://MyWebsiteAdvisor.com
  • transparent-image-watermark-plugin/trunk/transparent-watermark-plugin.php

    r709903 r710036  
    66
    77    //plugin version number
    8     private $version = "2.3.9";
     8    private $version = "2.3.10";
    99   
    1010    private $debug = false;
     
    7979           
    8080            add_filter('attachment_fields_to_edit', array(&$this, 'attachment_field_add_watermark'), 10, 2);
    81            
    82            
     81               
    8382        }
    8483       
     
    118117   
    119118   
    120     public function add_watermark_js(){
    121        
    122         wp_enqueue_script('transparent-watermark-script', $this->plugin_url . "watermark.js");
    123        
    124     }
    125    
    126    
    127    
    128    
    129    
    130     function delete_attachment_watermark_backups($attachment_id){
    131        
    132         $bk_meta = get_post_meta($attachment_id, '_watermark_backups', true);
    133        
    134         if(isset($bk_meta) && is_array($bk_meta)){
    135             foreach($bk_meta as $key => $info){
    136                 @unlink( $info['bk_path'] );
    137             }
    138         }
    139        
    140     }
    141 
    142 
    143 
    144 
    145     function revert_watermarks(){
    146        
    147         check_ajax_referer( 'revert-watermarks', 'security' );
    148        
    149         $attachment_id = $_POST['post_id'];
    150        
    151         $bk_meta = get_post_meta($attachment_id, '_watermark_backups', true);
    152        
    153         foreach($bk_meta as $key => $info){
    154            
    155             @unlink( $info['original_path'] );
    156             copy( $info['bk_path'] , $info['original_path'] );
    157             @unlink( $info['bk_path'] );
    158             echo "Removed Watermark: " . $info['original_path'] . "\r\n";
    159            
    160         }
    161        
    162         delete_post_meta($attachment_id, '_watermark_backups');
    163        
    164         die();
    165        
    166     }
     119
    167120   
    168121   
     
    11121065    public function attachment_field_add_watermark($form_fields, $post){
    11131066            if ($post->post_mime_type == 'image/jpeg' || $post->post_mime_type == 'image/gif' || $post->post_mime_type == 'image/png') {
    1114                        
    1115                                              
     1067                                           
    11161068                    $form_js = "<style>
    11171069                        #watermark_preview {
     
    11341086                                                         
    11351087                    </style>";   
    1136                                                            
    1137                       /**   
    1138                          
    1139                        $attachment_info =  wp_get_attachment_metadata($post->ID);   
    1140                        
    1141                        $bk_meta = get_post_meta($post->ID, '_watermark_backups', true);     
    1142                        
    1143                        $sizes = array();                           
    1144                                                  
    1145                       foreach($attachment_info['sizes'] as $size){
    1146                        
    1147                             $sizes[$size['width']] = $size;
    1148                        
    1149                        
    1150                       }
    1151                                                  
    1152                         //$sizes = array_unique($sizes);
    1153                     krsort($sizes);
    1154                  
    1155 
    1156 
    1157                     $upload_dir   = wp_upload_dir();
    1158                  
    1159                     $url_info = parse_url($post->guid);
    1160                     $url_info['path'] = str_replace("/wp-content/uploads/", "/", $url_info['path']);
    1161  
    1162                     $filepath = $upload_dir['basedir']  . $url_info['path'];
    1163 
    1164                  
    1165    
    1166                     $path_info = pathinfo($url_info['path']);
    1167                    
    1168                     $base_filename = $path_info['basename'];
    1169                     $base_path = str_replace($base_filename, "", $post->guid);
    1170                    
    1171              
    1172              
    1173                     $url_info = parse_url($post->guid);
    1174                     $url_info['path'] = ereg_replace("/wp-content/uploads/", "/", $url_info['path']);
    1175 
    1176                     $path_info = pathinfo($post->guid);
    1177                     $url_base = $path_info['dirname']."/".$path_info['filename'] . "." . $path_info['extension'];
    1178                     $filepath = ABSPATH . str_replace(get_option('siteurl'), "", $url_base);
    1179                     $filepath = str_replace("//", "/", $filepath);
    1180                   **/
    1181                  
     1088
    11821089                 
    11831090                 
     
    12261133                     
    12271134                    $checked = "";
     1135                    $disabled = "";
    12281136                       
    12291137                    if(isset($bk_meta) && is_array($bk_meta)){ 
     
    12311139                            if($bk['original_path'] == $file_path){
    12321140                                $checked = 'checked="checked" ';   
     1141                                $disabled = 'disabled="disabled" ';
    12331142                            }
    12341143                        }
    12351144                    }
    12361145                   
    1237                 $form_html = "<p><input type='checkbox' name='attachment_size[]' value='".$post->guid."' style='width:auto;' ".$checked." class='attachment_sizes'> Original";
     1146                $form_html = "<p><input type='checkbox' name='attachment_size[]' value='".$post->guid."' style='width:auto;' ".$checked." " . $disabled . "  class='attachment_sizes'> Original";
    12381147                $form_html .= " <a class='watermark_preview' href='".$post->guid."?". $time ."' title='$base_filename Preview' target='_blank'>" . $base_filename . "</a></p>";
    12391148                  $form_html .= $form_js;
     
    12531162                   
    12541163                        $checked = "";
     1164                        $disabled = "";
    12551165                           
    12561166                        if( isset($bk_meta) && is_array($bk_meta) ){   
     
    12581168                                if($bk['original_path'] == $current_filepath){
    12591169                                    $checked = 'checked="checked" ';   
     1170                                    $disabled = 'disabled="disabled" ';
    12601171                                }
    12611172                            }
    12621173                        }
    12631174                       
    1264                         $form_html = "<p><input type='checkbox' name='attachment_size[]' value='".$base_path.$size['file']."' style='width:auto;' ".$checked."  class='attachment_sizes'> ".$size['width'] . "x" . $size['height'];
     1175                        $form_html = "<p><input type='checkbox' name='attachment_size[]' value='".$base_path.$size['file']."' style='width:auto;' ".$checked." " . $disabled . "  class='attachment_sizes'> ".ucwords($name);
    12651176                        $form_html .= " <a class='watermark_preview' title='".$size['file']." Preview'  href='".$image_link."?". $time ."' target='_blank'>" . $size['file'] . "</a></p>";
    12661177                   
     
    14031314
    14041315           
     1316           
     1317           
     1318           
     1319           
     1320
     1321    // add plugin js file
     1322    public function add_watermark_js(){
     1323       
     1324        wp_enqueue_script('transparent-watermark-script', $this->plugin_url . "watermark.js");
     1325       
     1326    }
     1327   
     1328   
     1329   
     1330   
     1331    // deletes backup image files when the main image attachment is deleted
     1332    function delete_attachment_watermark_backups($attachment_id){
     1333       
     1334        $bk_meta = get_post_meta($attachment_id, '_watermark_backups', true);
     1335       
     1336        if(isset($bk_meta) && is_array($bk_meta)){
     1337            foreach($bk_meta as $key => $info){
     1338                @unlink( $info['bk_path'] );
     1339            }
     1340        }
     1341       
     1342    }
     1343
     1344
     1345
     1346    // overwrite the watermarked copy with the backup copy
     1347    function revert_watermarks(){
     1348       
     1349        check_ajax_referer( 'revert-watermarks', 'security' );
     1350       
     1351        $attachment_id = $_POST['post_id'];
     1352       
     1353        $bk_meta = get_post_meta($attachment_id, '_watermark_backups', true);
     1354       
     1355        foreach($bk_meta as $key => $info){
     1356           
     1357            @unlink( $info['original_path'] );
     1358            copy( $info['bk_path'] , $info['original_path'] );
     1359            @unlink( $info['bk_path'] );
     1360            echo "Removed Watermark: " . $info['original_path'] . "\r\n";
     1361           
     1362        }
     1363       
     1364        delete_post_meta($attachment_id, '_watermark_backups');
     1365       
     1366        die();
     1367       
     1368    }
     1369   
     1370   
     1371   
    14051372       
    14061373}
Note: See TracChangeset for help on using the changeset viewer.