当前位置: 首页>>代码示例>>PHP>>正文


PHP zipfile::get_size方法代码示例

本文整理汇总了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);
     }
 }
开发者ID:genaromendezl,项目名称:ATutor,代码行数:36,代码来源:LanguageEditor.class.php

示例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);
     }
 }
开发者ID:giuliaforsythe,项目名称:AChecker,代码行数:39,代码来源:LanguageEditor.class.php


注:本文中的zipfile::get_size方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。