本文整理汇总了PHP中zipfile::get_size方法的典型用法代码示例。如果您正苦于以下问题:PHP zipfile::get_size方法的具体用法?PHP zipfile::get_size怎么用?PHP zipfile::get_size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类zipfile
的用法示例。
在下文中一共展示了zipfile::get_size方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: export
function export($filename = '')
{
$search = array('"', "'", "", "\n", "\r", "");
//\x08\\x09, not required
$replace = array('\\"', "\\'", '\\0', '\\n', '\\r', '\\Z');
// use a function to generate the ini file
// use a diff fn to generate the sql dump
// use the zipfile class to package the ini file and the sql dump
$sql_dump = "INSERT INTO `languages` VALUES ('{$this->code}', '{$this->characterSet}', '{$this->direction}', '{$this->regularExpression}', '{$this->nativeName}', '{$this->englishName}', {$this->status});\r\n\r\n";
$sql_dump .= "INSERT INTO `language_text` VALUES ";
$sql = "SELECT * FROM %slanguage_text WHERE language_code='%s' ORDER BY variable, term";
$rows_text = queryDB($sql, array(TABLE_PREFIX, $this->code));
if (count($rows_text) > 0) {
foreach ($rows_text as $row) {
$row['text'] = str_replace($search, $replace, $row['text']);
$row['context'] = str_replace($search, $replace, $row['context']);
$sql_dump .= "('{$this->code}', '{$row['variable']}', '{$row['term']}', '{$row['text']}', '{$row['revised_date']}', '{$row['context']}'),\r\n";
}
} else {
$this->msg->addError('LANG_EMPTY');
}
$sql_dump = substr($sql_dump, 0, -3) . ";";
$readme = 'This is an ATutor language pack. Use the administrator Language section to import this language pack or manually import the contents of the SQL file into your [table_prefix]language_text table, where `table_prefix` should be replaced with your correct ATutor table prefix as defined in ./include/config.inc.php . Additional Language Packs can be found on http://atutor.ca .';
require AT_INCLUDE_PATH . 'classes/zipfile.class.php';
$zipfile = new zipfile();
$zipfile->add_file($sql_dump, 'language_text.sql');
$zipfile->add_file($readme, 'readme.txt');
$zipfile->add_file($this->getXML(), 'language.xml');
if ($filename) {
$fp = fopen($filename, 'wb+');
fwrite($fp, $zipfile->get_file(), $zipfile->get_size());
} else {
$version = str_replace('.', '_', VERSION);
$zipfile->send_file('atutor_' . $version . '_' . $this->code);
}
}
示例2: export
function export($filename = '')
{
// $search = array('"', "'", "\x00", "\x0a", "\x0d", "\x1a"); //\x08\\x09, not required
// $replace = array('\"', "\'", '\0', '\n', '\r', '\Z');
// use a function to generate the ini file
// use a diff fn to generate the sql dump
// use the zipfile class to package the ini file and the sql dump
global $addslashes;
$sql_dump = "INSERT INTO `languages` VALUES ('{$this->code}', '{$this->characterSet}', '{$this->regularExpression}', '{$this->nativeName}', '{$this->englishName}', {$this->status});\r\n\r\n";
$sql_dump .= "INSERT INTO `language_text` VALUES ";
$languageTextDAO = new LanguageTextDAO();
$rows = $languageTextDAO->getAllByLang($this->code);
if (is_array($rows)) {
foreach ($rows as $row) {
// $row['text'] = str_replace($search, $replace, $row['text']);
// $row['context'] = str_replace($search, $replace, $row['context']);
$row['text'] = $addslashes($row['text']);
$row['context'] = $addslashes($row['context']);
$sql_dump .= "('{$this->code}', '{$row['variable']}', '{$row['term']}', '{$row['text']}', '{$row['revised_date']}', '{$row['context']}'),\r\n";
}
} else {
$this->msg->addError('LANG_EMPTY');
return;
}
$sql_dump = substr($sql_dump, 0, -3) . ";";
$readme = 'This is an AChecker language pack. Use the administrator Language section to import this language pack or manually import the contents of the SQL file into your [table_prefix]language_text table, where `table_prefix` should be replaced with your correct AChecker table prefix as defined in ./include/config.inc.php .';
require AC_INCLUDE_PATH . 'classes/zipfile.class.php';
$zipfile = new zipfile();
$zipfile->add_file($sql_dump, 'language_text.sql');
$zipfile->add_file($readme, 'readme.txt');
$zipfile->add_file($this->getXML(), 'language.xml');
if ($filename) {
$fp = fopen($filename, 'wb+');
fwrite($fp, $zipfile->get_file(), $zipfile->get_size());
} else {
$version = str_replace('.', '_', VERSION);
$zipfile->send_file('achecker_' . $version . '_' . $this->code);
}
}