Overview
Comment:Déplacement progressif des modifieurs et fonctions dans l'objet
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dev
Files: files | file ages | folders
SHA1: 64e31c6172feaf3d7898d5bd87b741538f4fc75b
User & Date: bohwaz on 2017-08-02 07:16:39
Other Links: branch diff | manifest | tags
Context
2017-08-02
07:23
Modernisation: suppression progressive de $_POST et Utils::post check-in: 986fdb6e0a user: bohwaz tags: dev
07:16
Déplacement progressif des modifieurs et fonctions dans l'objet check-in: 64e31c6172 user: bohwaz tags: dev
04:59
Suite modernisation check-in: 2cb5cf4b5d user: bohwaz tags: dev
Changes

Modified src/include/lib/Garradin/Template.php from [469e9b3bcb] to [5392e23abe].

25
26
27
28
29
30
31







32
33
34
35





36



37
38
39
40
41
42
43
        parent::__construct();

        $this->assign('www_url', WWW_URL);
        $this->assign('self_url', Utils::getSelfUrl());
        $this->assign('self_url_no_qs', Utils::getSelfUrl(true));

        $this->assign('is_logged', false);








        $this->register_function('form_errors', [$this, 'formErrors']);
        $this->register_function('show_error', [$this, 'showError']);
        $this->register_function('custom_colors', [$this, 'customColors']);





        $this->register_modifier('strlen', 'strlen');



    }

    protected function formErrors($params)
    {
        $form = $this->getTemplateVars('form');

        if (!$form->hasErrors())







>
>
>
>
>
>
>




>
>
>
>
>

>
>
>







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
        parent::__construct();

        $this->assign('www_url', WWW_URL);
        $this->assign('self_url', Utils::getSelfUrl());
        $this->assign('self_url_no_qs', Utils::getSelfUrl(true));

        $this->assign('is_logged', false);

        $this->register_compile_function('continue', function ($pos, $block, $name, $raw_args) {
            if ($block == 'continue')
            {
                return 'continue;';
            }
        });

        $this->register_function('form_errors', [$this, 'formErrors']);
        $this->register_function('show_error', [$this, 'showError']);
        $this->register_function('custom_colors', [$this, 'customColors']);
        $this->register_function('plugin_url', ['Garradin\Utils', 'plugin_url']);
        $this->register_function('csrf_field', function ($params) {
            return Form::tokenHTML($params['key']);
        });

        $this->register_modifier('strlen', 'strlen');
        $this->register_modifier('get_country_name', ['Garradin\Utils', 'getCountryName']);
        $this->register_modifier('format_sqlite_date_to_french', ['Garradin\Utils', 'sqliteDateToFrench']);
        $this->register_modifier('format_bytes', ['Garradin\Utils', 'format_bytes']);
    }

    protected function formErrors($params)
    {
        $form = $this->getTemplateVars('form');

        if (!$form->hasErrors())
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104

        return sprintf($out, $couleur1, $couleur2, $image_fond);
    }
}

$tpl = Template::getInstance();

function tpl_csrf_field($params)
{
    return Form::tokenHTML($params['key']);
}

function tpl_form_field($params)
{
    if (!isset($params['name']))
        throw new \BadFunctionCallException('name argument is mandatory');

    $name = $params['name'];








<
<
<
<
<







101
102
103
104
105
106
107





108
109
110
111
112
113
114

        return sprintf($out, $couleur1, $couleur2, $image_fond);
    }
}

$tpl = Template::getInstance();






function tpl_form_field($params)
{
    if (!isset($params['name']))
        throw new \BadFunctionCallException('name argument is mandatory');

    $name = $params['name'];

613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655

            return implode(', ', $out);
        default:
            return htmlspecialchars($v);
    }
}

$tpl->register_function('csrf_field', 'Garradin\tpl_csrf_field');
$tpl->register_function('form_field', 'Garradin\tpl_form_field');
$tpl->register_function('select_compte', 'Garradin\tpl_select_compte');

$tpl->register_function('format_droits', 'Garradin\tpl_format_droits');

$tpl->register_function('pagination', 'Garradin\tpl_pagination');

$tpl->register_function('diff', 'Garradin\tpl_diff');
$tpl->register_function('html_champ_membre', 'Garradin\tpl_html_champ_membre');

$tpl->register_function('plugin_url', ['Garradin\Utils', 'plugin_url']);

$tpl->register_modifier('get_country_name', ['Garradin\Utils', 'getCountryName']);
$tpl->register_modifier('format_tel', 'Garradin\tpl_format_tel');
$tpl->register_modifier('format_wiki', 'Garradin\tpl_format_wiki');
$tpl->register_modifier('liens_wiki', 'Garradin\tpl_liens_wiki');
$tpl->register_modifier('escape_money', 'Garradin\escape_money');
$tpl->register_modifier('html_money', 'Garradin\tpl_html_money');
$tpl->register_modifier('abs', 'abs');

$tpl->register_modifier('display_champ_membre', 'Garradin\tpl_display_champ_membre');

$tpl->register_modifier('format_sqlite_date_to_french', ['Garradin\Utils', 'sqliteDateToFrench']);

$tpl->register_modifier('format_bytes', ['Garradin\Utils', 'format_bytes']);

$tpl->register_modifier('strftime_fr', 'Garradin\tpl_strftime_fr');
$tpl->register_modifier('date_fr', 'Garradin\tpl_date_fr');

$tpl->register_compile_function('continue', function ($pos, $block, $name, $raw_args) {
    if ($block == 'continue')
    {
        return 'continue;';
    }
});







<










<
<
<









<
<
<
<


<
<
<
<
<
<
<
623
624
625
626
627
628
629

630
631
632
633
634
635
636
637
638
639



640
641
642
643
644
645
646
647
648




649
650








            return implode(', ', $out);
        default:
            return htmlspecialchars($v);
    }
}


$tpl->register_function('form_field', 'Garradin\tpl_form_field');
$tpl->register_function('select_compte', 'Garradin\tpl_select_compte');

$tpl->register_function('format_droits', 'Garradin\tpl_format_droits');

$tpl->register_function('pagination', 'Garradin\tpl_pagination');

$tpl->register_function('diff', 'Garradin\tpl_diff');
$tpl->register_function('html_champ_membre', 'Garradin\tpl_html_champ_membre');




$tpl->register_modifier('format_tel', 'Garradin\tpl_format_tel');
$tpl->register_modifier('format_wiki', 'Garradin\tpl_format_wiki');
$tpl->register_modifier('liens_wiki', 'Garradin\tpl_liens_wiki');
$tpl->register_modifier('escape_money', 'Garradin\escape_money');
$tpl->register_modifier('html_money', 'Garradin\tpl_html_money');
$tpl->register_modifier('abs', 'abs');

$tpl->register_modifier('display_champ_membre', 'Garradin\tpl_display_champ_membre');





$tpl->register_modifier('strftime_fr', 'Garradin\tpl_strftime_fr');
$tpl->register_modifier('date_fr', 'Garradin\tpl_date_fr');