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

PclZip::privReadCentralFileHeader() public WP 1.0

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

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

Хуков нет.

Возвращает

Null. Ничего.

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

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

Код PclZip::privReadCentralFileHeader() WP 5.5.1

wp-admin/includes/class-pclzip.php
<?php
function privReadCentralFileHeader(&$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'] != 0x02014b50)
  {

    // ----- 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, 42);

  // ----- Look for invalid block size
  if (strlen($v_binary_data) != 42)
  {
    $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
  $p_header = unpack('vversion/vversion_extracted/vflag/vcompression/vmtime/vmdate/Vcrc/Vcompressed_size/Vsize/vfilename_len/vextra_len/vcomment_len/vdisk/vinternal/Vexternal/Voffset', $v_binary_data);

  // ----- Get filename
  if ($p_header['filename_len'] != 0)
    $p_header['filename'] = fread($this->zip_fd, $p_header['filename_len']);
  else
    $p_header['filename'] = '';

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

  // ----- Get comment
  if ($p_header['comment_len'] != 0)
    $p_header['comment'] = fread($this->zip_fd, $p_header['comment_len']);
  else
    $p_header['comment'] = '';

  // ----- Extract properties

  // ----- Recuperate date in UNIX format
  //if ($p_header['mdate'] && $p_header['mtime'])
  // TBC : bug : this was ignoring time with 0/0/0
  if (1)
  {
    // ----- 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();
  }

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

  // ----- Set default status to ok
  $p_header['status'] = 'ok';

  // ----- Look if it is a directory
  if (substr($p_header['filename'], -1) == '/') {
    //$p_header['external'] = 0x41FF0010;
    $p_header['external'] = 0x00000010;
  }


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