<commit_before><?php
/**
 * Attachment Model File
 *
 * Copyright (c) 2007-2009 <NAME>
 *
 * Distributed under the terms of the MIT License.
 * Redistributions of files must retain the above copyright notice.
 *
 * PHP version 5
 * CakePHP version 1.2
 *
 * @package    media
 * @subpackage media.models
 * @author     <NAME> <<EMAIL>>
 * @copyright  2007-2009 <NAME> <<EMAIL>>
 * @license    http://www.opensource.org/licenses/mit-license.php The MIT License
 * @link       http://github.com/davidpersson/media
 */
/**
 * Attachment Model Class
 *
 * @package    media
 * @subpackage media.models
 */
class Attachment extends MediaAppModel {
/**
 * Name of model
 *
 * @var   string
 */
	var $name = 'Attachment';
/**
 * Name of table to use
 *
 * @var   mixed
 */
	var $useTable = 'attachments';
/**
 * actsAs property
 *
 * @var   array
 */
	var $actsAs = array(
	    'Media.Polymorphic' => array(
									  'classField' => 'model',
									  'foreignKey' => 'foreign_key',
									 ),
	    'Media.Transfer'		  => array(
									  'destinationFile' => ':MEDIA:transfer:DS::Medium.short::DS::Source.basename:',
									  'createDirectory' => true,
									 ),
	    'Media.Media'			  => array(
									  'makeVersions'    => true,
									  'metadataLevel'   => 2,
									  'createDirectory' => true,
									 ),
				  );
/**
 * Validation
 *
 * @var   array
 */
	var $validate = array(
		 'file'		=> array(
		   /* @see TransferBehavior::checkResource */
		   'resource'   => array(
					'rule' => 'checkResource',
						   ),
		   /* @see TransferBehavior::checkAccess */
		   'access'     => array(
					'rule' => 'checkAccess',
						   ),
		   /* @see TransferBehavior::checkLocation */
		   'location'   => array(
					'rule' => array('checkLocation', array(':MEDIA:', '/tmp/')),
						   ),
		   /* @see TransferBehavior::checkPermission */
		   'permission' => array(
					'rule' => array('checkPermission', '*'),
						   ),
		   /* @see TransferBehavior::checkSize */
		   'size'       => array(
					'rule' => array('checkSize', '5M'),
					 	   ),
		   /* @see TransferBehavior::checkPixels */
		   'pixels'     => array(
					'rule' => array('checkPixels', '1600x1600'),
					 	   ),
		   /* @see TransferBehavior::checkExtension */
		   'extension'  => array(
					'rule' => array(
					           'checkExtension',
			 				   array(
								 'bin', 'class', 'dll', 'dms', 'exe', 'lha',
								 'lzh', 'so', 'as', 'asp', 'sh', 'java', 'js',
								 'lisp', 'lua', 'pl', 'pm', 'php', 'py', 'pyc',
								 'vb', 'bas', 'jar',
							    ),
							   '*'
							  ),
						  ),
		   /* @see TransferBehavior::checkMimeType */
		   'mimeType'   => array(
					'rule' => array(
							   'checkMimeType',
						  		false,
								'*'
							  ),
						),
		), /* END of validations for file field */
	 	'alternative' => array(
				   /* @see MediaBehavior::checkRepresent */
				   'rule' 	    => 'checkRepresent',
            	   'on' 	    => 'create',
            	   'required'   => false,
	   			   'allowEmpty' => true,
			 	   ),
     ); /* END of validation var */
}
?><commit_msg>Updating docblocks, cosmetics<commit_after><?php
/**
 * Attachment Model File
 *
 * Copyright (c) 2007-2009 <NAME>
 *
 * Distributed under the terms of the MIT License.
 * Redistributions of files must retain the above copyright notice.
 *
 * PHP version 5
 * CakePHP version 1.2
 *
 * @package    media
 * @subpackage media.models
 * @author     <NAME> <david<EMAIL>>
 * @copyright  2007-2009 <NAME> <<EMAIL>>
 * @license    http://www.opensource.org/licenses/mit-license.php The MIT License
 * @link       http://github.com/davidpersson/media
 */
/**
 * Attachment Model Class
 *
 * A ready-to-use model combining multiple behaviors.
 *
 * @package    media
 * @subpackage media.models
 */
class Attachment extends MediaAppModel {
/**
 * Name of model
 *
 * @var string
 */
	var $name = 'Attachment';
/**
 * Name of table to use
 *
 * @var mixed
 */
	var $useTable = 'attachments';
/**
 * actsAs property
 *
 * @var array
 */
	var $actsAs = array(
			'Media.Polymorphic' => array(
				'classField' => 'model',
				'foreignKey' => 'foreign_key',
				),
			'Media.Transfer' => array(
				'destinationFile' => ':MEDIA:transfer:DS::Medium.short::DS::Source.basename:',
				'createDirectory' => true,
				),
			'Media.Media' => array(
				'makeVersions'    => true,
				'metadataLevel'   => 2,
				'createDirectory' => true,
				),
			);
/**
 * Validation rules for file and alternative fields
 *
 * For more information on the rules used here
 * see the source of TransferBehavior and MediaBehavior.
 *
 * If you experience problems with your model not validating,
 * try commenting the mimeType rule or providing less strict
 * settings for single rules.
 *
 * @var array
 */
	var $validate = array(
			'file' => array(
				'resource'   => array('rule' => 'checkResource'),
				'access'     => array('rule' => 'checkAccess'),
				'location'   => array('rule' => array('checkLocation', array(':MEDIA:', '/tmp/'))),
				'permission' => array('rule' => array('checkPermission', '*')),
				'size'       => array('rule' => array('checkSize', '5M')),
				'pixels'     => array('rule' => array('checkPixels', '1600x1600')),
				'extension'  => array('rule' => array('checkExtension',
													array(
														'bin', 'class', 'dll', 'dms', 'exe', 'lha',
														'lzh', 'so', 'as', 'asp', 'sh', 'java', 'js',
														'lisp', 'lua', 'pl', 'pm', 'php', 'py', 'pyc',
														'vb', 'bas', 'jar',
														),
													'*'
													),
												),
				'mimeType'   => array('rule' => array('checkMimeType', false, '*')),
				),
			'alternative' => array(
				'rule'       => 'checkRepresent',
				'on'         => 'create',
				'required'   => false,
				'allowEmpty' => true,
				),
			);
}
?>
{'fraction_non_alphanumeric': 0.17938604013033785, 'fraction_numerical': 0.009946835877208026, 'mean_word_length': 2.2986425339366514, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 83, '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': '4514719', 'n_tokens_mistral': 2401, 'n_tokens_neox': 1821, 'n_words': 441}