<commit_before><?php defined('BASEPATH') OR exit('No direct script access allowed');

/**
 * News Controller.
 *
 * @author    <NAME>   <<EMAIL>>
 * @copyright Activisme-BE  <<EMAIL>>
 * @license:  MIT license
 * @since     2017
 * @package   BK-wansmaak
 */
class News extends MY_Controller
{
    /**
     * AUthencated user data.
     *
     * @return arry $user
     */
    public $user = [];

    /**
     * News constructor.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
        $this->load->library(['blade', 'session', 'form_validation', 'pagination']);
        $this->load->helper(['url']);

        $this->user = $this->session->userdata('authencated_user');
    }

    /**
     * Middleware instance
     *
     * only create if you want to use, not compulsory.
     * or return parent::middleware(); if you want to keep.
     * or return empty array() and no middleware will run.
     *
     * @return array
     */
    protected function middleware()
    {
        // Return the list of middlewares you want to be applied,
        // Here is list of some valid options
        //
        // admin_auth                    // As used below, simplest, will be applied to all
        // someother|except:index,list   // This will be only applied to posts()
        // yet_another_one|only:index    // This will be only applied to index()
        //
        return [];
    }

    /**
     * Get the front-end for the nws items.
     *
     * @see    GET|HEAD:    http://www.domain.tld/news
     * @return blade view.
     */
    public function index()
    {
        $data['data']       = 'Nieuws';
        $data['categories'] = NewsCategories::all(); 

        return $this->blade->render('news/index', $data);
    }

    /**
     * Get the backend for the news articles. 
     * 
     * @see     GET|HEAD:   http://www.domain.tld/news/backend
     * @return  Blade view
     */
    public function backend() 
    {
        // FIXME: Set pagination for articles. 
        // FIXME: Set pagination for categories. 

        $data['title']      = 'Nieuws berichten';
        $data['news']       = Articles::with(['comments', 'author', 'categories'])->get();
        $data['categories'] = NewsCategories::all(); 

        return $this->blade->render('news/backend', $data); 
    }

    /** 
     * Show a specific news item. 
     *
     * @see    GET|HEAD:    http://www.domain.tld/news/show/{id}<commit_msg>Title bugfix<commit_after><?php defined('BASEPATH') OR exit('No direct script access allowed');

/**
 * News Controller.
 *
 * @author    <NAME>   <<EMAIL>>
 * @copyright Activisme-BE  <<EMAIL>>
 * @license:  MIT license
 * @since     2017
 * @package   BK-wansmaak
 */
class News extends MY_Controller
{
    /**
     * AUthencated user data.
     *
     * @return arry $user
     */
    public $user = [];

    /**
     * News constructor.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
        $this->load->library(['blade', 'session', 'form_validation', 'pagination']);
        $this->load->helper(['url']);

        $this->user = $this->session->userdata('authencated_user');
    }

    /**
     * Middleware instance
     *
     * only create if you want to use, not compulsory.
     * or return parent::middleware(); if you want to keep.
     * or return empty array() and no middleware will run.
     *
     * @return array
     */
    protected function middleware()
    {
        // Return the list of middlewares you want to be applied,
        // Here is list of some valid options
        //
        // admin_auth                    // As used below, simplest, will be applied to all
        // someother|except:index,list   // This will be only applied to posts()
        // yet_another_one|only:index    // This will be only applied to index()
        //
        return [];
    }

    /**
     * Get the front-end for the nws items.
     *
     * @see    GET|HEAD:    http://www.domain.tld/news
     * @return blade view.
     */
    public function index()
    {
        $data['title']      = 'Nieuws';
        $data['categories'] = NewsCategories::all(); 

        return $this->blade->render('news/index', $data);
    }

    /**
     * Get the backend for the news articles. 
     * 
     * @see     GET|HEAD:   http://www.domain.tld/news/backend
     * @return  Blade view
     */
    public function backend() 
    {
        // FIXME: Set pagination for articles. 
        // FIXME: Set pagination for categories. 

        $data['title']      = 'Nieuws berichten';
        $data['news']       = Articles::with(['comments', 'author', 'categories'])->get();
        $data['categories'] = NewsCategories::all(); 

        return $this->blade->render('news/backend', $data); 
    }

    /** 
     * Show a specific news item. 
     *
     * @see    GET|HEAD:    http://www.domain.tld/news/show/{id}
{'fraction_non_alphanumeric': 0.14594703860925815, 'fraction_numerical': 0.0016171417020416413, 'mean_word_length': 1.933017190278601, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, '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': '6416100', 'n_tokens_mistral': 1495, 'n_tokens_neox': 1441, 'n_words': 392}