-
Notifications
You must be signed in to change notification settings - Fork 4
Node++ functions and macros
Jurek Muszyński edited this page Mar 31, 2022
·
16 revisions
Name | Description |
---|---|
npp_app_init | Called when application starts |
npp_app_main | Called after parsing HTTP request header Main entry point for a request |
npp_app_session_init | Called when new anonymous user session starts |
npp_app_user_login | Called after successful authentication |
npp_app_user_logout | Called when downgrading logged in user session to anonymous |
npp_app_session_done | Called when closing anonymous user session |
npp_app_done | Called when application shuts down |
Name | Description |
---|---|
npp_add_message | Adds error message |
npp_add_to_static_res | Adds string to static resources |
npp_read_param_int | Reads integer parameter from npp.conf |
npp_read_param_str | Reads string parameter from npp.conf |
npp_require_auth | Sets required authorization level for a resource |
npp_add_host | Assigns separate resource directories to a host |
Name | Description |
---|---|
HOST | Compares request Host with string |
QS | Retrieves string value from query string |
QSD | Retrieves double value from query string |
QSF | Retrieves float value from query string |
QSI | Retrieves integer value from query string |
QSL | Retrieves long integer value from query string |
QSU | Retrieves unsigned integer value from query string |
REQ | Compares the first part of request URI with string |
REQ_BOT | Answers whether request is from a bot |
REQ_COOKIE | Retrieves a cookie |
REQ_DATA | Request payload pointer |
REQ_DELETE | Answers whether request method is DELETE |
REQ_DSK | Answers whether request is from desktop user agent |
REQ_GET | Answers whether request method is GET |
REQ_ID | Last part of URI |
REQ_LANG | User agent primary language |
REQ_METHOD | Request method |
REQ_MOB | Answers whether request is from mobile user agent |
REQ_POST | Answers whether request method is POST |
REQ_PUT | Answers whether request method is PUT |
REQ_TAB | Answers whether request is from tablet user agent |
REQ_URI | Request URI |
URI | Compares request URI with string |
Name | Description |
---|---|
OUT | Appends string to the output buffer |
OUT_BIN | Appends binary data to the output buffer |
OUT_HTML_HEADER | Appends standard HTML header to the output buffer |
OUT_HTML_FOOTER | Appends standard HTML footer to the output buffer |
OUT_MSG_DESCRIPTION | Writes error message to the output buffer |
OUT_SNIPPET | Appends snippet to the output buffer |
OUT_SNIPPET_MD | Parses snippet as Markdown and appends result to the output buffer |
REDIRECT_TO_LANDING | Redirects browser to landing page |
RES_COOKIE | Sets a cookie |
RES_CONTENT_DISPOSITION | Adds Content-Disposition to response header |
RES_CONTENT_TYPE | Sets response content type |
RES_DONT_CACHE | Prevents response from being cached by browser |
RES_KEEP_CONTENT | Prevents response content from being reset on error |
RES_LOCATION | Sets response location and changes its status to 303 |
RES_STATUS | Sets response status |
Name | Description |
---|---|
LOGGED | Tells whether current session is logged in or not |
SESSION | Engine session structure |
SESSION_DATA | Application session data structure |
Name | Description |
---|---|
ALWAYS | Write string to log if logLevel > 0 |
ERR | Write string to log as ERROR if logLevel > 0 |
WAR | Write string to log as WARNING if logLevel > 1 |
INF | Write string to log if logLevel > 2 |
DBG | Write string to log if logLevel > 3 |
DDBG | Write string to log if NPP_DEBUG is defined |
Name | Description |
---|---|
CALL_ASYNC | Calls asynchronous service |
CALL_ASYNC_NR | Calls asynchronous service without response |
CALL_ASYNC_TM | Calls asynchronous service with specific timeout |
SVC | Compares service name with string |
Name | Description |
---|---|
npp_usr_activate | Activates user account |
npp_usr_add_user | Adds new user account without using current session |
npp_usr_change_password | Changes user password |
npp_usr_create_account | Creates user account |
npp_usr_email_registered | Checks whether email is already registered |
npp_usr_get_avatar | Retrieves user avatar into output buffer |
npp_usr_login | Logs user in |
npp_usr_logout | Logs user out |
npp_usr_reset_password | Resets user password using the emailed key |
npp_usr_save_account | Updates user details |
npp_usr_save_avatar | Saves user avatar |
npp_usr_send_message | Saves message from user |
npp_usr_send_passwd_reset_email | Sends password reset link |
npp_usr_verify_passwd_reset_key | Verifies password reset key |
GET_USER_INT | Gets user setting (integer) |
GET_USER_STR | Gets user setting (string) |
SET_USER_INT | Sets user setting (integer) |
SET_USER_STR | Sets user setting (string) |
Name | Description |
---|---|
CALL_HTTP | Makes HTTP call with plain char buffers |
CALL_REST | Makes HTTP call with JSON buffers |
CALL_HTTP_CONTENT_TYPE | Returns last CALL_HTTP response status |
CALL_HTTP_STATUS | Returns last CALL_HTTP response Content-Type |
CALL_HTTP_HEADER_SET | Adds or overwrites CALL_HTTP header |
CALL_HTTP_HEADER_UNSET | Removes CALL_HTTP header |
CALL_HTTP_HEADERS_RESET | Removes all previously set CALL_HTTP headers |
CALL_HTTP_DISCONNECT | Closes connection open with CALL_HTTP |
Name | Description |
---|---|
JSON_ADD_STR | Adds string to JSON object |
JSON_ADD_STR_A | Adds string to JSON array |
JSON_ADD_INT | Adds integer to JSON object |
JSON_ADD_INT_A | Adds integer to JSON array |
JSON_ADD_UINT | Adds unsigned integer to JSON object |
JSON_ADD_UINT_A | Adds unsigned integer to JSON array |
JSON_ADD_LONG | Adds long integer to JSON object |
JSON_ADD_LONG_A | Adds long integer to JSON array |
JSON_ADD_FLOAT | Adds float to JSON object |
JSON_ADD_FLOAT_A | Adds float to JSON array |
JSON_ADD_DOUBLE | Adds double to JSON object |
JSON_ADD_DOUBLE_A | Adds double to JSON array |
JSON_ADD_BOOL | Adds bool to JSON object |
JSON_ADD_BOOL_A | Adds bool to JSON array |
JSON_ADD_RECORD | Adds JSON record to JSON object |
JSON_ADD_RECORD_A | Adds JSON record to JSON array |
JSON_ADD_ARRAY | Adds JSON array to JSON object |
JSON_ADD_ARRAY_A | Adds JSON array to JSON array |
JSON_COUNT | Returns number of elements in JSON object |
JSON_FROM_STRING | Converts string to JSON object |
JSON_GET_STR | Gets string from JSON object |
JSON_GET_STR_A | Gets string from JSON array |
JSON_GET_INT | Gets integer from JSON object |
JSON_GET_INT_A | Gets integer from JSON array |
JSON_GET_UINT | Gets unsigned integer from JSON object |
JSON_GET_UINT_A | Gets unsigned integer from JSON array |
JSON_GET_LONG | Gets long integer from JSON object |
JSON_GET_LONG_A | Gets long integer from JSON array |
JSON_GET_FLOAT | Gets float from JSON object |
JSON_GET_FLOAT_A | Gets float from JSON array |
JSON_GET_DOUBLE | Gets double from JSON object |
JSON_GET_DOUBLE_A | Gets double from JSON array |
JSON_GET_BOOL | Gets bool from JSON object |
JSON_GET_BOOL_A | Gets bool from JSON array |
JSON_GET_RECORD | Gets JSON record from JSON object |
JSON_GET_RECORD_A | Gets JSON record from JSON array |
JSON_GET_ARRAY | Gets JSON array from JSON object |
JSON_GET_ARRAY_A | Gets JSON array from JSON array |
JSON_LOG_DBG | Logs JSON object content on DBG level |
JSON_LOG_INF | Logs JSON object content on INF level |
JSON_PRESENT | Checks field presence in JSON object |
JSON_RESET | Removes all elements from JSON object |
JSON_TO_STRING | Converts JSON object to string |
JSON_TO_STRING_PRETTY | Converts JSON object to pretty string |
Name | Description |
---|---|
AMT | Formats amount considering session's or user agent's language |
COPY | Safely copies NULL-terminated string with UTF-8 awareness |
CSRFT_OK | Verifies CSRF token |
CSRFT_OUT_INPUT | Adds hidden input with CSRF token to the form |
CSRFT_REFRESH | Refreshes CSRF token |
DATE | Formats date considering session's or user agent's language |
INT | Formats integer considering session's or user agent's language |
MSG | Returns error message considering session's or user agent's language |
MSG_CAT_GREEN | Tells whether error code belongs to messages category |
MSG_CAT_ORANGE | Tells whether error code belongs to warnings category |
MSG_CAT_RED | Tells whether error code belongs to errors category |
npp_admin_info | Renders admin info page |
npp_bin2hex | Converts binary data to its hex representation |
npp_convert | Converts string from one CP to another |
npp_email | Sends an email |
npp_email_attach | Sends email with attachement |
npp_filter_strict | Converts string to be suitable for a file name |
npp_html_esc | HTML-escapes string |
npp_html_unesc | HTML-unescapes string |
npp_message | Returns an error message |
npp_minify | Minifies CSS or JS |
npp_random | Generates random string |
npp_sql_esc | SQL-escapes string |
STR | Returns string version depending on session or user agent's language |
STRM | Provides simple streaming for C-style strings |
npp_url_encode | URI-encodes string |