Server IP : 103.119.228.120 / Your IP : 52.15.52.104 Web Server : Apache System : Linux v8.techscape8.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64 User : nobody ( 99) PHP Version : 5.6.40 Disable Function : shell_exec,symlink,system,exec,proc_get_status,proc_nice,proc_terminate,define_syslog_variables,syslog,openlog,closelog,escapeshellcmd,passthru,ocinum cols,ini_alter,leak,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dl,dll,myshellexec,proc_open,socket_bind,proc_close,escapeshellarg,parse_ini_filepopen,fpassthru,exec,passthru,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,popen,show_source,proc_nice,proc_terminate,proc_get_status,proc_close,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,dl,symlink,shell_exec,system,dl,passthru,escapeshellarg,escapeshellcmd,myshellexec,c99_buff_prepare,c99_sess_put,fpassthru,getdisfunc,fx29exec,fx29exec2,is_windows,disp_freespace,fx29sh_getupdate,fx29_buff_prepare,fx29_sess_put,fx29shexit,fx29fsearch,fx29ftpbrutecheck,fx29sh_tools,fx29sh_about,milw0rm,imagez,sh_name,myshellexec,checkproxyhost,dosyayicek,c99_buff_prepare,c99_sess_put,c99getsource,c99sh_getupdate,c99fsearch,c99shexit,view_perms,posix_getpwuid,posix_getgrgid,posix_kill,parse_perms,parsesort,view_perms_color,set_encoder_input,ls_setcheckboxall,ls_reverse_all,rsg_read,rsg_glob,selfURL,dispsecinfo,unix2DosTime,addFile,system,get_users,view_size,DirFiles,DirFilesWide,DirPrintHTMLHeaders,GetFilesTotal,GetTitles,GetTimeTotal,GetMatchesCount,GetFileMatchesCount,GetResultFiles,fs_copy_dir,fs_copy_obj,fs_move_dir,fs_move_obj,fs_rmdir,SearchText,getmicrotime MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/softaculous/sitepad/editor/site-data/plugins/documentor/includes/ |
Upload File : |
<?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'; } }