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 getCurlValue($filepath) | |
{ | |
$contentType = mime_content_type($filepath); | |
$filename = basename($filepath); | |
// PHP 5.5 introduced a CurlFile object that deprecates the old @filename syntax |
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
jQuery('span.show-password').click(function(){ | |
var passfield = jQuery('input[name="password"]'); | |
if(passfield.attr('type')=='password'){ | |
passfield.attr('type','text'); | |
}else if(passfield.attr('type')=='text'){ | |
passfield.attr('type','password'); | |
} | |
}) |
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 downloadAndUploadImages($post_id,$post_title,$img,$sku){ | |
ini_set('max_execution_time', 300); //300 seconds = 5 minutes | |
ini_set('memory_limit','1024M'); | |
$ext = substr(strrchr($img,'.'),1); | |
// WordPress Upload Directory to Copy to (must be CHMOD to 777) | |
$uploads = wp_upload_dir(); | |
$copydir = $uploads['path']."/"; | |
// Code to Copy Image to WordPress Upload Directory (Server Must Support file_get_content/fopen/fputs) |
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 to remove query parameter by name*/ | |
function removeQueryParam($url, $key) | |
{ | |
return preg_replace('/(?:&|(\?))' . $key . '=[^&]*(?(1)&|)?/i', "$1", $url); | |
} | |
//How to use | |
$url = "https://gist.github.com/?test=false"; | |
$key = "test"; | |
$newURL = removeQueryParam($url,$key); |