shortcodes.php
Functions used for parsing user values for some shortcode attributes.
Tags
Table of Contents
- parse_categories() : array<string|int, mixed>
- Parses a string of transaction category/type slugs.
- parse_tags() : array<string|int, mixed>
- parse_atts_for_currency() : void
- Parses shortcode attributes to determine the currency specified, if any.
- parse_atts_for_user() : void
- Parses shortcode attributes to determine the user specified, if any.
- get_template_part() : string
- Retrieves a template part for this plugin or its extensions.
- locate_template() : string|null
Functions
parse_categories()
Parses a string of transaction category/type slugs.
parse_categories(string $category_slugs) : array<string|int, mixed>
Transactions can have any one of the category/type slugs:
-
deposit
-
withdrawal
-
move
Additionally, all
is used to refer to all three categories/types.
Note that these are not real taxonomies, just a post_meta on the posts of wallets_tx
type.
Parameters
- $category_slugs : string
-
Comma-separated list of category/type slugs.
Return values
array<string|int, mixed> —Parsed list of category/type slugs.
parse_tags()
parse_tags([string $tags = '' ]) : array<string|int, mixed>
Parameters
- $tags : string = ''
Return values
array<string|int, mixed> —parse_atts_for_currency()
Parses shortcode attributes to determine the currency specified, if any.
parse_atts_for_currency(array<string|int, mixed> &$atts) : void
Looks for these attributes in sequence: currency_id
, coingecko_id
, symbol
.
Parameters
- $atts : array<string|int, mixed>
-
The shortcode attruibutes.
Return values
void —parse_atts_for_user()
Parses shortcode attributes to determine the user specified, if any.
parse_atts_for_user(array<string|int, mixed> &$atts) : void
First checks for the user attribute. If it matches a login, email, or slug for a user,
it sets the \WP_User
object in $atts['user_data']
Alternatively, if the user_id is specified, then the user with that ID is loaded into user_data
.
Parameters
- $atts : array<string|int, mixed>
-
The shortcode attributes.
Tags
Return values
void —get_template_part()
Retrieves a template part for this plugin or its extensions.
get_template_part(string $slug[, string|null $name = null ][, bool $load = false ][, string $plugin_slug = 'wallets' ]) : string
Adapted from bbPress
Parameters
- $slug : string
-
The generic template part.
- $name : string|null = null
-
The specialized template part.
- $load : bool = false
-
Whether to include the template.
- $plugin_slug : string = 'wallets'
Tags
Return values
string —Full path to the template file.
locate_template()
locate_template(array<string|int, mixed> $template_names[, bool $load = false ][, string $plugin_slug = 'wallets' ]) : string|null
Parameters
- $template_names : array<string|int, mixed>
- $load : bool = false
- $plugin_slug : string = 'wallets'