[eluser]theprodigy[/eluser]
Personally, I agree with both the MY_Controller and library ways of thinking, but I would probably end up putting it in MY_Controller myself.
I tend to use $this->data rather than just $data, and I would have the function set $this->data, rather than return a value.
I would also be more inclined to using a switch case, rather than a series of if statements. Right now, your function is checking each and every if statement, even if the first one catches. There's no need for that since all the if's are checking for ==. It will only ever catch on one of them at most (but it is still checking all of them). Either use a switch case or convert some of your if's to elseif's.