<commit_before><?php

if( !defined( 'WPINC' ) )
  die();

/**
 *
 * Controller Contato
 */
class CTR_Contact
{

    private $_mail_contact        = "<EMAIL>";

    // -----------------------------------------------------------------------------

    function __construct() {
        add_filter( "ctr_contact_send_mail" ,  array( &$this, 'send_mail' ), 10, 2);
    }

    // -----------------------------------------------------------------------------

    /**
     * Format the body content of the mail
     * @return string 
     */
    private function format_body_content() {

        $data = new DateTime("now",  new DateTimeZone('America/Sao_Paulo'));
        $body = file_get_contents(TEMPLATEPATH . '/partials/mail-template/mail-template-contact.php');
        $body = str_replace( "%name%",  $_POST['cf_name'], $body);
        $body = str_replace( "%titulo%", 'E-mail enviado via Página de Contato', $body);
        $body = str_replace( "%email%", $_POST['cf_email'], $body);
        $body = str_replace( "%telephone%", $_POST['cf_phone'], $body);
        $body = str_replace( "%message%", $_POST['cf_message'], $body);
        $body = str_replace( "%subscribe_news%", $_POST['cf_subscribe_news'], $body);
        $body = str_replace( "%sent_date%", $data->format("d/m/Y H:i:s"), $body );
        return $body;

    }

    // -----------------------------------------------------------------------------

    /**
     * Send a contact mail 
     * @return bool True if sucess, false if fail
     */
    public function send_mail() {

        $contact_info = get_option( 'localizacao_e_contato' );

        if( isset( $contact_info['email_contato'] ) )
            $this->_mail_contact = $contact_info['email_contato'];


        if(!$_POST)
            return false;

        $headers[] = "From: Cliente - Página de Contato  <". $this->_mail_contact . ">";
        $headers[] = 'Cco: <NAME> <<EMAIL>>';
        $headers[] = "Content-type: text/html";

        $body      = $this->format_body_content();

        if( wp_mail( $this->_mail_contact  ,  " Cliente - Página de Contato ", $body, $headers) )
            return true;
        else
            return false;

    }

    // -----------------------------------------------------------------------------

}

new CTR_Contact;<commit_msg> [ CONTATO ] Arruma o controller de contato<commit_after><?php

if( !defined( 'WPINC' ) )
  die();

/**
 *
 * Controller Contato
 */
class CTR_Contact
{

    private $_mail_contact        = "<EMAIL>";

    // -----------------------------------------------------------------------------

    function __construct() {
        add_filter( "ctr_contact_send_mail" ,  array( &$this, 'send_mail' ), 10, 2);
    }

    // -----------------------------------------------------------------------------

    /**
     * Send a contact mail 
     * @return bool True if sucess, false if fail
     */
    public function send_mail() {

        if(!$_POST)
            return false;

        $contact_info = get_option( 'localizacao_e_contato' );

        if( isset( $contact_info['email_contato'] ) )
            $this->_mail_contact = $contact_info['email_contato'];

        $headers[] = "From: Cliente - Página de Contato  <". $this->_mail_contact . ">";
        $headers[] = 'Cco: <NAME> <<EMAIL>>';
        $headers[] = "Content-type: text/html";

        $body      = $this->formatBodyContent();

        if( wp_mail( $this->_mail_contact  ,  " Cliente - Página de Contato ", $body, $headers) )
            return true;
        else
            return false;

    }

    // -----------------------------------------------------------------------------

    /**
     * Format the body content of the mail
     * @return string 
     */
    private function formatBodyContent() {

        $data = new DateTime("now",  new DateTimeZone('America/Sao_Paulo'));
        $body = file_get_contents(TEMPLATEPATH . '/partials/mail-template/mail-template-contact.php');
        $body = str_replace( "%name%",  $_POST['cf_name'], $body);
        $body = str_replace( "%titulo%", 'E-mail enviado via Página de Contato', $body);
        $body = str_replace( "%email%", $_POST['cf_email'], $body);
        $body = str_replace( "%telephone%", $_POST['cf_phone'], $body);
        $body = str_replace( "%message%", $_POST['cf_message'], $body);
        $body = str_replace( "%subscribe_news%", $_POST['cf_subscribe_news'], $body);
        $body = str_replace( "%sent_date%", $data->format("d/m/Y H:i:s"), $body );
        return $body;

    }

    // -----------------------------------------------------------------------------

}

new CTR_Contact;
{'fraction_non_alphanumeric': 0.2784864864864865, 'fraction_numerical': 0.0012972972972972972, 'mean_word_length': 1.6017997750281214, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2615481', 'n_tokens_mistral': 1357, 'n_tokens_neox': 1309, 'n_words': 289}