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


PHP ZipArchive::deleteName方法代码示例

本文整理汇总了PHP中ZipArchive::deleteName方法的典型用法代码示例。如果您正苦于以下问题:PHP ZipArchive::deleteName方法的具体用法?PHP ZipArchive::deleteName怎么用?PHP ZipArchive::deleteName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ZipArchive的用法示例。


在下文中一共展示了ZipArchive::deleteName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: removeConfigFile

 public function removeConfigFile()
 {
     if (!$this->file || !file_exists($this->file)) {
         return false;
     }
     if ($this->archiver != null) {
     } else {
         if ($this->checkZipConsole()) {
             //todo: implement
         } else {
             if ($this->checkZipSupport()) {
                 $zip = new ZipArchive();
                 $zipRes = $zip->open($this->file);
                 if ($zipRes) {
                     $zip->deleteName('wp-config.php');
                     $zip->deleteName('clone');
                     $zip->close();
                     return true;
                 }
                 return false;
             } else {
                 //use pclzip
                 $zip = new PclZip($this->file);
                 $list = $zip->delete(PCLZIP_OPT_BY_NAME, 'wp-config.php');
                 $list2 = $zip->delete(PCLZIP_OPT_BY_NAME, 'clone');
                 if ($list == 0) {
                     return false;
                 }
                 return true;
             }
         }
     }
     return false;
 }
开发者ID:HasClass0,项目名称:mainwp-child,代码行数:34,代码来源:MainWPCloneInstall.class.php

示例2: finishAndGetDocument

 /**
  * @return string
  */
 public function finishAndGetDocument()
 {
     $content = $this->create();
     $this->zip->deleteName('content.xml');
     $this->zip->addFromString('content.xml', $content);
     $this->zip->close();
     $content = file_get_contents($this->tmpZipFile);
     unlink($this->tmpZipFile);
     return $content;
 }
开发者ID:CatoTH,项目名称:html2opendocument,代码行数:13,代码来源:Base.php

示例3: processPluginsFolder

function processPluginsFolder($folder, $requiredMpsVersion, $pluginsVersion)
{
    $files = scandir($folder);
    foreach ($files as $zipfile) {
        if (pathinfo($zipfile, PATHINFO_EXTENSION) == 'zip') {
            $za = new ZipArchive();
            $za->open($folder . $zipfile);
            for ($i = 0; $i < $za->numFiles; $i++) {
                $stat = $za->statIndex($i);
                $pluginXmlFile = $stat['name'];
                if (endsWith($pluginXmlFile, "META-INF/plugin.xml")) {
                    $stream = $za->getStream($pluginXmlFile);
                    $content = stream_get_contents($stream);
                    $xml = simplexml_load_string($content);
                    if (fixPluginXml($xml, $requiredMpsVersion, $pluginsVersion)) {
                        $za->deleteName($pluginXmlFile);
                        $za->addFromString($pluginXmlFile, $xml->asXML());
                    }
                    printPluginXml($xml, $zipfile, $requiredMpsVersion, $pluginsVersion);
                    break;
                }
            }
        }
    }
}
开发者ID:palpandi111,项目名称:mbeddr.core,代码行数:25,代码来源:repo.php

示例4: docxTemplate

 public function docxTemplate($filepath = false, $templates = false, $output = false)
 {
     if ($filepath === false || $templates === false || $output === false) {
         return false;
     }
     if (file_exists($output)) {
         unlink($output);
     }
     copy($filepath, $output);
     if (!file_exists($output)) {
         die('File not found.');
     }
     $zip = new ZipArchive();
     if (!$zip->open($output)) {
         die('File not open.');
     }
     $documentXml = $zip->getFromName('word/document.xml');
     $rekeys = array_keys($templates);
     for ($i = 0; $i < count($templates); $i++) {
         $reg = '';
         $reg .= substr($rekeys[$i], 0, 1);
         for ($i2 = 1; $i2 < strlen($rekeys[$i]); $i2++) {
             $reg .= '(<.*?>)*+' . substr($rekeys[$i], $i2, 1);
         }
         $reg = '#' . str_replace(array('#', '{', '[', ']', '}'), array('#', '{', '[', ']', '}'), $reg) . '#';
         $documentXml = preg_replace($reg, $templates[$rekeys[$i]], $documentXml);
         print '->' . $reg . '<br/>';
     }
     $zip->deleteName('word/document.xml');
     $zip->addFromString('word/document.xml', $documentXml);
     $zip->close();
 }
