Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Forum: Hacks
    In reply to: code file inclusion question.
    Thread Starter idono

    (@idono)

    Thx for the input. I solved it in another way. I ended up changing some lines in facebooks autoloader.php file instead. I was on the right track from before i asked the question. Just got a bit blinded by frustration and forgot to change all the parts.

    Also i meant codefile inclusion in wordpress and not php. I’m meticulous about not including API files and constants when they aren’t needed. But that doesn’t seem to be all that common with the plugins i’m using. Wich is a bit worrying.

    For those that are interested. If you have dependency issues with the facebook API where the error states that it can’t find the class. It could be because someone is hogging the FACEBOOK_SDK_V4_SRD_DIR constant. So check if the constant has been defined. If it has then you can do 1 out of 3 things. Disable the plugin hogging the constant. But that’s hardly an option.

    In the second approach. Find this part in Facebooks autoload.php file.

    // For backwards compatibility
       $customBaseDir = '';
       //@todo v6: Remove support for 'FACEBOOK_SDK_V4_SRC_DIR'
       if (defined('FACEBOOK_SDK_V4_SRC_DIR')) {
            $customBaseDir = FACEBOOK_SDK_V4_SRC_DIR;
        } elseif (defined('FACEBOOK_SDK_SRC_DIR')) {
            $customBaseDir = FACEBOOK_SDK_SRC_DIR;
        }
        // base directory for the namespace prefix
        $baseDir = $customBaseDir ?: __DIR__ . '/';

    And change the FACEBOOK_SDK_V4_SRC_DIR and FACEBOOK_SDK_SRC_DIR constants to something that is guaranteed to be unique for your plugin.

    // For backwards compatibility
       $customBaseDir = '';
       //@todo v6: Remove support for 'FACEBOOK_SDK_V4_SRC_DIR'
       if (defined('FBAF_FACEBOOK_SDK_V4_SRC_DIR')) {
            $customBaseDir = FBAF_FACEBOOK_SDK_V4_SRC_DIR;
        } elseif (defined('FBAF_FACEBOOK_SDK_SRC_DIR')) {
            $customBaseDir = FBAF_FACEBOOK_SDK_SRC_DIR;
        }
        // base directory for the namespace prefix
        $baseDir = $customBaseDir ?: __DIR__ . '/';

    In my case i just prefixed the constants with FBAF_

    Third option is to comment out the entire if/else statement. Based on the todo tag. Support for the src dir constant will be removed completly in version 6 of the api.

    I strongly recommend option 2.

    Edit: I spoke to soon. But it fixes the problem of not finding some of the classes in V5.

    Thread Starter idono

    (@idono)

    Figured it out.

Viewing 2 replies - 1 through 2 (of 2 total)