eZPublish  4.5
eZISBN13 Class Reference

The class eZISBN13 handles ISBN-13 numbers. More...

Public Member Functions

 attribute ($value)
 
 attributes ()
 
 extractISBNNumber ($isbnNr=false, &$error)
 
 eZISBN13 ($isbnNr=null, $separator= '-')
 
 formatedISBNValue ($isbnNr=false, &$error, $separator= '-')
 
 hasAttribute ($value)
 
 hasRangeData ()
 
 validate ($isbnNr, &$error)
 

Public Attributes

 $CheckDigit
 
 $Prefix
 
 $PublicationElement
 
 $RegistrantElement
 
 $RegistrationGroup
 
const CHECK_LENGTH = 1
 
const LENGTH = 13
 
const PREFIX_978 = 978
 
const PREFIX_979 = 979
 
const PREFIX_LENGTH = 3
 

Private Member Functions

 validateISBN13Checksum ($isbnNr, &$error)
 

Detailed Description

The class eZISBN13 handles ISBN-13 numbers.

The class is containing an ISBN-13 number and extracts the different groups based on the information stored in the different ranges for Registration group and Registration elements. The Publication element will get the space left available.

Member Function Documentation

eZISBN13::attribute (   $value)

Fetch the attribute sent in $value.

Parameters
$valueis the name of the attribute that should be fetched.
Returns
the result of the attribute.
eZISBN13::attributes ( )

Contains a list of all attributes for this class.

Returns
the array with existing attributes.

Referenced by hasAttribute().

eZISBN13::extractISBNNumber (   $isbnNr = false,
$error 
)

Extracts the ISBN-13 number and are setting the class variables for the different parts when the value is found. The class variables should be set as default false in the constructor.

Parameters
$isbnNris the ISBN-13 number. Should be 13 digits long and may contain space or hyphen as separator.
$erroris used to send back an error message that will be shown to the user if the ISBN number was not extracted correctly.
Returns
true if the ISBN-13 number was successfully extracted and false if not.

Referenced by eZISBN13(), formatedISBNValue(), and validate().

eZISBN13::eZISBN13 (   $isbnNr = null,
  $separator = '-' 
)

Constructor

Parameters
$isbnNris the ISBN-13 number. example is: 978-0-11-000222-4
$separatoris the hyphen used in the ISBN number to make the ISBN number more visible.
eZISBN13::formatedISBNValue (   $isbnNr = false,
$error,
  $separator = '-' 
)

Receives an ISBN number and place hyphen on the correct place in the number. If the placement is not found, an error message will be set and false

The different parts of the ISBN-13 number will be stored in separate class variables.

Parameters
$isbnNris the ISBN-13 number. Should be 13 digits long and may contain space or hyphen as separator.
$erroris used to send back an error message that will be shown to the user if the ISBN number was not extracted correctly.
$separatoris the separator used to make the ISBN number visible. Could be either a space or hyphen.
Returns
A formated ISBN number or the original value if it was not possible to find the structure.
eZISBN13::hasAttribute (   $value)

Check if the attribute set in the string $value exists.

Parameters
$valueis the attribute you want to see if exist.
Returns
true if the attribute is found.
eZISBN13::hasRangeData ( )

Check if any ISBN ranges exist.

Returns
true if any ranges are found.

Referenced by attribute().

eZISBN13::validate (   $isbnNr,
$error 
)

Validates the ISBN-13 number $isbnNr.

Parameters
$isbnNrA string containing the number without any dashes.
$erroris used to send back an error message that will be shown to the user if the ISBN number was not extracted correctly.
Returns
true if it is valid.
eZISBN13::validateISBN13Checksum (   $isbnNr,
$error 
)
private

Validates the ISBN-13 number $isbnNr.

Parameters
$isbnNrA string containing the number without any dashes.
$erroris used to send back an error message that will be shown to the user if the ISBN number validated.
Returns
true if it is valid.

Referenced by validate().

Member Data Documentation

eZISBN13::$CheckDigit

Referenced by formatedISBNValue().

eZISBN13::$Prefix
eZISBN13::$PublicationElement
eZISBN13::$RegistrantElement
eZISBN13::$RegistrationGroup

Referenced by formatedISBNValue().

const eZISBN13::CHECK_LENGTH = 1
const eZISBN13::LENGTH = 13
const eZISBN13::PREFIX_978 = 978
const eZISBN13::PREFIX_979 = 979
const eZISBN13::PREFIX_LENGTH = 3

The documentation for this class was generated from the following file: