You are here

function _fb_settings_parse in Drupal for Facebook 7.3

Same name and namespace in other branches
  1. 5.2 fb_settings.inc \_fb_settings_parse()
  2. 6.3 fb_url_rewrite.inc \_fb_settings_parse()
  3. 6.2 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
This file is a replacement for Drupal's session.inc. Although not truly a replacement, as we include the default session.inc to do the heavy lifting.
fb_settings.inc in ./fb_settings.inc
This file is to be included from your sites/.../settings.php file.
2 string references to '_fb_settings_parse'
fb_session.inc in ./fb_session.inc
This file is a replacement for Drupal's session.inc. Although not truly a replacement, as we include the default session.inc to do the heavy lifting.
fb_settings.inc in ./fb_settings.inc
This file is to be included from your sites/.../settings.php file.

File

./fb_url_rewrite.inc, line 50
Performs custom url rewriting for Drupal for Facebook.

Code

function _fb_settings_parse($key) {
  if (!function_exists('request_path')) {

    // May not exist if settings.php is being include in drupal utilities that are not drupal proper.
    return;
  }

  // TODO: confirm this working in D7
  if ($path = request_path()) {
    $pos = strpos($path, $key . '/');
    if ($pos !== FALSE) {

      // Too soon for arg() function. (Actually in D7 no longer true.  We could use arg() here.)
      $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;
      }
    }
  }
}