<commit_before><?php
/**
 * Wysiwyg is a helper for outputting .
 * This helper REQUIRES the installation files for the wysiwyg helpers you will use
 *
 * @package       cake
 * @subpackage    cake.app.plugins.wysiwyg.views.helpers
 * @author:       <NAME>
 * @version:      0.1
 * @email:        <EMAIL>
 * @site:         http://josediazgonzalez.com
 */
class WysiwygHelper extends AppHelper {
/**
 * Helper dependencies
 *
 * @var array
 */
	var $helpers = array('Form', 'Wysiwyg.Fck', 'Wysiwyg.Nicedit', 'Wysiwyg.Markitup', 'Wysiwyg.Tinymce');

/**
 * Default Helper to use
 *
 * @var string
 **/
	var $helper = 'Tinymce';

/**
 * Sets the $this->helper to the helper configured in the session
 *
 * @return void
 * @author <NAME>
 **/
	function __construct($options) {
		if(!empty($options) && isset($options['editor'])) {
			$this->helper = ucfirst($options['editor']);
		}
	}

/**
 * Changes the editor on the fly
 *
 * @param string $editor String name of editor, excluding the word 'Helper'
 * @return void
 * @author <NAME>
 **/
	function changeEditor($editor) {
		$this->helper = $editor;
	}

/**
* Returns the appropriate input field element
* 
* @param string $field - used to build input name for views, 
* @param array $options Array of HTML attributes.
* @param array $editorOptions Array of editor attributes for this input field
* @return string
* @author <NAME>
*/
	function input($field, $options = array(), $editorOptions = array()) {
		$editorHelper = $this->helper;

		return $this->$editorHelper->input($field, $options, $editorOptions);
	}

/**
* Returns the appropriate textarea element

* @param string $field - used to build input name for views, 
* @param array $options Array of HTML attributes.
* @param array $editorOptions Array of editor attributes for this textarea
* @return string
* @author <NAME>
*/
	function textarea($field, $options = array(), $editorOptions = array()) {
		$editorHelper = $this->helper;

		return $this->$editorHelper->textarea($field, $options, $editorOptions);
	}
}
?><commit_msg>fixing App::import for wysiwyg helper. Now does not load all the helpers by default, saving some memory<commit_after><?php
/**
 * Wysiwyg is a helper for outputting .
 * This helper REQUIRES the installation files for the wysiwyg helpers you will use
 *
 * @package       cake
 * @subpackage    cake.app.plugins.wysiwyg.views.helpers
 * @author:       <NAME>
 * @version:      0.1
 * @email:        <EMAIL>
 * @site:         http://josediazgonzalez.com
 */
class WysiwygHelper extends AppHelper {
/**
 * Helper dependencies
 *
 * @var array
 */
	var $helpers = array();

/**
 * Default Helper to use
 *
 * @var string
 **/
	var $helper = '';

/**
* Array of whether a certain helper has been imported yet
* 
*/
	var $importedHelpers = array(
		'Form' => false,
		'Wysiwyg.Fck' => false,
		'Wysiwyg.Nicedit' => false,
		'Wysiwyg.Markitup' => false,
		'Wysiwyg.Tinymce' => false
	);

/**
 * Sets the $this->helper to the helper configured in the session
 *
 * @return void
 * @author <NAME>
 **/
	function __construct($options) {
		$options = array_merge(array('editor' => 'tinymce'), $options);
		$this->changeEditor($options['editor']);
	}

/**
 * Changes the editor on the fly
 *
 * @param string $editor String name of editor, excluding the word 'Helper'
 * @return void
 * @author <NAME>
 **/
	function changeEditor($editor) {
		$this->helper = ucfirst($editor);
		if ($this->helper !== 'Form') {
			$this->helper = 'Wysiwyg.' . $this->helper;
		}
		if (!$this->importedHelpers[$this->helper] and App::import('Helper', $this->helper)) {
			$this->importedHelpers[$this->helper] = true;
			$this->helpers[] = $this->helper;
		}
	}

/**
* Returns the appropriate input field element
* 
* @param string $field - used to build input name for views, 
* @param array $options Array of HTML attributes.
* @param array $editorOptions Array of editor attributes for this input field
* @return string
* @author <NAME>
*/
	function input($field, $options = array(), $editorOptions = array()) {
		$editorHelper = $this->helper;

		return $this->$editorHelper->input($field, $options, $editorOptions);
	}

/**
* Returns the appropriate textarea element
* 
* @param string $field - used to build input name for views, 
* @param array $options Array of HTML attributes.
* @param array $editorOptions Array of editor attributes for this textarea
* @return string
* @author <NAME>
*/
	function textarea($field, $options = array(), $editorOptions = array()) {
		$editorHelper = $this->helper;

		return $this->$editorHelper->textarea($field, $options, $editorOptions);
	}
}
?>
{'fraction_non_alphanumeric': 0.1488806781134536, 'fraction_numerical': 0.000869376222560313, 'mean_word_length': 3.8340336134453783, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 51, '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': '2852619', 'n_tokens_mistral': 1489, 'n_tokens_neox': 1456, 'n_words': 448}