Use for loop to iterate over array, check existance

A couple things here were causing the editor to `TypeError` in Safari and IE when trying to use any of the popup initializer buttons.

  1. Iterating over an `Array` like it was a plain `Object` was causing unexpected results (fixed with a standard `for` loop).
  2. `elements` being passed to `attachFileBrowser` as `undefined` (fixed with a simple check and return);

I didn't dig very deep into this and definitely don't know the ins and outs of ckeditor, but this has fixed Safari and IE for us.