开发者ID:Celni,项目名称:DocXGen,代码行数:32,代码来源:DocXGen.php

示例5: remplace_image

 public function remplace_image($search, $urlImage)
 {
     /* recherche des images dans le document 
      *  /word/media
      */
     if (!file_exists($urlImage)) {
         return "RI : pb urlImage.";
     }
     $name = 'word/media/' . $search;
     $info = $this->_objZip->statName($name);
     // l'image n'est pas trouvé
     if ($info === FALSE) {
         return "RI : L'image n'est pas présente dans le docx. (" . $name . ")";
     }
     // image est trouvé, il reste à la remplacer
     $ret = $this->_objZip->deleteName($name);
     if (!$ret) {
         return 'RI pb delete image';
     }
     $ret = $this->_objZip->addFile($urlImage, $name);
     if (!$ret) {
         return 'RI addFile';
     }
     return TRUE;
 }
开发者ID:r1zib,项目名称:salesforce,代码行数:25,代码来源:Template.php

示例6: offsetUnset

 /**
  * @inheritdoc
  */
 public function offsetUnset($offset)
 {
     if ($this->archive->locateName($offset) !== false) {
         $this->archive->deleteName($offset);
     } else {
         return null;
     }
 }
开发者ID:alexanderwanyoike,项目名称:php-compression,代码行数:11,代码来源:ZipArchive.php

示例7: removeCacheItem

 public function removeCacheItem($cacheId, $cachetype, $metaData)
 {
     list($zipName, $fileName, $subFolder) = $this->calculateFilePath($cacheId, $cachetype, $metaData);
     $zip = new ZipArchive();
     if ($zip->open($zipName, ZipArchive::CREATE) !== true) {
         throw new CacheIsCorruptException('Unable to open ZIP file');
     }
     // if
     $zip->deleteName($fileName);
     $zip->close();
 }
开发者ID:dsadsdadsadsadsds,项目名称:spotweb,代码行数:11,代码来源:Dao_Base_ZipCacheStore.php

示例8: deleteFile

 /**
  * @param $pathInArchive
  * @return $this
  * @throws \Thelia\Exception\FileNotFoundException
  * @throws \ErrorException
  *
  * This method deletes a file in the archive
  */
 public function deleteFile($pathInArchive)
 {
     $pathInArchive = $this->formatFilePath($pathInArchive);
     if (!$this->hasFile($pathInArchive)) {
         $this->throwFileNotFound($pathInArchive);
     }
     $deleted = $this->zip->deleteName($pathInArchive);
     if (!$deleted) {
         throw new \ErrorException($this->translator->trans("The file %file has not been deleted", ["%file" => $pathInArchive]));
     }
     return $this;
 }
开发者ID:margery,项目名称:thelia,代码行数:20,代码来源:ZipArchiveBuilder.php

示例9: write

 public static function write($archive, $filename, $content)
 {
     $zip = new ZipArchive();
     if (file_exists($archive)) {
         $zip->open(realpath($archive));
     } else {
         $zip->open(getcwd() . '/' . $archive, ZipArchive::CREATE);
     }
     if ($zip->locateName($filename) !== false) {
         $zip->deleteName($filename);
     }
     $error = $zip->addFromString($filename, $content);
     return $error;
 }
开发者ID:jamesiarmes,项目名称:php-ups-api,代码行数:14,代码来源:ZipWrapper.php

示例10: getDocumentFile

 /**
  * @param array $markers
  * @param string $documentIndex
  * @return mixed
  * @throws \ErrorException
  */
 public function getDocumentFile($markers = [], $documentIndex, $directory)
 {
     $sourceFile = $this->filename;
     $file = basename($sourceFile, '.' . $this->mode);
     $destFile = $directory . $file . '-' . $documentIndex . '.' . $this->mode;
     if (is_file($destFile)) {
         unlink($destFile);
     }
     if (!is_dir(dirname($destFile))) {
         mkdir(dirname($destFile), 0700);
     }
     copy($sourceFile, $destFile);
     $zip = new \ZipArchive();
     // И пытаемся открыть переданный zip-файл
     if ($zip->open($destFile)) {
         $documentXml = $zip->getFromName($this->contentFile);
         $documentXml = str_replace($markers['search'], $markers['replacement'], $documentXml);
         $zip->deleteName($this->contentFile);
         $zip->addFromString($this->contentFile, $documentXml);
         $zip->close();
     }
     return $destFile;
 }
