Social Media Toolkit - Dynamic page option
As I often use the Social Media Toolkit as a plugin on dynamic pages I have to change the code to also be dynamic.
It would be good if you had a 'static' option for one off pages where you put the full URL (so as not to loose the current functionality) and a dynamic or plugin version where you just put in the domain name and the extension that then adds the php code
<?php echo $_SERVER["PHP_SELF"]; ?>
or make it completely inteligent by adding this code;
<?php
function curPageURL() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}
?>
<?php
echo curPageURL();
?>
<?php
function curPageName() {
return substr($_SERVER["SCRIPT_NAME"],strrpos($_SERVER["SCRIPT_NAME"],"/")+1);
}
echo "The current page name is ".curPageName();
?>
Which I got from here - get_current_page_url.php