forked from silexlabs/amfphp-2.0
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConfig.php
48 lines (42 loc) · 1.43 KB
/
Config.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
/**
* This file is part of amfPHP
*
* LICENSE
*
* This source file is subject to the license that is bundled
* with this package in the file license.txt.
* @package Amfphp_BackOffice
*/
/**
* config for the backoffice
*
* @package Amfphp_BackOffice
* @author Ariel Sommeria-Klein
*/
class Amfphp_BackOffice_Config {
/**
* path to amfPHP. relative or absolute. If relative, be careful, it's relative to the script, not this file.
* 'http://silexlabs.org/Tests/TestData/';
* some entry points that pertain to the code:
* '../Amfphp/'
* '../Examples/Php/'
* '../Tests/TestData/'
* @var String
*/
public $amfphpEntryPointUrl = '../Tests/TestData/';
//public $amfphpEntryPointUrl = 'http://arielsommeria.com/amfphp-2.1/Amfphp/';
public function resolveAmfphpEntryPointUrl(){
//determine url to amfphp. If in config it contains 'http', we consider it's absolute. Otherwise it's relative, and we build it.
$httpMarkerPos = strpos($this->amfphpEntryPointUrl, 'http');
if ($httpMarkerPos === false) {
$scriptUrl = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'];
//remove everything after last '/'
$scriptUrlPath = substr($scriptUrl, 0, strrpos($scriptUrl, '/'));
return $scriptUrlPath . '/' . $this->amfphpEntryPointUrl;
}else{
return $this->amfphpEntryPointUrl;
}
}
}
?>