<commit_before><?
defined('C5_EXECUTE') or die("Access Denied.");
/**
 * @package Core
 * @category Concrete
 * @author <NAME> <<EMAIL>>
 * @copyright  Copyright (c) 2003-2008 Concrete5. (http://www.concrete5.org)
 * @license    http://www.concrete5.org/license/     MIT License
 *
 */

/**
 * A generic object that every block or page controller extends
 * @package Core
 * @author <NAME> <<EMAIL>>
 * @category Concrete
 * @copyright  Copyright (c) 2003-2008 Concrete5. (http://www.concrete5.org)
 * @license    http://www.concrete5.org/license/     MIT License
 *
 */
class Concrete5_Library_Controller {

	public $theme = null;
	/*
	 * an array of items set by the set() method.
	 * @var array
	*/ 
	private $sets = array();
	
	/*
	 * array of helper objects
	 * @var array
	*/
	protected $helperObjects = array();
	
	/*
	 * Page Object for the controller's page
	 * @var Page 
	 * 
	*/
	protected $c;
	
	/*
	 * Task to be run ex: 'view'
	 * @var string
	*/
	protected $task = false;
	
	/*
	 * @var array
	*/
	protected $parameters = false;
	
	/*
	 * If the page supports full page caching or not
	 * @var bool
	*/
	protected $supportsPageCache = false;	
	
	/**
	 * array of method names that can't be called through the url
	 * @var array
	*/
	protected $restrictedMethods = array();
	
	
	public function __construct() {
		if (!isset($this->helpers)) {
			$this->helpers[] = 'html';
		}
		foreach($this->helpers as $h) {
			$this->helperObjects[(str_replace('/','_',$h))] = Loader::helper($h);
		}		
	}	
	
	public function __sleep() {
		$this->helperObjects = array();
		return get_object_vars($this);
	}

	/**
	 * @access private
	 */
	public function getRenderOverride() {
		return $this->renderOverride;
	}
	
	
	/** 
	 * Is responsible for taking a method passed and ensuring that it is valid for the current request. You can't
	 * 1. Pass a method that starts with "on_"
	 * 2. Pass a method that's in the restrictedMethods array
	 * 3. Pass a method that's defined in the base class
	 * 4. Any non-public method
	 * @return void
	*/
	private function setupRequestTask() {
		
		$req = Request::get();
		
		// we are already on the right page now
		// let's grab the right method as well.
		$task = substr('/' . $req->getRequestPath(), strlen($req->getRequestCollectionPath()) + 1);

		// remove legacy separaters
		$task = preg_replace('/^\-\//', '', $task);

		// grab the whole shebang
		$taskparts = explode('/', $task);
		
		if (isset($taskparts[0]) && $taskparts[0] != '') {
			$method = $taskparts[0];
		}

		if ($method == '') {<commit_msg>Define `$method` before conditional<commit_after><?
defined('C5_EXECUTE') or die("Access Denied.");
/**
 * @package Core
 * @category Concrete
 * @author <NAME> <<EMAIL>>
 * @copyright  Copyright (c) 2003-2008 Concrete5. (http://www.concrete5.org)
 * @license    http://www.concrete5.org/license/     MIT License
 *
 */

/**
 * A generic object that every block or page controller extends
 * @package Core
 * @author <NAME> <<EMAIL>>
 * @category Concrete
 * @copyright  Copyright (c) 2003-2008 Concrete5. (http://www.concrete5.org)
 * @license    http://www.concrete5.org/license/     MIT License
 *
 */
class Concrete5_Library_Controller {

	public $theme = null;
	/*
	 * an array of items set by the set() method.
	 * @var array
	*/ 
	private $sets = array();
	
	/*
	 * array of helper objects
	 * @var array
	*/
	protected $helperObjects = array();
	
	/*
	 * Page Object for the controller's page
	 * @var Page 
	 * 
	*/
	protected $c;
	
	/*
	 * Task to be run ex: 'view'
	 * @var string
	*/
	protected $task = false;
	
	/*
	 * @var array
	*/
	protected $parameters = false;
	
	/*
	 * If the page supports full page caching or not
	 * @var bool
	*/
	protected $supportsPageCache = false;	
	
	/**
	 * array of method names that can't be called through the url
	 * @var array
	*/
	protected $restrictedMethods = array();
	
	
	public function __construct() {
		if (!isset($this->helpers)) {
			$this->helpers[] = 'html';
		}
		foreach($this->helpers as $h) {
			$this->helperObjects[(str_replace('/','_',$h))] = Loader::helper($h);
		}		
	}	
	
	public function __sleep() {
		$this->helperObjects = array();
		return get_object_vars($this);
	}

	/**
	 * @access private
	 */
	public function getRenderOverride() {
		return $this->renderOverride;
	}
	
	
	/** 
	 * Is responsible for taking a method passed and ensuring that it is valid for the current request. You can't
	 * 1. Pass a method that starts with "on_"
	 * 2. Pass a method that's in the restrictedMethods array
	 * 3. Pass a method that's defined in the base class
	 * 4. Any non-public method
	 * @return void
	*/
	private function setupRequestTask() {
		
		$req = Request::get();
		
		// we are already on the right page now
		// let's grab the right method as well.
		$task = substr('/' . $req->getRequestPath(), strlen($req->getRequestCollectionPath()) + 1);

		// remove legacy separaters
		$task = preg_replace('/^\-\//', '', $task);

		// grab the whole shebang
		$taskparts = explode('/', $task);
		
		$method = '';
		if (isset($taskparts[0]) && $taskparts[0] != '') {
			$method = $taskparts[0];
		}

		if ($method == '') {
{'fraction_non_alphanumeric': 0.1553398058252427, 'fraction_numerical': 0.012427184466019418, 'mean_word_length': 3.052714398111723, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 8, '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': '1679304', 'n_tokens_mistral': 1832, 'n_tokens_neox': 1608, 'n_words': 516}