From b99ee16d88573fcafa7b1ed4578cdc7650e5ba19 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Sat, 21 Nov 2009 02:39:04 +0000 Subject: [PATCH] ENHANCEMENT Removed CMSMain->jsDeclaration(), it was replicating functionality already present in Convert::raw2js() git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@92671 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- code/CMSMain.php | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/code/CMSMain.php b/code/CMSMain.php index 3e3af84e51..adf14cd38f 100755 --- a/code/CMSMain.php +++ b/code/CMSMain.php @@ -197,7 +197,7 @@ public function generateDataTreeHints() { } // Put data hints into a script tag at the top - Requirements::customScript("siteTreeHints = " . $this->jsDeclaration($def) . ";"); + Requirements::customScript("siteTreeHints = " . Convert::raw2json($def) . ";"); } public function generateTreeStylingJS() { @@ -238,33 +238,6 @@ public function generateTreeStylingJS() { Requirements::customScript($js); } - /** - * Return a javascript instanciation of this array - */ - protected function jsDeclaration($array) { - if(is_array($array)) { - $object = false; - foreach(array_keys($array) as $key) { - if(!is_numeric($key)) { - $object = true; - break; - } - } - - if($object) { - foreach($array as $k => $v) { - $parts[] = "$k : " . $this->jsDeclaration($v); - } - return " {\n " . implode(", \n", $parts) . " }\n"; - } else { - foreach($array as $part) $parts[] = $this->jsDeclaration($part); - return " [ " . implode(", ", $parts) . " ]\n"; - } - } else { - return "'" . addslashes($array) . "'"; - } - } - /** * Populates an array of classes in the CMS * which allows the user to change the page type.