vtmin_currPageURL

************************************************ * Application - get current page url.

Description

vtmin_currPageURL(); 

The code checking for www. is included since some server configurations do not respond with the actual info, as to whether www. is part of the URL. The additional code balances out the currURL, relative to the Parent Plugin's recorded URLs **************************************************


Usage

  1. if ( !function_exists( 'vtmin_currPageURL' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'varktech-minimum-purchase-for-woocommerce/woo-integration/vtmin-parent-functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = vtmin_currPageURL(); 
  7.  

Defined (1)

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

/woo-integration/vtmin-parent-functions.php  
  1. function vtmin_currPageURL() { 
  2. global $vtmin_info; 
  3. $currPageURL = vtmin_get_currPageURL(); 
  4. $www = 'www.'; 
  5.  
  6. $curr_has_www = 'no'; 
  7. if (strpos($currPageURL, $www )) { 
  8. $curr_has_www = 'yes'; 
  9.  
  10. //use checkout URL as an example of all setup URLs 
  11. $checkout_has_www = 'no'; 
  12. if (strpos($vtmin_info['woo_checkout_url'], $www )) { 
  13. $checkout_has_www = 'yes'; 
  14. }  
  15.  
  16. switch( true ) { 
  17. case ( ($curr_has_www == 'yes') && ($checkout_has_www == 'yes') ): 
  18. case ( ($curr_has_www == 'no') && ($checkout_has_www == 'no') ):  
  19. //all good, no action necessary 
  20. break; 
  21. case ( ($curr_has_www == 'no') && ($checkout_has_www == 'yes') ): 
  22. //reconstruct the URL with 'www.' included. 
  23. $currPageURL = vtmin_get_currPageURL($www);  
  24. break; 
  25. case ( ($curr_has_www == 'yes') && ($checkout_has_www == 'no') ):  
  26. //all of the woo URLs have no 'www.', and curr has it, so remove the string  
  27. $currPageURL = str_replace($www, "", $currPageURL); 
  28. break; 
  29. }  
  30.  
  31. return $currPageURL; 
  32. }