Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class WordpressSubdirectoryValetDriver extends BasicValetDriver
- {
- /**
- * Determine if the driver serves the request.
- *
- * @param string $sitePath
- * @param string $siteName
- * @param string $uri
- * @return bool
- */
- public function __construct() {
- $this->subfolder = 'wp';
- }
- public function serves($sitePath, $siteName, $uri)
- {
- return is_dir($sitePath . '/public/' . $this->subfolder . '/wp-admin');
- }
- /**
- * 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['PHP_SELF'] = $uri;
- if (0 === strpos($uri, '/wp/')) {
- return is_dir($sitePath.'/public'.$uri)
- ? $sitePath.'/public'.$uri.'/index.php'
- : $sitePath.'/public'.$uri;
- }
- return $sitePath.'/public/index.php';
- }
- public function isStaticFile($sitePath, $siteName, $uri)
- {
- $staticFilePath = $sitePath.'/public/'.$uri;
- if (file_exists($staticFilePath) && ! is_dir($staticFilePath)) {
- return $staticFilePath;
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement