2012-07-25 00:09:06 -04:00
|
|
|
snippet <?
|
2011-06-20 13:40:28 -04:00
|
|
|
<?php
|
2012-07-24 15:02:30 -04:00
|
|
|
|
2011-06-20 13:40:28 -04:00
|
|
|
${1}
|
|
|
|
snippet ec
|
2012-07-24 15:02:30 -04:00
|
|
|
echo ${1};
|
2012-07-25 00:09:06 -04:00
|
|
|
snippet <?e
|
2012-07-24 15:02:30 -04:00
|
|
|
<?php echo ${1} ?>
|
2012-07-27 07:40:14 -04:00
|
|
|
# this one is for php5.4
|
2012-07-25 00:09:06 -04:00
|
|
|
snippet <?=
|
|
|
|
<?=${1}?>
|
2013-04-16 17:44:48 -04:00
|
|
|
snippet ?=
|
|
|
|
<?= ${1} ?>
|
|
|
|
snippet ?
|
|
|
|
<?php ${1} ?>
|
|
|
|
snippet ?f
|
2013-04-16 17:52:43 -04:00
|
|
|
<?php foreach ($${1:vars} as $${2:$var}): ?>
|
2013-04-16 17:44:48 -04:00
|
|
|
${3}
|
|
|
|
<?php endforeach ?>
|
|
|
|
snippet ?i
|
2013-04-16 17:52:43 -04:00
|
|
|
<?php if ($${1:var}): ?>
|
2013-04-16 17:44:48 -04:00
|
|
|
${2}
|
|
|
|
<?php endif ?>
|
2012-07-27 07:40:14 -04:00
|
|
|
snippet ns
|
|
|
|
namespace ${1:Foo\Bar\Baz};
|
|
|
|
${2}
|
|
|
|
snippet use
|
|
|
|
use ${1:Foo\Bar\Baz};
|
|
|
|
${2}
|
|
|
|
snippet c
|
2013-04-11 21:20:42 -04:00
|
|
|
class ${1:`Filename()`}
|
2012-07-27 07:40:14 -04:00
|
|
|
{
|
2013-04-11 21:20:42 -04:00
|
|
|
${2}
|
2012-07-27 07:40:14 -04:00
|
|
|
}
|
|
|
|
snippet i
|
|
|
|
interface ${1:`Filename()`}
|
|
|
|
{
|
|
|
|
${2}
|
|
|
|
}
|
2012-07-30 11:09:36 -04:00
|
|
|
snippet t.
|
2012-07-30 04:19:03 -04:00
|
|
|
$this->${1}
|
2012-07-27 07:40:14 -04:00
|
|
|
snippet f
|
2012-07-27 08:34:02 -04:00
|
|
|
function ${1:foo}(${2:array }${3:$bar})
|
2012-07-27 07:40:14 -04:00
|
|
|
{
|
2012-07-27 08:04:48 -04:00
|
|
|
${4}
|
2012-07-27 07:40:14 -04:00
|
|
|
}
|
|
|
|
# method
|
|
|
|
snippet m
|
2013-04-11 21:16:52 -04:00
|
|
|
${1:protected} function ${2:foo}()
|
2012-07-27 07:40:14 -04:00
|
|
|
{
|
2013-04-11 21:16:52 -04:00
|
|
|
${3}
|
2012-07-27 07:40:14 -04:00
|
|
|
}
|
|
|
|
# setter method
|
2013-04-11 21:18:57 -04:00
|
|
|
snippet sm
|
2012-12-03 11:18:40 -05:00
|
|
|
/**
|
|
|
|
* Sets the value of ${1:foo}
|
|
|
|
*
|
|
|
|
* @param ${2:$1} $$1 ${3:description}
|
|
|
|
*
|
|
|
|
* @return ${4:`Filename()`}
|
|
|
|
*/
|
|
|
|
${5:public} function set${6:$2}(${7:$2 }$$1)
|
2012-07-27 07:40:14 -04:00
|
|
|
{
|
2012-12-03 11:18:40 -05:00
|
|
|
$this->${8:$1} = $$1;
|
2012-07-27 07:40:14 -04:00
|
|
|
return $this;
|
2012-12-03 11:18:40 -05:00
|
|
|
}${9}
|
2012-07-27 07:40:14 -04:00
|
|
|
# getter method
|
|
|
|
snippet gm
|
2012-12-03 11:18:40 -05:00
|
|
|
/**
|
|
|
|
* Gets the value of ${1:foo}
|
|
|
|
*
|
|
|
|
* @return ${2:$1}
|
|
|
|
*/
|
|
|
|
${3:public} function get${4:$2}()
|
2012-07-27 07:40:14 -04:00
|
|
|
{
|
2012-12-03 11:18:40 -05:00
|
|
|
return $this->${5:$1};
|
|
|
|
}${6}
|
2012-07-30 04:19:03 -04:00
|
|
|
#setter
|
|
|
|
snippet $s
|
|
|
|
${1:$foo}->set${2:Bar}(${3});
|
|
|
|
#getter
|
|
|
|
snippet $g
|
|
|
|
${1:$foo}->get${2:Bar}();
|
2012-07-30 11:09:36 -04:00
|
|
|
|
|
|
|
# Tertiary conditional
|
|
|
|
snippet =?:
|
|
|
|
$${1:foo} = ${2:true} ? ${3:a} : ${4};
|
|
|
|
snippet ?:
|
|
|
|
${1:true} ? ${2:a} : ${3}
|
|
|
|
|
2012-07-24 15:02:30 -04:00
|
|
|
snippet C
|
2011-06-20 13:40:28 -04:00
|
|
|
$_COOKIE['${1:variable}']${2}
|
2012-07-24 15:02:30 -04:00
|
|
|
snippet E
|
2011-06-20 13:40:28 -04:00
|
|
|
$_ENV['${1:variable}']${2}
|
2012-07-24 15:02:30 -04:00
|
|
|
snippet F
|
2011-06-20 13:40:28 -04:00
|
|
|
$_FILES['${1:variable}']${2}
|
2012-07-24 15:02:30 -04:00
|
|
|
snippet G
|
2011-06-20 13:40:28 -04:00
|
|
|
$_GET['${1:variable}']${2}
|
2012-07-24 15:02:30 -04:00
|
|
|
snippet P
|
2011-06-20 13:40:28 -04:00
|
|
|
$_POST['${1:variable}']${2}
|
2012-07-24 15:02:30 -04:00
|
|
|
snippet R
|
2011-06-20 13:40:28 -04:00
|
|
|
$_REQUEST['${1:variable}']${2}
|
2012-07-24 15:02:30 -04:00
|
|
|
snippet S
|
2011-06-20 13:40:28 -04:00
|
|
|
$_SERVER['${1:variable}']${2}
|
2012-07-24 15:02:30 -04:00
|
|
|
snippet SS
|
2011-06-20 13:40:28 -04:00
|
|
|
$_SESSION['${1:variable}']${2}
|
2013-04-11 21:18:57 -04:00
|
|
|
|
2012-07-28 02:16:41 -04:00
|
|
|
# the following are old ones
|
|
|
|
snippet inc
|
|
|
|
include '${1:file}';${2}
|
|
|
|
snippet inc1
|
|
|
|
include_once '${1:file}';${2}
|
|
|
|
snippet req
|
|
|
|
require '${1:file}';${2}
|
|
|
|
snippet req1
|
|
|
|
require_once '${1:file}';${2}
|
2011-06-20 13:40:28 -04:00
|
|
|
# Start Docblock
|
|
|
|
snippet /*
|
|
|
|
/**
|
|
|
|
* ${1}
|
|
|
|
*/
|
|
|
|
# Class - post doc
|
|
|
|
snippet doc_cp
|
|
|
|
/**
|
|
|
|
* ${1:undocumented class}
|
|
|
|
*
|
|
|
|
* @package ${2:default}
|
2011-12-22 10:03:01 -05:00
|
|
|
* @subpackage ${3:default}
|
|
|
|
* @author ${4:`g:snips_author`}
|
|
|
|
*/${5}
|
2011-06-20 13:40:28 -04:00
|
|
|
# Class Variable - post doc
|
|
|
|
snippet doc_vp
|
|
|
|
/**
|
|
|
|
* ${1:undocumented class variable}
|
|
|
|
*
|
|
|
|
* @var ${2:string}
|
|
|
|
*/${3}
|
|
|
|
# Class Variable
|
|
|
|
snippet doc_v
|
|
|
|
/**
|
|
|
|
* ${3:undocumented class variable}
|
|
|
|
*
|
|
|
|
* @var ${4:string}
|
|
|
|
*/
|
|
|
|
${1:var} $${2};${5}
|
|
|
|
# Class
|
|
|
|
snippet doc_c
|
|
|
|
/**
|
|
|
|
* ${3:undocumented class}
|
|
|
|
*
|
2012-02-09 10:58:46 -05:00
|
|
|
* @package ${4:default}
|
|
|
|
* @subpackage ${5:default}
|
|
|
|
* @author ${6:`g:snips_author`}
|
2011-06-20 13:40:28 -04:00
|
|
|
*/
|
|
|
|
${1:}class ${2:}
|
2012-02-09 10:58:46 -05:00
|
|
|
{
|
|
|
|
${7}
|
2011-06-20 13:40:28 -04:00
|
|
|
} // END $1class $2
|
|
|
|
# Constant Definition - post doc
|
|
|
|
snippet doc_dp
|
|
|
|
/**
|
|
|
|
* ${1:undocumented constant}
|
|
|
|
*/${2}
|
|
|
|
# Constant Definition
|
|
|
|
snippet doc_d
|
|
|
|
/**
|
|
|
|
* ${3:undocumented constant}
|
|
|
|
*/
|
|
|
|
define(${1}, ${2});${4}
|
|
|
|
# Function - post doc
|
|
|
|
snippet doc_fp
|
|
|
|
/**
|
|
|
|
* ${1:undocumented function}
|
|
|
|
*
|
|
|
|
* @return ${2:void}
|
|
|
|
* @author ${3:`g:snips_author`}
|
|
|
|
*/${4}
|
|
|
|
# Function signature
|
|
|
|
snippet doc_s
|
|
|
|
/**
|
|
|
|
* ${4:undocumented function}
|
|
|
|
*
|
|
|
|
* @return ${5:void}
|
|
|
|
* @author ${6:`g:snips_author`}
|
|
|
|
*/
|
|
|
|
${1}function ${2}(${3});${7}
|
|
|
|
# Function
|
|
|
|
snippet doc_f
|
|
|
|
/**
|
|
|
|
* ${4:undocumented function}
|
|
|
|
*
|
|
|
|
* @return ${5:void}
|
|
|
|
* @author ${6:`g:snips_author`}
|
|
|
|
*/
|
|
|
|
${1}function ${2}(${3})
|
|
|
|
{${7}
|
|
|
|
}
|
|
|
|
# Header
|
|
|
|
snippet doc_h
|
|
|
|
/**
|
|
|
|
* ${1}
|
|
|
|
*
|
|
|
|
* @author ${2:`g:snips_author`}
|
|
|
|
* @version ${3:$Id$}
|
|
|
|
* @copyright ${4:$2}, `strftime('%d %B, %Y')`
|
|
|
|
* @package ${5:default}
|
|
|
|
*/
|
2013-04-11 21:18:57 -04:00
|
|
|
|
2011-06-20 13:40:28 -04:00
|
|
|
# Interface
|
2012-07-25 00:09:06 -04:00
|
|
|
snippet interface
|
2011-06-20 13:40:28 -04:00
|
|
|
/**
|
|
|
|
* ${2:undocumented class}
|
|
|
|
*
|
|
|
|
* @package ${3:default}
|
|
|
|
* @author ${4:`g:snips_author`}
|
|
|
|
*/
|
2012-12-02 18:13:11 -05:00
|
|
|
interface ${1:`Filename()`}
|
2012-07-24 15:02:30 -04:00
|
|
|
{
|
|
|
|
${5}
|
2012-07-25 00:09:06 -04:00
|
|
|
}
|
2011-06-20 13:40:28 -04:00
|
|
|
# class ...
|
|
|
|
snippet class
|
|
|
|
/**
|
|
|
|
* ${1}
|
|
|
|
*/
|
2012-12-02 18:13:11 -05:00
|
|
|
class ${2:`Filename()`}
|
2011-06-20 13:40:28 -04:00
|
|
|
{
|
|
|
|
${3}
|
2012-07-25 00:09:06 -04:00
|
|
|
/**
|
|
|
|
* ${4}
|
|
|
|
*/
|
|
|
|
${5:public} function ${6:__construct}(${7:argument})
|
2011-06-20 13:40:28 -04:00
|
|
|
{
|
2012-07-25 00:09:06 -04:00
|
|
|
${8:// code...}
|
2012-07-28 02:16:41 -04:00
|
|
|
}
|
2011-06-20 13:40:28 -04:00
|
|
|
}
|
2013-04-07 07:05:25 -04:00
|
|
|
snippet nc
|
|
|
|
namespace ${1:`substitute(substitute(expand("%:h"), '\v^\w+\/(\u)', '\1', ''), '\/', '\\\', 'g')`};
|
|
|
|
|
|
|
|
${2:abstract }class ${3:`Filename()`}
|
|
|
|
{
|
|
|
|
${4}
|
|
|
|
}
|
2011-06-20 13:40:28 -04:00
|
|
|
# define(...)
|
|
|
|
snippet def
|
|
|
|
define('${1}'${2});${3}
|
|
|
|
# defined(...)
|
|
|
|
snippet def?
|
|
|
|
${1}defined('${2}')${3}
|
|
|
|
snippet wh
|
|
|
|
while (${1:/* condition */}) {
|
|
|
|
${2:// code...}
|
|
|
|
}
|
|
|
|
# do ... while
|
|
|
|
snippet do
|
|
|
|
do {
|
|
|
|
${2:// code... }
|
|
|
|
} while (${1:/* condition */});
|
|
|
|
snippet if
|
|
|
|
if (${1:/* condition */}) {
|
|
|
|
${2:// code...}
|
|
|
|
}
|
2012-04-07 08:33:16 -04:00
|
|
|
snippet ifil
|
|
|
|
<?php if (${1:/* condition */}): ?>
|
|
|
|
${2:<!-- code... -->}
|
|
|
|
<?php endif; ?>
|
2011-06-20 13:40:28 -04:00
|
|
|
snippet ife
|
|
|
|
if (${1:/* condition */}) {
|
|
|
|
${2:// code...}
|
|
|
|
} else {
|
|
|
|
${3:// code...}
|
|
|
|
}
|
|
|
|
${4}
|
2012-04-07 08:33:16 -04:00
|
|
|
snippet ifeil
|
|
|
|
<?php if (${1:/* condition */}): ?>
|
|
|
|
${2:<!-- html... -->}
|
|
|
|
<?php else: ?>
|
|
|
|
${3:<!-- html... -->}
|
|
|
|
<?php endif; ?>
|
|
|
|
${4}
|
2011-06-20 13:40:28 -04:00
|
|
|
snippet else
|
|
|
|
else {
|
|
|
|
${1:// code...}
|
|
|
|
}
|
|
|
|
snippet elseif
|
|
|
|
elseif (${1:/* condition */}) {
|
|
|
|
${2:// code...}
|
|
|
|
}
|
|
|
|
snippet switch
|
|
|
|
switch ($${1:variable}) {
|
|
|
|
case '${2:value}':
|
|
|
|
${3:// code...}
|
|
|
|
break;
|
|
|
|
${5}
|
|
|
|
default:
|
|
|
|
${4:// code...}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
snippet case
|
|
|
|
case '${1:value}':
|
|
|
|
${2:// code...}
|
|
|
|
break;${3}
|
|
|
|
snippet for
|
|
|
|
for ($${2:i} = 0; $$2 < ${1:count}; $$2${3:++}) {
|
|
|
|
${4: // code...}
|
|
|
|
}
|
|
|
|
snippet foreach
|
|
|
|
foreach ($${1:variable} as $${2:value}) {
|
|
|
|
${3:// code...}
|
|
|
|
}
|
2012-04-07 08:33:16 -04:00
|
|
|
snippet foreachil
|
|
|
|
<?php foreach ($${1:variable} as $${2:value}): ?>
|
|
|
|
${3:<!-- html... -->}
|
|
|
|
<?php endforeach; ?>
|
2011-06-20 13:40:28 -04:00
|
|
|
snippet foreachk
|
|
|
|
foreach ($${1:variable} as $${2:key} => $${3:value}) {
|
|
|
|
${4:// code...}
|
|
|
|
}
|
2012-04-07 08:33:16 -04:00
|
|
|
snippet foreachkil
|
|
|
|
<?php foreach ($${1:variable} as $${2:key} => $${3:value}): ?>
|
|
|
|
${4:<!-- html... -->}
|
|
|
|
<?php endforeach; ?>
|
2011-06-20 13:40:28 -04:00
|
|
|
# $... = array (...)
|
|
|
|
snippet array
|
|
|
|
$${1:arrayName} = array('${2}' => ${3});${4}
|
|
|
|
snippet try
|
|
|
|
try {
|
|
|
|
${2}
|
|
|
|
} catch (${1:Exception} $e) {
|
|
|
|
}
|
|
|
|
# lambda with closure
|
|
|
|
snippet lambda
|
|
|
|
${1:static }function (${2:args}) use (${3:&$x, $y /*put vars in scope (closure) */}) {
|
|
|
|
${4}
|
|
|
|
};
|
|
|
|
# pre_dump();
|
|
|
|
snippet pd
|
|
|
|
echo '<pre>'; var_dump(${1}); echo '</pre>';
|
|
|
|
# pre_dump(); die();
|
|
|
|
snippet pdd
|
|
|
|
echo '<pre>'; var_dump(${1}); echo '</pre>'; die(${2:});
|
|
|
|
snippet vd
|
|
|
|
var_dump(${1});
|
2011-11-24 03:43:32 -05:00
|
|
|
snippet vdd
|
|
|
|
var_dump(${1}); die(${2:});
|
2011-06-20 13:40:28 -04:00
|
|
|
snippet http_redirect
|
2013-04-11 21:18:57 -04:00
|
|
|
header ("HTTP/1.1 301 Moved Permanently");
|
|
|
|
header ("Location: ".URL);
|
2011-06-20 13:40:28 -04:00
|
|
|
exit();
|
2011-12-22 10:03:01 -05:00
|
|
|
# Getters & Setters
|
2012-12-03 11:18:40 -05:00
|
|
|
snippet gs
|
2011-12-22 10:03:01 -05:00
|
|
|
/**
|
2012-12-03 11:18:40 -05:00
|
|
|
* Gets the value of ${1:foo}
|
2011-12-22 10:03:01 -05:00
|
|
|
*
|
2012-12-03 11:18:40 -05:00
|
|
|
* @return ${2:$1}
|
2011-12-22 10:03:01 -05:00
|
|
|
*/
|
2012-12-03 11:18:40 -05:00
|
|
|
public function get${3:$2}()
|
2011-12-22 10:03:01 -05:00
|
|
|
{
|
2012-12-03 11:18:40 -05:00
|
|
|
return $this->${4:$1};
|
2011-12-22 10:03:01 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2011-12-22 10:40:48 -05:00
|
|
|
* Sets the value of $1
|
2011-12-22 10:03:01 -05:00
|
|
|
*
|
2012-12-03 11:18:40 -05:00
|
|
|
* @param $2 $$1 ${5:description}
|
2012-12-02 18:14:30 -05:00
|
|
|
*
|
2012-12-03 11:18:40 -05:00
|
|
|
* @return ${6:`Filename()`}
|
2011-12-22 10:03:01 -05:00
|
|
|
*/
|
2012-12-03 11:18:40 -05:00
|
|
|
public function set$3(${7:$2 }$$1)
|
2011-12-22 10:03:01 -05:00
|
|
|
{
|
2012-12-03 11:18:40 -05:00
|
|
|
$this->$4 = $$1;
|
2012-07-24 15:02:30 -04:00
|
|
|
return $this;
|
2012-12-03 11:18:40 -05:00
|
|
|
}${8}
|
2012-12-20 02:57:51 -05:00
|
|
|
# anotation, get, and set, useful for doctrine
|
|
|
|
snippet ags
|
|
|
|
/**
|
|
|
|
* ${1:description}
|
2013-04-11 21:18:57 -04:00
|
|
|
*
|
2013-01-10 22:37:02 -05:00
|
|
|
* @${7}
|
2012-12-20 02:57:51 -05:00
|
|
|
*/
|
|
|
|
${2:protected} $${3:foo};
|
|
|
|
|
|
|
|
public function get${4:$3}()
|
|
|
|
{
|
|
|
|
return $this->$3;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function set$4(${5:$4 }$${6:$3})
|
|
|
|
{
|
|
|
|
$this->$3 = $$6;
|
|
|
|
return $this;
|
|
|
|
}
|
2012-04-08 17:26:04 -04:00
|
|
|
snippet rett
|
|
|
|
return true;
|
|
|
|
snippet retf
|
|
|
|
return false;
|
2013-04-11 22:46:37 -04:00
|
|
|
snippet am
|
|
|
|
array_map(function($${1:v}) {
|
|
|
|
${3}
|
|
|
|
return $$1;
|
|
|
|
}, $${2:foo});
|