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()
215215 */
216216 public function getCode ()
217217 {
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 ' ];
222224
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 ;
225232 }
226233
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 );
229236 }
230237
231238 return $ code ;
232239 }
240+
241+ return $ default ;
233242 }
234243
235244 /**
You can’t perform that action at this time.
0 commit comments