<commit_before><?php

namespace Frontend\Core\Engine;

/*
 * This file is part of Fork CMS.
 *
 * For the full copyright and license information, please view the license
 * file that was distributed with this source code.
 */

use Frontend\Core\Engine\Base\AjaxAction as FrontendBaseAJAXAction;
use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Finder\Finder;

/**
 * FrontendAJAX
 * This class will handle AJAX-related stuff
 *
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 */
class Ajax extends \KernelLoader implements \ApplicationInterface
{
    /**
     * The action
     *
     * @var    string
     */
    private $action;

    /**
     * @var AjaxAction
     */
    private $ajaxAction;

    /**
     * The language
     *
     * @var    string
     */
    private $language;

    /**
     * The module
     *
     * @var    string
     */
    private $module;

    /**
     * Output generated by the action.
     *
     * @var array
     */
    private $output;

    /**
     * @return Symfony\Component\HttpFoundation\Response
     */
    public function display()
    {
        return $this->output;
    }

    /**
     * This method exists because the service container needs to be set before
     * the request's functionality gets loaded.
     */
    public function initialize()
    {
        // get vars
        $module = isset($_POST['fork']['module']) ? $_POST['fork']['module'] : '';
        if ($module == '' && isset($_GET['module'])) {
            $module = $_GET['module'];
        }
        $action = isset($_POST['fork']['action']) ? $_POST['fork']['action'] : '';
        if ($action == '' && isset($_GET['action'])) {
            $action = $_GET['action'];
        }
        $language = isset($_POST['fork']['language']) ? $_POST['fork']['language'] : '';
        if ($language == '' && isset($_GET['language'])) {
            $language = $_GET['language'];
        }
        if ($language == '') {
            $language = SITE_DEFAULT_LANGUAGE;
        }

        try {
            $this->setModule($module);
            $this->setAction($action);
            $this->setLanguage($language);

            $this->ajaxAction = new AjaxAction($this->getKernel(), $this->getAction(), $this->getModule());<commit_msg>New Relic: Give ajax actions a transaction name<commit_after><?php

namespace Frontend\Core\Engine;

/*
 * This file is part of Fork CMS.
 *
 * For the full copyright and license information, please view the license
 * file that was distributed with this source code.
 */

use Frontend\Core\Engine\Base\AjaxAction as FrontendBaseAJAXAction;
use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Finder\Finder;

/**
 * FrontendAJAX
 * This class will handle AJAX-related stuff
 *
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 */
class Ajax extends \KernelLoader implements \ApplicationInterface
{
    /**
     * The action
     *
     * @var    string
     */
    private $action;

    /**
     * @var AjaxAction
     */
    private $ajaxAction;

    /**
     * The language
     *
     * @var    string
     */
    private $language;

    /**
     * The module
     *
     * @var    string
     */
    private $module;

    /**
     * Output generated by the action.
     *
     * @var array
     */
    private $output;

    /**
     * @return Symfony\Component\HttpFoundation\Response
     */
    public function display()
    {
        return $this->output;
    }

    /**
     * This method exists because the service container needs to be set before
     * the request's functionality gets loaded.
     */
    public function initialize()
    {
        // get vars
        $module = isset($_POST['fork']['module']) ? $_POST['fork']['module'] : '';
        if ($module == '' && isset($_GET['module'])) {
            $module = $_GET['module'];
        }
        $action = isset($_POST['fork']['action']) ? $_POST['fork']['action'] : '';
        if ($action == '' && isset($_GET['action'])) {
            $action = $_GET['action'];
        }
        $language = isset($_POST['fork']['language']) ? $_POST['fork']['language'] : '';
        if ($language == '' && isset($_GET['language'])) {
            $language = $_GET['language'];
        }
        if ($language == '') {
            $language = SITE_DEFAULT_LANGUAGE;
        }

        try {
            $this->setModule($module);
            $this->setAction($action);
            $this->setLanguage($language);
            
            if (extension_loaded('newrelic')) {
                newrelic_name_transaction('ajax::' . $module . '::' . $action);
            }

            $this->ajaxAction = new AjaxAction($this->getKernel(), $this->getAction(), $this->getModule());
{'fraction_non_alphanumeric': 0.16160990712074302, 'fraction_numerical': 0.0, 'mean_word_length': 2.1986798679867987, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 43, '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': '4020332', 'n_tokens_mistral': 1392, 'n_tokens_neox': 1363, 'n_words': 329}