<commit_before><?php

namespace factlink\capability;

class IncludeFactlink extends \vg\wordpress_plugin\capability\Capability
{
    /***
     * inject the model:
     * @var \factlink\model\Settings
     */
    public $settings;

    public function initialize()
    {
        $id = get_queried_object_id();

        if ($this->settings->enabled_for_pages->get() == 1 &&

            is_page() &&

            ($this->settings->enabled_for_all_pages->get() == 0 && $this->settings->page_meta->get($id) == 1) ||

            $this->settings->enabled_for_all_pages->get() == 1

        ) {
            $this->render();
        }

        if ($this->settings->enabled_for_posts->get() == 1 &&

            is_single() &&

            ($this->settings->enabled_for_all_posts->get() == 0 && $this->settings->post_meta->get($id) == 1) ||

            $this->settings->enabled_for_all_posts->get() == 1
        ) {
            // render factlink
            $this->render();
        }
    }
}<commit_msg>Moved 'is Factlink enabled' logic to the settings model.<commit_after><?php

namespace factlink\capability;

class IncludeFactlink extends \vg\wordpress_plugin\capability\Capability
{
    /***
     * inject the model:
     * @var \factlink\model\Settings
     */
    public $settings;

    public function initialize()
    {
        $id = get_queried_object_id();

        if ($this->settings->is_enabled_for_post($id))
        {
            $this->render();
        }
    }
}
{'fraction_non_alphanumeric': 0.15671641791044777, 'fraction_numerical': 0.005427408412483039, 'mean_word_length': 2.1995661605206074, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 32, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '1447351', 'n_tokens_mistral': 467, 'n_tokens_neox': 440, 'n_words': 73}