-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Unstable. First config refactoring for multiple users implementation
- Loading branch information
Showing
6 changed files
with
217 additions
and
12 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
<?php | ||
/** | ||
* Description of FinderConfig | ||
* | ||
* Parses ini files to a FinderConfig Object | ||
* | ||
* The main instance of FinderConfig is a Singleton (and could only exist once) | ||
* The instance could have multiple instances of FinderConfig within it self, so | ||
* that multi dimentional array's can be parsed as a multy layered object | ||
* | ||
* @author niele | ||
* | ||
* @todo extract the path to the ini file and make it variable | ||
* | ||
*/ | ||
class FinderConfig | ||
{ | ||
/** | ||
* Path to default config file | ||
*/ | ||
const DEFAULT_CONFIG_FILE = 'config.ini'; | ||
|
||
|
||
|
||
/** | ||
* PlaceHolder for self (Singleton) | ||
* | ||
* @var FinderConfig | ||
*/ | ||
public static $instance; | ||
|
||
|
||
|
||
/** | ||
* Get the Instance of self | ||
* | ||
* @return FinderConfig | ||
*/ | ||
public static function getInstance() | ||
{ | ||
if (null == self::$instance) { | ||
self::$instance = new self; | ||
} | ||
|
||
return self::$instance; | ||
} | ||
|
||
|
||
|
||
/** | ||
* Constructor Class | ||
* | ||
* @param array $config | ||
* @access private | ||
*/ | ||
private function __construct(array $options=array()) | ||
{ | ||
if (empty($options)) { | ||
$options = parse_ini_file( | ||
APPLICATION_PATH . self::DEFAULT_CONFIG_FILE, | ||
true | ||
); | ||
} | ||
|
||
$this->setConfig($options); | ||
} | ||
|
||
|
||
|
||
/** | ||
* Set config options, sets recurivly if it's a multydimentional array | ||
* | ||
* @param array $options | ||
* @access private | ||
* @return FinderConfig | ||
*/ | ||
private function setConfig(array $options=array()) | ||
{ | ||
foreach ($options as $key => $value) { | ||
|
||
if (is_array($value) && !empty($value)) { | ||
$value = new self($value); | ||
} | ||
|
||
$this->$key = $value; | ||
} | ||
|
||
return $this; | ||
} | ||
|
||
|
||
|
||
/** | ||
* Magic method get | ||
* | ||
* This gets triggered if there is a call made to an undefined property in | ||
* the FinderConfig instance or subInstance, so we throw an Exception | ||
* | ||
* @param string $name | ||
* @throws Exception | ||
*/ | ||
public function __get($name) | ||
{ | ||
throw new Exception('call to undefined property: ' . $name); | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
disabled = false | ||
theme = dark | ||
uploadURL = /kcfinder/upload | ||
uploadDir = | ||
|
||
deny_zip_download = false | ||
deny_update_check = false | ||
deny_extension_rename = false | ||
|
||
[types] | ||
;(F)CKeditor types | ||
files = | ||
flash = swf | ||
images = *img | ||
|
||
;TinyMCE types | ||
file = | ||
media = swf flv avi mpg mpeg qt mov wmv asf rm | ||
image = *img | ||
|
||
[multiple_users] | ||
enabled = true | ||
lock_to_home = false | ||
rw_homes = false | ||
token_src = users.json | ||
request_method = get | ||
|
||
[image] | ||
image_driver_priority = imagick gmagick gd | ||
jpeg_quality = 90 | ||
thumbs_dir = .thumbs | ||
|
||
max_image_width = 0 | ||
max_image_height = 0 | ||
|
||
thumb_width = 100 | ||
thumb_height = 100 | ||
|
||
watermark = | ||
|
||
|
||
[access] | ||
dir_permissions = 0755 | ||
file_permissions = 0644 | ||
|
||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
$publicDir = $_SERVER['DOCUMENT_ROOT']; | ||
$publicUrl = 'http://'.$_SERVER['HTTP_HOST']; | ||
|
||
$_LOCALS = array( | ||
'theme' => 'dark', | ||
|
||
'uploadURL' => $publicUrl . '/RES/uploads', | ||
'uploadDir' => $publicDir . '/RES/uploads' | ||
); | ||
|
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -725,4 +725,4 @@ protected function get_htaccess() { | |
} | ||
} | ||
|
||
?> | ||
?> |