Skip to content
Extraits de code Groupes Projets
Sélectionner une révision Git
  • 97dc86b98e56dc9b81e2309cb086cfcef2184065
  • master par défaut protégée
  • rust-playlist-sync
  • rust
  • fix-qt-deprecated-qvariant-type
  • fix-mpris-qtwindow-race-condition
  • rust-appimage-wayland
  • windows-build-rebased
  • v2.5 protégée
  • v2.4 protégée
  • v2.3-1 protégée
  • v2.3 protégée
  • v2.2 protégée
  • v2.1 protégée
  • v2.0 protégée
  • v1.8-3 protégée
  • v1.8-2 protégée
  • v1.8-1 protégée
  • v1.8 protégée
  • v1.7 protégée
  • v1.6 protégée
  • v1.5 protégée
  • v1.4 protégée
  • v1.3 protégée
  • v1.2 protégée
  • v1.1 protégée
  • v1.0 protégée
27 résultats

lektord.1

Blame
  • functions.php 3,10 Kio
    <?php
    function commande_to_string($commande_formatee, $show_price = true) {
        global $foods;
        global $food_types;
        global $sauces;
        global $meats;
        global $sizes;
    
        $current_commande = unformat_commande_new($commande_formatee);
    
        $commande = $food_types[$current_commande['food_type_id']].' : ';
        $commande .= $foods[$current_commande['food_id']]['food_title'];
        $commande .= (isset($current_commande['size_id'])) ? ' ('.$sizes[$current_commande['size_id']]['title'].')' : '';
        if (sizeof($current_commande['sauces_ids']) > 0) {
            $commande .= ' (Sauce'.ngettext('', 's', sizeof($current_commande['sauces_ids']));
            $commande .= ' : '.implode(', ', array_map(function($sauce_id) use($sauces) { return $sauces[$sauce_id]; }, $current_commande['sauces_ids'])).')';
        }
        if (sizeof($current_commande['meats_ids']) > 0) {
            $commande .= ' (Viande'.ngettext('', 's', sizeof($current_commande['meats_ids']));
            $commande .= ' : '.implode(', ', array_map(function($sauce_id) use($meats) { return $meats[$sauce_id]; }, $current_commande['meats_ids'])).')';
        }
        if ($show_price)
            $commande .= ' <strong>('.$current_commande['price'].'€)</strong>';
        else
            $commande .= ' ['.$current_commande['price'].'€]';
    
        return $commande;
    }
    
    function commande_to_string_no_price($commande_formatee) {
        return commande_to_string($commande_formatee, false);
    }
    
    function format_commande($current_commande) {
        $commande_full = 'food_type_id:'.$current_commande['food_type_id'];
        $commande_full .= '-food_id:'.$current_commande['food_id'];
        $commande_full .= (isset($current_commande['size_id'])) ? '-size_id:'.$current_commande['size_id'] : '';
        if (sizeof($current_commande['sauces_ids']) > 0)
            $commande_full .= '-sauces_ids:'.implode(',', $current_commande['sauces_ids']);
        if (sizeof($current_commande['meats_ids']) > 0)
            $commande_full .= '-meats_ids:'.implode(',', $current_commande['meats_ids']);
        $commande_full .= '-price:'.$current_commande['price'];
        $commande_full .= '-price_obig:'.$current_commande['price_obig'];
    
        return $commande_full;
    }
    
    function unformat_commande_new($commande_formatee) {
        $commande_array = split("-", $commande_formatee);
    
        $current_commande['food_id'] = 0;
        $current_commande['food_type_id'] = 0;
        $current_commande['sauces_ids'] = array();
        $current_commande['meats_ids'] = array();
    
        foreach ($commande_array as $commande_element_infos) {
            $commande_element_infos_split = split(":", $commande_element_infos);
            $commande_element = $commande_element_infos_split[0];
            $commande_element_value = $commande_element_infos_split[1];
    
            switch ($commande_element) {
                case 'sauces_ids':
                    $current_commande['sauces_ids'] = split(",", $commande_element_value);
                    break;
                case 'meats_ids':
                    $current_commande['meats_ids'] = split(",", $commande_element_value);
                    break;
                default:
                    $current_commande[$commande_element] = $commande_element_value;
            }
        }
    
        return $current_commande;
    }
    ?>