misc.php
Table of Contents
- mpa_any_value() : array<string|int, mixed>
- mpa_no_value() : array<string|int, mixed>
- mpa_country_code() : string
- mpa_country_label() : string
- mpa_str_starts_with() : bool
- mpa_load_polyfill() : mixed
- mpa_mailer() : MailerInterface
- mpa_create_fields() : array<string|int, AbstractField>
- Usage: <ul> <li>1 argument (only fields, default usage): <code>mpa_create_fields($fields);</code> (get values from wp_options table)</li> <li>2 arguments - fields and prefix: <code>mpa_create_fields($fields, 'metabox'); // $type = 'postmeta', $id = get_the_ID()</code></li> <li>3 arguments - use default type, but custom ID: <code>mpa_create_fields($fields, 'metabox', $postId); // $type = 'postmeta', $id = $postId</code></li> <li>3 arguments: <code>mpa_create_fields($fields, $prefix, $type); // $id = get_the_ID()</code></li> <li>4 arguments: <code>mpa_create_fields($fields, $prefix, $type, $id);</code></li> </ul>
- mpa_group_fields() : array<string|int, mixed>
- mpa_shift_days_array() : array<string|int, mixed>
- Works properly only when all values (with indexes 0-6) are present in the array.
- mpa_str_ends_with() : bool
- mpa_carry() : Function
- mpa_carry_shift() : Function
- mpa_set_time_limit() : mixed
- mpa_generate_uuid4() : string
- Source: http://php.net/manual/ru/function.uniqid.php#94959
- mpa_add_post_uid() : int|false
- Adds UID meta field only if it does not exist.
- mpa_payment_manager() : PaymentManager
- mpa_generate_product_name() : string
Functions
mpa_any_value()
mpa_any_value([mixed $value = '' ][, string $label = '' ]) : array<string|int, mixed>
Parameters
- $value : mixed = ''
-
Optional. '' by default.
- $label : string = ''
-
Optional. '— Any —' by default.
Tags
mpa_no_value()
mpa_no_value([mixed $value = '' ][, string $label = '' ]) : array<string|int, mixed>
Parameters
- $value : mixed = ''
-
Optional. '' by default.
- $label : string = ''
-
Optional. '— Select —' by default.
Tags
mpa_country_code()
mpa_country_code(string $countryLabel) : string
Parameters
- $countryLabel : string
-
Country label like 'Germany' or 'United States (US)'.
Tags
mpa_country_label()
mpa_country_label(string $countryCode) : string
Parameters
- $countryCode : string
-
Country code like 'US'.
Tags
mpa_str_starts_with()
mpa_str_starts_with(string $haystack, string $needle) : bool
Parameters
- $haystack : string
- $needle : string
Tags
mpa_load_polyfill()
mpa_load_polyfill(string $polyfill) : mixed
Parameters
- $polyfill : string
-
Polyfill name, like 'mbstring'.
Tags
mpa_mailer()
mpa_mailer() : MailerInterface
Tags
mpa_create_fields()
Usage: <ul> <li>1 argument (only fields, default usage): <code>mpa_create_fields($fields);</code> (get values from wp_options table)</li> <li>2 arguments - fields and prefix: <code>mpa_create_fields($fields, 'metabox'); // $type = 'postmeta', $id = get_the_ID()</code></li> <li>3 arguments - use default type, but custom ID: <code>mpa_create_fields($fields, 'metabox', $postId); // $type = 'postmeta', $id = $postId</code></li> <li>3 arguments: <code>mpa_create_fields($fields, $prefix, $type); // $id = get_the_ID()</code></li> <li>4 arguments: <code>mpa_create_fields($fields, $prefix, $type, $id);</code></li> </ul>
mpa_create_fields(array<string|int, mixed> $fields[, string $prefix = 'public' ][, string $type = 'option' ], int $id) : array<string|int, AbstractField>
Parameters
- $fields : array<string|int, mixed>
-
Array of args.
- $prefix : string = 'public'
-
Optional. See allowed prefixes in mpa_prefix(). 'public' by default.
- $type : string = 'option'
-
'option'|'postmeta'|'widget' Optional. The type of the source. 'option' by default.
- $id : int
-
Optional. ID of the post. Only for metaboxes (postmetas). Current post ID by default.
Tags
mpa_group_fields()
mpa_group_fields(array<string|int, mixed> $fields) : array<string|int, mixed>
Parameters
- $fields : array<string|int, mixed>
-
[Field name => args or AbstractField]
Tags
mpa_shift_days_array()
Works properly only when all values (with indexes 0-6) are present in the array.
mpa_shift_days_array(array<string|int, mixed> $daysArray[, int $firstDay = -1 ]) : array<string|int, mixed>
Parameters
- $daysArray : array<string|int, mixed>
- $firstDay : int = -1
-
Optional. -1 by default (use settings value).
Tags
mpa_str_ends_with()
mpa_str_ends_with(string $haystack, string $needle) : bool
Parameters
- $haystack : string
- $needle : string
Tags
mpa_carry()
mpa_carry(callable $function, mixed $carry) : Function
Parameters
- $function : callable
- $carry : mixed
-
Value of the last argument.
Tags
mpa_carry_shift()
mpa_carry_shift(callable $function, mixed $carry) : Function
Parameters
- $function : callable
- $carry : mixed
-
Value of the first argument.
Tags
mpa_set_time_limit()
mpa_set_time_limit(int $limit) : mixed
Parameters
- $limit : int
-
The maximum execution time, in seconds. If set to zero, no time limit is imposed.
Tags
mpa_generate_uuid4()
Source: http://php.net/manual/ru/function.uniqid.php#94959
mpa_generate_uuid4() : string
Tags
mpa_add_post_uid()
Adds UID meta field only if it does not exist.
mpa_add_post_uid(int $postId[, string $uid = '' ]) : int|false
Parameters
- $postId : int
- $uid : string = ''
-
Optional. New UUID v4 by default.
Tags
mpa_payment_manager()
mpa_payment_manager() : PaymentManager
Tags
mpa_generate_product_name()
mpa_generate_product_name(Booking|int $booking) : string
Parameters
- $booking : Booking|int
-
Booking entity or ID.