add defined test on some constants to avoid PHP Notice error when using c...

I experienced some "PHP Notice constant xxx already defined in..."
I added defined() test on these constants.