gf_yst_get_query

The Gravity Forms Directory & Addons gf yst get query function.

Description

gf_yst_get_query( $query ); 

Parameters (1)

0. $query
The query.

Usage

  1. if ( !function_exists( 'gf_yst_get_query' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'gravity-forms-directory-addons/gravity-forms-referrer.php'; 
  3.  
  4. // The query. 
  5. $query = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = gf_yst_get_query($query); 
  9.  

Defined (1)

The function is defined in the following location(s).

/gravity-forms-referrer.php  
  1. function gf_yst_get_query( $query ) { 
  2. if ( strpos( $query, "google." ) ) { 
  3. $pattern = '/^.*\/search.*[\?&]q=(.*)$/'; 
  4. } else if ( strpos( $query, "bing.com" ) ) { 
  5. $pattern = '/^.*q=(.*)$/'; 
  6. } else if ( strpos( $query, "yahoo." ) ) { 
  7. $pattern = '/^.*[\?&]p=(.*)$/'; 
  8. } else if ( strpos( $query, "ask." ) ) { 
  9. $pattern = '/^.*[\?&]q=(.*)$/'; 
  10. } else { 
  11. return false; 
  12. preg_match( $pattern, $query, $matches ); 
  13. $querystr = substr( $matches[1], 0, strpos( $matches[1], '&' ) ); 
  14.  
  15. return urldecode( $querystr );