Added "jar" file to alleviate overhead of __autoload() look ups and decrease the number of included files to load a page.
This commit is contained in:
parent
bf4b86116f
commit
afac101ba5
2 changed files with 6128 additions and 0 deletions
41
pickles.php
41
pickles.php
|
@ -53,6 +53,47 @@ define('JSON_AVAILABLE', function_exists('json_encode'));
|
|||
// Creates a variable to flag if we're on the command line
|
||||
define('IS_CLI', !isset($_SERVER['REQUEST_METHOD']));
|
||||
|
||||
// }}}
|
||||
// {{{ Attempts to JAR the PICKLES - Har Har.
|
||||
|
||||
function readFileContents($directory)
|
||||
{
|
||||
$contents = '';
|
||||
$files = scandir($directory);
|
||||
|
||||
foreach ($files as $file)
|
||||
{
|
||||
if (!in_array($file, array('.', '..')))
|
||||
{
|
||||
$file = $directory . '/' . $file;
|
||||
|
||||
if (is_dir($file))
|
||||
{
|
||||
$contents .= readFileContents($file);
|
||||
}
|
||||
else
|
||||
{
|
||||
$contents .= file_get_contents($file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $contents;
|
||||
}
|
||||
|
||||
$jar_file = PICKLES_PATH . 'jar.php';
|
||||
|
||||
// The PICKLES path should only be writable in a development environment, never on a production server
|
||||
if (is_writable(PICKLES_PATH))
|
||||
{
|
||||
file_put_contents(dirname(__FILE__) . '/jar.php', str_replace("\n?>\n<?php\n", '', readFileContents(PICKLES_CLASS_PATH)));
|
||||
}
|
||||
|
||||
if (file_exists($jar_file))
|
||||
{
|
||||
require $jar_file;
|
||||
}
|
||||
|
||||
// }}}
|
||||
// {{{ Defaults some important configuration options
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue