prefix . "noesis_forms_" . $name; } function now(): string { return current_time("mysql", true); } function json($value): string { return (string) wp_json_encode( $value, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES, ); } function problem( string $message, int $status = 400, array $extra = [], ): \WP_Error { return new \WP_Error( "noesis_forms", $message, ["status" => $status] + $extra, ); } function allowed(string $cap = "manage_noesis_forms"): bool { return current_user_can($cap); } function settings(): array { return array_replace( [ "recipient" => get_option("admin_email"), "sender_name" => get_bloginfo("name"), "site_key" => "", "secret_key" => "", "hubspot_token" => "", "rate_limit" => 6, ], (array) get_option("noesis_forms_settings", []), ); } function nonce_link(string $url, string $action): string { return html_entity_decode( \wp_nonce_url($url, $action), ENT_QUOTES, "UTF-8", ); } function asset_stamp(string $file): string { return VERSION . "." . substr(hash_file("sha256", __DIR__ . "/assets/" . $file), 0, 12); }