public function addDefaultLocations()
{
// app->addAllLocations - will override creation of all locations
// app->addDefaultLocations - will let you add high-priority locations
// app->addSharedLocations - will let you add low-priority locations
if ($this->app->hasMethod('addAllLocations')) {
return $this->app->addAllLocations();
}
$base_directory = getcwd();
/// Add base location - where our private files are
if ($this->app->hasMethod('addDefaultLocations')) {
$this->app->addDefaultLocations($this, $base_directory);
}
$templates_folder = array('template', 'templates');
if ($this->app->compat_42 && is_dir($base_directory . '/templates/default')) {
$templates_folder = 'templates/default';
}
$this->base_location = $this->addLocation(array('php' => 'lib', 'page' => 'page', 'tests' => 'tests', 'template' => $templates_folder, 'mail' => 'mail', 'logs' => 'logs', 'dbupdates' => 'doc/dbupdates'))->setBasePath($base_directory);
if (@$this->app->pm) {
// Add public location - assets, but only if
// we hav PageManager to identify it's location
if (is_dir($base_directory . '/public')) {
$this->public_location = $this->addLocation(array('public' => '.', 'js' => 'js', 'css' => 'css'))->setBasePath($base_directory . '/public')->setBaseURL($this->app->pm->base_path);
} else {
$this->base_location->setBaseURL($this->app->pm->base_path);
$this->public_location = $this->base_location;
$this->public_location->defineContents(array('js' => 'templates/js', 'css' => 'templates/css'));
}
if (basename($this->app->pm->base_path) == 'public') {
$this->base_location->setBaseURL(dirname($this->app->pm->base_path));
}
}
if ($this->app->hasMethod('addSharedLocations')) {
$this->app->addSharedLocations($this, $base_directory);
}
// Add shared locations
if (is_dir(dirname($base_directory) . '/shared')) {
$this->shared_location = $this->addLocation(array('php' => 'lib', 'addons' => 'addons', 'template' => $templates_folder))->setBasePath(dirname($base_directory) . '/shared');
}
$atk_base_path = dirname(dirname(__FILE__));
$this->atk_location = $this->addLocation(array('php' => 'lib', 'template' => $templates_folder, 'tests' => 'tests', 'mail' => 'mail'))->setBasePath($atk_base_path);
if (@$this->app->pm) {
if ($this->app->compat_42 && is_dir($this->public_location->base_path . '/atk4/public/atk4')) {
$this->atk_public = $this->public_location->addRelativeLocation('atk4/public/atk4');
} elseif (is_dir($this->public_location->base_path . '/atk4')) {
$this->atk_public = $this->public_location->addRelativeLocation('atk4');
} elseif (is_dir($base_directory . '/vendor/atk4/atk4/public/atk4')) {
$this->atk_public = $this->base_location->addRelativeLocation('vendor/atk4/atk4/public/atk4');
} elseif (is_dir($base_directory . '/../vendor/atk4/atk4/public/atk4')) {
$this->atk_public = $this->base_location->addRelativeLocation('../vendor/atk4/atk4/public/atk4');
} else {
echo $this->public_location;
throw $this->exception('Unable to locate public/atk4 folder', 'Migration');
}
$this->atk_public->defineContents(array('public' => '.', 'js' => 'js', 'css' => 'css'));
}
// Add sandbox if it is found
$this->addSandbox();
}