neosnippet.vim/neosnippets/php.snip
2013-12-28 20:20:15 +09:00

277 lines
3.6 KiB
Plaintext

snippet function
abbr public function () {}
${1:public }function ${2:#:FunctionName}(${3})
{
${4:TARGET}
}
snippet function_literal
options word
abbr function () {}
function (${1})${2: use } {
${3:TARGET}
}
snippet php
<?php
${1:TARGET}
snippet pecho
<?php echo ${1} ?>${0}
snippet echoh
<?php echo htmlentities(${1}, ENT_QUOTES, 'utf-8') ?>${0}
snippet pfore
<?$php foreach ($${1:#:variable} as $${2:#:key}${3: =>}): ?>
${0:TARGET}
<?php endforeach ?>
snippet pife
<?php if (${1:#:condition}): ?>
${2:TARGET}
<?php else: ?>
${0}
<?php endif ?>
snippet pif
<?php if (${1:#:condition}): ?>
${0:TARGET}
<?php endif ?>
snippet pelse
<?php else: ?>
snippet this
<?php $this->${0} ?>
snippet ethis
<?php echo $this->${0} ?>
snippet docc
/**
* ${3:#:undocumented class variable}
*
* @var ${4:#:string}
**/
${1:#:var} $${2};${0}
snippet docd
/**
* ${3:#:undocumented constant}
**/
define(${1} ${2});${0}
snippet docs
/**
* ${4:#:undocumented function}
*
* @return ${5:void}
* @author ${6}
**/
${1}function ${2}(${3});${0}
snippet docf
/**
* ${4:#:undocumented function}
*
* @return ${5:void}
* @author ${6}
**/
${1}function ${2}(${3})
{
${0:TARGET}
}
snippet doch
/**
* ${1}
*
* @author ${2}
* @version ${3}
* @copyright ${4}
* @package ${5:default}
**/
/**
* Define DocBlock
**/
snippet doci
/**
* ${2:#:undocumented class}
*
* @package ${3:default}
* @author ${4}
**/
interface ${1}
{
${0:TARGET}
} // END interface $1
snippet c
/**
* $0
*/
snippet class_with_constructor
/**
* ${1}
*/
class ${2:#:ClassName}${3:#:extends}
{
$5
function ${4:__construct}(${5:#:argument})
{
${0:# code...}
}
}
snippet class
class ${2:#:ClassName} {
${0:TARGET}
}
snippet def
${1}defined('${2}')${0}
snippet do
do {
${0:TARGET}
} while (${1:#:condition});
snippet if?
$${1:#:retVal} = (${2:#:condition}) ? ${3:#:a} : ${4:#:b};
snippet ifelse
if (${1:#:condition}) {
${2:TARGET}
} else {
${3:#:code...}
}
${0}
snippet if
if (${1:#:condition}) {
${0:TARGET}
}
snippet var_dump
options head
var_dump(${0:TARGET});
snippet echo
echo "${1:#:string}"${0};
snippet else
else {
${0:TARGET}
}
snippet elseif
elseif (${1:#:condition}) {
${0:TARGET}
}
snippet for
for ($${1:i}=${2:0}; $$1 < ${3}; $$1++) {
${0:TARGET}
}
snippet fore
foreach ($${1:#:variable} as $${2:#:key}${3: =>} $${4:#:value}) {
${0:TARGET}
}
snippet con
function __construct(${1})
{
${0:TARGET}
}
snippet here
<<<${1:HTML}
${2:TARGET:#:content here}
$1;
snippet inc
include '${1:#:file}';${0}
snippet inco
include_once '${1:#:file}';${0}
snippet array
$${1:#:arrayName} = array('${2}' => ${3} ${0});
snippet req
require '${1:#:file}';${0}
snippet reqo
require_once '${1:#:file}';${0}
snippet ret
return${1};${0}
snippet retf
return false;
snippet rett
return true;
snippet case
case '${1:#:variable}':
${0:#:code...}
break;
snippet switch
abbr sw
switch (${1:#:variable}) {
case '${2:#:value}':
${3:#:code...}
break;
${0}
default:
${4:#:code...}
break;
}
snippet throw
throw new ${1}Exception(${2:"${3:#:Error Processing Request}"}${4:});
${0}
snippet while
abbr wh
while (${1}) {
${0:TARGET}
}
snippet gloabals
\$GLOBALS['${1:#:variable}']${2: = }${3:#:something}${4:;}${0}
snippet cookie
\$_COOKIE['${1:#:variable}']
snippet env
\$_ENV['${1:#:variable}']
snippet files
\$_FILES['${1:#:variable}']
snippet get
\$_GET['${1:#:variable}']
snippet post
\$_POST['${1:#:variable}']
snippet request
\$_REQUEST['${1:#:variable}']
snippet server
\$_SERVER['${1:#:variable}']
snippet session
\$_SESSION['${1:#:variable}']