eZ Publish  [4.2]
eZISBN13 Class Reference

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

List of all members.

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.

Definition at line 41 of file ezisbn13.php.


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.

Definition at line 87 of file ezisbn13.php.

eZISBN13::attributes ( )

Contains a list of all attributes for this class.

Returns:
the array with existing attributes.

Definition at line 75 of file ezisbn13.php.

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.

Definition at line 246 of file ezisbn13.php.

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.

Definition at line 55 of file ezisbn13.php.

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.

Definition at line 159 of file ezisbn13.php.

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.

Definition at line 118 of file ezisbn13.php.

eZISBN13::hasRangeData ( )

Check if any ISBN ranges exist.

Returns:
true if any ranges are found.

Definition at line 127 of file ezisbn13.php.

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.

Definition at line 348 of file ezisbn13.php.

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.

Definition at line 366 of file ezisbn13.php.

Referenced by validate().


Member Data Documentation

eZISBN13::$CheckDigit

Definition at line 416 of file ezisbn13.php.

eZISBN13::$Prefix

Definition at line 412 of file ezisbn13.php.

eZISBN13::$PublicationElement

Definition at line 415 of file ezisbn13.php.

eZISBN13::$RegistrantElement

Definition at line 414 of file ezisbn13.php.

eZISBN13::$RegistrationGroup

Definition at line 413 of file ezisbn13.php.

Definition at line 44 of file ezisbn13.php.

Referenced by formatedISBNValue().

const eZISBN13::LENGTH = 13

Definition at line 45 of file ezisbn13.php.

Referenced by validateISBN13Checksum().

const eZISBN13::PREFIX_978 = 978

Definition at line 46 of file ezisbn13.php.

const eZISBN13::PREFIX_979 = 979

Definition at line 47 of file ezisbn13.php.

Definition at line 43 of file ezisbn13.php.

Referenced by formatedISBNValue().


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