Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 1624 | Zur aktuellen Revision | Details | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
2 lars 1
<?php
2
 
1624 lars 3
    use Illuminate\Foundation\Inspiring;
4
    use Illuminate\Support\Facades\Artisan;
2 lars 5
 
1624 lars 6
    /*
7
    |--------------------------------------------------------------------------
8
    | Console Routes
9
    |--------------------------------------------------------------------------
10
    |
11
    | This file is where you may define all of your Closure based console
12
    | commands. Each Closure is bound to a command instance allowing a
13
    | simple approach to interacting with each command's IO methods.
14
    |
15
    */
2 lars 16
 
1624 lars 17
    $GLOBALS["INI"] = getConfig();
1625 lars 18
    function getConfig()
19
    {
20
        define( '__SITE__', env( 'site' ) );
21
        define( '__SHOP__', env( 'shop' ) );
22
        define( "__CFG_PATH__", "/etc/shop_configs/" . __SITE__ . "/" . __SHOP__ );
23
 
24
        $cfg_file = __CFG_PATH__ . "/config.de.xml";
25
        if ( !file_exists( $cfg_file ) )
26
        {
27
            trigger_error( "Konnte keine Konfigurationsdatei für das Shopsystem " . __SITE__ . " -> " . __SHOP__ . " finden (" . ( $cfg_file ) . ")!", E_USER_ERROR );
28
        }
29
        $xml = simplexml_load_file( $cfg_file, "SimpleXMLElement", LIBXML_NOCDATA );
30
        $ini = json_decode( json_encode( $xml ), true );
31
        foreach ( $ini as $key => $wert )
32
        {
33
            if ( $wert == array() )
34
            {
35
                $ini[$key] = "";
36
            }
37
            elseif ( is_array( $wert ) )
38
            {
39
                foreach ( $wert as $key2 => $wert2 )
40
                {
41
                    if ( $wert2 == array() )
42
                    {
43
                        $ini[$key][$key2] = "";
44
                    }
45
                }
46
            }
47
        }
48
 
49
        $v_file = __CFG_PATH__ . "/versand.xml";
50
        if ( file_exists( $v_file ) )
51
        {
52
            $xml = simplexml_load_file( $v_file, "SimpleXMLElement", LIBXML_NOCDATA );
53
            $ini["shipping"] = json_decode( json_encode( $xml ), true );
54
            foreach ( $ini["shipping"] as $key => $wert )
55
            {
56
                if ( $wert == array() )
57
                {
58
                    $ini["shipping"][$key] = "";
59
                }
60
                elseif ( is_array( $wert ) )
61
                {
62
                    foreach ( $wert as $key2 => $wert2 )
63
                    {
64
                        if ( $wert2 == array() )
65
                        {
66
                            $ini["shipping"][$key][$key2] = "";
67
                        }
68
                    }
69
                }
70
            }
71
        }
72
        return $ini;
73
    }
1624 lars 74
    Artisan::command( 'inspire', function ()
75
    {
76
        $this->comment( Inspiring::quote() );
77
    } )->purpose( 'Display an inspiring quote' );