You are here

function PclZip::delete in Quiz 6.5

Same name and namespace in other branches
  1. 6.6 includes/moodle/lib/pclzip/pclzip.lib.php \PclZip::delete()
1 call to PclZip::delete()
PclZip::deleteByIndex in includes/moodle/lib/pclzip/pclzip.lib.php

File

includes/moodle/lib/pclzip/pclzip.lib.php, line 999

Class

PclZip

Code

function delete() {

  //--(MAGIC-PclTrace)--//PclTraceFctStart(__FILE__, __LINE__, "PclZip::delete", "");
  $v_result = 1;

  // ----- Reset the error handler
  $this
    ->privErrorReset();

  // ----- Check archive
  if (!$this
    ->privCheckFormat()) {

    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
    return 0;
  }

  // ----- Set default values
  $v_options = array();

  // ----- Look for variable options arguments
  $v_size = func_num_args();

  //--(MAGIC-PclTrace)--//PclTraceFctMessage(__FILE__, __LINE__, 4, "$v_size arguments passed to the method");

  // ----- Look for arguments
  if ($v_size > 0) {

    // ----- Get the arguments
    $v_arg_list = func_get_args();

    // ----- Parse the options
    $v_result = $this
      ->privParseOptions($v_arg_list, $v_size, $v_options, array(
      PCLZIP_OPT_BY_NAME => 'optional',
      PCLZIP_OPT_BY_EREG => 'optional',
      PCLZIP_OPT_BY_PREG => 'optional',
      PCLZIP_OPT_BY_INDEX => 'optional',
    ));
    if ($v_result != 1) {

      //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0);
      return 0;
    }
  }

  // ----- Magic quotes trick
  $this
    ->privDisableMagicQuotes();

  // ----- Call the delete fct
  $v_list = array();
  if (($v_result = $this
    ->privDeleteByRule($v_list, $v_options)) != 1) {
    $this
      ->privSwapBackMagicQuotes();
    unset($v_list);

    //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, 0, PclZip::errorInfo());
    return 0;
  }

  // ----- Magic quotes trick
  $this
    ->privSwapBackMagicQuotes();

  // ----- Return

  //--(MAGIC-PclTrace)--//PclTraceFctEnd(__FILE__, __LINE__, $v_list);
  return $v_list;
}