src/Modernizr.php
public static function buildConvertJs($key, $cookieExtra = '', $reload = true)
    {
        $content = file_get_contents(__DIR__ . '/../web/convert/start.js.tmp');

        ksort(self::$properties);

        foreach (array_keys(self::$properties) as $i => $property) {
            if (is_array(self::$properties[$property])) {
                $content .= str_replace(
                    ['$propertykey', '$property'],
                    [$property, $property],
                    file_get_contents(__DIR__ . '/../web/convert/base-group-start.js.tmp')
                );

                ksort(self::$properties[$property]);

                foreach (array_keys(self::$properties[$property]) as $j => $subproperty) {
                    $content .= str_replace(
                        ['$property', '$subpropertykey', '$subproperty'],
                        [$property, self::$properties[$property][$subproperty], $subproperty],
                        file_get_contents(__DIR__ . '/../web/convert/base-groupbase.js.tmp')
                    );



                    if ($j < count(self::$properties[$property]) - 1) {
                        $content .= ',';
                    }

                    $content .= "\n";
                }

                $content .= str_replace(
                    '$property',
                    $property,
                    file_get_contents(__DIR__ . '/../web/convert/base-group-end.js.tmp')
                );
            } else {
                $content .= str_replace(
                    ['$propertykey', '$property'],
                    [self::$properties[$property], $property],
                    file_get_contents(__DIR__ . '/../web/convert/base-single.js.tmp')
                );
            }

            if ($i < count(self::$properties) - 1) {
                $content .= ',';
            }

            $content .= "\n";
        }

        $content .= file_get_contents(__DIR__ . '/../web/convert/end.js.tmp');

        return str_replace(
            ['###Modernizr###', '###EXTRA###', 'reload = false'],
            [$key, $cookieExtra, ($reload ? 'reload = true' : 'reload = false')],
            $content
        );
    }
public static function buildConvertJs($key, $cookieExtra = '', $reload = true)
    {
        $content = file_get_contents(__DIR__ . '/../web/convert/start.js.tmp');

        ksort(self::$properties);

        foreach (array_keys(self::$properties) as $i => $property) {
            if (is_array(self::$properties[$property])) {
                $content .= str_replace(
                    ['$propertykey', '$property'],
                    [$property, $property],
                    file_get_contents(__DIR__ . '/../web/convert/base-group-start.js.tmp')
                );

                ksort(self::$properties[$property]);

                foreach (array_keys(self::$properties[$property]) as $j => $subproperty) {
                    $content .= str_replace(
                        ['$property', '$subpropertykey', '$subproperty'],
                        [$property, self::$properties[$property][$subproperty], $subproperty],
                        file_get_contents(__DIR__ . '/../web/convert/base-groupbase.js.tmp')
                    );



                    if ($j < count(self::$properties[$property]) - 1) {
                        $content .= ',';
                    }

                    $content .= "\n";
                }

                $content .= str_replace(
                    '$property',
                    $property,
                    file_get_contents(__DIR__ . '/../web/convert/base-group-end.js.tmp')
                );
            } else {
                $content .= str_replace(
                    ['$propertykey', '$property'],
                    [self::$properties[$property], $property],
                    file_get_contents(__DIR__ . '/../web/convert/base-single.js.tmp')
                );
            }

            if ($i < count(self::$properties) - 1) {
                $content .= ',';
            }

            $content .= "\n";
        }

        $content .= file_get_contents(__DIR__ . '/../web/convert/end.js.tmp');

        return str_replace(
            ['###Modernizr###', '###EXTRA###', 'reload = false'],
            [$key, $cookieExtra, ($reload ? 'reload = true' : 'reload = false')],
            $content
        );
    }
public static function buildConvertJs ( $ key , $ cookieExtra = '' , $ reload = true ) { $ content = file_get_contents ( __DIR__ . '/../web/convert/start.js.tmp' ) ; ksort ( self :: $ properties ) ; foreach ( array_keys ( self :: $ properties ) as $ i => $ property ) { if ( is_array ( self :: $ properties [ $ property ] ) ) { $ content .= str_replace ( [ '$propertykey' , '$property' ] , [ $ property , $ property ] , file_get_contents ( __DIR__ . '/../web/convert/base-group-start.js.tmp' ) ) ; ksort ( self :: $ properties [ $ property ] ) ; foreach ( array_keys ( self :: $ properties [ $ property ] ) as $ j => $ subproperty ) { $ content .= str_replace ( [ '$property' , '$subpropertykey' , '$subproperty' ] , [ $ property , self :: $ properties [ $ property ] [ $ subproperty ] , $ subproperty ] , file_get_contents ( __DIR__ . '/../web/convert/base-groupbase.js.tmp' ) ) ; if ( $ j < count ( self :: $ properties [ $ property ] ) - 1 ) { $ content .= ',' ; } $ content .= "\n" ; } $ content .= str_replace ( '$property' , $ property , file_get_contents ( __DIR__ . '/../web/convert/base-group-end.js.tmp' ) ) ; } else { $ content .= str_replace ( [ '$propertykey' , '$property' ] , [ self :: $ properties [ $ property ] , $ property ] , file_get_contents ( __DIR__ . '/../web/convert/base-single.js.tmp' ) ) ; } if ( $ i < count ( self :: $ properties ) - 1 ) { $ content .= ',' ; } $ content .= "\n" ; } $ content .= file_get_contents ( __DIR__ . '/../web/convert/end.js.tmp' ) ; return str_replace ( [ '###Modernizr###' , '###EXTRA###' , 'reload = false' ] , [ $ key , $ cookieExtra , ( $ reload ? 'reload = true' : 'reload = false' ) ] , $ content ) ; }
builds the javascript code to write the detection result into a cookie

@param string $key
@param string $cookieExtra
@param bool   $reload

@return string
builds the javascript code to write the detection result into a cookie