update file class to use settings when retrieving sound files
This commit is contained in:
@@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* cache class provides an abstracted cache
|
* cache class provides an abstracted cache
|
||||||
*
|
|
||||||
* @method string glob
|
|
||||||
*/
|
*/
|
||||||
class file {
|
class file {
|
||||||
|
|
||||||
@@ -12,12 +10,17 @@ class file {
|
|||||||
*/
|
*/
|
||||||
public $recursive;
|
public $recursive;
|
||||||
public $files;
|
public $files;
|
||||||
|
private $settings;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the object is created
|
* Called when the object is created
|
||||||
|
* @param settings $settings Settings object
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function __construct($settings = null) {
|
||||||
//place holder
|
if ($settings === null) {
|
||||||
|
$settings = new settings();
|
||||||
|
}
|
||||||
|
$this->settings = $settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -66,8 +69,8 @@ class file {
|
|||||||
if (!isset($voice)) { $voice = 'callie'; }
|
if (!isset($voice)) { $voice = 'callie'; }
|
||||||
|
|
||||||
//set the variables
|
//set the variables
|
||||||
if (!empty($_SESSION['switch']['sounds']['dir']) && file_exists($_SESSION['switch']['sounds']['dir'])) {
|
if (!empty($this->settings->get('switch', 'sounds')) && file_exists($this->settings->get('switch', 'sounds'))) {
|
||||||
$dir = $_SESSION['switch']['sounds']['dir'].'/'.$language.'/'.$dialect.'/'.$voice;
|
$dir = $this->settings->get('switch', 'sounds').'/'.$language.'/'.$dialect.'/'.$voice;
|
||||||
$rate = '8000';
|
$rate = '8000';
|
||||||
$files = $this->glob($dir.'/*/'.$rate, true);
|
$files = $this->glob($dir.'/*/'.$rate, true);
|
||||||
}
|
}
|
||||||
@@ -93,5 +96,3 @@ class file {
|
|||||||
$files = $file->sounds();
|
$files = $file->sounds();
|
||||||
print_r($files);
|
print_r($files);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
?>
|
|
||||||
|
|||||||
Reference in New Issue
Block a user