Three functions of processing URL in DruPal7

We use the DRUPAL7 often use the Destination parameters in the URL to make a reformal processing. There are also functions that have been specifically exchanged on the Destination parameter on the URL. The introduction is as follows:

drupal_get_destination (); // This function can get the Destination parameter in the URL. When there is no Destination parameter, the function returns the current URL as a parameter.

DRUPAL_HTTP_BUILD_QUERY (Array $ Query, $ PARENT = ‘);

Drupal_get_Query_Parameters (Array $ Query = Null, Array $ Exclude = Array (‘ q ‘), $ PARENT =’ ‘) ; // Default Remove $ _GET [‘q’] section

The following is the API middle code:

 function drupal_get_destination () {$ destination = & drupal_static (__ function__) ; if (isset ($ destination)) {RETURN $ DESTINATION;} if (isset ($ _GET ['DESTION')) {$ DESTITION = Array ('DESTITION'],);} Else {$ PATH = $ _GET ['q']; $ query = drupal_http_build_query (drupal_get_query_parameters ()); if ($ query! = '') {$ PATH. = '?'. $ query;} $ destination = array ('destination' => $ path,);} returnid $ destination;}   
 function drupal_http_build_query (Array $ Query ($ PARENT = ') {$ params = array (); foreach ($ qERY AS $ key => $ value) {$ key = $ parent? $ parent. Rawurlencode (' ['. " $ key. ']'): Rawurlencode; if (is_ARRAY) {$ params [] = drupal_http_build_query ($ value, $ key);} else if (! isset ($ value) {$ Params [] = $ key;} else {$ param [] = $ key. '='. STR_REPLACE ('% 2f', '/', rawurlencode);}}}}} Return Implode ('&', $ Params);}   
Function drupal_get_query_parameters (Array $ query = NULL, Array $ EXCLUDE = Array (‘q’), $ PARENT = ‘) {/ / set default, if not givenif (! isset ($ query) {$ Query = $ _get;} // if exclude is empty, there is nothing to filterif (Empty ($ exclude)) {Return $ query;} elseif (! $ Parent) {$ exclude = array_flip ($ exclude) } $ params = array (); foreach ($ query as $ key => $ value) {$ string_key = $ parent? $ parent. ‘[‘. $ key. ‘]’: $ key; if (isset ($ ₹) Exclude [$ String_key]) {Continue;} IF (is_ARRAY ($ value) {$ params [$ key] = drupal_get_query_parameters ($ Value, $ Exclude, $ String_Key);} else {$ Params [$ key] = $ Value;}}} [}}}
 The above is for reference only, please refer to DruPal7 official website API content                      
© Copyright Notice
THE END
Just support it if you like
like0
share
comment Grab the couch

Please log in to comment