Skip to content

Commit 8f4cfc2

Browse files
committed
- Added support for date and time format characters for date_format, DateTime::format, DateTime::createFromFormat, date_create_from_format, strftime, gmstrftime and strptime
1 parent 5f8cccd commit 8f4cfc2

File tree

5 files changed

+25
-4
lines changed

5 files changed

+25
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
Changelog
22
=========
33

4+
### 1.0.3
5+
* Added support for date and time format characters for date_format, DateTime::format, DateTime::createFromFormat,
6+
date_create_from_format, strftime, gmstrftime and strptime
7+
48
### 1.0.2
59
* Added support for completion and file reference (Ctrl+Click, Rename..) for various file and folder related functions and methods
610
* Added file mode completion support for SplFileInfo::openFile

META-INF/plugin.xml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<idea-plugin version="2">
22
<id>net.king2500.plugins.PhpAdvancedAutoComplete</id>
33
<name>PHP Advanced AutoComplete</name>
4-
<version>1.0.2</version>
4+
<version>1.0.3</version>
55
<vendor email="phpstorm@king2500.net" url="https://github.com/King2500/PhpAdvancedAutoComplete">Thomas Schulz</vendor>
66

77
<description><![CDATA[
@@ -37,10 +37,17 @@
3737
<p><b>Important:</b> You have to start a string literal and press <i>Ctrl</i> + <i>Space</i> to activate the completion popup</p>
3838
3939
<p>If you have further suggestions/ideas, just send me an e-mail.</p>
40+
<p><a href="http://plugins.jetbrains.com/plugin/writeComment?pr=&pluginId=7276">Commend and rate this plugin here</a></p>
4041
]]></description>
4142

