File tree Expand file tree Collapse file tree 1 file changed +17
-8
lines changed Expand file tree Collapse file tree 1 file changed +17
-8
lines changed Original file line number Diff line number Diff line change @@ -215,21 +215,30 @@ public function getSource()
215
215
*/
216
216
public function getCode ()
217
217
{
218
- if ($ code = Utils::getFirstValue (Utils::getData ($ this ->providers , 'code ' ))) {
219
- if (strpos ($ code , '</iframe> ' ) !== false ) {
220
- return preg_replace ('|^.*(<iframe.*</iframe>).*$|Us ' , '$1 ' , $ code );
221
- }
218
+ $ allCodes = Utils::getData ($ this ->providers , 'code ' );
219
+
220
+ $ default = null ;
221
+
222
+ foreach ($ allCodes as $ codeInfo ) {
223
+ $ code = $ codeInfo ['value ' ];
222
224
223
- if (strpos ($ code , '</object> ' ) !== false ) {
224
- return preg_replace ('|^.*(<object.*</object>).*$|Us ' , '$1 ' , $ code );
225
+ // <object> and <embed> codes have less priority
226
+ if (strpos ($ code , '</object> ' ) !== false || strpos ($ code , '</embed> ' ) !== false ) {
227
+ if (empty ($ default )) {
228
+ $ default = $ code ;
229
+ }
230
+
231
+ continue ;
225
232
}
226
233
227
- if (strpos ($ code , '</embed > ' ) !== false ) {
228
- return preg_replace ('|^.*(<embed .*</embed >).*$|Us ' , '$1 ' , $ code );
234
+ if (strpos ($ code , '</iframe > ' ) !== false ) {
235
+ return preg_replace ('|^.*(<iframe .*</iframe >).*$|Us ' , '$1 ' , $ code );
229
236
}
230
237
231
238
return $ code ;
232
239
}
240
+
241
+ return $ default ;
233
242
}
234
243
235
244
/**
You can’t perform that action at this time.
0 commit comments