You are here

function plus1_get_cleared_destination in Plus 1 7

If widget is returned by ajax, and there are ajax_html_ids in the $_GET, then we need to clear destination parameter, reduce query length.

3 calls to plus1_get_cleared_destination()
plus1_build_comment_jquery_widget in ./plus1.module
Create voting widget to display on the webpage.
plus1_build_node_jquery_widget in ./plus1.module
Create voting widget to display on the webpage.
plus1_build_taxonomy_term_jquery_widget in ./plus1.module
Create voting widget to display on the webpage.

File

./plus1.module, line 492

Code

function plus1_get_cleared_destination() {
  $clear_destination =& drupal_static(__FUNCTION__);
  if (isset($clear_destination)) {
    return $clear_destination;
  }
  if (isset($_GET['destination'])) {
    $path = $_GET['destination'];
  }
  else {
    $path = $_GET['q'];
    $query = $_GET;
    unset($query['ajax_html_ids']);
    unset($query['ajax_page_state']);
    $query = drupal_http_build_query(drupal_get_query_parameters($query));
    if ($query != '') {
      $path .= '?' . $query;
    }
  }
  $clear_destination = array(
    'destination' => $path,
  );
  return $clear_destination;
}