OK.
So I've got two add-ons that both use the Facebook API.
My Friend Inviter and a yet to be released Social Status Updater which allows members to link their Facebook and Twitter accounts to their forum accounts so that when they update their status on XenForo it is automatically updated on Facebook, Twitter or both.
Independently both add-ons work great. When both installed, I get this when going to the Friend Inviter page:
Fatal error: Cannot redeclare class Facebook in C:\wamp\www\xenforo\library\SocialStatusUpdater\facebook\src\facebook.php on line 93
This is my PHP code for Friend Inviter:
and my PHP for Social Status Updater:
I was under the impression that the try / catch would prevent the fatal error from occurring, but it doesn't.
Have I missed something?
I know that if both add-ons require the same paths (e.g. both load facebook.php from the FriendInviter folder) then the exception is caught and both add-ons remain functioning.
Therefore, unless there's another solution I will have to start maybe using some sort of shared framework for my add-ons and packaging them under library/deeming/<addon> and that will enable me to have shared resources between certain releases.
So I've got two add-ons that both use the Facebook API.
My Friend Inviter and a yet to be released Social Status Updater which allows members to link their Facebook and Twitter accounts to their forum accounts so that when they update their status on XenForo it is automatically updated on Facebook, Twitter or both.
Independently both add-ons work great. When both installed, I get this when going to the Friend Inviter page:
Fatal error: Cannot redeclare class Facebook in C:\wamp\www\xenforo\library\SocialStatusUpdater\facebook\src\facebook.php on line 93
This is my PHP code for Friend Inviter:
PHP:
try
{
require_once "library/FriendInviter/facebook/src/facebook.php";
}
catch(Exception $e)
{
error_log($e);
}
and my PHP for Social Status Updater:
PHP:
try
{
require_once "library/SocialStatusUpdater/facebook/src/facebook.php";
}
catch(Exception $e)
{
error_log($e);
}
I was under the impression that the try / catch would prevent the fatal error from occurring, but it doesn't.
Have I missed something?
I know that if both add-ons require the same paths (e.g. both load facebook.php from the FriendInviter folder) then the exception is caught and both add-ons remain functioning.
Therefore, unless there's another solution I will have to start maybe using some sort of shared framework for my add-ons and packaging them under library/deeming/<addon> and that will enable me to have shared resources between certain releases.