= 1970 && $year <= 2100 ? $year : 0; } public static function request_sort(): string { $value = sanitize_key( (string) get_query_var( 'sg7sort', 'newest' ) ); return in_array( $value, array( 'newest', 'oldest', 'views', 'likes' ), true ) ? $value : 'newest'; } public static function render_hero(): void { if ( ! SG7G_Settings::enabled( 'show_archive_hero' ) || ! self::is_archive_landing_context() ) { return; } $hero_image_id = absint( SG7G_Settings::get( 'hero_image_id', 0 ) ); $hero_url = ''; if ( $hero_image_id && wp_attachment_is_image( $hero_image_id ) ) { $attachment_url = wp_get_attachment_image_url( $hero_image_id, 'full' ); $hero_url = is_string( $attachment_url ) ? $attachment_url : ''; } if ( '' === $hero_url ) { $hero_url = add_query_arg( 'ver', rawurlencode( SG7G_VERSION ), SG7G_URL . 'assets/images/default-hero.png' ); } $eyebrow = trim( (string) SG7G_Settings::get( 'hero_eyebrow', __( 'Video & Music Gallery', '7sgaleri' ) ) ); $title = trim( (string) SG7G_Settings::get( 'hero_title', '7S Medya' ) ); $description = trim( (string) SG7G_Settings::get( 'hero_description', __( 'Discover the voice of cinema, the story of music, and unforgettable moments in one place.', '7sgaleri' ) ) ); $quote = trim( (string) SG7G_Settings::get( 'hero_quote', '' ) ); ?>

'sg7g_category', 'hide_empty' => false, 'orderby' => 'name', 'order' => 'ASC', ) ); $categories = is_wp_error( $categories ) ? array() : $categories; $current_category = self::request_category(); if ( is_tax( 'sg7g_category' ) ) { $current_category = get_queried_object_id(); } elseif ( is_singular( 'sg7g_media' ) ) { $terms = get_the_terms( get_the_ID(), 'sg7g_category' ); if ( ! is_wp_error( $terms ) && ! empty( $terms ) ) { $current_category = (int) reset( $terms )->term_id; } } $current_type = self::request_type(); if ( is_singular( 'sg7g_media' ) ) { $stored_type = (string) get_post_meta( get_the_ID(), '_sg7g_media_type', true ); $current_type = in_array( $stored_type, array( 'video', 'audio' ), true ) ? $stored_type : ''; } $is_all_active = is_post_type_archive( 'sg7g_media' ) && ! is_tax() && '' === $current_type && 0 === $current_category && '' === SG7G_Search::request_term(); $menu_items = array( 'all' => array( 'label' => __( 'All', '7sgaleri' ), 'icon' => 'all', 'url' => $archive_url, 'active' => $is_all_active, ), 'video' => array( 'label' => __( 'Video', '7sgaleri' ), 'icon' => 'video', 'url' => add_query_arg( 'sg7type', 'video', $archive_url ), 'active' => 0 === $current_category && 'video' === $current_type, ), 'audio' => array( 'label' => __( 'Music', '7sgaleri' ), 'icon' => 'audio', 'url' => add_query_arg( 'sg7type', 'audio', $archive_url ), 'active' => 0 === $current_category && 'audio' === $current_type, ), ); foreach ( $categories as $category ) { $normalized_name = sanitize_title( remove_accents( $category->name ) ); if ( in_array( $normalized_name, array( 'video', 'videos', 'music', 'muzik', 'audio' ), true ) ) { continue; } $term_link = get_term_link( $category ); if ( is_wp_error( $term_link ) ) { continue; } $menu_items[ 'category-' . absint( $category->term_id ) ] = array( 'label' => $category->name, 'icon' => self::category_icon_key( $category ), 'url' => $term_link, 'active' => (int) $current_category === (int) $category->term_id, ); } $saved_order = SG7G_Settings::get( 'media_menu_order', array() ); $saved_order = is_array( $saved_order ) ? array_map( 'sanitize_key', $saved_order ) : array(); $menu_order = array(); foreach ( $saved_order as $key ) { if ( isset( $menu_items[ $key ] ) && ! in_array( $key, $menu_order, true ) ) { $menu_order[] = $key; } } foreach ( array_keys( $menu_items ) as $key ) { if ( ! in_array( $key, $menu_order, true ) ) { $menu_order[] = $key; } } $primary_keys = array_values( array_filter( $menu_order, static fn( string $key ): bool => in_array( $key, array( 'all', 'video', 'audio' ), true ) ) ); $category_keys = array_values( array_filter( $menu_order, static fn( string $key ): bool => str_starts_with( $key, 'category-' ) ) ); $panel_id = 'sg7g-mobile-category-panel'; ?>
get_the_title( $post_id ), 'loading' => $priority ? 'eager' : 'lazy', 'fetchpriority' => $priority ? 'high' : 'auto', 'decoding' => 'async' ) ) ); ?>

term_id ] ?? '' ) ); if ( '' !== $selected && 'auto' !== $selected && array_key_exists( $selected, self::category_icon_options() ) ) { return $selected; } } return self::automatic_category_icon_key( $term ); } public static function automatic_category_icon_key( WP_Term $term ): string { $haystack = strtolower( remove_accents( $term->name . ' ' . $term->slug ) ); if ( false !== strpos( $haystack, 'trailer' ) || false !== strpos( $haystack, 'fragman' ) || false !== strpos( $haystack, 'movie clip' ) || false !== strpos( $haystack, 'sahne' ) ) { return 'clapper'; } if ( false !== strpos( $haystack, 'interview' ) || false !== strpos( $haystack, 'roportaj' ) || false !== strpos( $haystack, 'podcast' ) ) { return 'mic'; } if ( false !== strpos( $haystack, 'music' ) || false !== strpos( $haystack, 'muzik' ) || false !== strpos( $haystack, 'soundtrack' ) || false !== strpos( $haystack, 'score' ) ) { return 'audio'; } if ( false !== strpos( $haystack, 'live' ) || false !== strpos( $haystack, 'canli' ) || false !== strpos( $haystack, 'perform' ) ) { return 'wave'; } if ( false !== strpos( $haystack, 'short' ) || false !== strpos( $haystack, 'kisa' ) ) { return 'video'; } return 'category'; } public static function category_icon_options(): array { return array( 'auto' => __( 'Auto', '7sgaleri' ), 'category' => __( 'Category', '7sgaleri' ), 'clapper' => __( 'Clapperboard', '7sgaleri' ), 'film' => __( 'Film strip', '7sgaleri' ), 'video' => __( 'Video / Play', '7sgaleri' ), 'camera' => __( 'Camera', '7sgaleri' ), 'mic' => __( 'Microphone', '7sgaleri' ), 'audio' => __( 'Music note', '7sgaleri' ), 'headphones' => __( 'Headphones', '7sgaleri' ), 'wave' => __( 'Waveform', '7sgaleri' ), 'star' => __( 'Star', '7sgaleri' ), 'ticket' => __( 'Ticket', '7sgaleri' ), 'list' => __( 'List', '7sgaleri' ), ); } public static function nav_icon( string $key ): string { $icons = array( 'auto' => '', 'all' => '', 'video' => '', 'audio' => '', 'clapper' => '', 'film' => '', 'camera' => '', 'mic' => '', 'headphones' => '', 'wave' => '', 'star' => '', 'ticket' => '', 'category' => '', 'search' => '', 'list' => '', 'play' => '', ); return $icons[ $key ] ?? $icons['category']; } }