<commit_before><?php
/**
 * Upload behavior
 *
 * Enables users to easily add file uploading and necessary validation rules
 *
 * PHP versions 4 and 5
 *
 * Copyright 2010, <NAME>
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright 2010, <NAME>
 * @package       upload
 * @subpackage    upload.models.behaviors
 * @link          http://github.com/josegonzalez/upload
 * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
 */
if (!class_exists('Folder')) {
	App::import('Core', 'Folder');
}
class UploadBehavior extends ModelBehavior {

	var $defaults = array(
		'pathMethod'		=> 'primaryKey',
		'path'				=> 'webroot{DS}files{DS}{model}{DS}{field}{DS}',
		'fields'			=> array('dir' => 'dir', 'type' => 'type', 'size' => 'size'),
		'mimetypes'			=> array(),
		'extensions'		=> array(),
		'maxSize'			=> 2097152,
		'minSize'			=> 8,
		'maxHeight'			=> 0,
		'minHeight'			=> 0,
		'maxWidth'			=> 0,
		'minWidth'			=> 0,
		'prefixStyle'		=> true,
		'thumbnails'		=> true,
		'thumbsizes'		=> array(),
		'thumbnailQuality'	=> 75,
		'thumbnailMethod'	=> 'imagick',
		'deleteOnUpdate'	=> false,
		'thumbnailType'		=> false,
		'mediaThumbnailType'=> 'png',
		'saveDir'			=> true,
		'thumbnailPath'		=> false,
	);

	var $_imageMimetypes = array(
		'image/bmp',
		'image/gif',
		'image/jpeg',
		'image/pjpeg',
		'image/png',
		'image/vnd.microsoft.icon',
		'image/x-icon',
		'application/pdf',
	);

	var $_pathMethods = array('flat', 'primaryKey', 'random');

	var $_resizeMethods = array('imagick', 'php');

	var $__filesToRemove = array();

	var $_removingOnly = array();

/**
 * Runtime configuration for this behavior
 *
 * @var array
 **/
	var $runtime;

/**
 * Initiate Upload behavior
 *
 * @param object $model instance of model
 * @param array $config array of configuration settings.<commit_msg>adding mediaTypes to cover types other than images<commit_after><?php
/**
 * Upload behavior
 *
 * Enables users to easily add file uploading and necessary validation rules
 *
 * PHP versions 4 and 5
 *
 * Copyright 2010, <NAME>
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright 2010, <NAME>
 * @package       upload
 * @subpackage    upload.models.behaviors
 * @link          http://github.com/josegonzalez/upload
 * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
 */
if (!class_exists('Folder')) {
	App::import('Core', 'Folder');
}
class UploadBehavior extends ModelBehavior {

	var $defaults = array(
		'pathMethod'		=> 'primaryKey',
		'path'				=> 'webroot{DS}files{DS}{model}{DS}{field}{DS}',
		'fields'			=> array('dir' => 'dir', 'type' => 'type', 'size' => 'size'),
		'mimetypes'			=> array(),
		'extensions'		=> array(),
		'maxSize'			=> 2097152,
		'minSize'			=> 8,
		'maxHeight'			=> 0,
		'minHeight'			=> 0,
		'maxWidth'			=> 0,
		'minWidth'			=> 0,
		'prefixStyle'		=> true,
		'thumbnails'		=> true,
		'thumbsizes'		=> array(),
		'thumbnailQuality'	=> 75,
		'thumbnailMethod'	=> 'imagick',
		'deleteOnUpdate'	=> false,
		'thumbnailType'		=> false,
		'mediaThumbnailType'=> 'png',
		'saveDir'			=> true,
		'thumbnailPath'		=> false,
	);

	var $_imageMimetypes = array(
		'image/bmp',
		'image/gif',
		'image/jpeg',
		'image/pjpeg',
		'image/png',
		'image/vnd.microsoft.icon',
		'image/x-icon',
	);

	var $_mediaMimetypes = array(
		'application/pdf',
		'application/postscript',
	);

	var $_pathMethods = array('flat', 'primaryKey', 'random');

	var $_resizeMethods = array('imagick', 'php');

	var $__filesToRemove = array();

	var $_removingOnly = array();

/**
 * Runtime configuration for this behavior
 *
 * @var array
 **/
	var $runtime;

/**
 * Initiate Upload behavior
 *
 * @param object $model instance of model
 * @param array $config array of configuration settings.
{'fraction_non_alphanumeric': 0.17181516466683686, 'fraction_numerical': 0.012254276231810059, 'mean_word_length': 3.664285714285714, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 55, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4092600', 'n_tokens_mistral': 1504, 'n_tokens_neox': 1368, 'n_words': 328}