Permalink
Browse files

Removed use of directory separator for #60.

  • Loading branch information...
1 parent 94644b4 commit 4bbef133beec3d7922dd7c545f2bf38068014519 @g105b g105b committed Mar 14, 2013
View
16 Framework/Request.php
@@ -67,8 +67,8 @@ public function __construct($config) {
$className = $apiName . "_Api";
$fileName = $apiName . ".api.php";
$apiPathArray = array(
- APPROOT . DS . "Api" . DS,
- GTROOT . DS . "Api" . DS
+ APPROOT . "/Api/",
+ GTROOT . "/Api/",
);
foreach ($apiPathArray as $path) {
if(file_exists($path . $fileName)) {
@@ -120,12 +120,12 @@ public function __construct($config) {
// directory tree and look for and execute higher PageCodes.
$pcClassSuffix = "_PageCode";
$pcDirArray = array();
- $pcBaseDir = APPROOT . DS . "PageCode" . DS;
+ $pcBaseDir = APPROOT . "/PageCode/";
$filePathArray = explode("/", DIR);
for($i = 0; $i < count($filePathArray); $i++) {
$prefix = "";
foreach ($pcDirArray as $pcDir) {
- $prefix .= $pcDir . DS;
+ $prefix .= $pcDir . "/";
}
$pcDirArray[] = $prefix . $filePathArray[$i];
@@ -145,7 +145,7 @@ public function __construct($config) {
$pcDirArray = array_reverse($pcDirArray);
foreach ($pcDirArray as $pcDir) {
- $pcCommonPath = APPROOT . DS . "PageCode" . DS . $pcDir . DS;
+ $pcCommonPath = APPROOT . "/PageCode/" . $pcDir . "/";
$pcCommonFile = "_Common.php";
$pcCommonClass = str_replace("/", "_", $pcDir)
. "_Common";
@@ -164,7 +164,7 @@ public function __construct($config) {
}
// for and load the page's specific PageCode.
- $pageCodeFile = APPROOT . DS . "PageCode" . DS . FILEPATH . ".php";
+ $pageCodeFile = APPROOT . "/PageCode/" . FILEPATH . ".php";
$pageCodeClass = FILECLASS;
if(file_exists($pageCodeFile)) {
require($pageCodeFile);
@@ -195,8 +195,8 @@ public function __construct($config) {
$reservedName = BASEDIR == ""
? FILE
: BASEDIR;
- $reservedFile = GTROOT . DS . "Framework" . DS
- . "Reserved" . DS . ucfirst($reservedName) . ".php";
+ $reservedFile = GTROOT . "/Framework/Reserved/"
+ . ucfirst($reservedName) . ".php";
if(file_exists($reservedFile)) {
require($reservedFile);
$reservedClassName = $reservedName . "_Reserved";
View
6 Framework/Reserved/Gt.php
@@ -52,7 +52,7 @@ public function __construct($config) {
"Forward" => $_GET["DbDeploy"]
);
require(
- GTROOT . DS . "Framework" . DS . "Reserved" . DS . "Gt.html");
+ GTROOT . "/Framework/Reserved/Gt.html");
exit;
}
else if(isset($_GET["CheckSql"])) {
@@ -87,14 +87,14 @@ private function getSqlArray($dbConfig) {
":DatabaseTable" => "`" . $dbConfig["DbName"] . "`.*"
);
- $dbPath = GTROOT . DS . "Database";
+ $dbPath = GTROOT . "/Database";
$fileArray = scandir($dbPath);
foreach($fileArray as $file) {
if(strpos($file, "_CreateDatabase") !== 0) {
continue;
}
- $sql = file_get_contents($dbPath . DS . $file);
+ $sql = file_get_contents($dbPath . "/" . $file);
foreach ($replacements as $key => $value) {
$sql = str_replace($key, $value, $sql);
View
33 Framework/Response.php
@@ -92,8 +92,8 @@ public function dispatch($name, $parameter = null) {
*/
public function executePageTools($pageToolArray, $api, $dom, $template) {
$toolPathArray = array(
- APPROOT . DS . "PageTool",
- GTROOT . DS . "PageTool"
+ APPROOT . "/PageTool",
+ GTROOT . "/PageTool"
);
if(empty($pageToolArray)) {
return;
@@ -107,8 +107,8 @@ public function executePageTools($pageToolArray, $api, $dom, $template) {
continue;
}
- if(file_exists($path . DS . $tool . DS . $toolFile)) {
- require_once($path . DS . $tool . DS . $toolFile);
+ if(file_exists( "$path/$tool/$toolFile")) {
+ require_once("$path/$tool/$toolFile");
}
else {
continue;
@@ -181,12 +181,12 @@ private function bufferPageView($fileName = null) {
// Request path is absolute, only one array element needed, with
// direct reference to DIR and FILE.
$fileArray = array(
- APPROOT . DS . "PageView" . DS . DIR . DS . FILE . ".html"
+ APPROOT . "/PageView/" . DIR . "/" . FILE . ".html"
);
if(DIR === BASEDIR) {
$fileArray[] =
- APPROOT . DS . "PageView" . DS . BASEDIR . DS . FILE . ".html";
+ APPROOT . "/PageView/" . "/" . BASEDIR . "/" . FILE . ".html";
}
// Ensure there is only ever one URI that can be used to access a
@@ -205,7 +205,7 @@ private function bufferPageView($fileName = null) {
$fwd = preg_replace("/\/+/", "/", $fwd);
// Only perform the redirect if the Index.html file exists.
- $pageViewFile = APPROOT . DS . "PageView" . $fwd;
+ $pageViewFile = APPROOT . "/PageView" . $fwd;
if(file_exists($pageViewFile)) {
http_response_code(301);
header("Location: $fwd");
@@ -220,14 +220,10 @@ private function bufferPageView($fileName = null) {
// List of PageView locations in priority order.
$fileArray = array(
- APPROOT . DS . "PageView"
- . DS . DIR . DS . "_{$fileName}.html",
- APPROOT . DS . "PageView"
- . DS . FILE . DS . "_{$fileName}.html",
- APPROOT . DS . "PageView"
- . DS . BASEDIR . DS . "_{$fileName}.html",
- APPROOT . DS . "PageView"
- . DS . "_{$fileName}.html"
+ APPROOT . "/PageView/" . DIR . "/_{$fileName}.html",
+ APPROOT . "/PageView/" . FILE . "/_{$fileName}.html",
+ APPROOT . "/PageView/" . BASEDIR . "/_{$fileName}.html",
+ APPROOT . "/PageView/" . "_{$fileName}.html"
);
}
@@ -266,12 +262,11 @@ private function bufferPageView($fileName = null) {
*/
private function findDynamicPageView() {
$found = false;
- $lookPath = DIR . DS . FILE;
+ $lookPath = DIR . "/" . FILE;
while($found === false) {
// Find position of last slash in requested page.
- $lastSlash = strrpos($lookPath, DS);
- $dynamicFile = APPROOT . DS . "PageView" . DS
- . $lookPath . DS . "_Dynamic.html";
+ $lastSlash = strrpos($lookPath, "/");
+ $dynamicFile = APPROOT . "/PageView/" . $lookPath . "/_Dynamic.html";
// If found, stop looking.
if(file_exists($dynamicFile)) {
View
3 Framework/Utility/OpenId.utility.php
@@ -13,8 +13,7 @@
* TODO: Docs.
*/
public function __construct($identity = "") {
- require_once(GTROOT . DS . "Framework" . DS . "Utility"
- . DS . "OpenId" . DS . "openid.php");
+ require_once(GTROOT . "/Framework/Utility/OpenId/openid.php");
if(empty($identity)) {
$identity = $this->_defaultIdentity;
View
3 Framework/Utility/SassParser.utility.php
@@ -3,8 +3,7 @@
private $_sassParser;
public function __construct($filePath) {
- require_once(GTROOT . DS . "Framework" . DS . "Utility" . DS . "Sass"
- . DS . "SassParser.php");
+ require_once(GTROOT . "/Framework/Utility/Sass/SassParser.php");
$filePath = preg_replace("/\/+/", "/", $filePath);
if(!file_exists($filePath)) {
return false;
View
2 PageTool/PayPal/PayPal.class.php
@@ -3,7 +3,7 @@
protected $endpoint = '/nvp';
public function __construct(PaypalGateway $gateway) {
- require_once(dirname(__FILE__) . DS . "PayPalGateway.class.php");
+ require_once(dirname(__FILE__) . "/PayPalGateway.class.php");
$this->gateway = $gateway;
}
View
4 PageTool/PayPal/PayPal.tool.php
@@ -11,8 +11,8 @@
* Username, password, API signature, [Optional] Sandbox.
*/
public function go($api, $dom, $template, $tool) {
- require_once(dirname(__FILE__) . DS . "PayPal.class.php");
- require_once(dirname(__FILE__) . DS . "PayPal_ExpressCheckout.class.php");
+ require_once(dirname(__FILE__) . "/PayPal.class.php");
+ require_once(dirname(__FILE__) . "/PayPal_ExpressCheckout.class.php");
$this->_apiUsername = func_get_arg(4);
$this->_apiPassword = func_get_arg(5);
View
9 Test/Framework/Component/DomTest.php
@@ -5,12 +5,9 @@ class DomTest extends PHPUnit_Framework_TestCase {
public function setup() {
define("GTROOT", "/home/g105b/Webroot/PHP.Gt/");
define("DS", DIRECTORY_SEPARATOR);
- require_once(GTROOT . DS . "Framework" . DS
- . "Component" . DS . "Dom.php");
- require_once(GTROOT . DS . "Framework" . DS
- . "Component" . DS . "DomEl.cmp.php");
- require_once(GTROOT . DS . "Framework" . DS
- . "Component" . DS . "DomElCollection.cmp.php");
+ require_once(GTROOT . "/Framework/Component/Dom.php");
+ require_once(GTROOT . "Framework/Component/DomEl.cmp.php");
+ require_once(GTROOT . "Framework/Component/DomElCollection.cmp.php");
}
public function testDomIsDom() {

0 comments on commit 4bbef13

Please sign in to comment.