diff --git a/html/class/template.php b/html/class/template.php index 76ddbd5a4..68923f299 100644 --- a/html/class/template.php +++ b/html/class/template.php @@ -11,7 +11,6 @@ * @license GPL 2.0 */ - if (!defined('SMARTY_DIR')) { exit(); } @@ -41,7 +40,8 @@ public function __construct() if (1 == $xoopsConfig['theme_fromfile']) { $this->_canUpdateFromFile = true; $this->compile_check = false; /* This should be set to false on an active site*/ - $this->force_compile = true; + $this->force_compile = true; /* This setting overrides $compile_check. By default this is FALSE. + This is handy for development and debugging. It should never be used in a production environment.*/ } else { $this->_canUpdateFromFile = false; $this->compile_check = false; @@ -52,13 +52,27 @@ public function __construct() $this->template_dir = XOOPS_THEME_PATH; $this->cache_dir = XOOPS_CACHE_PATH; $this->compile_dir = XOOPS_COMPILE_PATH; - //loading under root_path for compatibility with XCL2.1 + //Loading under root_path for compatibility with XCL2.1 //$this->plugins_dir = [SMARTY_DIR . 'plugins', XOOPS_ROOT_PATH . '/class/smarty/plugins']; $this->plugins_dir = [SMARTY_DIR . 'plugins']; - + // Legacy_RenderSystem // $this->default_template_handler_func = 'xoops_template_create'; $this->use_sub_dirs = false; - + + // Legacy compatility requirement for development and debugging of templates + // Because D3 modules can use XoopsTpl class without Cube's boot + if (isset($GLOBALS['xoopsUserIsAdmin'])) { + $isadmin['xoops_isadmin']=$GLOBALS['xoopsUserIsAdmin']; + }else{ + $isadmin['xoops_isadmin']=false; + } + // Render System - get config preferences e.g. logotype, favicon + // for D3 modules who don't delegate XoopsTpl.New + $moduleHandler = xoops_gethandler('module'); + $legacyRender =& $moduleHandler->getByDirname('legacyRender'); + $configHandler = xoops_gethandler('config'); + $configs =& $configHandler->getConfigsByCat(0, $legacyRender->get('mid')); + $this->assign( [ 'xoops_url' => XOOPS_URL, @@ -66,7 +80,10 @@ public function __construct() 'xoops_langcode' => _LANGCODE, 'xoops_charset' => _CHARSET, 'xoops_version' => XOOPS_VERSION, - 'xoops_upload_url' => XOOPS_UPLOAD_URL + 'xoops_upload_url' => XOOPS_UPLOAD_URL, + 'xoops_isadmin' => $isadmin, + 'logotype' => $configs['logotype'], + 'favicon' => $configs['favicon'] ] ); @@ -191,7 +208,7 @@ public function xoops_fetchFromData(&$data) } /** - * + * _canUpdateFromFile **/ public function xoops_canUpdateFromFile() { diff --git a/html/modules/legacy/admin/theme/site.webmanifest b/html/modules/legacy/admin/theme/site.webmanifest deleted file mode 100644 index 40ffdb90a..000000000 --- a/html/modules/legacy/admin/theme/site.webmanifest +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "XCL App", - "short_name": "XCL App", - "icons": [ - { - "src": "./design/android-chrome-192x192.png", - "sizes": "192x192", - "type": "image/png" - }, - { - "src": "./design/android-chrome-512x512.png", - "sizes": "512x512", - "type": "image/png" - } - ], - "theme_color": "#212527", - "background_color": "#212527", - "start_url": "./index.php?utm_source=homescreen", - "display": "standalone" -} diff --git a/html/modules/legacy/kernel/Legacy_Controller.class.php b/html/modules/legacy/kernel/Legacy_Controller.class.php index 88487037b..cd92308a0 100644 --- a/html/modules/legacy/kernel/Legacy_Controller.class.php +++ b/html/modules/legacy/kernel/Legacy_Controller.class.php @@ -1,11 +1,11 @@ isEnableCache() && $this->existActiveCacheFile($filepath, $blockProcedure->getCacheTime())) { $content = $this->loadCache($filepath); if ($blockProcedure->isDisplay() && !empty($content)) { @@ -434,7 +434,7 @@ public function _processBlock() if ($blockProcedure->isDisplay()) { $renderBuffer =& $blockProcedure->getRenderTarget(); // Note : version 2.3.0 - // @gigamaster added 'getTemplate' for block link in theme + // @gigamaster added 'getTemplate' to link block in front theme $context->mAttributes['legacy_BlockShowFlags'][$blockProcedure->getEntryIndex()] = true; $context->mAttributes['legacy_BlockContents'][$blockProcedure->getEntryIndex()][] = [ 'name' => $blockProcedure->getName(), @@ -1218,7 +1218,7 @@ public function executeRedirect($url, $time = 1, $message = null, $addRedirect = // @TODO test XOOPS2 Compatibility $addredirect = true -// TODO uncomment line 1195 + // TODO uncomment to test // $addRedirect = $addredirect = true; if ($addRedirect && strpos($url, 'user.php') !== false) { @@ -1246,13 +1246,8 @@ public function executeRedirect($url, $time = 1, $message = null, $addRedirect = /* XCL 2.3.x * @gigamaster added theme_set, theme_url and theme_css (custom templates from theme) - * @gigamaster added logotype, use $configs for LegacyRender + * also Render configs for X2 and D3 compatibility, refer to /class/template.php */ - $moduleHandler = xoops_gethandler('module'); - $legacyRender =& $moduleHandler->getByDirname('legacyRender'); - $configHandler = xoops_gethandler('config'); - $configs =& $configHandler->getConfigsByCat(0, $legacyRender->get('mid')); - if (!defined('XOOPS_CPFUNC_LOADED')) { require_once XOOPS_ROOT_PATH.'/class/template.php'; $xoopsTpl = new XoopsTpl(); @@ -1263,7 +1258,6 @@ public function executeRedirect($url, $time = 1, $message = null, $addRedirect = 'theme_set' =>htmlspecialchars($xoopsConfig['theme_set'], ENT_QUOTES), 'theme_url' =>XOOPS_THEME_URL . '/' . $xoopsConfig['theme_set'], 'theme_css' =>getcss(), - 'logotype' =>$configs['logotype'], 'langcode' =>_LANGCODE, 'charset' =>_CHARSET, 'time' =>$time, @@ -1274,7 +1268,7 @@ public function executeRedirect($url, $time = 1, $message = null, $addRedirect = ); $GLOBALS['xoopsModuleUpdate'] = 1; - $xoopsTpl->display('db:system_redirect.html'); // TODO gigamaster + $xoopsTpl->display('db:system_redirect.html'); // Legacy compatibility } else { @@ -1501,7 +1495,7 @@ public function setupModuleContext(&$context, $dirname) if (!is_object($module)) { XCube_DelegateUtils::call('Legacy.Event.Exception.XoopsModuleNotFound', $dirname); - $this->mController->executeRedirect(XOOPS_URL . '/', 1, 'You can\'t access this URL.'); // TODO need message catalog. + $this->mController->executeRedirect(XOOPS_URL . '/', 1, 'You can\'t access this URL.'); // TODO need message catalog. die(); } diff --git a/html/modules/legacy/preload/Primary/SiteClose.class.php b/html/modules/legacy/preload/Primary/SiteClose.class.php index 37361e83c..55f8d2747 100644 --- a/html/modules/legacy/preload/Primary/SiteClose.class.php +++ b/html/modules/legacy/preload/Primary/SiteClose.class.php @@ -56,6 +56,9 @@ public static function callbackSetupUser(&$principal, &$controller, &$context) /* XCL 2.3.x * @gigamaster added theme_set, theme_url and theme_css (custom templates from theme) * @gigamaster added logotype, use $configs for LegacyRender + * + * Render System - get config preferences e.g. logotype, footer + * for D3 modules who don't delegate XoopsTpl.New */ $moduleHandler = xoops_gethandler('module'); $legacyRender =& $moduleHandler->getByDirname('legacyRender'); @@ -78,6 +81,7 @@ public static function callbackSetupUser(&$principal, &$controller, &$context) 'lang_password' => _PASSWORD, 'lang_siteclosemsg' => $xoopsConfig['closesite_text'], 'logotype' => $configs['logotype'], + 'favicon' => $configs['favicon'], 'footer' => $configs['footer'] ] ); diff --git a/html/modules/legacyRender/admin/actions/AdminRenderAction.class.php b/html/modules/legacyRender/admin/actions/AdminRenderAction.class.php index be1ac32f8..c0e97f896 100644 --- a/html/modules/legacyRender/admin/actions/AdminRenderAction.class.php +++ b/html/modules/legacyRender/admin/actions/AdminRenderAction.class.php @@ -25,7 +25,8 @@ public function executeViewSuccess(&$controller, &$xoopsUser, &$render) $xoopsConfig = $controller->mRoot->mContext->getXoopsConfig(); $mRoot = $controller->mRoot; $mContext = $mRoot->mContext; - + + // Render System - get configurations categories $moduleHandler = xoops_gethandler('module'); $legacyRender =& $moduleHandler->getByDirname('legacyRender'); $configHandler = xoops_gethandler('config'); diff --git a/html/modules/legacyRender/admin/templates/admin_render.html b/html/modules/legacyRender/admin/templates/admin_render.html index b32a7afcc..001c5fe35 100644 --- a/html/modules/legacyRender/admin/templates/admin_render.html +++ b/html/modules/legacyRender/admin/templates/admin_render.html @@ -99,12 +99,11 @@

Render <{$smarty.const._CPHOME}>

Smarty Template Engine
-

The Web Application Platform Renderer uses Smarty Template Engine to provide data to FrontEnd and BackEnd.
- You can edit both, FrontEnd and BackEnd theme and templates with HTML, CSS, JavaScript and of course some
+

The Web Application Platform Renderer uses Smarty Template Engine for the Frontend and Backend.
+ You can edit both, Frontend and Backend themes and templates with HTML, CSS, JavaScript and of course some
Smarty code to add logic, dynamic data, and personalization rules to your templates.

-

This overview provides basic information of the Render syntax built on Smarty
- to help you get started with Smarty theme and template files. +

This overview provides basic information to help you get started with the Render syntax built on Smarty.

@@ -117,26 +116,43 @@

Render Engine

Default Themes

-

The system default theme for the frontend uses the suffix _default
- While the default admin theme for the backend uses a prefix admin_

+

The default theme for the frontend uses the suffix _default _default
+ While the default backend admin theme uses a prefix admin_

- +
You can put a custom backend theme with prefix admin_ in directory /themes e.g. /html/themes/admin_theme

Custom Theme

-

A custom theme can inherit the functionality, features, and style of the default theme and default template-set.
- You can copy to your custom theme only the templates you need to customize without making any changes to default set.

-

Custom themes can save time and effort, they are also a safer solution because of the automatic fallback to default settings.

The Smarty tags defined here are needed for the Core Render and components to work properly!
- When making a custom theme, you should base it on the following Smarty Engine variables.

- -
+ When making a custom theme, you should base it on the following logic and Smarty Engine variables.

+ +

Each installed module has a number of templates. These templates are automatically added to the default template set. +

A custom theme inherits the functionality, features, and style of the default set.

+ +

It is recommended to duplicate the default template set before any customization. You can do it from the Admin using the following modules:
+

+ +

In order to customize modules templates or blocks templates (prefix block_)

+ +

Custom themes can save time and effort, they are also a safer solution because of the automatic fallback to default settings.

+ +

Default Templates

@@ -152,15 +168,32 @@

Default Templates

However, the extension .tpl is used for email templates by convention.

It is recommended to not edit the default version of these templates !
- Make a copy of the default template-set in Template Management to customize.
+ First, clone the default template set in Template Management.

You can put a copy of default templates in the theme directory e.g.: /themes/theme_name/templates/module_name/
it was /theme_name/modules/templates/ prior to version 2.3.x

- <{* Help documentation on "How To Create a Custom Theme") for more details *}> + + <{* Help documentation on "How To Create a Custom Theme") for more details *}> + +

Template Syntax

+ +

Smarty uses a markup-like syntax which is similar to HTML tags.
+ The tags are shorter and more readable than embedding plain PHP on pages.

+ +

Tag delimiters

+ +

All Smarty tags, variables and functions start with a left delimiter curly bracket { and end with a right curly bracket } within <> like HTML.

+ +
The Renderer implementation of Smarty uses custom delimiters <{ ... }>
+ instead of Smarty code enclosed in curly brace tag delimiters {$var} of the official documentation.
+ +

The Render engine will handle the delimiters present in Theme and templates to generate valid HTML. +

+
-
+

-// XCube module directory tree
+// XCube module admin directory tree
 
 module-name
 ├── admin
@@ -174,23 +207,22 @@ 

Default Templates

└── components [optional]
-
-
- -

Template Syntax

- -

Smarty uses a markup-like syntax which is similar to HTML tags.
- The tags are shorter and more readable than embedding plain PHP on pages.

+
+

+// D3 in module TRUST_PATH directory
 
-    

Tag delimiters

+module-name * +└── templates + ├── blocks + ├── components [optional] + └── stylesheets [optional] -

All Smarty tags, variables and functions start with a left delimiter curly bracket { and end with a right curly bracket } within <> like HTML.

+* D3 duplicatable modules D4Forum, Pico +
+ -
The Renderer implementation of Smarty uses custom delimiters <{ ... }>
- instead of Smarty code enclosed in curly brace tag delimiters {$var} of the official documentation.
+ -

The Render engine will handle the delimiters present in Theme and templates to generate valid HTML. -

Template Variables

@@ -234,8 +266,8 @@

Template Variables

- - + + @@ -316,23 +348,23 @@

Template Variables

Twitter Developer Platform <{$ilink}> - - - - - - + + + + + + - + - + @@ -348,12 +380,12 @@

Template Variables

- + - + @@ -387,6 +419,9 @@
Database

Example from D3 module

<{include file="db:`$mydirname`_inc_breadcrumbs.html"}>
+
Conditional inclusion of subtemplates
+
<{include_if_exists file="foo.html" else="bar.html"}>
+

Block

The block loop indicates a position, however it is just a legacy code convention to identify areas in the theme layout.
diff --git a/html/modules/legacyRender/kernel/Legacy_RenderSystem.class.php b/html/modules/legacyRender/kernel/Legacy_RenderSystem.class.php index 8225c7188..e86a66e95 100644 --- a/html/modules/legacyRender/kernel/Legacy_RenderSystem.class.php +++ b/html/modules/legacyRender/kernel/Legacy_RenderSystem.class.php @@ -36,11 +36,6 @@ class Legacy_XoopsTpl extends XoopsTpl public $_mContextReserve = ['xoops_pagetitle' => 'legacy_pagetitle']; //public $_mContextReserve = []; -// public function Legacy_XoopsTpl() -// { -// $this->__construct(); -// } - public function __construct() { //$this->_mContextReserve = ['xoops_pagetitle' => 'legacy_pagetitle']; @@ -181,6 +176,9 @@ public function prepare(&$controller) $mTpl->xoops_setDebugging(true); } + if (isset($GLOBALS['xoopsUserIsAdmin'])) { + $isadmin['xoops_isadmin']=$GLOBALS['xoopsUserIsAdmin']; + } $mTpl->assign( [ 'xoops_requesturi' => htmlspecialchars($GLOBALS['xoopsRequestUri'], ENT_QUOTES), //@todo ????????????? @@ -268,7 +266,7 @@ public function _commonPrepareRender() $root =& $this->mController->mRoot; $context =& $root->getContext(); $textFilter =& $root->getTextFilter(); - // @gigamaster themename + // @gigamaster get theme name $themeName = $context->getThemeName(); $vars = [ 'xoops_theme' =>$themeName, @@ -276,8 +274,8 @@ public function _commonPrepareRender() 'xoops_themecss' =>xoops_getcss($themeName), 'xoops_sitename' =>$textFilter->toShow($context->getAttribute('legacy_sitename')), 'xoops_pagetitle' =>$textFilter->toShow($context->getAttribute('legacy_pagetitle')), - 'xoops_slogan' =>$textFilter->toShow($context->getAttribute('legacy_slogan')), - 'xoops_dirname' => '' + 'xoops_slogan' =>$textFilter->toShow($context->getAttribute('legacy_slogan')), + 'xoops_dirname' => '' ]; // @@ -405,6 +403,8 @@ public function renderTheme(&$target) $vars['xoops_module_header'] = $moduleHeader; $vars['module_header'] = $moduleHeader; // xcl 2.3.x + // gigamaster assign Render configs logotype, favicon + // in /class/template.php for X3 D3 compatibility $moduleHandler = xoops_gethandler('module'); $legacyRender =& $moduleHandler->getByDirname('legacyRender'); $configHandler = xoops_gethandler('config'); @@ -425,8 +425,6 @@ public function renderTheme(&$target) // Extra Meta App ID $vars['xoops_meta_fb_app'] = $textFilter->toShow($headerScript->getMeta('fb:app_id') ?: $configs['meta_fb_app']); $vars['xoops_meta_twitter_site'] = $textFilter->toShow($headerScript->getMeta('twitter:site') ?: $configs['meta_twitter_site']); - // main - $vars['logotype'] = $configs['logotype']; // footer may be raw HTML text. $vars['xoops_footer'] = $configs['footer']; diff --git a/html/modules/legacyRender/language/english/modinfo.php b/html/modules/legacyRender/language/english/modinfo.php index 8413ad059..9b757a771 100644 --- a/html/modules/legacyRender/language/english/modinfo.php +++ b/html/modules/legacyRender/language/english/modinfo.php @@ -56,6 +56,6 @@ define( '_MI_LR_ICONSET' , 'Directory for icon set files'); define( '_MI_LR_ICONSET_DESC' , 'Relative path to public/common/images. Default: icons'); define( '_MI_LR_FAVICON' , "Favicon - png or svg images"); -define( '_MI_LR_FAVICON_DESC' , "Note: The favicon must be a multiple of 48px square e.g. 48x48px, 96x96px, 144x144px and so on.
SVG files don't have a specific size. Root-relative hyperlink (e.g. https://example.com). Default: /favicon.svg"); +define( '_MI_LR_FAVICON_DESC' , 'SVG favicon has gained support in major browsers, visit Caniuse ↗ 🌐
Read more from the root-relative hyperlink (e.g. https://example.com/images/favicon). Default: /images/favicon/favicon.svg'); define( '_MI_LR_LOGO' , 'Logotype or logomark that represents your brand or website'); define( '_MI_LR_LOGO_DESC' , 'Root-relative hyperlink (e.g. https://example.com). Default: /images/logo.png'); diff --git a/html/modules/legacyRender/xoops_version.php b/html/modules/legacyRender/xoops_version.php index 457d8fa4f..ce622284d 100644 --- a/html/modules/legacyRender/xoops_version.php +++ b/html/modules/legacyRender/xoops_version.php @@ -51,7 +51,7 @@ 'description' => '_MI_LR_FAVICON_DESC', 'formtype' => 'textbox', 'valuetype' => 'text', - 'default' => XOOPS_URL . '/favicon.svg' + 'default' => XOOPS_URL . '/images/favicon/favicon.svg' ]; $modversion['config'][]= [

X2 ThemesXCL ThemesX2 / XCL ThemesXRENDER V3 Output
<{$favicon}>
<{$favicon}>
<{$logotype}>
<{$logotype}>
<{$logotype}>
<{$favicon}>
<{$favicon}>
<{$favicon}>
<{$xoops_module_header}>
<{$library}>
CSS style and JavaScript added by module header
<{$xoops_block_header}>
<{$framework}>
CSS style and JavaScript added by block
<{$xoops_version}>
<{$app_version}>
<{$app_version}><{$xoops_version}>
<{$xoops_upload_url}>
<{$upload_url}>
<{$upload_url}><{$xoops_upload_url}>
<{$xoops_banner}>