vovanbo
By: a guest | Jun 17th, 2009 | Syntax:
PHP | Size: 1.10 KB | Hits: 210 | Expires: Never
<?php
require_once('../config.php');
$output = ''; // Here we buffer the JavaScript code we want to send to the browser.
$delimiter = "\n"; // for eye candy... code gets new lines
$output .= 'var tinyMCEImageList = new Array(';
$directory = $image_list_dir;
if (!preg_match('~^\.~', $file)) { // no hidden files / directories here...
$output .= $delimiter
. '["'
. $file
. '", "'
. URL_PUBLIC."$image_public_path/$file"
. '"],';
}
}
}
$output = substr($output, 0
, -1
); // remove last comma from array item list (breaks some browsers)
$output .= $delimiter;
}
$output .= ');'; // Finish code: end of array definition. Now we have the JavaScript code ready!
echo $output; // Now we can send data to the browser because all headers have been set!
?>