This my first code smell, a basic one. A friend asks me to have a look and integrate a 3rd-party service on his PHP website. He initially hired a freelance developer through a freelance platform to build his website but we all know the costs of maintenance. I found some good things like well design SQL queries but the website architecture was very bad. This code block was funny though 😄
1if (strpos($key, "contact-form-") === false) {2}3else {4 ...5}
For readability I think you should switch the if condition..
1if (strpos($key, "contact-form-") !== false) {2 ...3}