Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

Public Member Functions | Public Attributes | Private Member Functions | List of all members
eZISBN13 Class Reference

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

## Public Member Functions
| __construct ( $isbnNr=null, $separator='-')
| attributes ()
| attribute ( $value)
| hasAttribute ( $value)
| hasRangeData ()
| formatedISBNValue ( $isbnNr=false, &$error, $separator='-')
| extractISBNNumber ( $isbnNr=false, &$error)
| validate ( $isbnNr, &$error)

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

## 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 20 of file ezisbn13.php.

## Constructor & Destructor Documentation

## ◆ __construct()

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

Constructor

Parameters

  string | null | $isbnNr | The ISBN-13 number, e.g. 978-0-11-000222-4
  string | $separator | The hyphen used in the ISBN number to make the ISBN number more visible.

Definition at line 34 of file ezisbn13.php.

References extractISBNNumber().

## Member Function Documentation

## ◆ attribute()

eZISBN13::attribute | ( |  | $value | ) |

Fetch the attribute sent in $value.

Parameters

  $value | is the name of the attribute that should be fetched.

Returns
  the result of the attribute.

Definition at line 66 of file ezisbn13.php.

References eZISBNGroup\fetchList(), eZISBNGroupRange\fetchList(), and hasRangeData().

## ◆ attributes()

eZISBN13::attributes | ( |  | ) |

Contains a list of all attributes for this class.

Returns
  the array with existing attributes.

Definition at line 54 of file ezisbn13.php.

Referenced by hasAttribute().

## ◆ extractISBNNumber()

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

  $isbnNr | is the ISBN-13 number. Should be 13 digits long and may contain space or hyphen as separator.
  $error | is 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 225 of file ezisbn13.php.

References eZISBNGroupRange\extractGroup(), eZISBNRegistrantRange\extractRegistrant(), eZISBNGroup\fetchByGroup(), and ezpI18n\tr().

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

## ◆ formatedISBNValue()

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

  $isbnNr | is the ISBN-13 number. Should be 13 digits long and may contain space or hyphen as separator.
  $error | is used to send back an error message that will be shown to the user if the ISBN number was not extracted correctly.
  $separator | is 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 138 of file ezisbn13.php.

References $CheckDigit, $RegistrationGroup, CHECK_LENGTH, extractISBNNumber(), and PREFIX_LENGTH.

## ◆ hasAttribute()

eZISBN13::hasAttribute | ( |  | $value | ) |

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

Parameters

  $value | is the attribute you want to see if exist.

Returns
  true if the attribute is found.

Definition at line 97 of file ezisbn13.php.

References attributes().

## ◆ hasRangeData()

eZISBN13::hasRangeData | ( |  | ) |

Check if any ISBN ranges exist.

Returns
  true if any ranges are found.

Definition at line 106 of file ezisbn13.php.

References eZDB\instance().

Referenced by attribute().

## ◆ validate()

eZISBN13::validate | ( |  | $isbnNr,
|  | & | $error
| ) |  |

Validates the ISBN-13 number $isbnNr.

Parameters

  $isbnNr | A string containing the number without any dashes.
  $error | is 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 327 of file ezisbn13.php.

References extractISBNNumber(), and validateISBN13Checksum().

## ◆ validateISBN13Checksum()

eZISBN13::validateISBN13Checksum | ( |  | $isbnNr,
|  | & | $error
| ) |  |
| private

Validates the ISBN-13 number $isbnNr.

Parameters

  $isbnNr | A string containing the number without any dashes.
  $error | is 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 345 of file ezisbn13.php.

References LENGTH, and ezpI18n\tr().

Referenced by validate().

## Member Data Documentation

## ◆ $CheckDigit

eZISBN13::$CheckDigit

Definition at line 395 of file ezisbn13.php.

Referenced by formatedISBNValue().

## ◆ $Prefix

eZISBN13::$Prefix

Definition at line 391 of file ezisbn13.php.

## ◆ $PublicationElement

eZISBN13::$PublicationElement

Definition at line 394 of file ezisbn13.php.

## ◆ $RegistrantElement

eZISBN13::$RegistrantElement

Definition at line 393 of file ezisbn13.php.

## ◆ $RegistrationGroup

eZISBN13::$RegistrationGroup

Definition at line 392 of file ezisbn13.php.

Referenced by formatedISBNValue().

## ◆ CHECK_LENGTH

const eZISBN13::CHECK_LENGTH = 1

Definition at line 23 of file ezisbn13.php.

Referenced by formatedISBNValue().

## ◆ LENGTH

const eZISBN13::LENGTH = 13

Definition at line 24 of file ezisbn13.php.

Referenced by validateISBN13Checksum().

## ◆ PREFIX_978

const eZISBN13::PREFIX_978 = 978

Definition at line 25 of file ezisbn13.php.

## ◆ PREFIX_979

const eZISBN13::PREFIX_979 = 979

Definition at line 26 of file ezisbn13.php.

## ◆ PREFIX_LENGTH

const eZISBN13::PREFIX_LENGTH = 3

Definition at line 22 of file ezisbn13.php.

Referenced by formatedISBNValue().

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

- ezisbn13.php

Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.