<commit_before><?php
namespace Grav\Plugin;

use Grav\Common\Grav;
use Grav\Common\Plugin;

class onWebChatPlugin extends Plugin
{
    public static function getSubscribedEvents() {
        return [
            'onPluginsInitialized' => ['onPluginsInitialized', 0]
        ];
    }

    public function onPluginsInitialized()
    {
		$pluginsobject = (array) $this->config->get('plugins');
		$enabled = (isset($pluginsobject['onwebchat']) && $pluginsobject['onwebchat']['enabled']);

        if ($this->isAdmin() || !$enabled) {
            $this->active = false;
            return;
        }

		$this->enable([
			'onPageInitialized' => ['onPageInitialized', 0]
		]);
    }

    public function onPageInitialized()
    {
        $pageobject = $this->grav['page'];

        if(isset($pageobject->header()->onwebchat)) {
			$activate = $pageobject->header()->onwebchat;
		}
		else {
			$activate = $this->config->get('plugins.onwebchat.active_default');
		}

		if ($activate) {
			$this->grav['assets']->addInlineJs('var onWebChat={ar:[], set: function(a,b){if (typeof onWebChat_==="undefined"){this.ar.push([a,b]);}else{onWebChat_.set(a,b);}},get:function(a){return(onWebChat_.get(a));},w:(function(){ var ga=document.createElement("script"); ga.type = "text/javascript";ga.async=1;ga.src="//www.onwebchat.com/clientchat/'.$this->config->get('plugins.onwebchat.chatid').'";var s=document.getElementsByTagName("script")[0];s.parentNode.insertBefore(ga,s);})()}');
		}
    }
}<commit_msg>Fix horrible mixed indentation (my bad) in PHP<commit_after><?php
namespace Grav\Plugin;

use Grav\Common\Grav;
use Grav\Common\Plugin;

class onWebChatPlugin extends Plugin
{
	public static function getSubscribedEvents() {
		return [
			'onPluginsInitialized' => ['onPluginsInitialized', 0]
		];
	}

    public function onPluginsInitialized()
    {
		$pluginsobject = (array) $this->config->get('plugins');
		$enabled = (isset($pluginsobject['onwebchat']) && $pluginsobject['onwebchat']['enabled']);

		if ($this->isAdmin() || !$enabled) {
			$this->active = false;
			return;
		}

		$this->enable([
			'onPageInitialized' => ['onPageInitialized', 0]
		]);
    }

	public function onPageInitialized()
	{
		$pageobject = $this->grav['page'];

		if(isset($pageobject->header()->onwebchat)) {
			$activate = $pageobject->header()->onwebchat;
		}
		else {
			$activate = $this->config->get('plugins.onwebchat.active_default');
		}

		if ($activate) {
			$this->grav['assets']->addInlineJs('var onWebChat={ar:[], set: function(a,b){if (typeof onWebChat_==="undefined"){this.ar.push([a,b]);}else{onWebChat_.set(a,b);}},get:function(a){return(onWebChat_.get(a));},w:(function(){ var ga=document.createElement("script"); ga.type = "text/javascript";ga.async=1;ga.src="//www.onwebchat.com/clientchat/'.$this->config->get('plugins.onwebchat.chatid').'";var s=document.getElementsByTagName("script")[0];s.parentNode.insertBefore(ga,s);})()}');
		}
	}
}
{'fraction_non_alphanumeric': 0.20279959030385797, 'fraction_numerical': 0.0027313076135199728, 'mean_word_length': 4.745098039215686, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 39, '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': '5344094', 'n_tokens_mistral': 1031, 'n_tokens_neox': 981, 'n_words': 131}