Plugin Directory

Changeset 1481341


Ignore:
Timestamp:
08/23/2016 06:58:42 AM (9 years ago)
Author:
wordgenie
Message:

Fixed error message display.
Added link to image.

Location:
files-addon-for-event-espresso-4/trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • files-addon-for-event-espresso-4/trunk/EE_FILE_Validation_Strategy.php

    r1449796 r1481341  
    11<?php
    2 class EE_FILE_Validation_Strategy extends EE_Validation_Strategy_Base{
     2class EE_FILE_Validation_Strategy extends EE_Validation_Strategy_Base
     3{
    34
    4     /**
    5      * @param null $validation_error_message
    6      */
    7     public function __construct( $validation_error_message = NULL ) {
    8         if( ! $validation_error_message ){
    9             $validation_error_message = __("Please enter a valid URL", "event_espresso");
    10         }
    11         parent::__construct( $validation_error_message );
    12     }
     5    /**
     6     * @param null $validation_error_message
     7     */
     8    public function __construct($validation_error_message = null)
     9    {
     10        if (! $validation_error_message) {
     11            $validation_error_message = __("Please enter a valid URL", "event_espresso");
     12        }
     13        parent::__construct($validation_error_message);
     14    }
    1315
    1416
    1517
    16     /**
    17      * just checks the field isn't blank
    18      *
    19      * @param $normalized_value
    20      * @return bool
    21      * @throws \EE_Validation_Error
    22      */
    23     public function validate($normalized_value) {
    24         $filetype = wp_check_filetype($normalized_value);
    25         $data = parse_url($normalized_value);
    26         $host = $data['host'];
    27         $server = $_SERVER['SERVER_NAME'];
    28         $allowed =  array('gif','png' ,'jpg','jpeg','bmp');
    29         $extn =  $filetype['ext']; 
    30          if (!in_array($extn, $allowed) || $server != $host) {
    31             throw new EE_Validation_Error( $this->get_validation_error_message(), 'regex' );
    32         }
    33         parent::validate($normalized_value);
    34     }
     18    /**
     19     * just checks the field isn't blank
     20     *
     21     * @param $normalized_value
     22     * @return bool
     23     * @throws \EE_Validation_Error
     24     */
     25    public function validate($normalized_value)
     26    {
     27       
     28            $filetype = wp_check_filetype($normalized_value);
     29            $data = parse_url($normalized_value);
     30            $host = $data['host'];
     31            $server = $_SERVER['SERVER_NAME'];
     32            $allowed =  array('gif','png' ,'jpg','jpeg','bmp');
     33            $extn =  $filetype['ext'];
     34            if (!in_array($extn, $allowed) || $server != $host) {
     35                throw new EE_Validation_Error($this->get_validation_error_message(), 'regex');
     36            }
     37       
     38        parent::validate($normalized_value);
     39    }
    3540}
  • files-addon-for-event-espresso-4/trunk/EE_File_Display_Strategy.php

    r1450455 r1481341  
    4747        $input .= ' id="' . $this->_input->html_id() . '"';
    4848        $class = $this->_input->required() ? $this->_input->required_css_class() . ' ' . $this->_input->html_class() : $this->_input->html_class();
     49
    4950        $input .= ' class="file_value ' . $class . '"';
    5051        $input .= ' style="' . $this->_input->html_style() . '"';
    5152        $input .= $this->_input->html_other_attributes();
    5253        $input .= '/>';
    53         if ($value != '' ) {
    54             $input .= "<br><img src='$value' style='padding:3px;border:1px solid #ccc;height:100px;width:100px'>";
     54        if ($value != '') {
     55            $input .= "<br><a href='$value' target='_blank'><img src='$value' style='padding:3px;border:1px solid #ccc;height:100px;width:100px'></a>";
    5556        }
    5657        return $input;
  • files-addon-for-event-espresso-4/trunk/css/ssa_style.css

    r1448510 r1481341  
    1717
    1818}
     19#-error
     20{
     21    display:none !important;
     22}
  • files-addon-for-event-espresso-4/trunk/eea-file.php

    r1449260 r1481341  
    55 * Author: WordGenie
    66 * License:GPL2
    7  * Version: 1.0.1
     7 * Version: 1.0.2
    88 * TextDomain:  wordfile
    99 */
  • files-addon-for-event-espresso-4/trunk/js/ssa_file_upload.js

    r1448510 r1481341  
    3636                    element.siblings('.ssa-loading').css('display','none');
    3737                    element.siblings('.ssa-remove').css('display','inline-block');
     38                    element.closest('div').find('.ee-required-text').hide();
     39                    element.removeClass('ee-needs-value');
     40                    element.addClass('ee-has-value');
    3841                }
    3942                else
  • files-addon-for-event-espresso-4/trunk/readme.txt

    r1449796 r1481341  
    55Tested up to: 4.5
    66Requires Event espresso version: 4.8.0
    7 Stable tag: 1.0.1
     7Stable tag: 1.0.2
    88License: GPL2
    99
     
    6666Fixed file upload security issue. Added EE_FILE_Validation_Strategy class for validating uploaded file.
    6767
     68= 1.0.2 =
     69
     701. Fixed error message display.
     712. Added link to image.
    6872
    6973
     74
Note: See TracChangeset for help on using the changeset viewer.