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 img2html($image, $letters='') { | |
/* | |
img2html: | |
takes an image as an array of data that is created by PHP | |
for uploaded files. | |
*/ | |
$suffix = preg_replace('%^[^/]+/%', '', $image['type']); | |
$getimagefunc = "imagecreatefrom$suffix"; |
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 benchmark($function, $args = null, $iterations = 1, $timeout = 0) | |
{ | |
set_time_limit($timeout); | |
if (is_callable($function) === true) { | |
list($usec, $sec) = explode(" ", microtime()); | |
$start = ((float)$usec + (float)$sec); |
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 toggleEncryption($text, $key = '') { | |
// return text unaltered if the key is blank | |
if ($key == '') { | |
return $text; | |
} | |
// remove the spaces in the key | |
$key = str_replace(' ', '', $key); |
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 shortURL($url) | |
{ | |
$url = urlencode($url); | |
$ch = curl_init('http://api.bitly.com/v3/shorten?login=sarfraznawaz2005&apiKey=R_182a565c28e4eafd0e23aa113464e73e&longUrl=' . $url); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
$result = curl_exec($ch); | |
$resultArray = json_decode($result, true); | |
$shortURL = $resultArray['data']['url']; |
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 | |
// include the following at the top of your script | |
define( '_JEXEC', 1 ); | |
define('JPATH_BASE', dirname(dirname(__FILE__))); | |
define( 'DS', DIRECTORY_SEPARATOR ); | |
require_once (JPATH_BASE . DS . 'includes' . DS . 'defines.php'); | |
require_once (JPATH_BASE . DS . 'includes' . DS . 'framework.php'); | |
$mainframe = JFactory::getApplication('site'); | |
//From there you can do normal development as if you were inside of Joomla's framework |
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 | |
/** | |
* varLog | |
* | |
* Logs messages/variables/data to browser by creating custom console/floating window at bottom | |
* | |
* @param $name | |
* @param $data | |
* @author Sarfraz | |
*/ |
NewerOlder