<?php

/*
 * Class MP_Profit_Plugin_First_Action
 * 
 * first call to action section
 */

class MP_Profit_Plugin_First_Action {

	public function __construct() {
		add_action( 'mp_profit_section_first_action', array( $this, 'get_html' ) );
	}

	/*
	 * Get title
	 */

	public function get_title() {
		$mp_profit_first_action_title = esc_html( get_theme_mod( 'mp_profit_first_action_title' ) );

		if ( get_theme_mod( 'mp_profit_first_action_title', false ) === false ) :
			?>
			<h2 class="section-title"><?php _e( 'We can manage your finance', 'mp-profit' ); ?></h2>
			<?php
		else:
			if ( ! empty( $mp_profit_first_action_title ) ):
				?>
				<h2 class="section-title"><?php echo $mp_profit_first_action_title; ?></h2>
				<?php
			endif;
		endif;
	}

	/*
	 * Get description
	 */

	public function get_description() {
		$mp_profit_first_action_description = wp_kses_post( get_theme_mod( 'mp_profit_first_action_description' ) );

		if ( get_theme_mod( 'mp_profit_first_action_description', false ) === false ) :
			?>
			<div
				class="section-description"><?php _e( 'Our team consists of professionals who provide clients and partners with confidence and only best consulting and financial services. Join our company and use a great chance to conquer the trading market and be the one of those who are eager to lead and innovate in the financial industry', 'mp-profit' ); ?></div>
			<?php
		else:
			if ( ! empty( $mp_profit_first_action_description ) ):
				?>
				<div class="section-description"><?php echo $mp_profit_first_action_description; ?></div>
				<?php
			endif;
		endif;
	}

	/*
	 * Get buttons
	 */

	public function get_buttons() {
		$mp_profit_first_action_brandbutton_label = esc_html( get_theme_mod( 'mp_profit_first_action_brandbutton_label', __( 'Join us', 'mp-profit' ) ) );
		$mp_profit_first_action_brandbutton_url   = esc_url( get_theme_mod( 'mp_profit_first_action_brandbutton_url', '#pricing' ) );
		?>
		<div class="section-buttons">
			<?php
			if ( ! empty( $mp_profit_first_action_brandbutton_label ) && ! empty( $mp_profit_first_action_brandbutton_url ) ):
				?>
				<a href="<?php echo $mp_profit_first_action_brandbutton_url; ?>"
				   title="<?php echo $mp_profit_first_action_brandbutton_label; ?>"
				   class="button btn-size-middle"><?php echo $mp_profit_first_action_brandbutton_label; ?></a>
				<?php
			endif;
			?>
		</div>
		<?php
	}

	/*
	 * first call to action section
	 */
	public function get_html() {
		$mp_profit_first_action_bg = esc_url( get_theme_mod( 'mp_profit_first_action_bg' ) );
		if ( get_theme_mod( 'mp_profit_first_action_bg', false ) === false ):
			$mp_profit_first_action_bg = MP_PROFIT_PLUGIN_PATH . '/images/first-action-bg.jpg';
		endif;
		?>
		<section id="first-action" class="first-action-section transparent-section" <?php
		if ( ! empty( $mp_profit_first_action_bg ) ): echo "style='background-image: url(\"" . $mp_profit_first_action_bg . "\")'";
		endif;
		?>>
			<div class="section-bg">
				<div class="container">
					<div class="section-content">
						<?php
						$this->get_title();
						$this->get_description();
						$this->get_buttons();
						?>
					</div>
				</div>
			</div>
		</section>
		<?php
	}
}
