Example #1
0
 public function authenticate()
 {
     // Load the provider
     $provider = Provider::forge($this->provider, $this->config);
     // Grab a callback from the config
     if ($provider->callback === null) {
         $provider->callback = Uri::create(Config::get('autho.urls.callback', \Request::active()->route->segments[0] . '/callback'));
         $provider->callback = rtrim($provider->callback, '/') . '/' . $this->provider;
     }
     $provider->authorize(array('redirect_uri' => $provider->callback));
 }
Example #2
0
 /**
  * Add a new item, prepending or appending
  *
  * @access  public
  * @param   string  $title
  * @param   string  $content
  * @param   bool    $prepend
  * @return  self
  */
 public function add($title, $content = '', $prepend = false)
 {
     if (empty($title)) {
         throw new FuelException(__METHOD__ . ": Unable to add empty breadcrumb.");
     }
     if (empty($content) or !strval($content)) {
         $content = '';
     }
     $data = (object) array('title' => $title, 'slug' => Inflector::friendly_title($title, '-', true), 'content' => Uri::create($content));
     if (true === $prepend) {
         array_unshift($this->items, $data);
     } else {
         array_push($this->items, $data);
     }
     return $this;
 }
Example #3
0
 public function authenticate()
 {
     // Create an consumer from the config
     $consumer = Consumer::forge($this->config);
     // Load the provider
     $provider = Provider::forge($this->provider);
     // Create the URL to return the user to
     $callback = Arr::get($this->config, 'callback') ?: Uri::create(Config::get('autho.urls.callback', \Request::active()->route->segments[0] . '/callback'));
     $callback = rtrim($callback, '/') . '/' . $this->provider;
     // Add the callback URL to the consumer
     $consumer->callback($callback);
     // Get a request token for the consumer
     $token = $provider->request_token($consumer);
     // Store the token
     Cookie::set('oauth_token', base64_encode(serialize($token)));
     // Redirect to the twitter login page
     Response::redirect($provider->authorize_url($token, array('oauth_callback' => $callback)));
 }
Example #4
0
 /**
  * Parse pagination url
  *
  * @access  protected
  * @param   integer     $page_id
  * @return  string
  */
 protected function build_url($page_id)
 {
     return Uri::create(Str::tr($this->uri, array('page' => $page_id)));
 }