Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Converted Doxygen to PHPDoc in eZDataType and all derived datatypes #207

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 5 additions & 20 deletions kernel/classes/datatypes/ezauthor/ezauthortype.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,18 +101,12 @@ function validateObjectAttributeHTTPInput( $http, $base, $contentObjectAttribute
return eZInputValidator::STATE_ACCEPTED;
}

/*!
Store content
*/
function storeObjectAttribute( $contentObjectAttribute )
{
$author = $contentObjectAttribute->content();
$contentObjectAttribute->setAttribute( "data_text", $author->xmlString() );
}

/*!
Sets the default value.
*/
function initializeObjectAttribute( $contentObjectAttribute, $currentVersion, $originalContentObjectAttribute )
{
if ( $currentVersion != false )
Expand All @@ -122,9 +116,6 @@ function initializeObjectAttribute( $contentObjectAttribute, $currentVersion, $o
}
}

/*!
Returns the content.
*/
function objectAttributeContent( $contentObjectAttribute )
{
$author = new eZAuthor( );
Expand Down Expand Up @@ -152,12 +143,9 @@ function objectAttributeContent( $contentObjectAttribute )
return $author;
}


/*!
Returns the meta data used for storing search indeces.
*/
function metaData( $contentObjectAttribute )
{
/** @var eZAuthor $author */
$author = $contentObjectAttribute->content();
if ( !$author )
return false;
Expand All @@ -176,13 +164,16 @@ function toString( $contentObjectAttribute )
return eZStringUtils::implodeStr( $authorList, "&" );
}

/**
* @inheritdoc
* @return eZAuthor
*/
function fromString( $contentObjectAttribute, $string )
{
$authorList = eZStringUtils::explodeStr( $string, '&' );

$author = new eZAuthor( );


foreach ( $authorList as $authorStr )
{
$authorData = eZStringUtils::explodeStr( $authorStr, '|' );
Expand All @@ -193,9 +184,6 @@ function fromString( $contentObjectAttribute, $string )
return $author;
}

/*!
Fetches the http post var integer input and stores it in the data instance.
*/
function fetchObjectAttributeHTTPInput( $http, $base, $contentObjectAttribute )
{
if ( $http->hasPostVariable( $base . "_data_author_id_" . $contentObjectAttribute->attribute( "id" ) ) )
Expand Down Expand Up @@ -253,9 +241,6 @@ function hasObjectAttributeContent( $contentObjectAttribute )
return count( $authorList ) > 0;
}

/*!
Returns the string value.
*/
function title( $contentObjectAttribute, $name = null )
{
$author = $contentObjectAttribute->content( );
Expand Down
92 changes: 14 additions & 78 deletions kernel/classes/datatypes/ezbinaryfile/ezbinaryfiletype.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@
* @package kernel
*/

/*!
\class eZBinaryFileType ezbinaryfiletype.php
\ingroup eZDatatype
\brief The class eZBinaryFileType handles files and association with content objects

*/

/**
* The class eZBinaryFileType handles files and association with content objects
*
* @package kernel
*/
class eZBinaryFileType extends eZDataType
{
const MAX_FILESIZE_FIELD = 'data_int1';
Expand Down Expand Up @@ -51,14 +49,6 @@ function viewTemplate( $contentobjectAttribute )
return $template;
}

/*!
\return the template name to use for editing the attribute.
\note Default is to return the datatype string which is OK
for most datatypes, if you want dynamic templates
reimplement this function and return a template name.
\note The returned template name does not include the .tpl extension.
\sa viewTemplate, informationTemplate
*/
function editTemplate( $contentobjectAttribute )
{
$handler = $this->fileHandler();
Expand All @@ -69,14 +59,6 @@ function editTemplate( $contentobjectAttribute )
return $template;
}

/*!
\return the template name to use for information collection for the attribute.
\note Default is to return the datatype string which is OK
for most datatypes, if you want dynamic templates
reimplement this function and return a template name.
\note The returned template name does not include the .tpl extension.
\sa viewTemplate, editTemplate
*/
function informationTemplate( $contentobjectAttribute )
{
$handler = $this->fileHandler();
Expand All @@ -87,9 +69,6 @@ function informationTemplate( $contentobjectAttribute )
return $template;
}

/*!
Sets value according to current version
*/
function initializeObjectAttribute( $contentObjectAttribute, $currentVersion, $originalContentObjectAttribute )
{
if ( $currentVersion != false )
Expand All @@ -106,10 +85,6 @@ function initializeObjectAttribute( $contentObjectAttribute, $currentVersion, $o
}
}

/*!
The object is being moved to trash, do any necessary changes to the attribute.
Rename file and update db row with new name, so that access to the file using old links no longer works.
*/
function trashStoredObjectAttribute( $contentObjectAttribute, $version = null )
{
$contentObjectAttributeID = $contentObjectAttribute->attribute( "id" );
Expand Down Expand Up @@ -158,9 +133,6 @@ function trashStoredObjectAttribute( $contentObjectAttribute, $version = null )
}
}

/*!
Delete stored attribute
*/
function deleteStoredObjectAttribute( $contentObjectAttribute, $version = null )
{
$contentObjectAttributeID = $contentObjectAttribute->attribute( "id" );
Expand Down Expand Up @@ -214,9 +186,9 @@ function deleteStoredObjectAttribute( $contentObjectAttribute, $version = null )
}
}

