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 | |
/** | |
* Trova l'ip del cliente | |
*/ | |
function mc_get_user_ip() { | |
// Tiro giù l'ip del client | |
if ( isset( $_SERVER["REMOTE_ADDR"] ) ) { | |
$ip = $_SERVER["REMOTE_ADDR"]; | |
} elseif ( isset( $_SERVER["HTTP_X_FORWARDED_FOR"] ) ) { |
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 | |
/** | |
* RITORNA L'URL CORRENTE | |
*/ | |
function curPageURL() { | |
$pageURL = 'http'; | |
if ( isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") $pageURL .= "s"; | |
$pageURL .= "://"; | |
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; |
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
function varDump( Obj ) { | |
this.eplode = function( theObj ){ | |
var output = ("<ul style='list-style:none;padding-left:20px;margin:0;color:#02adea;'>"); | |
if( typeof theObj == 'object' ){ | |
for( var p in theObj ){ | |
output += "<li style='font-size:12px;'>"; | |
if( theObj[p] && | |
( theObj[p].constructor == Array || theObj[p].constructor == Object ) ){ |
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 | |
// ADD NEW ADMIN USER TO WORDPRESS | |
// ---------------------------------- | |
// Put this file in your Wordpress root directory and run it from your browser. | |
// Delete it when you're done. | |
require_once('wp-blog-header.php'); | |
require_once('wp-includes/registration.php'); | |
// CONFIG |
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
<form method="post" id="tiribi" enctype="multipart/form-data"> | |
<input id="fileuploader" type="file" name="file[]" multiple="" > | |
<ul class="filelist"></ul> | |
<input type="submit" class="button" name="multi_post_submit" value="Upload files" id="submit_button" /> | |
</form> |
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 | |
/** | |
* WordPress Gists Shortcode | |
* | |
* To include a Gist you have different possibilities: | |
* [gists id="5964192"] | |
* [gists]https://gist.github.com/micc83/5964192[/gists] | |
* [gists id="5964192" file="index.html"] | |
* [gists file="index.html"]https://gist.github.com/micc83/5964192[/gists] |
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 | |
/** | |
* Export WordPress Posts by category or custom taxonomy with attachments | |
* | |
* Add the needed select boxes to the ui | |
*/ | |
add_action( 'export_filters', 'export_custom_taxonomy_fields' ); | |
function export_custom_taxonomy_fields() { | |
?> | |
<!-- Styles --> |
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 | |
/** | |
* Controlla che non si tratti di un proxy | |
*/ | |
function ipProxyPortCheck( $ip ){ | |
//timeout you want to use to test | |
$timeout = 5; | |
// ports we're going to check |
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 set_newuser_cookie() { | |
if (!isset($_COOKIE['sitename_newvisitor'])) { | |
setcookie('sitename_newvisitor', 1, time() + HOUR_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN, false); | |
} | |
} | |
add_action( 'init', 'set_newuser_cookie'); | |
/** | |
* MINUTE_IN_SECONDS = 60 (seconds) |
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 relative_time($date, $postfix = ' ago', $fallback = 'F Y') | |
{ | |
$diff = time() - strtotime($date); | |
if($diff < 60) | |
return $diff . ' second'. ($diff != 1 ? 's' : '') . $postfix; | |
$diff = round($diff/60); | |
if($diff < 60) | |
return $diff . ' minute'. ($diff != 1 ? 's' : '') . $postfix; | |
$diff = round($diff/60); |
OlderNewer