]> git.r.bdr.sh - rbdr/dotfiles/blob - vim/snippets/php.snippets
Remove SearchComplete vim plugin
[rbdr/dotfiles] / vim / snippets / php.snippets
1 snippet php
2 <?php
3 ${1}
4 ?>
5 snippet ec
6 echo "${1:string}"${2};
7 snippet inc
8 include '${1:file}';${2}
9 snippet inc1
10 include_once '${1:file}';${2}
11 snippet req
12 require '${1:file}';${2}
13 snippet req1
14 require_once '${1:file}';${2}
15 # $GLOBALS['...']
16 snippet globals
17 $GLOBALS['${1:variable}']${2: = }${3:something}${4:;}${5}
18 snippet $_ COOKIE['...']
19 $_COOKIE['${1:variable}']${2}
20 snippet $_ ENV['...']
21 $_ENV['${1:variable}']${2}
22 snippet $_ FILES['...']
23 $_FILES['${1:variable}']${2}
24 snippet $_ Get['...']
25 $_GET['${1:variable}']${2}
26 snippet $_ POST['...']
27 $_POST['${1:variable}']${2}
28 snippet $_ REQUEST['...']
29 $_REQUEST['${1:variable}']${2}
30 snippet $_ SERVER['...']
31 $_SERVER['${1:variable}']${2}
32 snippet $_ SESSION['...']
33 $_SESSION['${1:variable}']${2}
34 # Start Docblock
35 snippet /*
36 /**
37 * ${1}
38 **/
39 # Class - post doc
40 snippet doc_cp
41 /**
42 * ${1:undocumented class}
43 *
44 * @package ${2:default}
45 * @author ${3:`g:snips_author`}
46 **/${4}
47 # Class Variable - post doc
48 snippet doc_vp
49 /**
50 * ${1:undocumented class variable}
51 *
52 * @var ${2:string}
53 **/${3}
54 # Class Variable
55 snippet doc_v
56 /**
57 * ${3:undocumented class variable}
58 *
59 * @var ${4:string}
60 **/
61 ${1:var} $${2};${5}
62 # Class
63 snippet doc_c
64 /**
65 * ${3:undocumented class}
66 *
67 * @packaged ${4:default}
68 * @author ${5:`g:snips_author`}
69 **/
70 ${1:}class ${2:}
71 {${6}
72 } // END $1class $2
73 # Constant Definition - post doc
74 snippet doc_dp
75 /**
76 * ${1:undocumented constant}
77 **/${2}
78 # Constant Definition
79 snippet doc_d
80 /**
81 * ${3:undocumented constant}
82 **/
83 define(${1}, ${2});${4}
84 # Function - post doc
85 snippet doc_fp
86 /**
87 * ${1:undocumented function}
88 *
89 * @return ${2:void}
90 * @author ${3:`g:snips_author`}
91 **/${4}
92 # Function signature
93 snippet doc_s
94 /**
95 * ${4:undocumented function}
96 *
97 * @return ${5:void}
98 * @author ${6:`g:snips_author`}
99 **/
100 ${1}function ${2}(${3});${7}
101 # Function
102 snippet doc_f
103 /**
104 * ${4:undocumented function}
105 *
106 * @return ${5:void}
107 * @author ${6:`g:snips_author`}
108 **/
109 ${1}function ${2}(${3})
110 {${7}
111 }
112 # Header
113 snippet doc_h
114 /**
115 * ${1}
116 *
117 * @author ${2:`g:snips_author`}
118 * @version ${3:$Id$}
119 * @copyright ${4:$2}, `strftime('%d %B, %Y')`
120 * @package ${5:default}
121 **/
122
123 /**
124 * Define DocBlock
125 *//
126 # Interface
127 snippet doc_i
128 /**
129 * ${2:undocumented class}
130 *
131 * @package ${3:default}
132 * @author ${4:`g:snips_author`}
133 **/
134 interface ${1:}
135 {${5}
136 } // END interface $1
137 # class ...
138 snippet class
139 /**
140 * ${1}
141 **/
142 class ${2:ClassName}
143 {
144 ${3}
145 function ${4:__construct}(${5:argument})
146 {
147 ${6:// code...}
148 }
149 }
150 # define(...)
151 snippet def
152 define('${1}'${2});${3}
153 # defined(...)
154 snippet def?
155 ${1}defined('${2}')${3}
156 snippet wh
157 while (${1:/* condition */}) {
158 ${2:// code...}
159 }
160 # do ... while
161 snippet do
162 do {
163 ${2:// code... }
164 } while (${1:/* condition */});
165 snippet if
166 if (${1:/* condition */}) {
167 ${2:// code...}
168 }
169 snippet ife
170 if (${1:/* condition */}) {
171 ${2:// code...}
172 } else {
173 ${3:// code...}
174 }
175 ${4}
176 snippet else
177 else {
178 ${1:// code...}
179 }
180 snippet elseif
181 elseif (${1:/* condition */}) {
182 ${2:// code...}
183 }
184 # Tertiary conditional
185 snippet t
186 $${1:retVal} = (${2:condition}) ? ${3:a} : ${4:b};${5}
187 snippet switch
188 switch ($${1:variable}) {
189 case '${2:value}':
190 ${3:// code...}
191 break;
192 ${5}
193 default:
194 ${4:// code...}
195 break;
196 }
197 snippet case
198 case '${1:value}':
199 ${2:// code...}
200 break;${3}
201 snippet for
202 for ($${2:i} = 0; $$2 < ${1:count}; $$2${3:++}) {
203 ${4: // code...}
204 }
205 snippet foreach
206 foreach ($${1:variable} as $${2:key}) {
207 ${3:// code...}
208 }
209 snippet fun
210 ${1:public }function ${2:FunctionName}(${3})
211 {
212 ${4:// code...}
213 }
214 # $... = array (...)
215 snippet array
216 $${1:arrayName} = array('${2}' => ${3});${4}