attribute['sg_content_date'] );
$label_position = esc_attr( $this->attribute['st_content_label_position'] );
$due_date = gmdate( 'Y-m-d\TH:i:s', strtotime( $date ) );
$data = array_merge( array( 'due-date' => $due_date ), $this->expired_data() );
$separator = 'yes' === $this->attribute['sg_content_separator_enable'] ? 'separator-enable' : '';
$timer = '';
if ( 'yes' === $this->attribute['sg_content_day_enable'] ) {
$content = '0 ';
if ( 'top' === $label_position ) {
$content = '' . esc_attr( $this->attribute['sg_content_day_label'] ) . '' . $content;
} else {
$content = $content . '' . esc_attr( $this->attribute['sg_content_day_label'] ) . '';
}
$timer = $timer .
'
';
}
if ( 'yes' === $this->attribute['sg_content_hour_enable'] ) {
$content = '0 ';
if ( 'top' === $label_position ) {
$content = '' . esc_attr( $this->attribute['sg_content_hour_label'] ) . '' . $content;
} else {
$content = $content . '' . esc_attr( $this->attribute['sg_content_hour_label'] ) . '';
}
$timer = $timer .
'';
}
if ( 'yes' === $this->attribute['sg_content_minute_enable'] ) {
$content = '0 ';
if ( 'top' === $label_position ) {
$content = '' . esc_attr( $this->attribute['sg_content_minute_label'] ) . '' . $content;
} else {
$content = $content . '' . esc_attr( $this->attribute['sg_content_minute_label'] ) . '';
}
$timer = $timer .
'';
}
if ( 'yes' === $this->attribute['sg_content_second_enable'] ) {
$content = '0 ';
if ( 'top' === $label_position ) {
$content = '' . esc_attr( $this->attribute['sg_content_second_label'] ) . '' . $content;
} else {
$content = $content . '' . esc_attr( $this->attribute['sg_content_second_label'] ) . '';
}
$timer = $timer .
'';
}
return $this->render_wrapper( 'countdown', $timer, array( $separator ), $data );
}
/**
* Add expired action data
*
* @return array
*/
private function expired_data() {
$data = array();
$type = esc_attr( $this->attribute['sg_expire_type'] );
$data['expired-type'] = $type;
if ( 'message' === $type ) {
$data['expired-title'] = esc_attr( $this->attribute['sg_expire_title'] );
$data['expired-content'] = esc_attr( $this->attribute['sg_expire_content'] );
} elseif ( 'redirect' === $type ) {
$data['redirect-link'] = esc_url( $this->attribute['sg_expire_link'] );
$data['iframe-content'] = esc_html__( 'Your page will be redirected on frontend', 'jeg-elementor-kit' );
} elseif ( 'template' === $type ) {
$template = Plugin::$instance->frontend->get_builder_content( $this->attribute['sg_expire_template'], true );
$template = preg_replace( '~[\r\n\s]+~', ' ', $template );
$data['template'] = esc_attr( $template );
}
return $data;
}
}