Plugin Directory

Changeset 659945


Ignore:
Timestamp:
01/28/2013 12:20:03 AM (13 years ago)
Author:
sverde1
Message:

Added file type checking

Location:
watermark-reloaded/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • watermark-reloaded/trunk/readme.txt

    r581977 r659945  
    44Tags: watermark, images, pictures, text watermark, image watermark, watermark reloaded, upload, Post, admin
    55Requires at least: 3.0
    6 Tested up to: 3.4.1
    7 Stable tag: 1.3.1
     6Tested up to: 3.5.1
     7Stable tag: 1.3.2
    88
    99Add watermark to your uploaded images and customize your watermark appearance on a user friendly settings page.
     
    123123* Plugin options page credentials update
    124124* Added dashboard with current watermark settings and preview display
     125
     126= 1.3.2 =
     127* Added file type check, because we need to process only image files
  • watermark-reloaded/trunk/watermark-loader.php

    r571715 r659945  
    44Plugin URI: http://eappz.eu/en/products/watermark-reloaded/
    55Description: Add watermark to your uploaded images and customize your watermark appearance in user friendly settings page.
    6 Version: 1.3.1
     6Version: 1.3.2
    77Author: Sandi Verdev
    88Author URI: http://eAppz.eu/
  • watermark-reloaded/trunk/watermark-reloaded.php

    r571715 r659945  
    1515     */
    1616    protected $_options             = array(
     17        'watermark_installed'    => 0,
    1718        'watermark_donated'      => 0,
    1819        'watermark_hide_nag'     => 0,
     
    157158     */
    158159    public function applyWatermark($data) {
    159         // get settings for watermarking
    160         $upload_dir   = wp_upload_dir();
    161         $watermark_on = $this->get_option('watermark_on');
    162 
    163         // loop through image sizes ...
    164         foreach($watermark_on as $image_size => $on) {
    165             if($on == true) {
    166                 switch($image_size) {
    167                     case 'fullsize':
    168                         $filepath = $upload_dir['basedir'] . DIRECTORY_SEPARATOR . $data['file'];
    169                         break;
    170                     default:
    171                         if(!empty($data['sizes']) && array_key_exists($image_size, $data['sizes'])) {
    172                             $filepath = $upload_dir['basedir'] . DIRECTORY_SEPARATOR . dirname($data['file']) . DIRECTORY_SEPARATOR . $data['sizes'][$image_size]['file'];
    173                         } else {
    174                             // early getaway
    175                             continue 2;
    176                         }
     160        // check if input data is provided, thus it is image and needs to be watermarked
     161        if(!empty($data)) {
     162            // get settings for watermarking
     163            $upload_dir   = wp_upload_dir();
     164            $watermark_on = $this->get_option('watermark_on');
     165
     166            // loop through image sizes ...
     167            foreach($watermark_on as $image_size => $on) {
     168                if($on == true) {
     169                    switch($image_size) {
     170                        case 'fullsize':
     171                            $filepath = $upload_dir['basedir'] . DIRECTORY_SEPARATOR . $data['file'];
     172                            break;
     173                        default:
     174                            if(!empty($data['sizes']) && array_key_exists($image_size, $data['sizes'])) {
     175                                $filepath = $upload_dir['basedir'] . DIRECTORY_SEPARATOR . dirname($data['file']) . DIRECTORY_SEPARATOR . $data['sizes'][$image_size]['file'];
     176                            } else {
     177                                // early getaway
     178                                continue 2;
     179                            }
     180                    }
     181
     182                    // ... and apply watermark
     183                    $this->doWatermark($filepath);
    177184                }
    178 
    179                 // ... and apply watermark
    180                 $this->doWatermark($filepath);
    181185            }
    182186        }
     
    435439    public function __construct() {
    436440        $this->_plugin_dir   = DIRECTORY_SEPARATOR . str_replace(basename(__FILE__), null, plugin_basename(__FILE__));
    437         $this->_settings_url = 'options-general.php?page=' . plugin_basename(__FILE__);;
     441        $this->_settings_url = 'options-general.php?page=' . plugin_basename(__FILE__);
    438442
    439443        $allowed_options = array(
Note: See TracChangeset for help on using the changeset viewer.