true )
);
} //End of cf7_init
/**
* Admin init
*/
public function admin_init() {
//Add Tag generator button
if ( ! class_exists( 'WPCF7_TagGenerator' ) ) {
return;
}
$tag_generator = WPCF7_TagGenerator::get_instance();
$tag_generator->add(
'mpconsent',
$this->__( 'MailPoet Consent' ),
array( $this, 'mailpoetsignup_tag_generator' )
);
} //End of admin_init
/**
* Display message
*/
public function mpconsent_form_tag( $tag ) {
$controls_class = wpcf7_form_controls_class( $tag->type ); // conrol class
$id_option = $tag->get_id_option(); // id option if avilable
$id = empty( $id_option ) ? $tag->name : $id_option; // fetch id
// build html attribute
$atts = array(
'class' => $tag->get_class_option(),
'id' => $id,
);
$attributes = wpcf7_format_atts( $atts );
// build consent ***
$consent = '';
foreach ( $tag->values as $key => $value ) {
if ( empty( $value ) ) {
$consent .= "
";
continue;
}
$consent .= $value;
$consent .= ' ';
}
$privacypage = $tag->get_option( 'privacypage' );
$translatedPp = $this->__( 'Privacy Policy' );
$privacypage = ! empty( $privacypage[0] ) ? "$translatedPp" : '';
$consent = str_replace( '{privacypage}', $privacypage, $consent );
if ( ! empty( $consent ) ) {
$consent = html_entity_decode( $consent );
}
ob_start();
?>