_escaped_fragment support for sai, advanced support for that seo feature
This commit is contained in:
parent
9b74439f85
commit
45fd16f2a6
@ -6,13 +6,15 @@ abstract class api_default extends api_system {
|
|||||||
//https://developers.google.com/webmasters/ajax-crawling/docs/getting-started
|
//https://developers.google.com/webmasters/ajax-crawling/docs/getting-started
|
||||||
//mojotrollz.eu:80/web/flingit/?_escaped_fragment_=start%3Bhash.ce5504f67533ab3d881a32e1dcdd330aaeb27f19
|
//mojotrollz.eu:80/web/flingit/?_escaped_fragment_=start%3Bhash.ce5504f67533ab3d881a32e1dcdd330aaeb27f19
|
||||||
public static function static__escaped_fragment_($_escaped_fragment_){
|
public static function static__escaped_fragment_($_escaped_fragment_){
|
||||||
$state = \SYSTEM\PAGE\State::get(1, $_escaped_fragment_,false);
|
|
||||||
$html = new \DOMDocument();
|
$html = new \DOMDocument();
|
||||||
$html->loadHTML(static::default_page()->html($_escaped_fragment_));
|
$html->loadHTML(static::default_page($_escaped_fragment_));
|
||||||
|
$state = \SYSTEM\PAGE\State::get(static::get_apigroup(), $_escaped_fragment_,false);
|
||||||
foreach($state as $row){
|
foreach($state as $row){
|
||||||
$frag = new \DOMDocument();
|
$frag = new \DOMDocument();
|
||||||
parse_str(\parse_url($row['url'],PHP_URL_QUERY), $params);
|
parse_str(\parse_url($row['url'],PHP_URL_QUERY), $params);
|
||||||
$frag->loadHTML(\SYSTEM\API\api::run('\SYSTEM\API\verify', static::get_class(), $params, 1, true, true)->html());
|
$class = static::get_class($params);
|
||||||
|
if($class){
|
||||||
|
$frag->loadHTML(\SYSTEM\API\api::run('\SYSTEM\API\verify', $class, static::get_params($params), static::get_apigroup(), true, false));
|
||||||
$html->getElementById(substr($row['div'], 1))->appendChild($html->importNode($frag->documentElement, true));
|
$html->getElementById(substr($row['div'], 1))->appendChild($html->importNode($frag->documentElement, true));
|
||||||
//Load subpage css
|
//Load subpage css
|
||||||
foreach($row['css'] as $css){
|
foreach($row['css'] as $css){
|
||||||
@ -21,12 +23,17 @@ abstract class api_default extends api_system {
|
|||||||
$html->getElementsByTagName('head')[0]->appendChild($html->importNode($css_frag->documentElement,true));
|
$html->getElementsByTagName('head')[0]->appendChild($html->importNode($css_frag->documentElement,true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
echo $html->saveHTML();
|
echo $html->saveHTML();
|
||||||
|
new \SYSTEM\LOG\COUNTER("API was called sucessfully.");
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
public static function get_apigroup(){
|
||||||
public static function get_class(){
|
throw new \RuntimeException("Unimplemented");}
|
||||||
|
public static function get_class($params = null){
|
||||||
return self::class;}
|
return self::class;}
|
||||||
|
public static function get_params($params){
|
||||||
|
return $params;}
|
||||||
|
|
||||||
public static function default_page($_escaped_fragment_ = null){
|
public static function default_page($_escaped_fragment_ = null){
|
||||||
throw new \RuntimeException("Unimplemented");}
|
throw new \RuntimeException("Unimplemented");}
|
||||||
|
|||||||
@ -5,6 +5,7 @@ INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `nam
|
|||||||
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (1, 42, 1, 0, NULL, 'js', NULL);
|
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (1, 42, 1, 0, NULL, 'js', NULL);
|
||||||
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (2, 42, 1, 0, NULL, 'css', NULL);
|
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (2, 42, 1, 0, NULL, 'css', NULL);
|
||||||
-- INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (3, 42, 0, 0, NULL, 'page', NULL);
|
-- INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (3, 42, 0, 0, NULL, 'page', NULL);
|
||||||
|
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (5, 42, 4, -1, NULL, '_escaped_fragment_', 'STRING');
|
||||||
|
|
||||||
-- system_api
|
-- system_api
|
||||||
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (10, 42, 0, -1, NULL, 'call', NULL);
|
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (10, 42, 0, -1, NULL, 'call', NULL);
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
Welcome to the SYSTEM Admin Interface - short SAI.</br>
|
Welcome to the SYSTEM Admin Interface - short SAI.<br/>
|
||||||
From here you can control and manage your Website.
|
From here you can control and manage your Website.
|
||||||
|
|
||||||
<div id="project">
|
<div id="project">
|
||||||
|
|||||||
@ -2,6 +2,6 @@
|
|||||||
<h3 class="muted">Design. Simple. Fast. Reliable. Innovative.</h3>
|
<h3 class="muted">Design. Simple. Fast. Reliable. Innovative.</h3>
|
||||||
<h4 class="text-info">We write awesome code and we use <a href="https://github.com/ulfgebhardt/system">SYSTEM</a> and <a href="http://getbootstrap.com/">Twitter Bootstrap.</a></h4>
|
<h4 class="text-info">We write awesome code and we use <a href="https://github.com/ulfgebhardt/system">SYSTEM</a> and <a href="http://getbootstrap.com/">Twitter Bootstrap.</a></h4>
|
||||||
</div>
|
</div>
|
||||||
<div id="content" style="float:left; width: auto;">${content}</div>
|
<div id="content_saistart" style="float:left; width: auto;">${content}</div>
|
||||||
<div class="well" id="login" style="position: fixed; top: 80px; right: 20px; width:220px;">${login}</div>
|
<div class="well" id="login" style="position: fixed; top: 80px; right: 20px; width:220px;">${login}</div>
|
||||||
<div style="clear:both;"></div>
|
<div style="clear:both;"></div>
|
||||||
@ -1,9 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace SYSTEM\SAI;
|
namespace SYSTEM\SAI;
|
||||||
|
|
||||||
class default_page extends \SYSTEM\PAGE\Page {
|
class default_page extends \SYSTEM\PAGE\Page {
|
||||||
|
|
||||||
private static function menu_sys(){
|
private static function menu_sys(){
|
||||||
$result = '';
|
$result = '';
|
||||||
|
|
||||||
@ -36,7 +33,7 @@ class default_page extends \SYSTEM\PAGE\Page {
|
|||||||
|
|
||||||
private static function css(){
|
private static function css(){
|
||||||
$result = '<link rel="stylesheet" href="'.\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'page/css/libs/bootstrap.min.css').'" type="text/css" />'.
|
$result = '<link rel="stylesheet" href="'.\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'page/css/libs/bootstrap.min.css').'" type="text/css" />'.
|
||||||
'<link rel="stylesheet" href="./api.php?call=files&cat=sys&id=system.css" type="text/css" />'.
|
'<link rel="stylesheet" href="./api.php?call=files&cat=sys&id=system.css" type="text/css" />'.
|
||||||
'<link rel="stylesheet" href="'.\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'page/css/sai.css').'" type="text/css" />';
|
'<link rel="stylesheet" href="'.\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'page/css/sai.css').'" type="text/css" />';
|
||||||
//'<link rel="stylesheet" href="'.\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'page/css/sai_table.css').'" type="text/css" />';
|
//'<link rel="stylesheet" href="'.\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'page/css/sai_table.css').'" type="text/css" />';
|
||||||
return $result;
|
return $result;
|
||||||
@ -45,10 +42,10 @@ class default_page extends \SYSTEM\PAGE\Page {
|
|||||||
private static function js(){
|
private static function js(){
|
||||||
$result = '<script src="'.\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'page/js/libs/jquery.min.js').'" type="text/javascript"></script>'.
|
$result = '<script src="'.\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'page/js/libs/jquery.min.js').'" type="text/javascript"></script>'.
|
||||||
'<script src="'.\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'page/js/libs/bootstrap.min.js').'" type="text/javascript"></script>'.
|
'<script src="'.\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'page/js/libs/bootstrap.min.js').'" type="text/javascript"></script>'.
|
||||||
'<script type="text/javascript" language="JavaScript" src="./api.php?call=files&cat=sys&id=system.js"></script>'.
|
'<script type="text/javascript" language="JavaScript" src="./api.php?call=files&cat=sys&id=system.js"></script>'.
|
||||||
'<script src="'.\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'page/js/sai.js').'" type="text/javascript"></script>'.
|
'<script src="'.\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'page/js/sai.js').'" type="text/javascript"></script>'.
|
||||||
'<script src="https://www.google.com/jsapi" type="text/javascript"></script>'.
|
'<script src="https://www.google.com/jsapi" type="text/javascript"></script>'.
|
||||||
'<script src="https://maps.google.com/maps/api/js?v=3&sensor=false" type="text/javascript"></script>'.
|
'<script src="https://maps.google.com/maps/api/js?v=3&sensor=false" type="text/javascript"></script>'.
|
||||||
'<script type="text/javascript">google.load("visualization", "1", {packages:["corechart"]});</script>'.
|
'<script type="text/javascript">google.load("visualization", "1", {packages:["corechart"]});</script>'.
|
||||||
'<script src="'.\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_text/tinymce/tinymce.min.js').'" type="text/javascript"></script>';
|
'<script src="'.\SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_text/tinymce/tinymce.min.js').'" type="text/javascript"></script>';
|
||||||
return $result;
|
return $result;
|
||||||
@ -67,19 +64,20 @@ class default_page extends \SYSTEM\PAGE\Page {
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function html(){
|
public function html($_escaped_fragment_ = NULL){
|
||||||
|
|
||||||
$vars = array();
|
$vars = array();
|
||||||
$vars['css'] = $this->css();
|
$vars['css'] = self::css();
|
||||||
$vars['js'] = $this->js();
|
$vars['js'] = '';
|
||||||
|
if(!$_escaped_fragment_){
|
||||||
|
$vars['js'] = self::js();}
|
||||||
$vars['menu_start'] = self::menu_start();
|
$vars['menu_start'] = self::menu_start();
|
||||||
$vars['menu_sys'] = self::menu_sys();
|
$vars['menu_sys'] = self::menu_sys();
|
||||||
$vars['menu_proj'] = self::menu_proj();
|
$vars['menu_proj'] = self::menu_proj();
|
||||||
$vars['navimg'] = \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_SAI_CONFIG_NAVIMG);
|
$vars['navimg'] = \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_SAI_CONFIG_NAVIMG);
|
||||||
$vars['title'] = \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_SAI_CONFIG_TITLE);
|
$vars['title'] = \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_SAI_CONFIG_TITLE);
|
||||||
$vars['copyright'] = \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_SAI_CONFIG_COPYRIGHT);
|
$vars['copyright'] = \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_SAI_CONFIG_COPYRIGHT);
|
||||||
$vars['lang_switcher'] = self::lang_switcher();
|
//$vars['lang_switcher'] = self::lang_switcher();
|
||||||
|
$vars['lang_switcher'] = '';
|
||||||
$vars['PATH_LOCAL_IMG'] = \SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'page/img/');
|
$vars['PATH_LOCAL_IMG'] = \SYSTEM\WEBPATH(new \SYSTEM\PSAI(),'page/img/');
|
||||||
|
|
||||||
$vars = array_merge($vars,\SYSTEM\locale::getStrings(\SYSTEM\DBD\system_locale_string::VALUE_CATEGORY_SYSTEM_SAI));
|
$vars = array_merge($vars,\SYSTEM\locale::getStrings(\SYSTEM\DBD\system_locale_string::VALUE_CATEGORY_SYSTEM_SAI));
|
||||||
|
|||||||
@ -1,12 +1,29 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace SYSTEM\SAI;
|
namespace SYSTEM\SAI;
|
||||||
|
|
||||||
class SaiModule extends \SYSTEM\API\api_system{
|
class SaiModule extends \SYSTEM\API\api_default{
|
||||||
public static function default_page(){
|
public static function get_apigroup(){
|
||||||
$sai = new \SYSTEM\SAI\default_page();
|
return 42;}
|
||||||
return $sai->html();}
|
public static function get_class($params = NULL){
|
||||||
|
if(isset($params[\SYSTEM\SAI\saigui::SAI_MOD_POSTFIELD])){
|
||||||
|
$classname = \str_replace('.', '\\', $params[\SYSTEM\SAI\saigui::SAI_MOD_POSTFIELD]);
|
||||||
|
$mods = \SYSTEM\SAI\sai::getAllModules();
|
||||||
|
if( $classname &&
|
||||||
|
\array_search($classname, $mods) !== false &&
|
||||||
|
( \call_user_func(array($classname, 'right_public')) ||
|
||||||
|
\call_user_func(array($classname, 'right_right')))){
|
||||||
|
return $classname;
|
||||||
|
} else {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return self::class;
|
||||||
|
}
|
||||||
|
public static function get_params($params){
|
||||||
|
$params[\SYSTEM\SAI\saigui::SAI_MOD_POSTFIELD] = \str_replace('.', '_', $params[\SYSTEM\SAI\saigui::SAI_MOD_POSTFIELD]);
|
||||||
|
return $params;}
|
||||||
|
public static function default_page($_escaped_fragment_ = null){
|
||||||
|
return (new \SYSTEM\SAI\default_page())->html($_escaped_fragment_);}
|
||||||
public static function html_li_menu(){
|
public static function html_li_menu(){
|
||||||
throw new \RuntimeException("Unimplemented!");}
|
throw new \RuntimeException("Unimplemented!");}
|
||||||
//true or false -> if true no call to right_right()
|
//true or false -> if true no call to right_right()
|
||||||
|
|||||||
@ -1,9 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace SYSTEM\SAI;
|
namespace SYSTEM\SAI;
|
||||||
|
|
||||||
define('SAI_MOD_POSTFIELD','sai_mod');
|
|
||||||
|
|
||||||
class saigui extends \SYSTEM\PAGE\Page {
|
class saigui extends \SYSTEM\PAGE\Page {
|
||||||
|
const SAI_MOD_POSTFIELD = 'sai_mod';
|
||||||
|
|
||||||
public function html(){
|
public function html(){
|
||||||
\SYSTEM\SECURITY\Security::isLoggedIn(); // refresh session
|
\SYSTEM\SECURITY\Security::isLoggedIn(); // refresh session
|
||||||
@ -11,9 +9,9 @@ class saigui extends \SYSTEM\PAGE\Page {
|
|||||||
$pg = json_decode(file_get_contents("php://input"), true);
|
$pg = json_decode(file_get_contents("php://input"), true);
|
||||||
if(!$pg){
|
if(!$pg){
|
||||||
$pg = array_merge($_POST,$_GET);}
|
$pg = array_merge($_POST,$_GET);}
|
||||||
if(isset($pg[SAI_MOD_POSTFIELD])){
|
if(isset($pg[self::SAI_MOD_POSTFIELD])){
|
||||||
$classname = \str_replace('.', '\\', $pg[SAI_MOD_POSTFIELD]);
|
$classname = \str_replace('.', '\\', $pg[self::SAI_MOD_POSTFIELD]);
|
||||||
$pg[SAI_MOD_POSTFIELD] = \str_replace('.', '_', $pg[SAI_MOD_POSTFIELD]);
|
$pg[self::SAI_MOD_POSTFIELD] = \str_replace('.', '_', $pg[self::SAI_MOD_POSTFIELD]);
|
||||||
|
|
||||||
$mods = \SYSTEM\SAI\sai::getAllModules();
|
$mods = \SYSTEM\SAI\sai::getAllModules();
|
||||||
if( $classname &&
|
if( $classname &&
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user