Monkuar Posted January 4, 2011 Share Posted January 4, 2011 No ending delimiter '$' found in post_parser.php on line 608 608: $txt = preg_replace( "\$this->unconvert_mp3('\\1', '(\])')", "#\[mp3\](.+?)\[/mp3\]#se", $txt ); function unconvert_mp3: function unconvert_mp3($txt, $lol) { global $ibforums, $std, $DB; return '<embed type=\"application/x-shockwave-flash\" src=\"mp3.swf\" flashvars=\"m='.$txt.'" width=\"200\" height=\"12\" />'; } Pretty much I'm trying to replace <embed type=\"application/x-shockwave-flash\" src=\"mp3.swf\" flashvars=\"m='.$txt.'" width=\"200\" height=\"12\" /> with [mp3] XX [/mp3] bbcode, Thanks for your response Quote Link to comment Share on other sites More sharing options...
AbraCadaver Posted January 4, 2011 Share Posted January 4, 2011 Look at the manual for preg_replace(). Pay attention to the argument order. Quote Link to comment Share on other sites More sharing options...
Monkuar Posted January 4, 2011 Author Share Posted January 4, 2011 Look at the manual for preg_replace(). Pay attention to the argument order. Pattern replacement, subject, limit, count, it's perfectly fine, my pattern is the problem here? This code works fine $txt = preg_replace( '#(<div align=")(.+?)(">)(.+?)(</div>)#is', "\[ALIGN=\\2\]\\4\[/ALIGN\]", $txt ); But im still stumped, >_> And that code is to replace alignment html xD Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted January 4, 2011 Share Posted January 4, 2011 that one works because there are matching delimiters, # and # in '#(<div align=")(.+?)(">)(.+?)(</div>)#is' Quote Link to comment Share on other sites More sharing options...
Monkuar Posted January 4, 2011 Author Share Posted January 4, 2011 So i need to add the correct delimiters on this code: return '<embed type=\"application/x-shockwave-flash\" src=\"mp3.swf\" flashvars=\"m='.$txt.'" width=\"200\" height=\"12\" />'; But that's why I made this topic , im stuck, lol Quote Link to comment Share on other sites More sharing options...
Monkuar Posted January 4, 2011 Author Share Posted January 4, 2011 I tried: $txt = preg_replace( "#<embed type=\"application/x-shockwave-flash\" src=\"mp3.swf\" flashvars=\"m=\'(.+?)'\" width=\"200\" height=\"12\" />#es" ,"\[mp3\]\\1\[/mp3\]" , $txt ); And it doesnt give errors but it's not working and converting it... wtf? Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted January 4, 2011 Share Posted January 4, 2011 $text = 'somefile.mp3'; $string = '<embed type="application/x-shockwave-flash" src="mp3.swf" flashvars="m='.$text.'" width="200" height="12" />'; $pattern = '/<embed type="application\/x-shockwave-flash" src="mp3.swf" flashvars="m=(.*)" width="200" height="12" \/>/'; $txt = preg_replace($pattern, '[mp3]$1[/mp3]', $string); echo "txt: $txt"; HOWEVER, function unconvert_mp3 as posted above should return an improperly formatted tag that looks like this: <embed type=\"application/x-shockwave-flash\" src=\"mp3.swf\" flashvars=\"m=somefile.mp3" width=\"200\" height=\"12\" /> that function should be fixed to return a proper <embed> tag. Quote Link to comment Share on other sites More sharing options...
Monkuar Posted January 4, 2011 Author Share Posted January 4, 2011 $text = 'somefile.mp3'; my $text is coming from a input data , that full function is: function unconvert($txt="", $code=1, $html=0) { $text = 'somefile.mp3'; $string = '<embed type="application/x-shockwave-flash" src="mp3.swf" flashvars="m='.$text.'" width="200" height="12" />'; $pattern = '/<embed type="application\/x-shockwave-flash" src="mp3.swf" flashvars="m=(.*)" width="200" height="12" \/>/'; $txt = preg_replace($pattern, '[mp3]$1[/mp3]', $string); $txt = preg_replace( "#(<font style='width=80%; filter:xray'>)(.+?)(</font>)#is", "\[xray\]\\2\[/xray\]", $txt ); $txt = preg_replace( "#(<font style='width=80%; filter:glow\(color=)(.+?)(\)'>)(.+?)(</font>)#is", "\[glow=\\2\]\\4\[/glow\]", $txt ); $txt = preg_replace( "#(<font style='width=80%; filter:shadow\(color=)(.+?)(\)'>)(.+?)(</font>)#is", "\[shadow=\\2\]\\4\[/shadow\]", $txt ); $txt = preg_replace( "#(<font style='width=80%; filter:flipV'>)(.+?)(</font>)#is", "\[flipv\]\\2\[/flipv\]", $txt ); $txt = preg_replace( "#(<font style='width=80%; filter:flipH'>)(.+?)(</font>)#is", "\[fliph\]\\2\[/fliph\]", $txt ); $txt = preg_replace( '#(<div align=")(.+?)(">)(.+?)(</div>)#is', "\[ALIGN=\\2\]\\4\[/ALIGN\]", $txt ); $txt = preg_replace( "#(<font style='width=80%; filter:blur'>)(.+?)(</font>)#is", "\[blur\]\\2\[\/blur]", $txt ); $txt = preg_replace( "#(<font style='width=80%; filter:dropshadow\(color=)(.+?)(\)'>)(.+?)(</font>)#is", "\[dropshadow=\\2\]\\4\[\/dropshadow\]", $txt ); $txt = preg_replace( "#(<\!--txtStart-->)(.+?)(<\!--txtEnd-->)#is", "\[spoiler\]\\2\[/spoiler\]", $txt ); $txt = preg_replace( "#(<\!-- spoilerKillit -->)(.+?)(<\!-- spoilerKillitEnd -->)#is", "", $txt ); $txt = preg_replace( "#(<strike>)(.+?)(</strike>)#is", "\[s\]$2\[/s\]", $txt ); $txt = preg_replace( "#(<sup>)(.+?)(</sup>)#is", "\[sup\]$2\[/sup\]", $txt ); $txt = preg_replace( "#(<sub>)(.+?)(</sub>)#is", "\[sub\]$2\[/sub\]", $txt ); } I tried to change $txt = preg_replace($pattern, '[mp3]$1[/mp3]', $string); To: $txt = preg_replace($pattern, '[mp3]$1[/mp3]', $text); But then it just shows somfile.mp3 in my textarea instead of [mp3]my song i put to submit[/mp3] Any more info BLueSky, thanks Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted January 4, 2011 Share Posted January 4, 2011 then just replace $1 with whatever should be there $txt = preg_replace($pattern, '[mp3]my song i put to submit[/mp3]', $string); never mind. Quote Link to comment Share on other sites More sharing options...
Monkuar Posted January 4, 2011 Author Share Posted January 4, 2011 then just replace $1 with whatever should be there $txt = preg_replace($pattern, '[mp3]my song i put to submit[/mp3]', $string); but then that completely makes preg_replace() pointless as you're replacing one entire string with another unrelated string. Wont work man, cause it's a Edit Signature system, i have thousands of people everyone will enter submit a different url of a song, it can't be the samed it has to be some type of thing to read what m= was so it works for every single user. example: $txt = preg_replace( "#<img src=[\"'](\S+?)['\"].+?".">#" , "\[img\]\\1\[/img\]" , $txt ); See the (\S+?) that will be bring back whatever use has pulled from the img src=" XXX " tags, i need the same for m= " ", so I tried this: $txt = preg_replace($pattern, '[mp3](.+?)[/mp3]', $string); But doesn't work it brings back: Instead of [mp3]http://pds18.egloos.com/pds/201010/24/20/Dragon_Rider.mp3[/mp3] Like I submitted... ^^^^ This is what im trying to accomplish, this sht is so confusing for me, sorry if i can't explain well Quote Link to comment Share on other sites More sharing options...
Monkuar Posted January 4, 2011 Author Share Posted January 4, 2011 Sweet I guess all I did was change it to $pattern = '/<embed type="application\/x-shockwave-flash" src="mp3.swf" flashvars="m=(.*)" width="200" height="12" \/>/'; $txt = preg_replace($pattern, '[mp3]$1[/mp3]', $txt); Now it works, Thanks guys Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.