<?php
if ($view_status == 'post') {
    if ($url_type == 1) {
        ?>
        <center>
            <iframe style="margin: 0 auto;" width="260" height="200"
                    src="<?php echo $url ?>">
            </iframe>
        </center>
        <input type="hidden" id="url" value="<?php echo $url ?>">
        <input type="hidden" id="title" value="">
        <input type="hidden" id="description" value="">
        <input type="hidden" id="author" value="">
        <?php
    }
    if ($url_type == 2) {
        ?>
        <center>
            <iframe src="<?php echo $url ?>" style="margin: 0 auto;"
                    width="260" height="200" 
                    frameborder="0" 
                    webkitallowfullscreen mozallowfullscreen allowfullscreen>
            </iframe>
        </center>
        <input type="hidden" id="url" value="<?php echo $url ?>">
        <input type="hidden" id="title" value="">
        <input type="hidden" id="description" value="">
        <input type="hidden" id="author" value="">
        <?php
    }
    if ($url_type == 3) {
        ?>
        <div class="col-sm-12 text-left">
        <?php 
        if(!isset($invalide_url)){
        ?>
            <div class="col-sm-12">
                <h5><a href="<?php echo $url; ?>" target="_blank" style="color: #545457">
                        <?php
                        if ($title) {
                            echo $title;
                            echo '<input type="hidden" id="title" value="' . $title . '">';
                        } else {
                            echo '<input type="hidden" id="title" value="">';
                        }
                        ?></a>
                </h5>
            </div>
            <div class="col-sm-12" style="margin-top: -10px;">
                <p style="font-size: 12px;">
                    <a href="<?php echo $url; ?>" target="_blank" style="color: #545457">
                        <?php
                        if ($description) {
                            echo $description;
                            echo '<input type="hidden" id="description" value="' . $description . '">';
                        } else {
                            echo '<input type="hidden" id="description" value="">';
                        }
                        ?> 
                    </a>
                </p>
            </div>
            <div class="col-sm-12" style="margin-top: -10px;">
                <h6><a href="<?php echo $url; ?>" target="_blank" style="color: #545457"><?php
                        if ($url) {
                            echo $url;
                            echo '<input type="hidden" id="url" value="' . $url . '">';
                        } else {
                            echo '<input type="hidden" id="url" value="">';
                        }
                        ?>
                    </a>
                    <?php
                    $author1 = preg_replace('/[^\x{FFFF}-\x{FFFF}]+/u', '', $author);
                    if ($author1 != '') {
                        echo '| BY ';
                        echo ucfirst($author1);
                        echo '<input type="hidden" id="author" value="' . $author1 . '">';
                    } else {
                        echo '<input type="hidden" id="author" value="">';
                    }
                    ?></h6>
            </div>
        <?php 
        }
        else{ ?>
            <p style="font-size: 16px; color: red"><?php echo $invalide_url; ?> !!!</p>
        <?php
            }
        ?>
        </div>

        <?php
    }
}

if ($view_status == 'comment') {
    if ($url_type == 1) {
        ?>
        <center>
            <iframe style="margin: 0 auto; margin-top: 10px;" width="200" height="150"
                    src="<?php echo $url ?>">
            </iframe>
        </center>
        <input type="hidden" id="url<?php echo $post_id ?>" value="<?php echo $url ?>">
        <input type="hidden" id="title<?php echo $post_id ?>" value="">
        <input type="hidden" id="description<?php echo $post_id ?>" value="">
        <input type="hidden" id="author<?php echo $post_id ?>" value="">
        <?php
    }
    if ($url_type == 2) {
        ?>
        <center>
            <iframe src="<?php echo $url ?>" style="margin: 0 auto;  margin-top: 10px;"
                    width="200" height="150" 
                    frameborder="0" 
                    webkitallowfullscreen mozallowfullscreen allowfullscreen>
            </iframe>
        </center>
        <input type="hidden" id="url<?php echo $post_id ?>" value="<?php echo $url ?>">
        <input type="hidden" id="title<?php echo $post_id ?>" value="">
        <input type="hidden" id="description<?php echo $post_id ?>" value="">
        <input type="hidden" id="author<?php echo $post_id ?>" value="">
        <?php
    }
    if ($url_type == 3) {
        ?>
        <div class="col-sm-12">
            <h5>
                <a href="<?php echo $url; ?>" target="_blank" style="color: #545457">
                    <?php
                    if ($title) {
                        echo $title;
                        echo '<input type="hidden" id="title' . $post_id . '" value="' . $title . '">';
                    } else {
                        echo '<input type="hidden" id="title' . $post_id . '" value="">';
                    }
                    ?>
                </a>
            </h5>
        </div>
        <div class="col-sm-12" style="margin-top: -10px;">
            <a href="<?php echo $url; ?>" target="_blank" style="color: #545457">
                <p style="font-size: 12px; text-align:justify">
                    <?php
                    if ($description) {
                        echo $description;
                        echo '<input type="hidden" id="description' . $post_id . '" value="' . $description . '">';
                    } else {
                        echo '<input type="hidden" id="description' . $post_id . '" value="">';
                    }
                    ?>
                </p>
            </a>
        </div>
        <div class="col-sm-12" style="margin-top: -10px;">
            <h6>
                <a href="<?php echo $url; ?>" target="_blank" style="color: #545457"><?php
                    if ($url) {
                        echo $url;
                        echo '<input type="hidden" id="url' . $post_id . '" value="' . $url . '">';
                    } else {
                        echo '<input type="hidden" id="url' . $post_id . '" value="">';
                    }
                    ?>
                </a>
                <?php
                if ($author) {
                    echo '| BY ';
                    echo ucfirst($author);
                    echo '<input type="hidden" id="author' . $post_id . '" value="' . $author . '">';
                } else {
                    echo '<input type="hidden" id="author' . $post_id . '" value="">';
                }
                ?>
            </h6>
        </div>
        <?php
    }
}