wppaste
WordPress

getid3_lib

Source
wp-includes/ID3/getid3.lib.php:27

Compatibility

WordPress
core
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0).

Methods · 71

Source code

class getid3_lib{	/**	 * @param string      $string	 * @param bool        $hex	 * @param bool        $spaces	 * @param string|bool $htmlencoding	 *	 * @return string	 */	public static function PrintHexBytes($string, $hex=true, $spaces=true, $htmlencoding='UTF-8') {		$returnstring = '';		for ($i = 0; $i < strlen($string); $i++) {			if ($hex) {				$returnstring .= str_pad(dechex(ord($string[$i])), 2, '0', STR_PAD_LEFT);			} else {				$returnstring .= ' '.(preg_match("#[\x20-\x7E]#", $string[$i]) ? $string[$i] : '¤');			}			if ($spaces) {				$returnstring .= ' ';			}		}		if (!empty($htmlencoding)) {			if ($htmlencoding === true) {				$htmlencoding = 'UTF-8'; // prior to getID3 v1.9.0 the function's 4th parameter was boolean			}			$returnstring = htmlentities($returnstring, ENT_QUOTES, $htmlencoding);		}		return $returnstring;	} 	/**	 * Truncates a floating-point number at the decimal point.	 *	 * @param float $floatnumber	 *	 * @return float|int returns int (if possible, otherwise float)	 */	public static function trunc($floatnumber) {		if ($floatnumber >= 1) {			$truncatednumber = floor($floatnumber);		} elseif ($floatnumber <= -1) {			$truncatednumber = ceil($floatnumber);		} else {			$truncatednumber = 0;		}		if (self::intValueSupported($truncatednumber)) {			$truncatednumber = (int) $truncatednumber;		}		return $truncatednumber;	} 	/**	 * @param int|null $variable	 * @param-out int  $variable	 * @param int      $increment	 *	 * @return bool	 */	public static function safe_inc(&$variable, $increment=1) {		if (isset($variable)) {			$variable += $increment;		} else {			$variable = $increment;		}		return true;	} 	/**	 * @param int|float $floatnum	 *	 * @return int|float	 */	public static function CastAsInt($floatnum) {		// convert to float if not already		$floatnum = (float) $floatnum; 		// convert a float to type int, only if possible		if (self::trunc($floatnum) == $floatnum) {			// it's not floating point

Changelog

Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 7.1.0 tag, from src/wp-includes/ID3/getid3.lib.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.