Fixes for wordpress frontend
This commit is contained in:
parent
e5f42a129e
commit
90aefd81c9
2 changed files with 47 additions and 12 deletions
35
index.php
35
index.php
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
use PhangoApp\PhaUtils\Utils;
|
use PhangoApp\PhaUtils\Utils;
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
|
||||||
include('libraries/Utils.php');
|
include('libraries/Utils.php');
|
||||||
include('libraries/Routes.php');
|
include('libraries/Routes.php');
|
||||||
|
|
||||||
|
|
@ -27,15 +29,17 @@ if(is_file(__DIR__.'/vendor/autoload.php')) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ob_start();
|
//ob_start();
|
||||||
|
|
||||||
Utils::load_config('config');
|
Utils::load_config('config');
|
||||||
|
|
||||||
if(!PhangoApp\PhaRouter\Config::$get_path_info) {
|
if(!PhangoApp\PhaRouter\Config::$on_other) {
|
||||||
|
|
||||||
|
if(!PhangoApp\PhaRouter\Config::$get_path_info) {
|
||||||
|
|
||||||
$path_info=isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : '';
|
$path_info=isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : '';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
$path_info=str_replace(PhangoApp\PhaRouter\Config::$base_url.'index.php', '', $_SERVER['REQUEST_URI']);
|
$path_info=str_replace(PhangoApp\PhaRouter\Config::$base_url.'index.php', '', $_SERVER['REQUEST_URI']);
|
||||||
|
|
||||||
|
|
@ -45,8 +49,29 @@ else {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
if(!isset($_GET['path_info'])) {
|
||||||
|
|
||||||
|
$path_info='';
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
$path_info=$_GET['path_info'];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
echo \PhangoApp\PhaRouter\get_route($path_info);
|
echo \PhangoApp\PhaRouter\get_route($path_info);
|
||||||
|
|
||||||
ob_end_flush();
|
//ob_end_flush();
|
||||||
|
$final_content=ob_get_contents();
|
||||||
|
|
||||||
|
ob_end_clean();
|
||||||
|
|
||||||
|
echo $final_content;
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,8 @@ class Config {
|
||||||
|
|
||||||
static public $get_path_info=false;
|
static public $get_path_info=false;
|
||||||
|
|
||||||
|
static public $on_other=false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Examples
|
/*Examples
|
||||||
|
|
@ -52,8 +54,12 @@ function get_controller($controller, $args=[]) {
|
||||||
|
|
||||||
echo 'Page not found';
|
echo 'Page not found';
|
||||||
|
|
||||||
|
if(!\PhangoApp\PhaRouter\Config::$on_other) {
|
||||||
|
|
||||||
http_response_code(404);
|
http_response_code(404);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -139,8 +145,12 @@ function get_route($path_info) {
|
||||||
|
|
||||||
echo 'Page not found';
|
echo 'Page not found';
|
||||||
|
|
||||||
|
if(!\PhangoApp\PhaRouter\Config::$on_other) {
|
||||||
|
|
||||||
http_response_code(404);
|
http_response_code(404);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue