From aa20eb75b0d8c8b9888628ecb54d8a9def79c2ef Mon Sep 17 00:00:00 2001 From: Makis Tracend Date: Tue, 19 Mar 2024 17:47:38 +1100 Subject: [PATCH] :zap: Object.extend fallback --- app/helpers/template.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/helpers/template.php b/app/helpers/template.php index 4de56ad..57eb390 100644 --- a/app/helpers/template.php +++ b/app/helpers/template.php @@ -264,10 +264,10 @@ function setupClient(){ } function createClient( $dom ){ - $client = ""; + $client = 'if(typeof Object.extend == "undefined") Object.extend = Object.assign;if(!KISSCMS) var KISSCMS = {};'; // see if there is any "loose" source in the client if( !empty($GLOBALS['client']["_src"]) ) { - $client = $GLOBALS['client']["_src"]; + $client .= $GLOBALS['client']["_src"]; unset($GLOBALS['client']["_src"]); } // if in debug, remove any scripts in the require.js paths @@ -291,7 +291,7 @@ function createClient( $dom ){ } // render the global client vars - $client .= 'Object.extend(KISSCMS, '. json_encode_escaped( $GLOBALS['client'] ) .');'; + $client .= 'Object.assign(KISSCMS, '. json_encode_escaped( $GLOBALS['client'] ) .');'; if( $this->useRequire() ){ $client .= 'if(typeof require != "undefined") require.config( KISSCMS["require"] );'; }