public static function unzip($file_to_unzip, $destination_folder) { require_once AK_LIB_DIR . DS . 'AkZip.php'; $ArchiveZip = new AkZip($file_to_unzip); $ArchiveZip->extract(array('add_path' => str_replace(DS, '/', $destination_folder))); }
/** * AkZip::_check_parameters() * * { Description } * * @param integer $p_error_code * @param string $p_error_string */ function _check_parameters(&$p_params, $p_default) { // ----- Check that param is an array if (!is_array($p_params)) { $this->_errorLog(AK_ZIP_ERR_INVALID_PARAMETER, 'Unsupported parameter, waiting for an array'); return AkZip::errorCode(); } // ----- Check that all the params are valid for (reset($p_params); list($v_key, $v_value) = each($p_params);) { if (!isset($p_default[$v_key])) { $this->_errorLog(AK_ZIP_ERR_INVALID_PARAMETER, 'Unsupported parameter with key \'' . $v_key . '\''); return AkZip::errorCode(); } } // ----- Set the default values for (reset($p_default); list($v_key, $v_value) = each($p_default);) { if (!isset($p_params[$v_key])) { $p_params[$v_key] = $p_default[$v_key]; } } // ----- Check specific parameters $v_callback_list = array('callback_pre_add', 'callback_post_add', 'callback_pre_extract', 'callback_post_extract'); for ($i = 0; $i < sizeof($v_callback_list); $i++) { $v_key = $v_callback_list[$i]; if (isset($p_params[$v_key]) && $p_params[$v_key] != '') { if (!function_exists($p_params[$v_key])) { $this->_errorLog(AK_ZIP_ERR_INVALID_PARAM_VALUE, "Callback '" . $p_params[$v_key] . "()' is not an existing function for " . "parameter '" . $v_key . "'"); return AkZip::errorCode(); } } } return 1; }