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 foldersToArray($path, $flat = false) { | |
$folderArray = array(); | |
if($handle = opendir($path)) { | |
while (false !== ($file = readdir($handle))) { | |
if($file != '.' && $file != '..') { | |
if(!in_array($path.'/'.$file, $folderArray) && is_file($path.'/'.$file)) { | |
if($flat) { | |
array_push($folderArray, $path.'/'.$file); | |
} else { | |
array_push($folderArray, $file); |
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
/* | |
** String prototype for clipping text and optionally adding ellipsis | |
** Does not modify original variable | |
** -Example- | |
** var thisStr = 'Some string of text'; | |
** var newStr = thisStr.clip(10, '...', true); // Some... | |
** var newStr = thisStr.clip(15, '...', true); // Some string of... | |
*/ | |
String.prototype.clip = function(len/* Number */, str/* String */, bound/* Boolean */) { | |
var origLen = len; |
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
$files = array(); | |
function returnFiles($dir) { | |
global $files; | |
$dh = opendir($dir); | |
while(false !== ($filename = readdir($dh))) { | |
if($filename == '.' || $filename == '..') { | |
continue; | |
} | |
echo $dir.DIRECTORY_SEPARATOR.$filename . "\n"; | |
if(is_file($dir.DIRECTORY_SEPARATOR.$filename)) { |
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 checkFolders($path) { | |
$bits = explode(DIRECTORY_SEPARATOR, $path); | |
$sandbox = ''; | |
foreach($bits as $bit) { | |
$sandbox .= $bit . DIRECTORY_SEPARATOR; | |
if(!is_dir($sandbox)) { | |
mkdir($sandbox); | |
} | |
} |
NewerOlder