<commit_before><?php

/**
 * Model pro obsluhu, resp. výpis sliderů
 *
 * @author <NAME>
 * @link http://www.ktstudio.cz
 */
class KT_ZZZ_Sliders_Presenter extends KT_Presenter_Base {

    const DEFAULT_COUNT = 3;

    private $posts = null;

    public function __construct() {
        parent::__construct();
    }

    // --- getry & setry ------------------------

    /**
     * @return array
     */
    public function getPosts() {
        if (KT::issetAndNotEmpty($this->posts)) {
            return $this->posts;
        }
        return $this->initPosts();
    }

    // --- veřejné metody ------------------------

    public function isPosts() {
        $posts = $this->getPosts();
        return KT::arrayIssetAndNotEmpty($posts);
    }

    public function theIndicators() {
        if ($this->isPosts()) {
            $number = 0;
            foreach ($this->getPosts() as $post) {
                $classPart = ($number === 0) ? " class=\"active\"" : "";
                echo "<li data-target=\"#carousel\" data-slide-to=\"$number\"$classPart></li>";
                $number++;
            }
        }
    }

    public function theInners() {
        if ($this->isPosts()) {
            $number = 0;
            foreach ($this->getPosts() as $post) {
                $activePart = ($number === 0) ? " active" : "";
                $imageSrc = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), KT_ZZZ_IMAGE_SIZE_SLIDER);
                if (KT::arrayIssetAndNotEmpty($imageSrc)) {
                    $imageUrl = $imageSrc[0];
                    echo "<div class=\"item$activePart\">";
                    echo "<img src=\"$imageUrl\" alt=\"{$post->post_title}\" class=\"img-responsive\">";
                    echo "</div>";
                }
                $number++;
            }
        }
    }

    // --- neveřejné metody ------------------------

    private function initPosts() {
        $args = array(
            "post_type" => KT_ZZZ_SLIDER_KEY,
            "post_status" => "publish",
            "post_parent" => 0,
            "posts_per_page" => self::DEFAULT_COUNT,
            "orderby" => "menu_order title",
            "order" => "ASC",<commit_msg>Doplnění lazy loadingu u sliderů<commit_after><?php

/**
 * Model pro obsluhu, resp. výpis sliderů
 *
 * @author <NAME>
 * @link http://www.ktstudio.cz
 */
class KT_ZZZ_Sliders_Presenter extends KT_Presenter_Base {

    const DEFAULT_COUNT = 3;

    private $posts = null;

    public function __construct() {
        parent::__construct();
    }

    // --- getry & setry ------------------------

    /**
     * @return array
     */
    public function getPosts() {
        if (KT::issetAndNotEmpty($this->posts)) {
            return $this->posts;
        }
        return $this->initPosts();
    }

    // --- veřejné metody ------------------------

    public function isPosts() {
        $posts = $this->getPosts();
        return KT::arrayIssetAndNotEmpty($posts);
    }

    public function theIndicators() {
        if ($this->isPosts()) {
            $number = 0;
            foreach ($this->getPosts() as $post) {
                $classPart = ($number === 0) ? " class=\"active\"" : "";
                echo "<li data-target=\"#carousel\" data-slide-to=\"$number\"$classPart></li>";
                $number++;
            }
        }
    }

    public function theInners() {
        if ($this->isPosts()) {
            $number = 0;
            foreach ($this->getPosts() as $post) {
                $activePart = ($number === 0) ? " active" : "";
                $imageSrc = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), KT_ZZZ_IMAGE_SIZE_SLIDER);
                if (KT::arrayIssetAndNotEmpty($imageSrc)) {
                    $imageUrl = $imageSrc[0];
                    $transparentUrl = KT::imageGetTransparent();
                    echo "<div class=\"item$activePart\">";
                    echo "<img data-src=\"$imageUrl\" src=\"$transparentUrl\" alt=\"{$post->post_title}\" class=\"img-responsive\">";
                    echo "</div>";
                }
                $number++;
            }
        }
    }

    // --- neveřejné metody ------------------------

    private function initPosts() {
        $args = array(
            "post_type" => KT_ZZZ_SLIDER_KEY,
            "post_status" => "publish",
            "post_parent" => 0,
            "posts_per_page" => self::DEFAULT_COUNT,
            "orderby" => "menu_order title",
            "order" => "ASC",
{'fraction_non_alphanumeric': 0.18548923896161526, 'fraction_numerical': 0.003106279121366763, 'mean_word_length': 1.5701254275940706, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 47, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7659851', 'n_tokens_mistral': 1375, 'n_tokens_neox': 1295, 'n_words': 246}