4243
<change-notes><![CDATA[
4344
45+
<h2>1.0.3</h2>
46+
<ul>
47+
<li>Added support for date and time format characters for date_format, DateTime::format, DateTime::createFromFormat,
48+
date_create_from_format, strftime, gmstrftime and strptime</li>
49+
</ul>
50+
4451
<h2>1.0.2</h2>
4552
<ul>
4653
<li>Added support for completion and file reference (Ctrl+Click, Rename..) for various file and folder related functions and methods</li>

PhpAdvancedAutoComplete.jar

1.37 KB
Binary file not shown.

src/net/king2500/plugins/PhpAdvancedAutoComplete/PhpCompletionTokens.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,13 @@ public class PhpCompletionTokens {
252252
public static String[] obHandlerFuncs = { "ob_start" };
253253
public static String[] obHandlerElements = { "ob_gzhandler" };
254254

255-
public static String[] dateFormatFuncs = { "date" };
255+
public static String[] dateFormatFuncs = { "date:0", "date_format:1", "DateTime::format:0", "DateTime::createFromFormat:0", "date_create_from_format:0" };
256256
public static String[] dateFormatTokens = { "d", "D", "j", "jS", "l", "N", "S", "w", "z", "W", "F", "m", "M", "n", "t", "L", "o", "Y", "y", "a", "A", "B", "g", "G", "h", "H", "i", "s", "u", "e", "I", "O", "P", "T", "Z", "c", "r", "U", "H:i", "H:i:s", "m.d.y", "m.d.Y", "m/d/Y", "d.m.y", "d.m.Y", "d.m.Y H:i:s", "Ymd", "Y-m-d", "Y-m-d H:i:s", "Y/m/d H:i:s", "F j, Y, g:i a" };
257-
public static String[] dateFormatInfos = { "Day of month (01..31)", "Weekday (Mon..Sun)", "Day of month (1..31)", "Day of month (1st..31th)", "Weekday (Monday..Sunday)", "Weekday (1..7)", "Day of month suffix (st, nd, rd, th)", "Weekday (0..6)", "Day of year (0..365)", "Week of year (1..52)", "Month (January..December)", "Month (01..12)", "Month (Jan..Dec)", "Month (1..12)", "Number of days in month (28..31)", "Leap year (1=yes, 0=no)", "Year in ISO-8601 (ex. 2013)", "Year (ex. 2013)", "Year (ex. 13)", "am or pm", "AM or PM", "Swatch Internet time (000..999)", "Hour (1..12)", "Hour (0..23)", "Hour (01..12)", "Hour (00..23)", "Minutes (00..59)", "Seconds (00..59)", "Microseconds (000000..999999)", "Timezone identifier (UTC, GMT, ...)", "Daylight Saving Time (1=yes, 0=no)", "GMT in hours (ex. +0200)", "GMT with colon (ex. +02:00)", "Timezone abbreviation (EST, MDT, ...)", "Timezone offset in seconds (-43200..50400)", "ISO 8601 formatted date", "RFC 2822 formatted date", "Seconds since Jan 1st, 1970", "Hour and minutes", "Hour, minutes and seconds", "Month, day, year", "Month, day, year", "Month, day, year", "Day, month, year", "Day, month, year", "Day, month, year, hour, minutes, seconds", "Year, month, day", "Year, month, day", "Year, month, day, hour, minutes, seconds", "Year, month, day, hour, minutes, seconds", "Month, day, year, hour, minutes, am/pm" };
257+
public static String[] dateFormatInfos = { "Day of month (01..31)", "Weekday (Mon..Sun)", "Day of month (1..31)", "Day of month (1st..31th)", "Weekday (Monday..Sunday)", "Weekday (1..7)", "Day of month suffix (st, nd, rd, th)", "Weekday (0..6)", "Day of year (0..365)", "Week of year (1..52)", "Month (January..December)", "Month (01..12)", "Month (Jan..Dec)", "Month (1..12)", "Number of days in month (28..31)", "Leap year (1=yes, 0=no)", "Year in ISO-8601 (ex. 2014)", "Year (ex. 2014)", "Year (ex. 14)", "am or pm", "AM or PM", "Swatch Internet time (000..999)", "Hour (1..12)", "Hour (0..23)", "Hour (01..12)", "Hour (00..23)", "Minutes (00..59)", "Seconds (00..59)", "Microseconds (000000..999999)", "Timezone identifier (UTC, GMT, ...)", "Daylight Saving Time (1=yes, 0=no)", "GMT in hours (ex. +0200)", "GMT with colon (ex. +02:00)", "Timezone abbreviation (EST, MDT, ...)", "Timezone offset in seconds (-43200..50400)", "ISO 8601 formatted date", "RFC 2822 formatted date", "Seconds since Jan 1st, 1970", "Hour and minutes", "Hour, minutes and seconds", "Month, day, year", "Month, day, year", "Month, day, year", "Day, month, year", "Day, month, year", "Day, month, year, hour, minutes, seconds", "Year, month, day", "Year, month, day", "Year, month, day, hour, minutes, seconds", "Year, month, day, hour, minutes, seconds", "Month, day, year, hour, minutes, am/pm" };
258+
259+
public static String[] timeFormatFuncs = { "strftime:0", "gmstrftime:0", "strptime:1" };
260+
public static String[] timeFormatTokens = { "%a", "%A", "%d", "%e", "%j", "%u", "%w", "%U", "%V", "%W", "%h", "%b", "%B", "%m", "%C", "%g", "%G", "%y", "%Y", "%H", "%k", "%I", "%l", "%M", "%p", "%P", "%r", "%R", "%S", "%T", "%X", "%z", "%Z", "%c", "%D", "%F", "%s", "%x", "%n", "%t", "%%", "%d.%m.%y", "%d.%m.%Y", "%d.%m.%Y %H:%M:%S", "%H:%M", "%H:%M:%S", "%m.%d.%y", "%m.%d.%Y", "%m/%d/%Y", "%Y%m%d", "%Y-%m-%d", "%Y-%m-%d %H:%M:%S", "%Y/%m/%d %H:%M:%S" };
261+
public static String[] timeFormatInfos = { "Weekday (Mon..Sun)", "Weekday (Monday..Sunday)", "Day of month (01..31)", "Day of month (1..31)", "Day of year (001..366)", "Weekday (1..7 =Mon..Sun)", "Weekday (0..6 =Sun..Sat)", "Full week number (1..52)", "Week of year (01..53)", "Week of year (1..53)", "Month (Jan..Dec)", "Month (Jan..Dec)", "Month (January..December)", "Month (01..12)", "Century (ex. 20)", "Year in ISO-8601 (ex. 14)", "Year in ISO-8601 (ex. 2014)", "Year (ex. 14)", "Year (ex. 2014)", "Hour (00..23)", "Hour (0..23)", "Hour (01..12)", "Hour (1..12)", "Minutes (00..59)", "AM or PM", "am or pm", "hour, minutes, seconds, am/pm", "hour and minutes", "Seconds (00..59)", "Hour, minutes and seconds", "Locale based time", "Timezone offset (ex. -0500)", "Timezone abbreviation (EST, MDT, ...)", "Locale based date and time", "Month, day, year", "Year, month, day", "Unix timestamp", "Locale based date", "Newline character", "Tab character", "Percentage character", "Day, month, year", "Day, month, year", "Day, month, year, hour, minutes, seconds", "Hour and minutes", "Hour, minutes and seconds", "Month, day, year", "Month, day, year", "Month, day, year", "Year, month, day", "Year, month, day", "Year, month, day, hour, minutes, seconds", "Year, month, day, hour, minutes, seconds" };
258262

259263
public static String[] fileModeFuncs = { "fopen:1", "popen:1", "SplFileInfo::openFile:0" };
260264
public static String[] fileModeElements = { "r", "r+", "w", "w+", "a", "a+", "x", "x+", "c", "c+" };

src/net/king2500/plugins/PhpAdvancedAutoComplete/PhpFunctionCompletionContributor.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,18 @@ public void addCompletions(@NotNull CompletionParameters parameters,
110110
resultBold = true;
111111
}
112112

113-
if(Arrays.asList(PhpCompletionTokens.dateFormatFuncs).contains(funcName) && paramIndex == 0) {
113+
if(Arrays.asList(PhpCompletionTokens.dateFormatFuncs).contains(funcName + ":" + paramIndex)) {
114114
resultElements = PhpCompletionTokens.dateFormatTokens;
115115
resultInfos = PhpCompletionTokens.dateFormatInfos;
116116
resultBold = true;
117117
}
118118

119+
if(Arrays.asList(PhpCompletionTokens.timeFormatFuncs).contains(funcName + ":" + paramIndex)) {
120+
resultElements = PhpCompletionTokens.timeFormatTokens;
121+
resultInfos = PhpCompletionTokens.timeFormatInfos;
122+
resultBold = true;
123+
}
124+
119125
if(Arrays.asList(PhpCompletionTokens.htmlCharSetFuncs).contains(funcName) && paramIndex == 2) {
120126
resultElements = PhpCompletionTokens.htmlCharSets;
121127
resultCaseSensitivity = false;

0 commit comments

Comments
 (0)