File manager - Edit - /home/verseaumee/middletvnew26/wp-content/plugins/Archive-1/includes/shortcodes.php
Back
<?php if (!defined('ABSPATH')) exit; function mtvc_breaking_news() { $q = new WP_Query([ 'post_type' => 'mtv_ticker', 'posts_per_page' => 20, 'orderby' => 'menu_order', 'order' => 'ASC', ]); if (!$q->have_posts()) return ''; $speed = max(5, (int) get_option('mtvc_ticker_speed', 25)); $dir = get_option('mtvc_ticker_direction', 'left'); ob_start(); ?> <div class="mtvc-ticker"> <div class="mtvc-ticker-inner"> <strong>DERNIÈRES INFORMATIONS</strong> <span class="mtvc-speaker" aria-hidden="true"> <img src="<?php echo esc_url(MTVC_URL . 'assets/volume.svg'); ?>" alt=""> </span> <div class="mtvc-marquee <?php echo esc_attr($dir); ?>" style="--duration:<?php echo esc_attr($speed); ?>s"> <div> <?php while ($q->have_posts()) : $q->the_post(); if (get_post_meta(get_the_ID(), '_mtvc_active', true) === '0') continue; $link = get_post_meta(get_the_ID(), '_mtvc_link', true); ?> <span>● <?php if ($link) : ?> <a href="<?php echo esc_url($link); ?>"><?php the_title(); ?></a> <?php else : ?> <?php the_title(); ?> <?php endif; ?> </span> <?php endwhile; ?> </div> </div> </div> </div> <?php wp_reset_postdata(); return ob_get_clean(); } add_shortcode('middletv_breaking_news', 'mtvc_breaking_news'); function mtvc_banner_slider() { $q = new WP_Query([ 'post_type' => 'mtv_banner', 'posts_per_page' => 4, 'orderby' => 'menu_order', 'order' => 'ASC', ]); if (!$q->have_posts()) return ''; $delay = (int) get_option('mtvc_slider_delay', 6000); $speed = (int) get_option('mtvc_slider_speed', 700); $direction = get_option('mtvc_slider_direction', 'next'); ob_start(); ?> <div class="mtvc-slider" data-delay="<?php echo esc_attr($delay); ?>" data-speed="<?php echo esc_attr($speed); ?>" data-direction="<?php echo esc_attr($direction); ?>"> <div class="mtvc-slides"> <?php $i = 0; while ($q->have_posts()) : $q->the_post(); $img = get_the_post_thumbnail_url(get_the_ID(), 'full'); $sub = get_post_meta(get_the_ID(), '_mtvc_subtitle', true); $bt = get_post_meta(get_the_ID(), '_mtvc_button_text', true); $bu = get_post_meta(get_the_ID(), '_mtvc_button_url', true); $pos = get_post_meta(get_the_ID(), '_mtvc_position', true) ?: 'center'; $ov = get_post_meta(get_the_ID(), '_mtvc_overlay', true); if ($ov === '') $ov = '.35'; ?> <article class="mtvc-slide <?php echo $i++ === 0 ? 'active' : ''; ?> align-<?php echo esc_attr($pos); ?>" style="background-image:linear-gradient(rgba(0,0,0,<?php echo esc_attr($ov); ?>),rgba(0,0,0,<?php echo esc_attr($ov); ?>)),url('<?php echo esc_url($img); ?>')"> <div class="mtvc-slide-content"> <h2><?php the_title(); ?></h2> <?php if ($sub) : ?><p><?php echo esc_html($sub); ?></p><?php endif; ?> <?php if ($bt) : ?><a class="mtvc-yellow-btn" href="<?php echo esc_url($bu ?: '#'); ?>"><?php echo esc_html($bt); ?></a><?php endif; ?> </div> </article> <?php endwhile; ?> </div> <button class="mtvc-prev" aria-label="Précédent">‹</button> <button class="mtvc-next" aria-label="Suivant">›</button> <div class="mtvc-dots"></div> </div> <?php wp_reset_postdata(); return ob_get_clean(); } add_shortcode('middletv_banner_slider', 'mtvc_banner_slider'); function mtvc_live_player() { $custom = get_option('mtvc_twitch_embed'); $channel = trim(get_option('mtvc_twitch_channel')); $parent = get_option('mtvc_twitch_parent', wp_parse_url(home_url(), PHP_URL_HOST)); $title = get_option('mtvc_live_title', 'Journal de l’actualité'); $time = get_option('mtvc_live_time', '10:00 – 11:00'); ob_start(); ?> <section class="mtvc-live"> <div class="mtvc-live-badge">● EN DIRECT</div> <div class="mtvc-player-wrap"> <?php if ($custom) { echo wp_kses($custom, [ 'iframe' => [ 'src' => true, 'height' => true, 'width' => true, 'allowfullscreen' => true, 'frameborder' => true, 'scrolling' => true, 'allow' => true, 'title' => true, ], 'div' => ['class' => true], 'script' => ['src' => true], ]); } elseif ($channel) { ?> <iframe src="https://player.twitch.tv/?channel=<?php echo rawurlencode($channel); ?>&parent=<?php echo rawurlencode($parent); ?>&autoplay=true&muted=true" allowfullscreen title="Middle TV Live"></iframe> <?php } else { ?> <div class="mtvc-player-placeholder"> <img src="<?php echo esc_url(MTVC_URL . 'assets/middletv-logo.png'); ?>" alt="Middle TV"> <p><?php echo esc_html(get_option('mtvc_live_offline', 'Le direct reprendra prochainement.')); ?></p> </div> <?php } ?> </div> <div class="mtvc-program-bar"> <span>EN COURS</span> <div> <strong><?php echo esc_html($title); ?></strong> <small>◷ <?php echo esc_html($time); ?></small> </div> </div> </section> <?php return ob_get_clean(); } add_shortcode('middletv_live_player', 'mtvc_live_player');
| ver. 1.4 |
Github
|
.
| PHP 8.5.7 | Generation time: 0 |
proxy
|
phpinfo
|
Settings