*/ public static function feedbackClient(): array { $direct = self::feedbackDirect(); return array( 'direct' => $direct, 'endpoint' => $direct ? self::feedbackEndpoint() : '', 'accessKey' => $direct ? self::feedbackAccessKey() : '', 'timeoutMs' => self::FEEDBACK_TIMEOUT * 1000, 'siteUrl' => site_url(), 'wpVersion' => get_bloginfo( 'version' ), 'phpVersion' => PHP_VERSION, 'migratexVersion' => MIGRATEX_VERSION, 'types' => \MigrateX\Http\Controller\FeedbackController::types(), 'maxMessage' => \MigrateX\Http\Controller\FeedbackController::MAX_MESSAGE, // The page appends ?subject=...&body=... and ?text=... once it knows the message. 'mailto' => 'mailto:' . self::recipient(), 'whatsapp' => 'https://wa.me/' . self::WHATSAPP_NUMBER, ); } /** * A mailto: link with the subject and message already filled in, for when the request could not be made. * The body is cut to a length mail programs accept in a link. */ public static function mailtoUrl( string $subject, string $body ): string { $body = function_exists( 'mb_substr' ) ? mb_substr( $body, 0, 1500 ) : substr( $body, 0, 1500 ); return 'mailto:' . self::recipient() . '?subject=' . rawurlencode( $subject ) . '&body=' . rawurlencode( $body ); } /** * wa.me chat link with the start of the message filled in. */ public static function whatsappUrl( string $text ): string { $text = function_exists( 'mb_substr' ) ? mb_substr( $text, 0, 500 ) : substr( $text, 0, 500 ); return 'https://wa.me/' . self::WHATSAPP_NUMBER . '?text=' . rawurlencode( $text ); } /** * Who receives the fallback email. */ public static function recipient(): string { $address = (string) apply_filters( 'migratex_feedback_recipient', self::EMAIL ); return is_email( $address ) ? $address : self::EMAIL; } /** * The channels listed in the sidebar. * * @return array */ public static function channels(): array { $channels = array( 'whatsapp' => array( 'icon' => 'whatsapp', 'label' => __( 'Chat on WhatsApp', 'migratex' ), 'detail' => self::WHATSAPP_LABEL, 'url' => 'https://wa.me/' . self::WHATSAPP_NUMBER, 'external' => true, ), 'email' => array( 'icon' => 'mail', 'label' => self::EMAIL, 'detail' => __( 'Email support', 'migratex' ), 'url' => 'mailto:' . self::EMAIL, 'external' => false, // Shown as a "Copy email" button beside the row, for desktops whose mail program is not set up. 'copy' => self::EMAIL, ), ); return (array) apply_filters( 'migratex_contact_channels', $channels ); } }