开发者ID:HejVkt,项目名称:auto.only3.ru,代码行数:29,代码来源:DocumentReader.php

示例11: foreach

            $zip->addEmptyDir(Backup::encode($dest));
            continue;
        }
        $ob->out($item->getPathname() . '  =>  ' . $dest . "\n");
        $zip->addFile($item->getPathname(), Backup::encode($dest));
    }
    foreach ($installIterator as $item) {
        if ($item->isDir()) {
            continue;
        }
        $dest = str_replace($installFolder . DIRECTORY_SEPARATOR, '', 'installation' . DIRECTORY_SEPARATOR . $item->getPathname());
        $ob->out($item->getPathname() . '  =>  ' . $dest . "\n");
        $zip->addFile($item->getPathname(), str_replace('\\', '/', $dest));
    }
    $zip->addFile($backupSQLFile->getPathname(), $backupSQLFile->getBasename());
    $zip->deleteName('configuration.dist.php');
    $zip->renameName('configuration.php', 'configuration.dist.php');
    $zip->close();
    echo 'ZIP ok';
} else {
    echo 'failed';
}
?>
</pre>

<script>
	toBottom();
	stop = true;
</script>

<?php 
开发者ID:lyrasoft,项目名称:lyrasoft.github.io,代码行数:31,代码来源:backup.php

示例12: zipDocx

 /**
  * zipDocx
  *
  * zip the docx with all the change in word/document.xml
  */
 private function zipDocx()
 {
     try {
         $templateInfo = $this->docx->getTemplateInfo();
         $zip = new \ZipArchive();
         if ($zip->open($this->docx->getPathTmpDir() . '/' . $this->docx->getTmpName() . '.docx') === TRUE) {
             $zip->deleteName('word/document.xml');
             $zip->addFromString('word/document.xml', $this->docx->getXmlContent());
             $zip->close();
             $this->docx->addToLogs('zip in ' . $this->docx->getPathTmpDir() . '/' . $this->docx->getTmpName() . '.docx');
         } else {
             throw new \Exception('Fail to zip ' . $templateInfo['basename']);
         }
     } catch (\Exception $e) {
         $this->docx->addToLogs('zip : ' . $e->getMessage());
     }
 }
开发者ID:northvik,项目名称:DocxTemplatingParserBundle,代码行数:22,代码来源:DocxParserService.php

