<commit_before><?php
/**
 * Qwin Framework
 *
 * @copyright   Copyright (c) 2008-2012 <NAME>
 * @license     http://www.opensource.org/licenses/apache2.0.php Apache License
 */

namespace Qwin;

/**
 * Check if in ajax request
 * 
 * @package     Qwin
 * @author      <NAME> <<EMAIL>>
 * @todo        remove global var $_SERVER
 */
class InAjax extends Widget
{
    public function __invoke()
    {
        return isset($_SERVER['HTTP_X_REQUESTED_WITH'])
            && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest';
    }
}<commit_msg>added debug support for inAjax widget<commit_after><?php
/**
 * Qwin Framework
 *
 * @copyright   Copyright (c) 2008-2012 <NAME>
 * @license     http://www.opensource.org/licenses/apache2.0.php Apache License
 */

namespace Qwin;

/**
 * Check if in ajax request
 * 
 * @package     Qwin
 * @author      <NAME> <<EMAIL>>
 * @todo        remove global var $_SERVER
 */
class InAjax extends Widget
{
    public function __invoke()
    {
        // debug support
        if ($this->config('debug')) {
            if ($this->get('ajax')) {
                return true;
            }
        }
        
        return isset($_SERVER['HTTP_X_REQUESTED_WITH'])
            && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest';
    }
}
{'fraction_non_alphanumeric': 0.13933795227097767, 'fraction_numerical': 0.015396458814472672, 'mean_word_length': 2.4759358288770055, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 2}, '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': '7444225', 'n_tokens_mistral': 415, 'n_tokens_neox': 398, 'n_words': 93}