Skip to content

Commit

Permalink
- Added support for date and time format characters for date_format, …
Browse files Browse the repository at this point in the history
…DateTime::format, DateTime::createFromFormat, date_create_from_format, strftime, gmstrftime and strptime
  • Loading branch information
King2500 committed Feb 15, 2014
1 parent 5f8cccd commit 8f4cfc2
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Changelog
=========

### 1.0.3
* Added support for date and time format characters for date_format, DateTime::format, DateTime::createFromFormat,
date_create_from_format, strftime, gmstrftime and strptime

### 1.0.2
* Added support for completion and file reference (Ctrl+Click, Rename..) for various file and folder related functions and methods
* Added file mode completion support for SplFileInfo::openFile
Expand Down
9 changes: 8 additions & 1 deletion META-INF/plugin.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<idea-plugin version="2">
<id>net.king2500.plugins.PhpAdvancedAutoComplete</id>
<name>PHP Advanced AutoComplete</name>
<version>1.0.2</version>
<version>1.0.3</version>
<vendor email="phpstorm@king2500.net" url="https://github.com/King2500/PhpAdvancedAutoComplete">Thomas Schulz</vendor>

<description><![CDATA[
Expand Down Expand Up @@ -37,10 +37,17 @@
<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>
<p>If you have further suggestions/ideas, just send me an e-mail.</p>
<p><a href="http://plugins.jetbrains.com/plugin/writeComment?pr=&pluginId=7276">Commend and rate this plugin here</a></p>
]]></description>

<change-notes><![CDATA[
<h2>1.0.3</h2>
<ul>
<li>Added support for date and time format characters for date_format, DateTime::format, DateTime::createFromFormat,
date_create_from_format, strftime, gmstrftime and strptime</li>
</ul>
<h2>1.0.2</h2>
<ul>
<li>Added support for completion and file reference (Ctrl+Click, Rename..) for various file and folder related functions and methods</li>
Expand Down
Binary file modified PhpAdvancedAutoComplete.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,13 @@ public class PhpCompletionTokens {
public static String[] obHandlerFuncs = { "ob_start" };
public static String[] obHandlerElements = { "ob_gzhandler" };

public static String[] dateFormatFuncs = { "date" };
public static String[] dateFormatFuncs = { "date:0", "date_format:1", "DateTime::format:0", "DateTime::createFromFormat:0", "date_create_from_format:0" };
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" };
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" };
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" };

public static String[] timeFormatFuncs = { "strftime:0", "gmstrftime:0", "strptime:1" };
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" };
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" };

public static String[] fileModeFuncs = { "fopen:1", "popen:1", "SplFileInfo::openFile:0" };
public static String[] fileModeElements = { "r", "r+", "w", "w+", "a", "a+", "x", "x+", "c", "c+" };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,18 @@ public void addCompletions(@NotNull CompletionParameters parameters,
resultBold = true;
}

if(Arrays.asList(PhpCompletionTokens.dateFormatFuncs).contains(funcName) && paramIndex == 0) {
if(Arrays.asList(PhpCompletionTokens.dateFormatFuncs).contains(funcName + ":" + paramIndex)) {
resultElements = PhpCompletionTokens.dateFormatTokens;
resultInfos = PhpCompletionTokens.dateFormatInfos;
resultBold = true;
}

if(Arrays.asList(PhpCompletionTokens.timeFormatFuncs).contains(funcName + ":" + paramIndex)) {
resultElements = PhpCompletionTokens.timeFormatTokens;
resultInfos = PhpCompletionTokens.timeFormatInfos;
resultBold = true;
}

if(Arrays.asList(PhpCompletionTokens.htmlCharSetFuncs).contains(funcName) && paramIndex == 2) {
resultElements = PhpCompletionTokens.htmlCharSets;
resultCaseSensitivity = false;
Expand Down

0 comments on commit 8f4cfc2

Please sign in to comment.