src/Core/Application.php
public function outputJavascriptGlobal(string $name, array $data)
    {
        $output = "<script type=\"text/javascript\">\n\r";
        $output .= "/* <![CDATA[ */\n\r";
        $output .= "var {$name} = {\n\r";

        if (! empty($data) && is_array($data)) {
            foreach ($data as $key => $value) {
                $output .= $key.': '.json_encode($value).",\n\r";
            }
        }

        $output .= "};\n\r";
        $output .= "/* ]]> */\n\r";
        $output .= '</script>';

        return $output;
    }
public function outputJavascriptGlobal(string $name, array $data)
    {
        $output = "<script type=\"text/javascript\">\n\r";
        $output .= "/* <![CDATA[ */\n\r";
        $output .= "var {$name} = {\n\r";

        if (! empty($data) && is_array($data)) {
            foreach ($data as $key => $value) {
                $output .= $key.': '.json_encode($value).",\n\r";
            }
        }

        $output .= "};\n\r";
        $output .= "/* ]]> */\n\r";
        $output .= '</script>';

        return $output;
    }
public function outputJavascriptGlobal ( string $ name , array $ data ) { $ output = "<script type=\"text/javascript\">\n\r" ; $ output .= "/* <![CDATA[ */\n\r" ; $ output .= "var {$name} = {\n\r" ; if ( ! empty ( $ data ) && is_array ( $ data ) ) { foreach ( $ data as $ key => $ value ) { $ output .= $ key . ': ' . json_encode ( $ value ) . ",\n\r" ; } } $ output .= "};\n\r" ; $ output .= "/* ]]> */\n\r" ; $ output .= '</script>' ; return $ output ; }
Return a Javascript Global variable.

@param string $name
@param array  $data

@return string
Return a Javascript Global variable .