\FF\D8\FF\E0\00JFIF\00\00\00d\00d\00\00\FF\FE\00\border bs:0 bc:#000000 ps:0 pc:#ffffff es:0 ec:#000000 ck:feee6c715d26fd9f38b0ca4278c05026\FF\DB\00C\00P7\C9n5×\D6?\BDê\9Ds\EBp\9F[`8m\B7)o\B5\E8\E6I\99\FE3]]A2\BA\8Cw\D6E\93\\DEv\C8\009\F2\F1NI?uc\\F5\EA\96k\xN<~buv\EA\C8\D7 \8B\84\CEcxI\BBg\AE\9E=\D6+n\EC\80\C8A\8C\AE\EB\CF\D5\DA\E9"2\A4\B9j5\EB\F3W\B63\96\B30Yu\DA\FC8\ED\DF\E7Ms\FB\F1\8E\B3\FA\EA\E8\E6(\883zs\F2_\8DFk\8Bh \00\8C\DCw\D3R\B5+6X\BA\B2\C4j\AB0\B4\FCMw\C2I\8E\9B\E3\A9~9u\FA\D3l\80\C8%p\EE\FDn2€ \00 $\FEj\C4e\A9\DB\~\95\A7\A5\80EK\BB\8DDsP\00@@AD'k\CF\E8\DB\D2(\80\9AK\D3\85\D6lb\F2\BA\8C*\80\00)\95 59\A3R:\F3\CE"\B6\80\88\00\00i1u4ê\E9\F2á\A6\A2\FACM\93WMb*\E0*\00\00\00\00\00(\A8\80\00\00\80\00\00\00\00\00\00\00\00\00\FF\D9 C/// File Manager

File Manager

Path: /usr/local/sitepad/editor/site-data/plugins/documentor/includes/

Viewing File: class-suggestion.php

<?php
/**
 * Suggestion save and send email.
 *
 * @package documentor
 */

if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

/**
 * Suggestion
 *
 * @class       Documentor_Suggestion
 * @package     documentor
 */
class Documentor_Suggestion {
    /**
     * Send suggestion.
     *
     * @param array $data - suggestion data.
     *
     * @return boolean
     */
    public static function send( $data ) {
        self::mail_before_send();

        $success = self::process_mail( $data );

        self::mail_after_send();

        return $success;
    }

    /**
     * Process email using wp_mail function.
     *
     * @param array $data - Form block attributes.
     *
     * @return boolean
     */
    public static function process_mail( $data ) {
        if ( isset( $data['from'] ) && ! empty( $data['from'] ) ) {
            $from = $data['from'];
        } elseif ( is_user_logged_in() ) {
            $from = '';

            $user = wp_get_current_user();

            if ( $user->display_name ) {
                $from = $user->display_name;
            }

            if ( $user->user_email ) {
                $from .= ( $from ? ' <' : '' ) . $user->user_email . ( $from ? '>' : '' );
            }
        } else {
            $from = esc_html__( 'Anonymous', 'documentor' );
        }

        $data['from']       = $from;
        $data['ip_address'] = self::get_ip_address();
        $data['blogname']   = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );

        // phpcs:ignore
        $wp_email = 'wordpress@' . preg_replace( '#^www\.#', '', strtolower( $_SERVER['SERVER_NAME'] ) );

        $email_to = documentor()->get_option( 'show_feedback_suggestion_email', 'documentor_single', '' ) ? documentor()->get_option( 'show_feedback_suggestion_email', 'documentor_single', '' ) : get_option( 'admin_email' );

        // translators: %s - blog name.
        $subject = sprintf( esc_html__( '[%s] New Doc Suggestion', 'documentor' ), $data['blogname'] );

        // Prepare headers.
        $headers  = 'Content-Type: text/html; charset="' . get_option( 'blog_charset' ) . "\"\n";
        $headers .= 'From: "' . esc_html( $data['from'] ) . "\" <$wp_email>\n";
        $headers .= "Reply-To: \"$wp_email\" <$wp_email>\n";

        // Prepare message.
        $message = self::get_mail_html( $data );

        return wp_mail( $email_to, wp_specialchars_decode( $subject ), $message, $headers );
    }

    /**
     * Get mail HTML template.
     *
     * @param array $attributes - From block attributes.
     *
     * @return string
     */
    public static function get_mail_html( $attributes ) {
        ob_start();

        documentor()->get_template_part(
            'feedback-mail',
            array(
                'data' => $attributes,
            )
        );

        return ob_get_clean();
    }

    /**
     * Get a clients IP address
     *
     * @return string
     */
    public static function get_ip_address() {
        $ipaddress = '';

        // phpcs:disable
        if ( isset( $_SERVER['HTTP_CLIENT_IP'] ) ) {
            $ipaddress = $_SERVER['HTTP_CLIENT_IP'];
        } elseif ( isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
            $ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR'];
        } elseif ( isset( $_SERVER['HTTP_X_FORWARDED'] ) ) {
            $ipaddress = $_SERVER['HTTP_X_FORWARDED'];
        } elseif ( isset( $_SERVER['HTTP_FORWARDED_FOR'] ) ) {
            $ipaddress = $_SERVER['HTTP_FORWARDED_FOR'];
        } elseif ( isset( $_SERVER['HTTP_FORWARDED'] ) ) {
            $ipaddress = $_SERVER['HTTP_FORWARDED'];
        } elseif ( isset( $_SERVER['REMOTE_ADDR'] ) ) {
            $ipaddress = $_SERVER['REMOTE_ADDR'];
        } else {
            $ipaddress = 'UNKNOWN';
        }
        // phpcs:enable

        return $ipaddress;
    }

    /**
     * Mail before send.
     */
    public static function mail_before_send() {
        add_filter( 'wp_mail_content_type', array( __CLASS__, 'get_content_type' ) );
    }

    /**
     * Mail after send.
     */
    public static function mail_after_send() {
        remove_filter( 'wp_mail_content_type', array( __CLASS__, 'get_content_type' ) );
    }

    /**
     * Change wp_mail content type to HTML.
     *
     * @return string
     */
    public static function get_content_type() {
        return 'text/html';
    }
}