<commit_before><?php
/**
 * Koowa Framework - http://developer.joomlatools.com/koowa
 *
 * @copyright	Copyright (C) 2007 - 2013 <NAME> and Timble CVBA. (http://www.timble.net)
 * @license		GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
 * @link		http://github.com/joomlatools/koowa for the canonical source repository
 */

/**
 * Editable Controller Behavior
 *
 * @author  <NAME> <https://github.com/johanjanssens>
 * @package Koowa\Library\Controller
 */
class KControllerBehaviorEditable extends KControllerBehaviorAbstract
{
    protected $_cookie_path;

    /**
     * Constructor
     *
     * @param   KObjectConfig $config Configuration options
     */
    public function __construct(KObjectConfig $config)
    {
        parent::__construct($config);

        if($this->isDispatched() && $this->getRequest()->getFormat() == 'html')
        {
            $this->registerCallback('before.read' , array($this, 'setReferrer'));
            $this->registerCallback('after.apply' , array($this, 'lockReferrer'));
            $this->registerCallback('after.read'  , array($this, 'unlockReferrer'));
            $this->registerCallback('after.save'  , array($this, 'unsetReferrer'));
            $this->registerCallback('after.cancel', array($this, 'unsetReferrer'));

            // Only lock/unlock entities in administrator or in form layouts in site
            $application = $this->getMixer()->getIdentifier()->application;
            if ($application === 'admin' || $this->getRequest()->query->layout === 'form')
            {
                $this->registerCallback('after.read'  , array($this, 'lockResource'));
                $this->registerCallback('after.save'  , array($this, 'unlockResource'));
                $this->registerCallback('after.cancel', array($this, 'unlockResource'));
            }
        }

        $this->_cookie_path = $config->cookie_path;
    }

    /**
     * Initializes the options for the object
     *
     * Called from {@link __construct()} as a first step of object instantiation.
     *
     * @param  KObjectConfig $config A ObjectConfig object with configuration options
     * @return void
     */
    protected function _initialize(KObjectConfig $config)
    {
        $config->append(array(
            'cookie_path' => $this->getObject('request')->getBaseUrl('site').'/'
        ));<commit_msg>re #120 Synced with FW.<commit_after><?php
/**
 * Koowa Framework - http://developer.joomlatools.com/koowa
 *
 * @copyright	Copyright (C) 2007 - 2013 <NAME> and Timble CVBA. (http://www.timble.net)
 * @license		GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
 * @link		http://github.com/joomlatools/koowa for the canonical source repository
 */

/**
 * Editable Controller Behavior
 *
 * @author  <NAME> <https://github.com/johanjanssens>
 * @package Koowa\Library\Controller
 */
class KControllerBehaviorEditable extends KControllerBehaviorAbstract
{
    protected $_cookie_path;

    /**
     * Constructor
     *
     * @param   KObjectConfig $config Configuration options
     */
    public function __construct(KObjectConfig $config)
    {
        parent::__construct($config);

        if($this->isDispatched() && $this->getRequest()->getFormat() == 'html')
        {
            $this->registerCallback('before.read' , array($this, 'setReferrer'));
            $this->registerCallback('after.apply' , array($this, 'lockReferrer'));
            $this->registerCallback('after.read'  , array($this, 'unlockReferrer'));
            $this->registerCallback('after.save'  , array($this, 'unsetReferrer'));
            $this->registerCallback('after.cancel', array($this, 'unsetReferrer'));

            $domain = $this->getMixer()->getIdentifier()->domain;

            // Only lock/unlock entities in administrator or in form layouts in site
            if ($domain === 'admin' || $this->getRequest()->query->layout === 'form')
            {
                $this->registerCallback('after.read'  , array($this, 'lockResource'));
                $this->registerCallback('after.save'  , array($this, 'unlockResource'));
                $this->registerCallback('after.cancel', array($this, 'unlockResource'));
            }
        }

        $this->_cookie_path = $config->cookie_path;
    }

    /**
     * Initializes the options for the object
     *
     * Called from {@link __construct()} as a first step of object instantiation.
     *
     * @param  KObjectConfig $config A ObjectConfig object with configuration options
     * @return void
     */
    protected function _initialize(KObjectConfig $config)
    {
        $config->append(array(
            'cookie_path' => $this->getObject('request')->getBaseUrl('site').'/'
        ));
{'fraction_non_alphanumeric': 0.1520442930153322, 'fraction_numerical': 0.004471890971039182, 'mean_word_length': 2.8468468468468466, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 57, 'https://': 2, 'lorem ipsum': 0, 'www.': 4, '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': '827689', 'n_tokens_mistral': 1349, 'n_tokens_neox': 1298, 'n_words': 268}