WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

PclZip::privReadFileHeader() public WP 1.0

Function : privReadFileHeader() Description : Parameters : Return Values :

Это метод класса: PclZip{}

Хуков нет.

Возвращает

Null. Ничего.

Использование

$PclZip = new PclZip();
$PclZip->privReadFileHeader( $p_header );

Код PclZip::privReadFileHeader() WP 5.5.1

wp-admin/includes/class-pclzip.php
<?php
function privReadFileHeader(&$p_header)
{
  $v_result=1;

  // ----- Read the 4 bytes signature
  $v_binary_data = @fread($this->zip_fd, 4);
  $v_data = unpack('Vid', $v_binary_data);

  // ----- Check signature
  if ($v_data['id'] != 0x04034b50)
  {

    // ----- Error log
    PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, 'Invalid archive structure');

    // ----- Return
    return PclZip::errorCode();
  }

  // ----- Read the first 42 bytes of the header
  $v_binary_data = fread($this->zip_fd, 26);

  // ----- Look for invalid block size
  if (strlen($v_binary_data) != 26)
  {
    $p_header['filename'] = "";
    $p_header['status'] = "invalid_header";

    // ----- Error log
    PclZip::privErrorLog(PCLZIP_ERR_BAD_FORMAT, "Invalid block size : ".strlen($v_binary_data));

    // ----- Return
    return PclZip::errorCode();
  }

  // ----- Extract the values
  $v_data = unpack('vversion/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len', $v_binary_data);

  // ----- Get filename
  $p_header['filename'] = fread($this->zip_fd, $v_data['filename_len']);

  // ----- Get extra_fields
  if ($v_data['extra_len'] != 0) {
    $p_header['extra'] = fread($this->zip_fd, $v_data['extra_len']);
  }
  else {
    $p_header['extra'] = '';
  }

  // ----- Extract properties
  $p_header['version_extracted'] = $v_data['version'];
  $p_header['compression'] = $v_data['compression'];
  $p_header['size'] = $v_data['size'];
  $p_header['compressed_size'] = $v_data['compressed_size'];
  $p_header['crc'] = $v_data['crc'];
  $p_header['flag'] = $v_data['flag'];
  $p_header['filename_len'] = $v_data['filename_len'];

  // ----- Recuperate date in UNIX format
  $p_header['mdate'] = $v_data['mdate'];
  $p_header['mtime'] = $v_data['mtime'];
  if ($p_header['mdate'] && $p_header['mtime'])
  {
    // ----- Extract time
    $v_hour = ($p_header['mtime'] & 0xF800) >> 11;
    $v_minute = ($p_header['mtime'] & 0x07E0) >> 5;
    $v_seconde = ($p_header['mtime'] & 0x001F)*2;

    // ----- Extract date
    $v_year = (($p_header['mdate'] & 0xFE00) >> 9) + 1980;
    $v_month = ($p_header['mdate'] & 0x01E0) >> 5;
    $v_day = $p_header['mdate'] & 0x001F;

    // ----- Get UNIX date format
    $p_header['mtime'] = @mktime($v_hour, $v_minute, $v_seconde, $v_month, $v_day, $v_year);

  }
  else
  {
    $p_header['mtime'] = time();
  }

  // TBC
  //for(reset($v_data); $key = key($v_data); next($v_data)) {
  //}

  // ----- Set the stored filename
  $p_header['stored_filename'] = $p_header['filename'];

  // ----- Set the status field
  $p_header['status'] = "ok";

  // ----- Return
  return $v_result;
}