<commit_before><?php
/**
 * Music Card
 *
 * Place a Spotify or MusicBrainz reference to an album or track in a markdown file 
 * and it will pull in the necessary data. 
 *
 * Read musiccard.md for instructions.
 *
 * Based on Grav Team's "Grav Page Inject"
 * Original work licensed under MIT.
 */

namespace Grav\Plugin;
use Grav\Common\Grav;
use Grav\Common\Plugin;
use Grav\Common\Twig\Twig;
use Grav\Common\Page\Page;
use Grav\Common\Page\Collection;
use RocketTheme\Toolbox\Event\Event;

use Grav\Plugin\MusicCard\Autoloader;
use Grav\Plugin\MusicCard\MusicCard;

class MusicCardPlugin extends Plugin
{
    
    /**
     * @var MusicCardPlugin
     */

    /** ---------------------------
     * Private/protected properties
     * ----------------------------
     */

    /**
     * Instance of MusicCard class
     *
     * @var object
     */

    protected $musiccard;

    /** -------------
     * Public methods
     * --------------
     */
    
    /**
     * Return a list of subscribed events.
     *
     * @return array    The list of events of the plugin of the form
     *                      'name' => ['method_name', priority].
     */
    public static function getSubscribedEvents()
    {
        return [
            'onPluginsInitialized' => ['onPluginsInitialized', 0],
        ];
    }
    
    /**
     * Initialize configuration.
     */
    public function onPluginsInitialized()
    {
        if ($this->isAdmin()) {
            $this->active = false;
            return;
        }
        
        if ($this->config->get('plugins.musiccard.enabled')) {
            // Initialize Autoloader
            require_once(__DIR__ . '/classes/Autoloader.php');
            
            $autoloader = new Autoloader();
            $autoloader->register();
            
            // Initialize MusicCard class
            $this->musiccard = new MusicCard($this->config);
        
            $this->enable([
                'onPageContentRaw' => ['onPageContentRaw', 0],<commit_msg>Fix autoloader<commit_after><?php
/**
 * Music Card
 *
 * Place a Spotify or MusicBrainz reference to an album or track in a markdown file 
 * and it will pull in the necessary data. 
 *
 * Read musiccard.md for instructions.
 *
 * Based on Grav Team's "Grav Page Inject"
 * Original work licensed under MIT.
 */

namespace Grav\Plugin;
use Grav\Common\Grav;
use Grav\Common\Plugin;
use Grav\Common\Twig\Twig;
use Grav\Common\Page\Page;
use Grav\Common\Page\Collection;
use RocketTheme\Toolbox\Event\Event;
use Grav\Plugin\MusicCard\MusicCard;

class MusicCardPlugin extends Plugin
{
    
    /**
     * @var MusicCardPlugin
     */

    /** ---------------------------
     * Private/protected properties
     * ----------------------------
     */

    /**
     * Instance of MusicCard class
     *
     * @var object
     */

    protected $musiccard;

    /** -------------
     * Public methods
     * --------------
     */
    
    /**
     * Return a list of subscribed events.
     *
     * @return array    The list of events of the plugin of the form
     *                      'name' => ['method_name', priority].
     */
    public static function getSubscribedEvents()
    {
        return [
            'onPluginsInitialized' => ['onPluginsInitialized', 0],
        ];
    }
    
    /**
     * Initialize configuration.
     */
    public function onPluginsInitialized()
    {
        if ($this->isAdmin()) {
            $this->active = false;
            return;
        }
        
        if ($this->config->get('plugins.musiccard.enabled')) {
            // Initialize Autoloader
            require_once(__DIR__ . '/vendor/autoloader.php');
            // Initialize MusicCard
            require_once(__DIR__ . '/classes/MusicCard.php');
            
            // Initialize MusicCard class
            $this->musiccard = new MusicCard($this->config);
        
            $this->enable([
                'onPageContentRaw' => ['onPageContentRaw', 0],
{'fraction_non_alphanumeric': 0.1495608531994981, 'fraction_numerical': 0.0010037641154328732, 'mean_word_length': 1.6414844267726971, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 24, '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': '3163674', 'n_tokens_mistral': 1122, 'n_tokens_neox': 1080, 'n_words': 272}