/home/fdhrevqn/public_html/wp-content/plugins.disabled/fox-framework/addons/heading/frontend.php
<?php
$settings = $this->get_settings_for_display();

extract( wp_parse_args( $settings, [
    'title' => 'Enter title here',
    'title_tag' => '',
    'title_color' => '',
    'title_size' => '',
    'title_text_transform' => '',

    'subtitle' => '',
    'subtitle_tag' => '',
    'subtitle_color' => '',

    'url' => '',
    'url_target' => '',
    'url_text' => '',
    'url_position' => 'right',

    'image' => '',
    'image_width' => '',

    'line' => false,

    'align' => '',
    'extra_class' => '',
]) );

$title = trim( $title );
if ( $title == '' ) return;

$class = [ 'fox-heading' ];
if ( $extra_class ) {
    $class[] = $extra_class;
}

$title_attrs = $subtitle_attrs = [];
$title_css = $subtitle_css = [];
$title_class = [ 'heading-title-main' ];
$subtitle_class = [ 'heading-subtitle-main' ];

/* TITLE
-------------------- */
// color
if ( $title_color ) {
    $title_css[] = 'color:' . $title_color;
    $title_class[] = 'custom-color';
}

// size
if ( ! in_array( $title_size, [ 'large', 'medium', 'normal', 'small', 'tiny', 'supertiny' ] ) ) $title_size = 'large';
$title_class[] = 'size-' . $title_size;

// transform
if ( $title_text_transform ) {
    $title_class[] = 'text-' . $title_text_transform;
}

// attrs
if ( $title_css ) {
    $title_attrs[] = 'style="' . esc_attr( join( ';', $title_css ) ). '"';
}
$title_attrs[] = 'class="' . esc_attr( join( ' ', $title_class ) ) . '"';
$title_attrs = join( ' ', $title_attrs );

// title
if ( ! in_array( $title_tag, [ 'h1', 'h2', 'h3', 'h4', 'p' ] ) ) $title_tag = 'h2';
$line_html = '';
if ( $line ) {
    $class[] = 'heading-line-' . $line;
    $line_html = '<span class="line line-left"></span><span class="line line-right"></span>';
}
$title_html = "<{$title_tag} {$title_attrs}>{$title}{$line_html}</{$title_tag}>";

/* LINK
-------------------- */
$link_html = '';
if ( $url && $url_text ) {
    
    $link_css = '';
    if ( $title_css ) {
        $link_css = ' style="' . esc_attr( join( ';', $title_css ) ). '"';
    }

    if ( '_blank' != $url_target ) $url_target = '_self';
    $link_html = '<a href="' . esc_url( $url ) . '" target="' . esc_attr( $url_target ) . '"' . $link_css . '>' . esc_html( $url_text ) . '</a>';
    $class[] = 'has-link';

    if ( 'next' != $url_position ) $url_position = 'right';
    $class[] = 'link-position-' . $url_position;

}

/* SUBTITLE
-------------------- */
// color
if ( $subtitle_color ) {
    $subtitle_css[] = 'color:' . $subtitle_color;
    $subtitle_class[] = 'custom-color';
}

// attrs
if ( $subtitle_css ) {
    $subtitle_attrs[] = 'style="' . esc_attr( join( ';', $subtitle_css ) ). '"';
}
$subtitle_attrs[] = 'class="' . esc_attr( join( ' ', $subtitle_class ) ) . '"';
$subtitle_attrs = join( ' ', $subtitle_attrs );

// subtitle
$subtitle_html = '';
$subtitle = trim( $subtitle );

if ( $subtitle ) {

    if ( ! in_array( $subtitle_tag, [ 'h1', 'h2', 'h3', 'h4', 'p' ] ) ) $subtitle_tag = 'h3';
    $subtitle_html = "<{$subtitle_tag} {$subtitle_attrs}>{$subtitle}</{$subtitle_tag}>";

}

/* ALIGN
-------------------- */
if ( 'left' != $align && 'right' != $align ) $align = 'center';
$class[] = 'align-' . $align;

/* IMAGE
-------------------- */
$image_style = '';
$img_html = '';
if ( $image && isset( $image[ 'id' ] ) ) {
    $img_html = wp_get_attachment_image( $image[ 'id' ], 'full' );
    if ( $image_width ) {
        if ( is_numeric( $image_width ) ) {
            $image_width .= 'px';
        }
        $image_style = ' style="width:' . $image_width . '"';
    }
    if ( $img_html ) {
        $img_html = '<div class="heading-image-main"' . $image_style . '>' . $img_html . '</div>';
    }
}

?>

<div class="<?php echo esc_attr( join( ' ', $class ) ); ?>">

<?php if ( $img_html ) { ?>
<div class="heading-section heading-image">

    <?php echo $img_html; ?>

</div>
<?php } ?>

<div class="heading-section heading-title">

    <?php echo $title_html; ?>
    <?php echo $link_html; ?>

</div><!-- .heading-title -->

<?php if ( $subtitle_html ) { ?>
<div class="heading-section heading-subtitle">

    <?php echo $subtitle_html; ?>

</div><!-- .heading-subtitle -->
<?php } ?>

</div><!-- .fox-heading -->