Subversion-Projekte lars-tiefland.laravel_shop

Revision

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

<?php

    use Illuminate\Foundation\Inspiring;
    use Illuminate\Support\Facades\Artisan;

    /*
    |--------------------------------------------------------------------------
    | Console Routes
    |--------------------------------------------------------------------------
    |
    | This file is where you may define all of your Closure based console
    | commands. Each Closure is bound to a command instance allowing a
    | simple approach to interacting with each command's IO methods.
    |
    */

    $GLOBALS["INI"] = getConfig();
    function getConfig()
    {
        define( '__SITE__', env( 'site' ) );
        define( '__SHOP__', env( 'shop' ) );
        define( "__CFG_PATH__", "/etc/shop_configs/" . __SITE__ . "/" . __SHOP__ );

        $cfg_file = __CFG_PATH__ . "/config.de.xml";
        if ( !file_exists( $cfg_file ) )
        {
            trigger_error( "Konnte keine Konfigurationsdatei für das Shopsystem " . __SITE__ . " -> " . __SHOP__ . " finden (" . ( $cfg_file ) . ")!", E_USER_ERROR );
        }
        $xml = simplexml_load_file( $cfg_file, "SimpleXMLElement", LIBXML_NOCDATA );
        $ini = json_decode( json_encode( $xml ), true );
        foreach ( $ini as $key => $wert )
        {
            if ( $wert == array() )
            {
                $ini[$key] = "";
            }
            elseif ( is_array( $wert ) )
            {
                foreach ( $wert as $key2 => $wert2 )
                {
                    if ( $wert2 == array() )
                    {
                        $ini[$key][$key2] = "";
                    }
                }
            }
        }

        $v_file = __CFG_PATH__ . "/versand.xml";
        if ( file_exists( $v_file ) )
        {
            $xml = simplexml_load_file( $v_file, "SimpleXMLElement", LIBXML_NOCDATA );
            $ini["shipping"] = json_decode( json_encode( $xml ), true );
            foreach ( $ini["shipping"] as $key => $wert )
            {
                if ( $wert == array() )
                {
                    $ini["shipping"][$key] = "";
                }
                elseif ( is_array( $wert ) )
                {
                    foreach ( $wert as $key2 => $wert2 )
                    {
                        if ( $wert2 == array() )
                        {
                            $ini["shipping"][$key][$key2] = "";
                        }
                    }
                }
            }
        }
        return $ini;
    }
    Artisan::command( 'inspire', function ()
    {
        $this->comment( Inspiring::quote() );
    } )->purpose( 'Display an inspiring quote' );