WordPress at Your Fingertips
function is not described

PclZip::privAddList() public WP 1.0

Function : privAddList() Description : $p_add_dir and $p_remove_dir will give the ability to memorize a path which is different from the real path of the file. This is useful if you want to have PclTar running in any directory, and memorize relative path from an other directory. Parameters : $p_list : An array containing the file or directory names to add in the tar $p_result_list : list of added files with their properties (specially the status field) $p_add_dir : Path to add in the filename path archived $p_remove_dir : Path to remove in the filename path archived Return Values :

function privAddList($p_list, &$p_result_list, $p_add_dir, $p_remove_dir, $p_remove_all_dir, &$p_options)

{} It's a method of the class: PclZip{}

No Hooks.

Return

null. Nothing.

Usage

$PclZip = new PclZip();
$PclZip->privAddList( $p_filedescr_list, $p_result_list, $p_options );
$p_filedescr_list (required)
-
$p_result_list (required) (passed by reference — &)
-
$p_options (required) (passed by reference — &)
-

Code of PclZip::privAddList() WP 5.8.2

function privAddList($p_filedescr_list, &$p_result_list, &$p_options)
{
  $v_result=1;

  // ----- Add the files
  $v_header_list = array();
  if (($v_result = $this->privAddFileList($p_filedescr_list, $v_header_list, $p_options)) != 1)
  {
    // ----- Return
    return $v_result;
  }

  // ----- Store the offset of the central dir
  $v_offset = @ftell($this->zip_fd);

  // ----- Create the Central Dir files header
  for ($i=0,$v_count=0; $i<sizeof($v_header_list); $i++)
  {
    // ----- Create the file header
    if ($v_header_list[$i]['status'] == 'ok') {
      if (($v_result = $this->privWriteCentralFileHeader($v_header_list[$i])) != 1) {
        // ----- Return
        return $v_result;
      }
      $v_count++;
    }

    // ----- Transform the header to a 'usable' info
    $this->privConvertHeader2FileInfo($v_header_list[$i], $p_result_list[$i]);
  }

  // ----- Zip file comment
  $v_comment = '';
  if (isset($p_options[PCLZIP_OPT_COMMENT])) {
    $v_comment = $p_options[PCLZIP_OPT_COMMENT];
  }

  // ----- Calculate the size of the central header
  $v_size = @ftell($this->zip_fd)-$v_offset;

  // ----- Create the central dir footer
  if (($v_result = $this->privWriteCentralHeader($v_count, $v_size, $v_offset, $v_comment)) != 1)
  {
    // ----- Reset the file list
    unset($v_header_list);

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

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