Created
April 23, 2018 06:15
-
-
Save floriangaechter/60c8013d45800325e1d9a2a9c22104e6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<?php | |
class ClarifyValetDriver extends ValetDriver | |
{ | |
/** | |
* Determine if the driver serves the request. | |
* | |
* @param string $sitePath | |
* @param string $siteName | |
* @param string $uri | |
* @return bool | |
*/ | |
public function serves($sitePath, $siteName, $uri) | |
{ | |
return file_exists($sitePath.'/public/index.php') && | |
file_exists($sitePath.'/.frontify'); | |
} | |
/** | |
* Determine if the incoming request is for a static file. | |
* | |
* @param string $sitePath | |
* @param string $siteName | |
* @param string $uri | |
* @return string|false | |
*/ | |
public function isStaticFile($sitePath, $siteName, $uri) | |
{ | |
if (file_exists($staticFilePath = $sitePath.'/public'.$uri) && !is_dir($staticFilePath)) { | |
return $staticFilePath; | |
} | |
return false; | |
} | |
/** | |
* Get the fully resolved path to the application's front controller. | |
* | |
* @param string $sitePath | |
* @param string $siteName | |
* @param string $uri | |
* @return string | |
*/ | |
public function frontControllerPath($sitePath, $siteName, $uri) | |
{ | |
$_SERVER['SCRIPT_NAME'] = '/index.php'; | |
$_SERVER['PHP_SELF'] = '/index.php'; | |
if (file_exists($sitePath.'/public'.$uri) && !is_dir($sitePath.'/public'.$uri)) { | |
return $sitePath.'/public'.$uri; | |
} | |
if(is_dir($sitePath.'/public'.$uri)) { | |
return $sitePath.'/public'.$uri.'/index.php'; | |
} | |
return $sitePath.'/public/index.php'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment