Completed
Branch FET/attendee-importer (99aa68)
by
unknown
28:33 queued 19:52
created
core/libraries/form_sections/inputs/EE_File_Input.input.php 2 patches
Indentation   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -19,97 +19,97 @@
 block discarded – undo
19 19
  */
20 20
 class EE_File_Input extends EE_Form_Input_Base
21 21
 {
22
-    /**
23
-     * @var array
24
-     */
25
-    protected $allowed_file_extensions;
22
+	/**
23
+	 * @var array
24
+	 */
25
+	protected $allowed_file_extensions;
26 26
 
27
-    /**
28
-     * @var array
29
-     */
30
-    protected $allowed_mime_types;
27
+	/**
28
+	 * @var array
29
+	 */
30
+	protected $allowed_mime_types;
31 31
 
32
-    /**
33
-     * @param array $options
34
-     * @throws InvalidArgumentException
35
-     */
36
-    public function __construct($options = array())
37
-    {
38
-        if (isset($options['allowed_file_extensions'])) {
39
-            if (!is_array($options['allowed_file_extensions'])) {
40
-                throw new InvalidArgumentException(esc_html__('A valid allowed_file_extensions array was not provided to EE_File_Input', 'event_espresso'));
41
-            }
42
-            $this->allowed_file_extensions = $options['allowed_file_extensions'];
43
-        } else {
44
-            $this->allowed_file_extensions = ['csv'];
45
-        }
46
-        if (isset($options['allowed_mime_types'])) {
47
-            if (!is_array($options['allowed_mime_types'])) {
48
-                throw new InvalidArgumentException(esc_html__('A valid allowed_mime_types array was not provided to EE_File_Input', 'event_espresso'));
49
-            }
50
-            $this->allowed_mime_types = $options['allowed_file_extensions'];
51
-        } else {
52
-            $this->allowed_mime_types = ['text/csv'];
53
-        }
32
+	/**
33
+	 * @param array $options
34
+	 * @throws InvalidArgumentException
35
+	 */
36
+	public function __construct($options = array())
37
+	{
38
+		if (isset($options['allowed_file_extensions'])) {
39
+			if (!is_array($options['allowed_file_extensions'])) {
40
+				throw new InvalidArgumentException(esc_html__('A valid allowed_file_extensions array was not provided to EE_File_Input', 'event_espresso'));
41
+			}
42
+			$this->allowed_file_extensions = $options['allowed_file_extensions'];
43
+		} else {
44
+			$this->allowed_file_extensions = ['csv'];
45
+		}
46
+		if (isset($options['allowed_mime_types'])) {
47
+			if (!is_array($options['allowed_mime_types'])) {
48
+				throw new InvalidArgumentException(esc_html__('A valid allowed_mime_types array was not provided to EE_File_Input', 'event_espresso'));
49
+			}
50
+			$this->allowed_mime_types = $options['allowed_file_extensions'];
51
+		} else {
52
+			$this->allowed_mime_types = ['text/csv'];
53
+		}
54 54
 
55
-        $this->_set_display_strategy(new EE_File_Input_Display_Strategy());
56
-        $this->_set_normalization_strategy(new EE_File_Normalization());
57
-        $this->add_validation_strategy(
58
-            new EE_Text_Validation_Strategy(
59
-                sprintf(
60
-                    // translators: %1$s is a list of allowed file extensions.
61
-                    esc_html__('Please provide a file of the requested filetype: %1$s', 'event_espresso'),
62
-                    implode(', ', $this->allowed_file_extensions)
63
-                ),
64
-                '~.*\.(' . implode('|', $this->allowed_file_extensions) . ')$~'
65
-            )
66
-        );
67
-        parent::__construct($options);
55
+		$this->_set_display_strategy(new EE_File_Input_Display_Strategy());
56
+		$this->_set_normalization_strategy(new EE_File_Normalization());
57
+		$this->add_validation_strategy(
58
+			new EE_Text_Validation_Strategy(
59
+				sprintf(
60
+					// translators: %1$s is a list of allowed file extensions.
61
+					esc_html__('Please provide a file of the requested filetype: %1$s', 'event_espresso'),
62
+					implode(', ', $this->allowed_file_extensions)
63
+				),
64
+				'~.*\.(' . implode('|', $this->allowed_file_extensions) . ')$~'
65
+			)
66
+		);
67
+		parent::__construct($options);
68 68
 
69 69
 //        It would be great to add this HTML attribute, but jQuery validate chokes on it.
70
-        $this->set_other_html_attributes(
71
-            $this->other_html_attributes()
72
-            . ' extension="'
73
-            . implode(
74
-                ',',
75
-                array_map(
76
-                    function ($file_extension) {
77
-                        return  $file_extension;
78
-                    },
79
-                    $this->allowed_file_extensions
80
-                )
81
-            )
82
-            . '"'
83
-        );
84
-    }
70
+		$this->set_other_html_attributes(
71
+			$this->other_html_attributes()
72
+			. ' extension="'
73
+			. implode(
74
+				',',
75
+				array_map(
76
+					function ($file_extension) {
77
+						return  $file_extension;
78
+					},
79
+					$this->allowed_file_extensions
80
+				)
81
+			)
82
+			. '"'
83
+		);
84
+	}
85 85
 
86
-    /**
87
-     * $_FILES has a really weird structure. So we let `FilesDataHandler` take care of finding the file info for
88
-     * this input.
89
-     * @since $VID:$
90
-     * @param array $req_data
91
-     * @return FileSubmissionInterface
92
-     * @throws InvalidArgumentException
93
-     * @throws InvalidDataTypeException
94
-     * @throws InvalidInterfaceException
95
-     */
96
-    public function find_form_data_for_this_section($req_data)
97
-    {
98
-        // ignore $req_data. Files are in the files data handler.
99
-        $fileDataHandler = LoaderFactory::getLoader()->getShared(
100
-            'EventEspresso\core\services\request\files\FilesDataHandler'
101
-        );
102
-        return $fileDataHandler->getFileObject($this->html_name());
103
-    }
86
+	/**
87
+	 * $_FILES has a really weird structure. So we let `FilesDataHandler` take care of finding the file info for
88
+	 * this input.
89
+	 * @since $VID:$
90
+	 * @param array $req_data
91
+	 * @return FileSubmissionInterface
92
+	 * @throws InvalidArgumentException
93
+	 * @throws InvalidDataTypeException
94
+	 * @throws InvalidInterfaceException
95
+	 */
96
+	public function find_form_data_for_this_section($req_data)
97
+	{
98
+		// ignore $req_data. Files are in the files data handler.
99
+		$fileDataHandler = LoaderFactory::getLoader()->getShared(
100
+			'EventEspresso\core\services\request\files\FilesDataHandler'
101
+		);
102
+		return $fileDataHandler->getFileObject($this->html_name());
103
+	}
104 104
 
105
-    /**
106
-     * Don't transform the file submission object into a string, thanks.
107
-     *
108
-     * @param string $value
109
-     * @return null|string
110
-     */
111
-    protected function _sanitize($value)
112
-    {
113
-        return $value;
114
-    }
105
+	/**
106
+	 * Don't transform the file submission object into a string, thanks.
107
+	 *
108
+	 * @param string $value
109
+	 * @return null|string
110
+	 */
111
+	protected function _sanitize($value)
112
+	{
113
+		return $value;
114
+	}
115 115
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     public function __construct($options = array())
37 37
     {
38 38
         if (isset($options['allowed_file_extensions'])) {
39
-            if (!is_array($options['allowed_file_extensions'])) {
39
+            if ( ! is_array($options['allowed_file_extensions'])) {
40 40
                 throw new InvalidArgumentException(esc_html__('A valid allowed_file_extensions array was not provided to EE_File_Input', 'event_espresso'));
41 41
             }
42 42
             $this->allowed_file_extensions = $options['allowed_file_extensions'];
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
             $this->allowed_file_extensions = ['csv'];
45 45
         }
46 46
         if (isset($options['allowed_mime_types'])) {
47
-            if (!is_array($options['allowed_mime_types'])) {
47
+            if ( ! is_array($options['allowed_mime_types'])) {
48 48
                 throw new InvalidArgumentException(esc_html__('A valid allowed_mime_types array was not provided to EE_File_Input', 'event_espresso'));
49 49
             }
50 50
             $this->allowed_mime_types = $options['allowed_file_extensions'];
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
                     esc_html__('Please provide a file of the requested filetype: %1$s', 'event_espresso'),
62 62
                     implode(', ', $this->allowed_file_extensions)
63 63
                 ),
64
-                '~.*\.(' . implode('|', $this->allowed_file_extensions) . ')$~'
64
+                '~.*\.('.implode('|', $this->allowed_file_extensions).')$~'
65 65
             )
66 66
         );
67 67
         parent::__construct($options);
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
             . implode(
74 74
                 ',',
75 75
                 array_map(
76
-                    function ($file_extension) {
76
+                    function($file_extension) {
77 77
                         return  $file_extension;
78 78
                     },
79 79
                     $this->allowed_file_extensions
Please login to merge, or discard this patch.