示例13: remove

 /**
  * {@inheritdoc}
  */
 public function remove($file_path)
 {
     $this->zip->deleteName($file_path);
     return $this;
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:8,代码来源:Zip.php

示例14: uploadNewDoctypeAction

 /**
  * @Security("has_role('ROLE_ADMIN')")
  */
 public function uploadNewDoctypeAction(Request $request)
 {
     $data = array();
     $form = $this->createForm(new DocTypeType(), $data);
     $session = $request->getSession();
     if ($request->getMethod() == 'POST') {
         $form->handleRequest($this->get('request'));
         if ($form->isValid()) {
             $data = $form->getData();
             // Création d'un fichier temporaire
             $file = $data['template'];
             $filename = sha1(uniqid(mt_rand(), true));
             $filename .= '.' . $file->guessExtension();
             $file->move('tmp/', $filename);
             $docxFullPath = 'tmp/' . $filename;
             // Extraction des infos XML
             $templatesXML = $this->getDocxContent($docxFullPath);
             $relationship = $this->getDocxRelationShip($docxFullPath);
             // Nettoyage des XML
             $templatesXMLTraite = array();
             foreach ($templatesXML as $templateName => $templateXML) {
                 $this->cleanDocxFields($templateXML);
                 $this->cleanDocxTableRow($templateXML);
                 $this->cleanDocxParagraph($templateXML);
                 $this->linkDocxImages($templateXML, $relationship);
                 $this->arrayPushAssoc($templatesXMLTraite, $templateName, $templateXML);
             }
             // Enregistrement dans le fichier temporaire
             $zip = new \ZipArchive();
             $zip->open($docxFullPath);
             foreach ($templatesXMLTraite as $templateXMLName => $templateXMLContent) {
                 $zip->deleteName('word/' . $templateXMLName);
                 $zip->addFromString('word/' . $templateXMLName, $templateXMLContent);
             }
             $zip->close();
             if (array_key_exists('etude', $data)) {
                 $etude = $data['etude'];
             } else {
                 $etude = null;
             }
             // Vérification du template (document étude)
             if ($etude && ($data['name'] == self::DOCTYPE_AVANT_PROJET || $data['name'] == self::DOCTYPE_CONVENTION_CLIENT || $data['name'] == self::DOCTYPE_SUIVI_ETUDE) && $data['verification'] && $this->publipostage($docxFullPath, self::ROOTNAME_ETUDE, $etude->getId(), true)) {
                 $session->getFlashBag()->add('success', 'Le template a été vérifié, il ne contient pas d\'erreur');
             }
             if (array_key_exists('etudiant', $data)) {
                 $etudiant = $data['etudiant'];
             } else {
                 $etudiant = null;
             }
             $etudiant = $data['etudiant'];
             // Vérification du template (document étudiant)
             if ($etudiant && ($data['name'] == self::DOCTYPE_CONVENTION_ETUDIANT || $data['name'] == self::DOCTYPE_DECLARATION_ETUDIANT_ETR) && $data['verification'] && $this->publipostage($docxFullPath, self::ROOTNAME_ETUDIANT, $etudiant->getId(), true)) {
                 $session->getFlashBag()->add('success', 'Le template a été vérifié, il ne contient pas d\'erreur');
             }
             // Enregistrement du template
             $em = $this->getDoctrine()->getManager();
             $user = $this->getUser();
             $personne = $user->getPersonne();
             $file = new File($docxFullPath);
             $doc = new Document();
             $doc->setAuthor($personne)->setName($data['name'])->setFile($file);
             $kernel = $this->get('kernel');
             $doc->setRootDir($kernel->getRootDir());
             $em->persist($doc);
             $docs = $em->getRepository('MgatePubliBundle:Document')->findBy(array('name' => $doc->getName()));
             foreach ($docs as $doc) {
                 $doc->setRootDir($kernel->getRootDir());
                 $em->remove($doc);
             }
             $em->flush();
             $session->getFlashBag()->add('success', 'Le document a été mis à jour : ');
             return $this->redirect($this->generateUrl('Mgate_publi_documenttype_upload'));
         }
     }
     return $this->render('MgatePubliBundle:DocType:upload.html.twig', array('form' => $form->createView()));
 }
开发者ID:N7-Consulting,项目名称:Incipio,代码行数:79,代码来源:TraitementController.php

示例15:

        if ($ae->aenderung_begruendung_html) {
            $text_begruendung = $ae->aenderung_begruendung;
        } else {
            $text_begruendung = '<div>' . HtmlBBcodeUtils::bbcode2html($ae->aenderung_begruendung) . '</div>';
        }
        if (!isset($COL_BEGRUENDUNG)) {
            $text = '<p><strong>Änderungsantrag:</strong></p>' . $diffhtml;
            $text .= '<p><strong>Begründung:</strong></p>' . $text_begruendung;
            $doc->setCell($row, $COL_ANTRAGSTEXT, OdsTemplateEngine::$TYPE_HTML, $text);
        } else {
            if ($DEBUG) {
                echo CHtml::encode($text_begruendung);
            }
            $doc->setCell($row, $COL_ANTRAGSTEXT, OdsTemplateEngine::$TYPE_HTML, $diffhtml);
            $doc->setCell($row, $COL_BEGRUENDUNG, OdsTemplateEngine::$TYPE_HTML, $text_begruendung);
        }
    }
    if (!$antraege_separat) {
        /** @var int $antrag_row_from */
        $doc->drawBorder($antrag_row_from, $first_col, $row, $COL_VERFAHREN, 1.5);
    }
}
$content = $doc->create();
if ($DEBUG) {
    $doc->debugOutput();
}
$zip->deleteName("content.xml");
$zip->addFromString("content.xml", $content);
$zip->close();
readfile($tmpZipFile);
unlink($tmpZipFile);
开发者ID:andi98,项目名称:antragsgruen,代码行数:31,代码来源:ae_ods_list.php


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