/*!
Checks if file uploads are enabled, if not it gives a warning.
*/
/**
* Checks if file uploads are enabled, if not it gives a warning.
*/
function checkFileUploads()
{
$isFileUploadsEnabled = ini_get( 'file_uploads' ) != 0;
Expand All @@ -235,10 +207,6 @@ function checkFileUploads()
}
}

/*!
Validates the input and returns true if the input was
valid for this datatype.
*/
function validateObjectAttributeHTTPInput( $http, $base, $contentObjectAttribute )
{
eZBinaryFileType::checkFileUploads();
Expand Down Expand Up @@ -302,9 +270,6 @@ function validateObjectAttributeHTTPInput( $http, $base, $contentObjectAttribute
return eZInputValidator::STATE_ACCEPTED;
}

/*!
Fetches the http post var integer input and stores it in the data instance.
*/
function fetchObjectAttributeHTTPInput( $http, $base, $contentObjectAttribute )
{
eZBinaryFileType::checkFileUploads();
Expand Down Expand Up @@ -386,9 +351,6 @@ function fetchObjectAttributeHTTPInput( $http, $base, $contentObjectAttribute )
return true;
}

/*!
Does nothing, since the file has been stored. See fetchObjectAttributeHTTPInput for the actual storing.
*/
function storeObjectAttribute( $contentObjectAttribute )
{
}
Expand All @@ -404,25 +366,16 @@ function customObjectAttributeHTTPAction( $http, $action, $contentObjectAttribut
}
}

/*!
HTTP file insertion is supported.
*/
function isHTTPFileInsertionSupported()
{
return true;
}

/*!
HTTP file insertion is supported.
*/
function isRegularFileInsertionSupported()
{
return true;
}

/*!
Inserts the file using the eZBinaryFile class.
*/
function insertHTTPFile( $object, $objectVersion, $objectLanguage,
$objectAttribute, $httpFile, $mimeData,
&$result )
Expand Down Expand Up @@ -452,7 +405,6 @@ function insertHTTPFile( $object, $objectVersion, $objectLanguage,
return false;
}


$filePath = $binary->attribute( 'filename' );

$binary->setAttribute( "contentobject_attribute_id", $attributeID );
Expand All @@ -475,9 +427,6 @@ function insertHTTPFile( $object, $objectVersion, $objectLanguage,
return true;
}

/*!
Inserts the file using the eZBinaryFile class.
*/
function insertRegularFile( $object, $objectVersion, $objectLanguage,
$objectAttribute, $filePath,
&$result )
Expand Down Expand Up @@ -521,7 +470,6 @@ function insertRegularFile( $object, $objectVersion, $objectLanguage,
$fileHandler = eZClusterFileHandler::instance();
$fileHandler->fileStore( $destination, 'binaryfile', true, $mimeData['name'] );


$binary->setAttribute( "contentobject_attribute_id", $attributeID );
$binary->setAttribute( "version", $objectVersion );
$binary->setAttribute( "filename", $destFileName );
Expand All @@ -534,18 +482,12 @@ function insertRegularFile( $object, $objectVersion, $objectLanguage,
return true;
}

/*!
We support file information
*/
function hasStoredFileInformation( $object, $objectVersion, $objectLanguage,
$objectAttribute )
{
return true;
}

/*!
Extracts file information for the binaryfile entry.
*/
function storedFileInformation( $object, $objectVersion, $objectLanguage,
$objectAttribute )
{
Expand All @@ -557,9 +499,6 @@ function storedFileInformation( $object, $objectVersion, $objectLanguage,
}
return false;
}
/*!
Updates download count for binary file.
*/
function handleDownload( $object, $objectVersion, $objectLanguage,
$objectAttribute )
{
Expand Down Expand Up @@ -589,9 +528,6 @@ function fetchClassAttributeHTTPInput( $http, $base, $classAttribute )
$classAttribute->setAttribute( self::MAX_FILESIZE_FIELD, $filesizeValue );
}
}
/*!
Returns the object title.
*/
function title( $contentObjectAttribute, $name = "original_filename" )
{
$value = false;
Expand All @@ -612,6 +548,10 @@ function hasObjectAttributeContent( $contentObjectAttribute )
return true;
}

/**
* @inheritdoc
* @return eZBinaryFile
*/
function objectAttributeContent( $contentObjectAttribute )
{
$binaryFile = eZBinaryFile::fetch( $contentObjectAttribute->attribute( "id" ),
Expand Down Expand Up @@ -653,16 +593,13 @@ function serializeContentClassAttribute( $classAttribute, $attributeNode, $attri

function unserializeContentClassAttribute( $classAttribute, $attributeNode, $attributeParametersNode )
{
/** @var DOMElement $sizeNode */
$sizeNode = $attributeParametersNode->getElementsByTagName( 'max-size' )->item( 0 );
$maxSize = $sizeNode->textContent;
$unitSize = $sizeNode->getAttribute( 'unit-size' );
$classAttribute->setAttribute( self::MAX_FILESIZE_FIELD, $maxSize );
}

/*!
\return string representation of an contentobjectattribute data for simplified export

*/
function toString( $objectAttribute )
{
$binaryFile = $objectAttribute->content();
Expand All @@ -675,8 +612,6 @@ function toString( $objectAttribute )
return '';
}



function fromString( $objectAttribute, $string )
{
if( !$string )
Expand Down Expand Up @@ -774,6 +709,7 @@ function supportsBatchInitializeObjectAttribute()

/**
* Checks if current HTTP request is asking for current binary file deletion
*
* @param eZHTTPTool $http
* @param eZContentObjectAttribute $contentObjectAttribute
* @return bool
Expand Down
Loading