home/monara/public_html/SMJ2/wp-content/plugins/mailpoet/lib/WP/Functions.php 0000644 00000062212 15073177134 0023147 0 ustar 00 install($package, $args);
}
/**
* @param string $plugin
* @param string $redirect
* @param bool $networkWide
* @param bool $silent
* @return WP_Error|null
*/
public function activatePlugin($plugin, $redirect = '', $networkWide = false, $silent = false) {
return activate_plugin($plugin, $redirect, $networkWide, $silent);
}
public function wpGetAttachmentImageSrcset(int $attachmentId, $size = 'medium', $imageMeta = null) {
return wp_get_attachment_image_srcset($attachmentId, $size, $imageMeta);
}
/**
* @param string $host
* @return array|bool
*/
public function parseDbHost($host) {
global $wpdb;
return $wpdb->parse_db_host($host);
}
/**
* @param int|\WP_Post $post
* @param string $context
* @return string|null
*/
public function getEditPostLink($post, string $context = 'display') {
return get_edit_post_link($post, $context);
}
/**
* @param string $string
* @param array[]|string $allowedHtml
* @param array $allowedProtocols
* @return string
*/
public function wpKses(string $string, $allowedHtml, $allowedProtocols = []) {
return wp_kses($string, $allowedHtml, $allowedProtocols);
}
public function deprecatedHook(string $hook_name, string $version, string $replacement, string $message) {
_deprecated_hook(
esc_html($hook_name),
esc_html($version),
esc_html($replacement),
wp_kses_post($message)
);
}
public function getTheExcerpt($post = null) {
return get_the_excerpt($post);
}
public function hasExcerpt($post = null) {
return has_excerpt($post);
}
public function wpMkdirP(string $dir) {
return wp_mkdir_p($dir);
}
public function wpGetImageEditor(string $path, $args = []) {
return wp_get_image_editor($path, $args);
}
public function wpRegisterScript(string $handle, $src, $deps = [], $ver = false, $in_footer = false): bool {
return wp_register_script($handle, $src, $deps, $ver, $in_footer);
}
public function wpSetScriptTranslations(string $handle, string $domain = 'default', string $path = ''): bool {
return wp_set_script_translations($handle, $domain, $path);
}
/**
* @return \WP_Scripts
*/
public function getWpScripts() {
return wp_scripts();
}
/** @param string[]|null $protocols */
public function escUrlRaw(string $url, array $protocols = null): string {
return esc_url_raw($url, $protocols);
}
public function restUrl(string $path = '', string $scheme = 'rest'): string {
return rest_url($path, $scheme);
}
public function registerRestRoute(string $namespace, string $route, array $args = [], bool $override = false): bool {
return register_rest_route($namespace, $route, $args, $override);
}
public function registerRestField($object_type, string $attribute, array $args = []) {
return register_rest_field($object_type, $attribute, $args);
}
/**
* @param mixed $value
* @return true|WP_Error
*/
public function restValidateValueFromSchema($value, array $args, string $param = '') {
return rest_validate_value_from_schema($value, $args, $param);
}
/**
* @param mixed $value
* @return mixed|WP_Error
*/
public function restSanitizeValueFromSchema($value, array $args, string $param = '') {
return rest_sanitize_value_from_schema($value, $args, $param);
}
/**
* @param mixed $value
* @param string $param
* @param array $errors
* @return WP_Error
*/
public function restGetCombiningOperationError($value, string $param, array $errors): WP_Error {
/* @phpstan-ignore-next-line Wrong annotation for first parameter in WP. */
return rest_get_combining_operation_error($value, $param, $errors);
}
/**
* @param mixed $value
* @param array $args
* @param string $param
* @param bool $stopAfterFirstMatch
* @return array|WP_Error
*/
public function restFindOneMatchingSchema($value, array $args, string $param, bool $stopAfterFirstMatch = false) {
return rest_find_one_matching_schema($value, $args, $param, $stopAfterFirstMatch);
}
/**
* @param string $property
* @param array $args
* @return array|null
*/
public function restFindMatchingPatternPropertySchema(string $property, array $args): ?array {
return rest_find_matching_pattern_property_schema($property, $args);
}
public function wpGetInstalledTranslations(string $type): array {
return wp_get_installed_translations($type);
}
public function getAvailableLanguages(?string $dir = null): array {
return get_available_languages($dir);
}
public function isWpError($value): bool {
return is_wp_error($value);
}
public function wpIsSiteUrlUsingHttps(): bool {
return wp_is_site_url_using_https();
}
public function getPostMeta(int $postId, string $key, bool $single = false) {
return get_post_meta($postId, $key, $single);
}
public function getFileData(string $file, array $default_headers, string $context = 'plugin'): array {
return get_file_data($file, $default_headers, $context);
}
public function getPluginData(string $plugin_file, bool $markup = true, bool $translate = true): array {
return get_plugin_data($plugin_file, $markup, $translate);
}
public function wpIsBlockTheme(): bool {
// wp_is_block_theme exists only in WP 5.9+
if (function_exists('wp_is_block_theme')) {
return wp_is_block_theme();
}
return false;
}
public function getShortcodeRegex($tagnames = null): string {
return get_shortcode_regex($tagnames);
}
public function isHome() {
return is_home();
}
public function getQueriedObjectId() {
return get_queried_object_id();
}
}