File tree Expand file tree Collapse file tree 3 files changed +6
-63
lines changed
source/Jocic/Encoders/Base Expand file tree Collapse file tree 3 files changed +6
-63
lines changed Original file line number Diff line number Diff line change @@ -245,28 +245,9 @@ public function isEncodingValid($encoding)
245245 return true ;
246246 }
247247
248- // Step 2 - Check General Form
248+ // Step 2 - Check Encoding
249249
250- if (!preg_match ("/^([A-z0-9]+)?$/ " , $ encoding ))
251- {
252- return false ;
253- }
254-
255- // Step 3 - Generate Character Array
256-
257- $ characters = str_split ($ encoding );
258-
259- // Step 4 - Check Characters
260-
261- foreach ($ characters as $ character )
262- {
263- if (!in_array ($ character , $ baseTable ))
264- {
265- return false ;
266- }
267- }
268-
269- return true ;
250+ return preg_match ("/^([A-F0-7]+)([=]+)?$/ " , $ encoding ) == 1 ;
270251 }
271252
272253 /********************\
Original file line number Diff line number Diff line change @@ -265,28 +265,9 @@ public function isEncodingValid($encoding)
265265 return true ;
266266 }
267267
268- // Step 2 - Check General Form
268+ // Step 2 - Check Encoding
269269
270- if (!preg_match ("/^([A-z0-9]+)([=]+)?$/ " , $ encoding ))
271- {
272- return false ;
273- }
274-
275- // Step 3 - Trim Padding & Generate Array
276-
277- $ characters = str_split (rtrim ($ encoding , $ basePadding ));
278-
279- // Step 4 - Check Characters
280-
281- foreach ($ characters as $ character )
282- {
283- if (!in_array ($ character , $ baseTable ))
284- {
285- return false ;
286- }
287- }
288-
289- return true ;
270+ return preg_match ("/^([A-Z2-7]+)([=]+)?$/ " , $ encoding ) == 1 ;
290271 }
291272
292273 /********************\
Original file line number Diff line number Diff line change @@ -269,28 +269,9 @@ public function isEncodingValid($encoding)
269269 return true ;
270270 }
271271
272- // Step 2 - Check General Form
272+ // Step 2 - Check Encoding
273273
274- if (!preg_match ("/^([A-z0-9]+)([=]+)?$/ " , $ encoding ))
275- {
276- return false ;
277- }
278-
279- // Step 3 - Trim Padding & Generate Array
280-
281- $ characters = str_split (rtrim ($ encoding , $ basePadding ));
282-
283- // Step 4 - Check Characters
284-
285- foreach ($ characters as $ character )
286- {
287- if (!in_array ($ character , $ baseTable ))
288- {
289- return false ;
290- }
291- }
292-
293- return true ;
274+ return preg_match ("/^([A-z0-9+\/]+)([=]+)?$/ " , $ encoding ) == 1 ;
294275 }
295276
296277 /********************\
You can’t perform that action at this time.
0 commit comments