Skip to content

Commit b5a054b

Browse files
minor bug fixes
1 parent 8bc329d commit b5a054b

File tree

15 files changed

+164
-119
lines changed

15 files changed

+164
-119
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Change Log
22

3+
## 0.0.9 (June 20, 2017)
4+
- Fixed minor bugs
5+
- Added: usefull php functions
6+
37
## 0.0.8 (May 20, 2017)
48
- Added: classes use features of yii2-bootstrap
59
- Added: usefull php functions

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "yii2-snippets",
33
"displayName": "Yii2 Snippets",
44
"description": "Yii2 snippets for Visual Studio Code",
5-
"version": "0.0.8",
5+
"version": "0.0.9",
66
"publisher": "imanilchaudhari",
77
"keywords": [
88
"yii2",

snippets/helpers/array-helper.json

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,87 @@
11
{
22
"ArrayHelper::filter": {
33
"prefix": "ArrayHelper::filter",
4-
"body": "ArrayHelper::filter(${\\$array}, ${\\$filters})$3",
4+
"body": "ArrayHelper::filter(\\$${array}, \\$${filters})$3",
55
"description": "Filters array according to rules specified."
66
},
77
"ArrayHelper::getColumn()": {
88
"prefix": "ArrayHelper::getColumn()",
9-
"body": "ArrayHelper::getColumn(${\\$array},${\\$name}, ${\\$keepKeys = true})$3",
9+
"body": "ArrayHelper::getColumn(\\$${array},\\$${name}, \\$${keepKeys = true})$3",
1010
"description": "Returns the values of a specified column in an array."
1111
},
1212
"ArrayHelper::getValue": {
1313
"prefix": "ArrayHelper::getValue",
14-
"body": "ArrayHelper::getValue(${\\$array},${\\$key}, ${\\$default = null})$3",
14+
"body": "ArrayHelper::getValue(\\$${array},\\$${key}, \\$${default = null})$3",
1515
"description": "Retrieves the value of an array element or object property with the given key or property name."
1616
},
1717
"ArrayHelper::htmlDecode()": {
1818
"prefix": "ArrayHelper::htmlDecode()",
19-
"body": "ArrayHelper::htmlDecode(${\\$data}, ${\\$valuesOnly = true})$3",
19+
"body": "ArrayHelper::htmlDecode(\\$${data}, \\$${valuesOnly = true})$3",
2020
"description": "Decodes HTML entities into the corresponding characters in an array of strings."
2121
},
2222
"ArrayHelper::htmlEncode()": {
2323
"prefix": "ArrayHelper::htmlEncode()",
24-
"body": "ArrayHelper::htmlEncode(${\\$data}, ${\\$valuesOnly = true}, ${\\$charset = null})$3",
24+
"body": "ArrayHelper::htmlEncode(\\$${data}, \\$${valuesOnly = true}, \\$${charset = null})$3",
2525
"description": "Encodes HTML entities into the corresponding characters in an array of strings."
2626
},
2727
"ArrayHelper::index()": {
2828
"prefix": "ArrayHelper::index()",
29-
"body": "ArrayHelper::index(${\\$array}, ${function($element){}})$3",
29+
"body": "ArrayHelper::index(\\$${array}, ${function($element){}})$3",
3030
"description": "Indexes and/or groups the array according to a specified key."
3131
},
3232
"ArrayHelper::isAssociative()": {
3333
"prefix": "ArrayHelper::isAssociative()",
34-
"body": "ArrayHelper::isAssociative(${\\$array}, ${\\$allstring = true})$3",
34+
"body": "ArrayHelper::isAssociative(\\$${array}, \\$${allstring = true})$3",
3535
"description": "Returns a value indicating whether the given array is an associative array."
3636
},
3737
"ArrayHelper::isIn()": {
3838
"prefix": "ArrayHelper::isIn()",
39-
"body": "ArrayHelper::isIn(${\\$needle}, ${\\$haystack}, ${\\$strict = false})$3",
39+
"body": "ArrayHelper::isIn(\\$${needle}, \\$${haystack}, \\$${strict = false})$3",
4040
"description": "Check whether an array or Traversable contains an element."
4141
},
4242
"ArrayHelper::isIndexed()": {
4343
"prefix": "ArrayHelper::isIndexed()",
44-
"body": "ArrayHelper::isIndexed(${\\$array}, ${\\$consecutive = false})$3",
44+
"body": "ArrayHelper::isIndexed(\\$${array}, \\$${consecutive = false})$3",
4545
"description": "Returns a value indicating whether the given array is an indexed array."
4646
},
4747
"ArrayHelper::isSubset()": {
4848
"prefix": "ArrayHelper::isSubset()",
49-
"body": "ArrayHelper::isSubset(${\\$needle}, ${\\$haystack}, ${\\$strict = false})$3",
49+
"body": "ArrayHelper::isSubset(\\$${needle}, \\$${haystack}, \\$${strict = false})$3",
5050
"description": "Checks whether an array or Traversable is a subset of another array or Traversable."
5151
},
5252
"ArrayHelper::isTraversable()": {
5353
"prefix": "ArrayHelper::isTraversable()",
54-
"body": "ArrayHelper::isTraversable(${\\$var})$3",
54+
"body": "ArrayHelper::isTraversable(\\$${var})$3",
5555
"description": "Checks whether a variable is an array or Traversable."
5656
},
5757
"ArrayHelper::keyExists()": {
5858
"prefix": "ArrayHelper::keyExists()",
59-
"body": "ArrayHelper::keyExists(${\\$key}, ${\\$array}, ${\\$caseSensitive = true})$3",
59+
"body": "ArrayHelper::keyExists(\\$${key}, \\$${array}, \\$${caseSensitive = true})$3",
6060
"description": "Checks if the given array contains the specified key."
6161
},
6262
"ArrayHelper::map()": {
6363
"prefix": "ArrayHelper::map()",
64-
"body": "ArrayHelper::map(${\\$array}, ${\\$from},${\\$to}, ${\\$group = null})$3",
64+
"body": "ArrayHelper::map(\\$${array}, \\$${from},\\$${to}, \\$${group = null})$3",
6565
"description": "Builds a map (key-value pairs) from a multidimensional array or an array of objects."
6666
},
6767
"ArrayHelper::merge()": {
6868
"prefix": "ArrayHelper::merge()",
69-
"body": "ArrayHelper::merge(${\\$a}, ${\\$b})$3",
69+
"body": "ArrayHelper::merge(\\$${a}, \\$${b})$3",
7070
"description": "Merges two or more arrays into one recursively."
7171
},
7272
"ArrayHelper::multisort()": {
7373
"prefix": "ArrayHelper::multisort()",
74-
"body": "ArrayHelper::multisort(${&$array}, ${\\$key}, ${\\$direction = SORT_ASC}, ${\\$sortFlf = SORT_REGULAR})$3",
74+
"body": "ArrayHelper::multisort(${&$array}, \\$${key}, \\$${direction = SORT_ASC}, \\$${sortFlf = SORT_REGULAR})$3",
7575
"description": "Sorts an array of objects or arrays (with the same structure) by one or several keys."
7676
},
7777
"ArrayHelper::remove()": {
7878
"prefix": "ArrayHelper::remove()",
79-
"body": "ArrayHelper::remove(${&$array}, ${\\$key}, ${\\$default = null})$3",
79+
"body": "ArrayHelper::remove(${&$array}, \\$${key}, \\$${default = null})$3",
8080
"description": "Removes an item from an array and returns the value. If the key does not exist in the array, the default value will be returned instead."
8181
},
8282
"ArrayHelper::toArray()": {
8383
"prefix": "ArrayHelper::toArray()",
84-
"body": "ArrayHelper::toArray(${\\$options}, ${\\$properties = []}, ${\\$recursive = true})$3",
84+
"body": "ArrayHelper::toArray(\\$${options}, \\$${properties = []}, \\$${recursive = true})$3",
8585
"description": "Converts an object or an array of objects into an array."
8686
}
8787
}

snippets/helpers/file-helper.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,57 @@
11
{
22
"FileHelper::copyDirectory": {
33
"prefix": "FileHelper::copyDirectory",
4-
"body": "FileHelper::copyDirectory(${\\$source}, ${\\$dest}, ${\\$options = []})$3",
4+
"body": "FileHelper::copyDirectory(\\$${source}, \\$${dest}, \\$${options = []})$3",
55
"description": "Copies a whole directory as another one."
66
},
77
"FileHelper::createDirectory": {
88
"prefix": "FileHelper::createDirectory",
9-
"body": "FileHelper::createDirectory(${\\$path}, ${\\$mode = 509}, ${\\$recursive = true})$3",
9+
"body": "FileHelper::createDirectory(\\$${path}, \\$${mode = 509}, \\$${recursive = true})$3",
1010
"description": "Creates a new directory."
1111
},
1212
"FileHelper::filterPath": {
1313
"prefix": "FileHelper::filterPath",
14-
"body": "FileHelper::filterPath(${\\$path}, ${\\$options})$3",
14+
"body": "FileHelper::filterPath(\\$${path}, \\$${options})$3",
1515
"description": "Checks if the given file path satisfies the filtering options."
1616
},
1717
"FileHelper::findFiles": {
1818
"prefix": "FileHelper::findFiles",
19-
"body": "FileHelper::findFiles(${\\$dir}, ${\\$options = []})$3",
19+
"body": "FileHelper::findFiles(\\$${dir}, \\$${options = []})$3",
2020
"description": "Returns the files found under the specified directory and subdirectories."
2121
},
2222
"FileHelper::getExtensionsByMimeType": {
2323
"prefix": "FileHelper::getExtensionsByMimeType",
24-
"body": "FileHelper::getExtensionsByMimeType(${\\$mimeType}, ${\\$magicFile = null})$3",
24+
"body": "FileHelper::getExtensionsByMimeType(\\$${mimeType}, \\$${magicFile = null})$3",
2525
"description": "Determines the extensions by given MIME type."
2626
},
2727
"FileHelper::getMimeType": {
2828
"prefix": "FileHelper::getMimeType",
29-
"body": "FileHelper::getMimeType(${\\$file}, ${\\$magicFile = null}, ${\\$checkedExtension = true})$3",
29+
"body": "FileHelper::getMimeType(\\$${file}, \\$${magicFile = null}, \\$${checkedExtension = true})$3",
3030
"description": "Determines the MIME type of the specified file."
3131
},
3232
"FileHelper::getMimeTypeByExtension": {
3333
"prefix": "FileHelper::getMimeTypeByExtension",
34-
"body": "FileHelper::getMimeTypeByExtension(${\\$file}, ${\\$magicFile = null})$3",
34+
"body": "FileHelper::getMimeTypeByExtension(\\$${file}, \\$${magicFile = null})$3",
3535
"description": "Determines the MIME type based on the extension name of the specified file."
3636
},
3737
"FileHelper::loadMimeTypes": {
3838
"prefix": "FileHelper::loadMimeTypes",
39-
"body": "FileHelper::loadMimeTypes(${\\$magicFile})$3",
39+
"body": "FileHelper::loadMimeTypes(\\$${magicFile})$3",
4040
"description": "Loads MIME types from the specified file."
4141
},
4242
"FileHelper::localize": {
4343
"prefix": "FileHelper::localize",
44-
"body": "FileHelper::localize(${\\$file}, ${\\$language = null}, ${\\$sourceLanguage = null})$3",
44+
"body": "FileHelper::localize(\\$${file}, \\$${language = null}, \\$${sourceLanguage = null})$3",
4545
"description": "Returns the localized version of a specified file."
4646
},
4747
"FileHelper::normalizePath": {
4848
"prefix": "FileHelper::normalizePath",
49-
"body": "FileHelper::normalizePath(${\\$path}, ${\\$ds = DIRECTORY_SEPARATOR})$3",
49+
"body": "FileHelper::normalizePath(\\$${path}, \\$${ds = DIRECTORY_SEPARATOR})$3",
5050
"description": "Normalizes a file/directory path."
5151
},
5252
"FileHelper::removeDirectory": {
5353
"prefix": "FileHelper::removeDirectory",
54-
"body": "FileHelper::removeDirectory(${\\$dir}, ${\\$options = []})$3",
54+
"body": "FileHelper::removeDirectory(\\$${dir}, \\$${options = []})$3",
5555
"description": "Removes a directory (and all its content) recursively."
5656
}
5757
}

snippets/helpers/html.json

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,127 +1,127 @@
11
{
22
"Html::a": {
33
"prefix": "Html::a",
4-
"body": "Html::a(${\\$text}, ${\\$url}, ${\\$options = []})$3",
4+
"body": "Html::a(\\$${text}, \\$${url}, \\$${options = []})$3",
55
"description": "Generates a hyperlink tag."
66
},
77
"Html::activeBooleanInput": {
88
"prefix": "Html::activeBooleanInput",
9-
"body": "Html::activeBooleanInput(${\\$type}, ${\\$model}, ${\\$attribute}, ${\\$options = []})$3",
9+
"body": "Html::activeBooleanInput(\\$${type}, \\$${model}, \\$${attribute}, \\$${options = []})$3",
1010
"description": "Generates a boolean input This method is mainly called by activeCheckbox() and activeRadio()."
1111
},
1212
"Html::activeCheckbox": {
1313
"prefix": "Html::activeCheckbox",
14-
"body": "Html::activeCheckbox(${\\$model}, ${\\$attribute}, ${\\$options = []})$3",
14+
"body": "Html::activeCheckbox(\\$${model}, \\$${attribute}, \\$${options = []})$3",
1515
"description": "Generates a checkbox tag together with a label for the given model attribute."
1616
},
1717
"Html::activeCheckboxList": {
1818
"prefix": "Html::activeCheckboxList",
19-
"body": "Html::activeCheckboxList(${\\$model}, ${\\$attribute}, ${\\$items}, ${\\$options = []})$3",
19+
"body": "Html::activeCheckboxList(\\$${model}, \\$${attribute}, \\$${items}, \\$${options = []})$3",
2020
"description": "Generates a list of checkboxes."
2121
},
2222
"Html::activeDropDownList": {
2323
"prefix": "Html::activeDropDownList",
24-
"body": "Html::activeDropDownList(${\\$model}, ${\\$attribute}, ${\\$items}, ${\\$options = []})$3",
24+
"body": "Html::activeDropDownList(\\$${model}, \\$${attribute}, \\$${items}, \\$${options = []})$3",
2525
"description": "Generates a drop-down list for the given model attribute."
2626
},
2727
"Html::activeFileInput": {
2828
"prefix": "Html::activeFileInput",
29-
"body": "Html::activeFileInput(${\\$model}, ${\\$attribute}, ${\\$options = []})$3",
29+
"body": "Html::activeFileInput(\\$${model}, \\$${attribute}, \\$${options = []})$3",
3030
"description": "Generates a file input tag for the given model attribute."
3131
},
3232
"Html::activeHiddenInput": {
3333
"prefix": "Html::activeHiddenInput",
34-
"body": "Html::activeHiddenInput(${\\$model}, ${\\$attribute}, ${\\$options = []})$3",
34+
"body": "Html::activeHiddenInput(\\$${model}, \\$${attribute}, \\$${options = []})$3",
3535
"description": "Generates a hidden input tag for the given model attribute."
3636
},
3737
"Html::activeHint": {
3838
"prefix": "Html::activeHint",
39-
"body": "Html::activeHint(${\\$model}, ${\\$attribute}, ${\\$options = []})$3",
39+
"body": "Html::activeHint(\\$${model}, \\$${attribute}, \\$${options = []})$3",
4040
"description": "Generates a hint tag for the given model attribute."
4141
},
4242
"Html::activeInput": {
4343
"prefix": "Html::activeInput",
44-
"body": "Html::activeInput(${\\$type}, ${\\$model}, ${\\$attribute}, ${\\$options = []})$3",
44+
"body": "Html::activeInput(\\$${type}, \\$${model}, \\$${attribute}, \\$${options = []})$3",
4545
"description": "Generates an input tag for the given model attribute."
4646
},
4747
"Html::activeLabel": {
4848
"prefix": "Html::activeLabel",
49-
"body": "Html::activeLabel(${\\$model}, ${\\$attribute}, ${\\$options = []})$3",
49+
"body": "Html::activeLabel(\\$${model}, \\$${attribute}, \\$${options = []})$3",
5050
"description": "Generates a label tag for the given model attribute."
5151
},
5252
"Html::activeListBox": {
5353
"prefix": "Html::activeListBox",
54-
"body": "Html::activeListBox(${\\$model}, ${\\$attribute}, ${\\$items}, ${\\$options = []})$3",
54+
"body": "Html::activeListBox(\\$${model}, \\$${attribute}, \\$${items}, \\$${options = []})$3",
5555
"description": "Generates a list box."
5656
},
5757
"Html::activeListInput": {
5858
"prefix": "Html::activeListInput",
59-
"body": "Html::activeListInput(${\\$type}, ${\\$model}, ${\\$attribute}, ${\\$items}, ${\\$options = []})$3",
59+
"body": "Html::activeListInput(\\$${type}, \\$${model}, \\$${attribute}, \\$${items}, \\$${options = []})$3",
6060
"description": "Generates a list of input fields."
6161
},
6262
"Html::activePasswordInput": {
6363
"prefix": "Html::activePasswordInput",
64-
"body": "Html::activePasswordInput(${\\$model}, ${\\$attribute}, ${\\$options = []})$3",
64+
"body": "Html::activePasswordInput(\\$${model}, \\$${attribute}, \\$${options = []})$3",
6565
"description": "Generates a password input tag for the given model attribute."
6666
},
6767
"Html::activeRadio": {
6868
"prefix": "Html::activeRadio",
69-
"body": "Html::activeRadio(${\\$model}, ${\\$attribute}, ${\\$options = []})$3",
69+
"body": "Html::activeRadio(\\$${model}, \\$${attribute}, \\$${options = []})$3",
7070
"description": "Generates a radio button tag together with a label for the given model attribute."
7171
},
7272
"Html::activeRadioList": {
7373
"prefix": "Html::activeRadioList",
74-
"body": "Html::activeRadioList(${\\$model}, ${\\$attribute}, ${\\$items}, ${\\$options = []})$3",
74+
"body": "Html::activeRadioList(\\$${model}, \\$${attribute}, \\$${items}, \\$${options = []})$3",
7575
"description": "Generates a list of radio buttons."
7676
},
7777
"Html::activeTextInput": {
7878
"prefix": "Html::activeTextInput",
79-
"body": "Html::activeTextInput(${\\$model}, ${\\$attribute}, ${\\$options = []})$3",
79+
"body": "Html::activeTextInput(\\$${model}, \\$${attribute}, \\$${options = []})$3",
8080
"description": "Generates a text input tag for the given model attribute."
8181
},
8282
"Html::activeTextarea": {
8383
"prefix": "Html::activeTextarea",
84-
"body": "Html::activeTextarea(${\\$model}, ${\\$attribute}, ${\\$options = []})$3",
84+
"body": "Html::activeTextarea(\\$${model}, \\$${attribute}, \\$${options = []})$3",
8585
"description": "Generates a textarea tag for the given model attribute."
8686
},
8787
"Html::addCssClass": {
8888
"prefix": "Html::addCssClass",
89-
"body": "Html::addCssClass(${&$options}, ${\\$class})$3",
89+
"body": "Html::addCssClass(${&$options}, \\$${class})$3",
9090
"description": "Adds a CSS class (or several classes) to the specified options."
9191
},
9292
"Html::beginForm": {
9393
"prefix": "Html::beginForm",
94-
"body": "Html::beginForm(${\\$action = ''}, ${\\$method = 'post'}, ${\\$options = []})$3",
94+
"body": "Html::beginForm(\\$${action = ''}, \\$${method = 'post'}, \\$${options = []})$3",
9595
"description": "Generates a form start tag."
9696
},
9797
"Html::beginTag": {
9898
"prefix": "Html::beginTag",
99-
"body": "Html::beginTag(${\\$name}, ${\\$options = []})$3",
99+
"body": "Html::beginTag(\\$${name}, \\$${options = []})$3",
100100
"description": "Generates a start tag."
101101
},
102102
"Html::booleanInput": {
103103
"prefix": "Html::booleanInput",
104-
"body": "Html::booleanInput(${\\$type}, ${\\$name}, ${\\$checked}, ${\\$options = []})$3",
104+
"body": "Html::booleanInput(\\$${type}, \\$${name}, \\$${checked}, \\$${options = []})$3",
105105
"description": "Generates a boolean input."
106106
},
107107
"Html::button": {
108108
"prefix": "Html::button",
109-
"body": "Html::button(${\\$content = 'Button'}, ${\\$options = []})$3",
109+
"body": "Html::button(\\$${content = 'Button'}, \\$${options = []})$3",
110110
"description": "Generates a boolean input."
111111
},
112112
"Html::buttonInput": {
113113
"prefix": "Html::buttonInput",
114-
"body": "Html::buttonInput(${\\$content = 'Button'}, ${\\$options = []})$3",
114+
"body": "Html::buttonInput(\\$${content = 'Button'}, \\$${options = []})$3",
115115
"description": "Generates an input button."
116116
},
117117
"Html::checkbox": {
118118
"prefix": "Html::checkbox",
119-
"body": "Html::checkbox( ${\\$name}, ${\\$checked}, ${\\$options = []})$3",
119+
"body": "Html::checkbox( \\$${name}, \\$${checked}, \\$${options = []})$3",
120120
"description": "Generates a checkbox input."
121121
},
122122
"Html::checkboxList": {
123123
"prefix": "Html::checkboxList",
124-
"body": "Html::checkboxList( ${\\$name}, ${\\$selection = null}, ${\\$items}, ${\\$options = []})$3",
124+
"body": "Html::checkboxList( \\$${name}, \\$${selection = null}, \\$${items}, \\$${options = []})$3",
125125
"description": "Generates a list of checkboxes."
126126
},
127127
"Html::csrfMetaTags": {
@@ -131,7 +131,7 @@
131131
},
132132
"Html::cssFile": {
133133
"prefix": "Html::cssFile",
134-
"body": "Html::cssFile(${\\$url}, ${\\$options = []})$3",
134+
"body": "Html::cssFile(\\$${url}, \\$${options = []})$3",
135135
"description": "Generates a link tag that refers to an external CSS file."
136136
},
137137
"Html::cssStyleFromArray": {
@@ -151,12 +151,12 @@
151151
},
152152
"Html::dropDownList": {
153153
"prefix": "Html::dropDownList",
154-
"body": "Html::dropDownList($name}, ${\\$selection = null}, ${\\$items = []}, ${\\$options = []})$3",
154+
"body": "Html::dropDownList($name}, \\$${selection = null}, \\$${items = []}, \\$${options = []})$3",
155155
"description": "Generates a drop-down list."
156156
},
157157
"Html::encode": {
158158
"prefix": "Html::encode",
159-
"body": "Html::encode($content}, ${\\$doubleEncode = true})$3",
159+
"body": "Html::encode($content}, \\$${doubleEncode = true})$3",
160160
"description": "Encodes special characters into HTML entities."
161161
},
162162
"Html::endForm": {
@@ -171,7 +171,7 @@
171171
},
172172
"Html::error": {
173173
"prefix": "Html::error",
174-
"body": "Html::error($model, ${\\$attribute}, ${\\$options = []})$3",
174+
"body": "Html::error($model, \\$${attribute}, \\$${options = []})$3",
175175
"description": "Generates a tag that contains the first validation error of the specified model attribute."
176176
}
177177
}

0 commit comments

Comments
 (0)