public function _remap($method, $args) { if ($method == 'linked') { $this->linked(); return; } // Invalid method or no provider = BOOM if (!in_array($method, array('session', 'callback')) or empty($args)) { show_404(); } // Get the provider (facebook, twitter, etc) list($provider) = $args; // This provider is not supported by the module if (!isset($this->providers[$provider])) { show_404(); } // Look to see if we have this provider in the db? if (!($credentials = $this->credential_m->get_active_provider($provider))) { $this->ion_auth->is_admin() ? show_error('Social Integration: ' . $provider . ' is not supported, or not enabled.') : show_404(); } // oauth or oauth 2? $strategy = $this->providers[$provider]; switch ($strategy) { case 'oauth': include $this->module_details['path'] . '/oauth/libraries/OAuth.php'; $oauth = new OAuth(); // Create an consumer from the config $consumer = $oauth->consumer(array('key' => $credentials->client_key, 'secret' => $credentials->client_secret)); // Load the provider $provider = $oauth->provider($provider); break; case 'oauth2': include $this->module_details['path'] . '/oauth2/libraries/OAuth2.php'; $oauth2 = new OAuth2(); // OAuth2 is the honey badger when it comes to consumers - it just dont give a shit $consumer = null; $provider = $oauth2->provider($provider, array('id' => $credentials->client_key, 'secret' => $credentials->client_secret, 'scope' => $credentials->scope)); break; default: exit('Something went properly wrong!'); } // Call session or callback, with lots of handy details call_user_func(array($this, '_' . $method), $strategy, $provider, $consumer); }