HEX
Server: Apache/2.4.25
System: Linux ion14 4.9.0-8-amd64 #1 SMP Debian 4.9.144-3.1 (2019-02-19) x86_64
User: (10087)
PHP: 7.4.30
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,system, exec, shell_exec, passthru, popen, proc_open
Upload Files
File: /home/www/web115/wordpress/wp-content/plugins/digimember/system/library/mail_renderer.php
<?php

class ncore_MailRendererLib extends ncore_Library
{
    public function variableName( $basename )
    {
        return '%%' . $basename . '%%';
    }

    public function renderMail( $template, $params )
    {
        $this->initialize();

        $template_body_html = $this->filterMailBody( $template->body_html );

        list( $params_text, $params_html ) = $this->splitParams( $params );

        $subject   = $this->render( $template->subject, $params_text );
        $body_html = $this->render( $template_body_html, $params_html );

        return array(
             $subject,
            $body_html
        );
    }


    private static $is_initialized = false;

    private function render( $template, $params )
    {
        list( $find, $repl ) = $this->prepareParams( $params );

        $text = str_replace( $find, $repl, $template );

        return $text;
    }

    private function prepareParams( $params )
    {
        $find = array();
        $repl = array();

        foreach ( $params as $key => $value )
        {
            $find[] = $this->variableName( $key );
            $repl[] = $value;
        }

        return array(
             $find,
            $repl
        );
    }

    private function initialize()
    {
        if ( self::$is_initialized )
        {
            return;
        }

        self::$is_initialized = true;
    }

    private function splitParams( $params )
    {
        $params_text = array();
        $params_html = array();

        foreach ( $params as $key => $value )
        {
            if ( is_array( $value ) )
            {
                $text = $value[ 0 ];
                $html = $value[ 1 ];
            }
            else
            {
                $text = $value;
                $html = $value;
            }

            $params_text[ $key ] = $text;
            $params_html[ $key ] = $html;
        }
        return array(
             $params_text,
            $params_html
        );
    }

    private function filterMailBody( $body )
    {
        $body = wptexturize(       $body );
        $body = convert_smilies(   $body );
        $body = convert_chars(     $body );
        $body = wpautop(           $body );
        $body = shortcode_unautop( $body );

        return $body;
    }
}