fix php5 notices, strict warnings and code formatting
Merge pull request #312 from dlobo/NoticeFixes

fix php5 notices, strict warnings and code formatting