The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Help with plugin array and option settings
Firstly sorry if the title is misleading, i am trying to create a plugin that should check for each instance in an array, the array should look like array('FOO', 'BAR', 'FOOBAR');, however i am trying to read a multi line textarea in to the array like this: array($vbulletin->options['bs_sel_list']); but it only works if there is only one item in the textarea, if i put two or more, each on its own line or on the same line it doesn't work, i then tried this array(explode("\r\n", $vbulletin->options['bs_sel_list'])); but it doesn't make any difference!
How can i read the $vbulletin->options['bs_sel_list'] in to the array to get it to look like array('FOO', 'BAR', 'FOOBAR'); Any help or advice is appreciated! |
#2
|
|||
|
|||
Have you tried just explode("\n", $vbulletin->options['bs_sel_list']) ? (explode returns an array so you don't need array())
|
#3
|
||||
|
||||
Thanks, there was a little change with that, my list in bs_sel_list looks like this example
(foo)123 (bar + 1ht) there foobar(foo) + there With your suggestion it only finds foobar(foo) + there the last one in the array Any further suggestions? Thanks for your help by the way --------------- Added [DATE]1307408504[/DATE] at [TIME]1307408504[/TIME] --------------- Actually i think your suggestion does work!, i think i had my for each check the wrong way round...a couple more tests and i'll confirm it --------------- Added [DATE]1307410678[/DATE] at [TIME]1307410678[/TIME] --------------- Yep it works!, thanks for the suggestion too |
#4
|
||||
|
||||
I wonder if ti varies by server? Because all my mods that use multi-line text boxes I separate each line into array using this exact code:
PHP Code:
|
#5
|
||||
|
||||
BoP5, that is correct and thats what KH99 was getting at, if you check my example i state its as Array(explode.... which was my downfall, removing Array( allowed it to work, the other issue was my fault because im still green at this
|
#6
|
||||
|
||||
Sorry I thought the difference was "\n" as opposed to "\r\n" - I was just saying i know \r\n works. Never tried just \n. I hadn't even noticed the array() call.
|
#7
|
|||
|
|||
Joe's right. I was suggesting just "\n" but it looks like there is "\r\n" between each line, so if you only use a "\n" it works but you end up with a "\r" at the end of each string. I guess if you later trim() the strings either would work, but Joe's way is correct.
In any case, I'm glad you got it working. |
#8
|
||||
|
||||
While i have your attention guys, any idea why this doesn't seem to work, im using the hook global_complete
Quote:
Quote:
|
#9
|
|||
|
|||
Hmm...well, the only thing I can think of is, were you always using the "\r\n" in the explode? If you were using "\n" it could be that the extra "\r" that I mentioned above was messing things up for you.
|
#10
|
||||
|
||||
, always used the \r\n but either way it doesn't seem to work in the plugin, i have tried changing the execution order but no go, and im pretty sure the syntax is right?
--------------- Added [DATE]1307505034[/DATE] at [TIME]1307505034[/TIME] --------------- infact if i have the execution order earlier than another plugin using the same hook that checks user agents the plugin doesn't work, so it kind of looks like its stopping the user agent from getting through any further but it's not redirecting???? --------------- Added [DATE]1307505279[/DATE] at [TIME]1307505279[/TIME] --------------- I have also substituted strtolower($_SERVER['HTTP_USER_AGENT']); for strtoupper($_SERVER['HTTP_USER_AGENT']); but no change |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|