-
-
Save dovidezra/aa865a2f135b1237bf0c9784be277f17 to your computer and use it in GitHub Desktop.
WordPress Plugin to List all Site Cookies
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function get_cookies( $paras = '', $content = '' ) { | |
if ( strtolower( $paras[ 0 ] ) == 'novalue' ) { $novalue = true; } else { $novalue = false; } | |
if ( $content == '' ) { $seperator = ' : '; } else { $seperator = $content; } | |
$cookie = $_COOKIE; | |
ksort( $cookie ); | |
$content = "<ul>n"; | |
foreach ( $cookie as $key => $val ) { | |
$content .= '<li>' . $key; | |
if ( !$novalue ) { $content .= $seperator . $val; } | |
$content .= "</li>n"; | |
} | |
$content .= "</ul>n"; | |
return do_shortcode( $content ); | |
} | |
add_shortcode( 'cookies', 'get_cookies' ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment