Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php
2
 
3
namespace Illuminate\View\Compilers\Concerns;
4
 
5
trait CompilesLayouts
6
{
7
    /**
8
     * The name of the last section that was started.
9
     *
10
     * @var string
11
     */
12
    protected $lastSection;
13
 
14
    /**
15
     * Compile the extends statements into valid PHP.
16
     *
17
     * @param  string  $expression
18
     * @return string
19
     */
20
    protected function compileExtends($expression)
21
    {
22
        $expression = $this->stripParentheses($expression);
23
 
24
        $echo = "<?php echo \$__env->make({$expression}, \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>";
25
 
26
        $this->footer[] = $echo;
27
 
28
        return '';
29
    }
30
 
31
    /**
32
     * Compile the extends-first statements into valid PHP.
33
     *
34
     * @param  string  $expression
35
     * @return string
36
     */
37
    protected function compileExtendsFirst($expression)
38
    {
39
        $expression = $this->stripParentheses($expression);
40
 
41
        $echo = "<?php echo \$__env->first({$expression}, \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>";
42
 
43
        $this->footer[] = $echo;
44
 
45
        return '';
46
    }
47
 
48
    /**
49
     * Compile the section statements into valid PHP.
50
     *
51
     * @param  string  $expression
52
     * @return string
53
     */
54
    protected function compileSection($expression)
55
    {
56
        $this->lastSection = trim($expression, "()'\" ");
57
 
58
        return "<?php \$__env->startSection{$expression}; ?>";
59
    }
60
 
61
    /**
62
     * Replace the @parent directive to a placeholder.
63
     *
64
     * @return string
65
     */
66
    protected function compileParent()
67
    {
68
        $escapedLastSection = strtr($this->lastSection, ['\\' => '\\\\', "'" => "\\'"]);
69
 
70
        return "<?php echo \Illuminate\View\Factory::parentPlaceholder('{$escapedLastSection}'); ?>";
71
    }
72
 
73
    /**
74
     * Compile the yield statements into valid PHP.
75
     *
76
     * @param  string  $expression
77
     * @return string
78
     */
79
    protected function compileYield($expression)
80
    {
81
        return "<?php echo \$__env->yieldContent{$expression}; ?>";
82
    }
83
 
84
    /**
85
     * Compile the show statements into valid PHP.
86
     *
87
     * @return string
88
     */
89
    protected function compileShow()
90
    {
91
        return '<?php echo $__env->yieldSection(); ?>';
92
    }
93
 
94
    /**
95
     * Compile the append statements into valid PHP.
96
     *
97
     * @return string
98
     */
99
    protected function compileAppend()
100
    {
101
        return '<?php $__env->appendSection(); ?>';
102
    }
103
 
104
    /**
105
     * Compile the overwrite statements into valid PHP.
106
     *
107
     * @return string
108
     */
109
    protected function compileOverwrite()
110
    {
111
        return '<?php $__env->stopSection(true); ?>';
112
    }
113
 
114
    /**
115
     * Compile the stop statements into valid PHP.
116
     *
117
     * @return string
118
     */
119
    protected function compileStop()
120
    {
121
        return '<?php $__env->stopSection(); ?>';
122
    }
123
 
124
    /**
125
     * Compile the end-section statements into valid PHP.
126
     *
127
     * @return string
128
     */
129
    protected function compileEndsection()
130
    {
131
        return '<?php $__env->stopSection(); ?>';
132
    }
133
}