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 resize($incoming, $max_width, $max_height, $crop = true){ | |
$original_name = explode('.', $incoming); | |
$original_ext = strtolower(array_pop($original_name)); | |
$original_name = implode('.', $original_name); | |
if(!file_exists($incoming)) $error = 'Original file doesn\'t exist.'; | |
else{ | |
if(!$original_info = getimagesize($incoming)) $error = 'Original file isn\'t a valid image.'; | |
else{ | |
$original_width = $original_info[0]; | |
$original_height = $original_info[1]; |
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 urlize($string){ | |
return preg_replace('/\-+/', '-', preg_replace('/[^a-zA-Z\-_]/', '', preg_replace('/\s+/', '-', strtolower($string)))); | |
} |
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 getNamed($string){ | |
$bad = array( | |
'€' => '€', | |
'‚' => '‚', | |
'ƒ' => 'ƒ', | |
'„' => '„', | |
'…' => '…', | |
'†' => '†', | |
'‡' => '‡', | |
'ˆ' => 'ˆ', |
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
CONCAT(UPPER(SUBSTR(field,1,1)), SUBSTR(field, 2)) |
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
//escape everything in tags | |
preg_match_all('/(\<[^\>]+\>)/', $string, $tags); | |
foreach($tags[0] as $key=>$value) | |
{ | |
$string = str_replace($value, str_replace(array('"', "'"), array('\"', "\'"), $value), $string); | |
} | |
//replace double quotes | |
preg_match_all('/(?<!\\\)"([^"]+)"/', $string, $matches); | |
foreach($matches[0] as $key=>$value) |
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
error_reporting(E_ALL); | |
ini_set("display_errors", 1); |
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 | |
$width = 960; | |
$columns = 12; | |
$margin = 10; | |
$column = ($width / $columns) - (2 * $margin); | |
echo '<pre>'; | |
$spans = ''; | |
for($i = 1; $i <= 12; $i++) | |
{ | |
$spans .= '.span_' . $i . ', '; |
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
((round(((strtotime($end) - strtotime($start)) / 60) / 15) * 15) / 60) |
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
((round(((strtotime($end) - strtotime($start)) / 60) / 15) * 15) / 60) |
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
lorem ipsum |
OlderNewer