Changeset 1481341
- Timestamp:
- 08/23/2016 06:58:42 AM (9 years ago)
- Location:
- files-addon-for-event-espresso-4/trunk
- Files:
-
- 6 edited
-
EE_FILE_Validation_Strategy.php (modified) (1 diff)
-
EE_File_Display_Strategy.php (modified) (1 diff)
-
css/ssa_style.css (modified) (1 diff)
-
eea-file.php (modified) (1 diff)
-
js/ssa_file_upload.js (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
files-addon-for-event-espresso-4/trunk/EE_FILE_Validation_Strategy.php
r1449796 r1481341 1 1 <?php 2 class EE_FILE_Validation_Strategy extends EE_Validation_Strategy_Base{ 2 class EE_FILE_Validation_Strategy extends EE_Validation_Strategy_Base 3 { 3 4 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 } 13 15 14 16 15 17 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 } 35 40 } -
files-addon-for-event-espresso-4/trunk/EE_File_Display_Strategy.php
r1450455 r1481341 47 47 $input .= ' id="' . $this->_input->html_id() . '"'; 48 48 $class = $this->_input->required() ? $this->_input->required_css_class() . ' ' . $this->_input->html_class() : $this->_input->html_class(); 49 49 50 $input .= ' class="file_value ' . $class . '"'; 50 51 $input .= ' style="' . $this->_input->html_style() . '"'; 51 52 $input .= $this->_input->html_other_attributes(); 52 53 $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>"; 55 56 } 56 57 return $input; -
files-addon-for-event-espresso-4/trunk/css/ssa_style.css
r1448510 r1481341 17 17 18 18 } 19 #-error 20 { 21 display:none !important; 22 } -
files-addon-for-event-espresso-4/trunk/eea-file.php
r1449260 r1481341 5 5 * Author: WordGenie 6 6 * License:GPL2 7 * Version: 1.0. 17 * Version: 1.0.2 8 8 * TextDomain: wordfile 9 9 */ -
files-addon-for-event-espresso-4/trunk/js/ssa_file_upload.js
r1448510 r1481341 36 36 element.siblings('.ssa-loading').css('display','none'); 37 37 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'); 38 41 } 39 42 else -
files-addon-for-event-espresso-4/trunk/readme.txt
r1449796 r1481341 5 5 Tested up to: 4.5 6 6 Requires Event espresso version: 4.8.0 7 Stable tag: 1.0. 17 Stable tag: 1.0.2 8 8 License: GPL2 9 9 … … 66 66 Fixed file upload security issue. Added EE_FILE_Validation_Strategy class for validating uploaded file. 67 67 68 = 1.0.2 = 69 70 1. Fixed error message display. 71 2. Added link to image. 68 72 69 73 74
Note: See TracChangeset
for help on using the changeset viewer.