You are here

function _fb_settings_parse in Drupal for Facebook 5.2

Same name and namespace in other branches
  1. 6.3 fb_url_rewrite.inc \_fb_settings_parse()
  2. 6.2 fb_url_rewrite.inc \_fb_settings_parse()
  3. 7.3 fb_url_rewrite.inc \_fb_settings_parse()

Parse a setting from the URL. This may be called before custom_url_rewrite, so we can't count on fb_settings() to return the value. For internal use only (see fb_session.inc).

2 calls to _fb_settings_parse()
fb_session.inc in ./fb_session.inc
fb_settings.inc in ./fb_settings.inc

File

./fb_settings.inc, line 124

Code

function _fb_settings_parse($key) {
  if (isset($_GET['q'])) {
    $path = $_GET['q'];
    $pos = strpos($path, $key . '/');
    if ($pos !== FALSE) {

      // Too soon for arg() function.
      $args = explode('/', $path);
      $i = 0;
      while (isset($args[$i]) && isset($args[$i + 1])) {
        if ($args[$i] == $key) {

          // Found the value we're interested in
          return $args[$i + 1];
        }
        $i = $i + 2;
      }
    }
  }
}