private function AdjustHtaccess()
    {
        $file = Path::Combine(PHINE_PATH, 'Public/.htaccess');
        if (!File::Exists($file))
        {
            throw new \Exception('HTACCESS FILE $file NOT FOUND');
        }
        $writer = new Writer();
        $rewriter = new Rewriter($writer);
        $text = File::GetContents($file);
        $startPos = strpos($text, (string)$rewriter->PageStartComment($this->page));
        $endPos = false;
        $pageFound = false;
        if ($startPos === false)
        {
            $startPos = strpos($text, (string)$rewriter->EndComment());
            $endPos = $startPos;
        }
        else
        {
            $endPos = strpos($text, (string)$rewriter->PageEndComment($this->page));
            if ($endPos !== false)
            {
                $pageFound = true;
                $endPos += strlen((string)$rewriter->PageEndComment($this->page));
            }
        }
        if ($startPos === false || $endPos === false)
        {
            throw new \Exception("HTACCESS COMMANDS NOT FOUND");
        }
        $rewriter->AddPageCommands($this->page);
        $newText = substr($text, 0, $startPos) . $writer->ToString() . substr($text, $endPos);
        File::CreateWithText($file, $newText);
    }
private function AdjustHtaccess()
    {
        $file = Path::Combine(PHINE_PATH, 'Public/.htaccess');
        if (!File::Exists($file))
        {
            throw new \Exception('HTACCESS FILE $file NOT FOUND');
        }
        $writer = new Writer();
        $rewriter = new Rewriter($writer);
        $text = File::GetContents($file);
        $startPos = strpos($text, (string)$rewriter->PageStartComment($this->page));
        $endPos = false;
        $pageFound = false;
        if ($startPos === false)
        {
            $startPos = strpos($text, (string)$rewriter->EndComment());
            $endPos = $startPos;
        }
        else
        {
            $endPos = strpos($text, (string)$rewriter->PageEndComment($this->page));
            if ($endPos !== false)
            {
                $pageFound = true;
                $endPos += strlen((string)$rewriter->PageEndComment($this->page));
            }
        }
        if ($startPos === false || $endPos === false)
        {
            throw new \Exception("HTACCESS COMMANDS NOT FOUND");
        }
        $rewriter->AddPageCommands($this->page);
        $newText = substr($text, 0, $startPos) . $writer->ToString() . substr($text, $endPos);
        File::CreateWithText($file, $newText);
    }
private function AdjustHtaccess ( ) { $ file = Path :: Combine ( PHINE_PATH , 'Public/.htaccess' ) ; if ( ! File :: Exists ( $ file ) ) { throw new \ Exception ( 'HTACCESS FILE $file NOT FOUND' ) ; } $ writer = new Writer ( ) ; $ rewriter = new Rewriter ( $ writer ) ; $ text = File :: GetContents ( $ file ) ; $ startPos = strpos ( $ text , ( string ) $ rewriter -> PageStartComment ( $ this -> page ) ) ; $ endPos = false ; $ pageFound = false ; if ( $ startPos === false ) { $ startPos = strpos ( $ text , ( string ) $ rewriter -> EndComment ( ) ) ; $ endPos = $ startPos ; } else { $ endPos = strpos ( $ text , ( string ) $ rewriter -> PageEndComment ( $ this -> page ) ) ; if ( $ endPos !== false ) { $ pageFound = true ; $ endPos += strlen ( ( string ) $ rewriter -> PageEndComment ( $ this -> page ) ) ; } } if ( $ startPos === false || $ endPos === false ) { throw new \ Exception ( "HTACCESS COMMANDS NOT FOUND" ) ; } $ rewriter -> AddPageCommands ( $ this -> page ) ; $ newText = substr ( $ text , 0 , $ startPos ) . $ writer -> ToString ( ) . substr ( $ text , $ endPos ) ; File :: CreateWithText ( $ file , $ newText ) ; }
Adds necessary rewrite commands
Adds necessary rewrite commands