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


PHP eZDir::recursiveList方法代码示例

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


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

示例1: gmapStaticImage

 /**
  *
  * http://maps.googleapis.com/maps/api/staticmap?zoom=13&size=600x300&maptype=roadmap&markers=color:blue|{first_set( $attribute.content.latitude, '0.0')},{first_set( $attribute.content.longitude, '0.0')}
  * @param array $parameters
  * @param eZContentObjectAttribute $attribute
  * @return string
  */
 public static function gmapStaticImage(array $parameters, eZContentObjectAttribute $attribute, $extraCacheFileNameStrings = array())
 {
     $cacheParameters = array(serialize($parameters));
     $cacheFile = $attribute->attribute('id') . implode('-', $extraCacheFileNameStrings) . '-' . md5(implode('-', $cacheParameters)) . '.cache';
     $extraPath = eZDir::filenamePath($attribute->attribute('id'));
     $cacheDir = eZDir::path(array(eZSys::cacheDirectory(), 'gmap_static', $extraPath));
     // cacenllo altri file con il medesimo attributo
     $fileList = array();
     $deleteItems = eZDir::recursiveList($cacheDir, $cacheDir, $fileList);
     foreach ($fileList as $file) {
         if ($file['type'] == 'file' && $file['name'] !== $cacheFile) {
             unlink($file['path'] . '/' . $file['name']);
         }
     }
     $cachePath = eZDir::path(array($cacheDir, $cacheFile));
     $args = compact('parameters', 'attribute');
     $cacheFile = eZClusterFileHandler::instance($cachePath);
     $result = $cacheFile->processCache(array('OCOperatorsCollectionsTools', 'gmapStaticImageRetrieve'), array('OCOperatorsCollectionsTools', 'gmapStaticImageGenerate'), null, null, $args);
     return $result;
 }
开发者ID:OpencontentCoop,项目名称:ocoperatorscollection,代码行数:27,代码来源:ocoperatorscollectionstools.php

示例2: writeDocument

 function writeDocument()
 {
     $ooINI = eZINI::instance('odf.ini');
     // Initalize directories
     eZDir::mkdir($this->OORootDir);
     eZDir::mkdir($this->OOExportDir . "META-INF", false, true);
     eZDir::mkdir($this->OOTemplateDir);
     $metaXML = "<?xml version='1.0' encoding='UTF-8'?>" . "<office:document-meta xmlns:office='urn:oasis:names:tc:opendocument:xmlns:office:1.0' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns:dc='http://purl.org/dc/elements/1.1/' xmlns:meta='urn:oasis:names:tc:opendocument:xmlns:meta:1.0' xmlns:ooo='http://openoffice.org/2004/office' office:version='1.0' xmlns:ezpublish='http://www.ez.no/ezpublish/oasis'>" . "<office:meta>" . "<meta:generator>eZ Publish</meta:generator>" . " <meta:creation-date>2004-11-10T11:39:50</meta:creation-date>" . "  <dc:date>2004-11-10T11:40:15</dc:date>" . "  <dc:language>en-US</dc:language>" . "  <meta:editing-cycles>3</meta:editing-cycles>" . "  <meta:editing-duration>PT26S</meta:editing-duration>" . "  <meta:user-defined meta:name='Info 1'/>" . "  <meta:user-defined meta:name='Info 2'/>" . "  <meta:user-defined meta:name='Info 3'/>" . "  <meta:user-defined meta:name='Info 4'/>" . " <meta:document-statistic meta:table-count='0' meta:image-count='0' meta:object-count='0' meta:page-count='1' meta:paragraph-count='1' meta:word-count='2' meta:character-count='10'/>" . " </office:meta>" . "</office:document-meta>";
     file_put_contents($this->OOExportDir . "meta.xml", $metaXML);
     $settingsXML = "<?xml version='1.0' encoding='UTF-8'?>" . "<office:document-settings xmlns:office='urn:oasis:names:tc:opendocument:xmlns:office:1.0' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns:config='urn:oasis:names:tc:opendocument:xmlns:config:1.0' xmlns:ooo='http://openoffice.org/2004/office' office:version='1.0'>" . "  <office:settings>" . " </office:settings>" . "</office:document-settings>";
     file_put_contents($this->OOExportDir . "settings.xml", $settingsXML);
     $useTemplate = $ooINI->variable('ODFExport', 'UseTemplate') == "true";
     $templateName = $ooINI->variable('ODFExport', 'TemplateName');
     if ($useTemplate) {
         $templateFile = "extension/ezodf/templates/" . $templateName;
         $archiveOptions = new ezcArchiveOptions(array('readOnly' => true));
         $archive = ezcArchive::open($templateFile, null, $archiveOptions);
         $archive->extract($this->OOTemplateDir);
         // Copy styles.xml and images, if any to the document being generated
         if (!copy($this->OOTemplateDir . "styles.xml", $this->OOExportDir . "styles.xml")) {
             return array(self::ERROR_COULD_NOT_COPY, "Could not copy the styles.xml file.");
         }
         $sourceDir = $this->OOTemplateDir . "Pictures";
         $destDir = $this->OOExportDir . "Pictures";
         eZDir::mkdir($destDir, false, true);
         eZDir::copy($sourceDir, $destDir, false, true);
     } else {
         // Generate a default empty styles.xml file
         $stylesXML = "<?xml version='1.0' encoding='UTF-8'?>" . "<office:document-styles xmlns:office='urn:oasis:names:tc:opendocument:xmlns:office:1.0' xmlns:style='urn:oasis:names:tc:opendocument:xmlns:style:1.0' xmlns:text='urn:oasis:names:tc:opendocument:xmlns:text:1.0' xmlns:table='urn:oasis:names:tc:opendocument:xmlns:table:1.0' xmlns:draw='urn:oasis:names:tc:opendocument:xmlns:drawing:1.0' xmlns:fo='urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns:dc='http://purl.org/dc/elements/1.1/' xmlns:meta='urn:oasis:names:tc:opendocument:xmlns:meta:1.0' xmlns:number='urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0' xmlns:svg='urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0' xmlns:chart='urn:oasis:names:tc:opendocument:xmlns:chart:1.0' xmlns:dr3d='urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0' xmlns:math='http://www.w3.org/1998/Math/MathML' xmlns:form='urn:oasis:names:tc:opendocument:xmlns:form:1.0' xmlns:script='urn:oasis:names:tc:opendocument:xmlns:script:1.0' xmlns:ooo='http://openoffice.org/2004/office' xmlns:ooow='http://openoffice.org/2004/writer' xmlns:oooc='http://openoffice.org/2004/calc' xmlns:dom='http://www.w3.org/2001/xml-events' office:version='1.0'>" . "  <office:font-face-decls>" . "  </office:font-face-decls>" . "   <office:styles>" . "     <style:style style:name='Table_20_Heading' style:display-name='Table Heading' style:family='paragraph' style:parent-style-name='Table_20_Contents' style:class='extra'>" . " <style:paragraph-properties fo:text-align='center' style:justify-single-word='false' text:number-lines='false' text:line-number='0'/>" . "  <style:text-properties fo:font-style='italic' fo:font-weight='bold' style:font-style-asian='italic' style:font-weight-asian='bold' style:font-style-complex='italic' style:font-weight-complex='bold'/>" . " </style:style>" . " <style:style style:name='Preformatted_20_Text' style:display-name='Preformatted Text' style:family='paragraph' style:parent-style-name='Standard' style:class='html'>" . "   <style:paragraph-properties fo:margin-top='0in' fo:margin-bottom='0in'/>" . "   <style:text-properties style:font-name='Courier New' fo:font-size='10pt' style:font-name-asian='Courier New' style:font-size-asian='10pt' style:font-name-complex='Courier New' style:font-size-complex='10pt'/>" . "  </style:style>" . " <style:style style:name='eZCustom_20_factbox' style:display-name='eZCustom_20_factbox' style:family='paragraph' style:parent-style-name='Standard' style:class='text'>" . "   <style:paragraph-properties fo:margin-top='0in' fo:margin-bottom='0in'/>" . "   <style:text-properties style:font-name='Helvetica' fo:font-size='10pt' style:font-name-asian='Helvetica' style:font-size-asian='10pt' style:font-name-complex='Helvetica' style:font-size-complex='10pt'/>" . "  </style:style>" . " <style:style style:name='eZCustom_20_quote' style:display-name='eZCustom_20_quote' style:family='paragraph' style:parent-style-name='Standard' style:class='text'>" . "   <style:paragraph-properties fo:margin-top='0in' fo:margin-bottom='0in'/>" . "   <style:text-properties style:font-name='Helvetica' fo:font-size='10pt' style:font-name-asian='Helvetica' style:font-size-asian='10pt' style:font-name-complex='Helvetica' style:font-size-complex='10pt'/>" . "  </style:style>" . "  </office:styles>" . "</office:document-styles>";
         file_put_contents($this->OOExportDir . "styles.xml", $stylesXML);
     }
     $mimeType = "application/vnd.oasis.opendocument.text";
     file_put_contents($this->OOExportDir . "mimetype", $mimeType);
     // Write content XML file
     $contentXML = "<?xml version='1.0' encoding='UTF-8'?>" . "<!DOCTYPE office:document-content PUBLIC '-//OpenOffice.org//DTD OfficeDocument1.0//EN' 'office.dtd'>" . "<office:document-content xmlns:office='urn:oasis:names:tc:opendocument:xmlns:office:1.0'" . "                          xmlns:meta='urn:oasis:names:tc:opendocument:xmlns:meta:1.0'" . "                          xmlns:config='urn:oasis:names:tc:opendocument:xmlns:config:1.0'" . "                          xmlns:text='urn:oasis:names:tc:opendocument:xmlns:text:1.0'" . "                          xmlns:table='urn:oasis:names:tc:opendocument:xmlns:table:1.0'" . "                          xmlns:draw='urn:oasis:names:tc:opendocument:xmlns:drawing:1.0'" . "                          xmlns:presentation='urn:oasis:names:tc:opendocument:xmlns:presentation:1.0'" . "                          xmlns:dr3d='urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0'" . "                          xmlns:chart='urn:oasis:names:tc:opendocument:xmlns:chart:1.0'" . "                          xmlns:form='urn:oasis:names:tc:opendocument:xmlns:form:1.0'" . "                          xmlns:script='urn:oasis:names:tc:opendocument:xmlns:script:1.0'" . "                          xmlns:style='urn:oasis:names:tc:opendocument:xmlns:style:1.0'" . "                          xmlns:number='urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0'" . "                          xmlns:math='http://www.w3.org/1998/Math/MathML'" . "                          xmlns:svg='urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0'" . "                          xmlns:fo='urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0'" . "                          xmlns:koffice='http://www.koffice.org/2005/'" . "                          xmlns:dc='http://purl.org/dc/elements/1.1/'" . "                          xmlns:xlink='http://www.w3.org/1999/xlink'>" . " <office:script/>" . " <office:font-face-decls/>" . " <office:automatic-styles>" . "  <text:list-style style:name='bulletlist'>" . "   <text:list-level-style-bullet text:level='1' text:style-name='Bullet_20_Symbols' style:num-suffix='.' text:bullet-char='●'>" . "      <style:list-level-properties text:space-before='0.25in' text:min-label-width='0.25in'/>" . "       <style:text-properties style:font-name='StarSymbol'/>" . "   </text:list-level-style-bullet>" . "   <text:list-level-style-bullet text:level='2' text:style-name='Bullet_20_Symbols' style:num-suffix='.' text:bullet-char='○'>" . "      <style:list-level-properties text:space-before='0.5in' text:min-label-width='0.25in'/>" . "       <style:text-properties style:font-name='StarSymbol'/>" . "   </text:list-level-style-bullet>" . "   <text:list-level-style-bullet text:level='3' text:style-name='Bullet_20_Symbols' style:num-suffix='.' text:bullet-char='■'>" . "      <style:list-level-properties text:space-before='0.75in' text:min-label-width='0.25in'/>" . "       <style:text-properties style:font-name='StarSymbol'/>" . "   </text:list-level-style-bullet>" . "  </text:list-style>" . "  <text:list-style style:name='numberedlist'>" . "   <text:list-level-style-number text:level='1' text:style-name='Numbering_20_Symbols' style:num-suffix='.' style:num-format='1'>" . "      <style:list-level-properties text:space-before='0.25in' text:min-label-width='0.25in'/>" . "   </text:list-level-style-number>" . "  </text:list-style>" . " <style:style style:name='imagecentered' style:family='graphic' style:parent-style-name='Graphics'>" . "  <style:graphic-properties style:horizontal-pos='center' style:horizontal-rel='paragraph' style:mirror='none' fo:clip='rect(0in 0in 0in 0in)' draw:luminance='0%' draw:contrast='0%' draw:red='0%' draw:green='0%' draw:blue='0%' draw:gamma='100%' draw:color-inversion='false' draw:image-opacity='100%' draw:color-mode='standard'/>" . " </style:style>" . " <style:style style:name='imageleft' style:family='graphic' style:parent-style-name='Graphics'>" . "   <style:graphic-properties style:wrap='right' style:horizontal-pos='left' style:horizontal-rel='paragraph' style:mirror='none' fo:clip='rect(0in 0in 0in 0in)' draw:luminance='0%' draw:contrast='0%' draw:red='0%' draw:green='0%' draw:blue='0%' draw:gamma='100%' draw:color-inversion='false' draw:image-opacity='100%' draw:color-mode='standard'/>" . "  </style:style>" . "  <style:style style:name='imageright' style:family='graphic' style:parent-style-name='Graphics'>" . "   <style:graphic-properties style:wrap='left' style:horizontal-pos='right' style:horizontal-rel='paragraph' style:mirror='none' fo:clip='rect(0in 0in 0in 0in)' draw:luminance='0%' draw:contrast='0%' draw:red='0%' draw:green='0%' draw:blue='0%' draw:gamma='100%' draw:color-inversion='false' draw:image-opacity='100%' draw:color-mode='standard'/>" . "  </style:style>" . " <style:style style:name='T1' style:family='text'>" . "   <style:text-properties fo:font-weight='bold' style:font-weight-asian='bold' style:font-weight-complex='bold'/>" . "   </style:style>" . " <style:style style:name='T2' style:family='text'>" . "  <style:text-properties fo:font-style='italic' style:font-style-asian='italic' style:font-style-complex='italic'/>" . " </style:style>" . " </office:automatic-styles>" . " <office:body>" . " <office:text>";
     $bodyXML = "";
     // Add body contents
     foreach ($this->DocumentArray as $element) {
         $bodyXML .= $this->handleElement($element);
     }
     // Handle charset conversion if needed
     $charset = 'UTF-8';
     $codec = eZTextCodec::instance(false, $charset);
     $bodyXML = $codec->convertString($bodyXML);
     $contentXML .= $bodyXML;
     // Add the content end
     $contentXML .= "</office:text></office:body></office:document-content>";
     file_put_contents($this->OOExportDir . "content.xml", $contentXML);
     // Write the manifest file
     $manifestXML = "<?xml version='1.0' encoding='UTF-8'?>" . "<!DOCTYPE manifest:manifest PUBLIC '-//OpenOffice.org//DTD Manifest 1.0//EN' 'Manifest.dtd'>" . "<manifest:manifest xmlns:manifest='urn:oasis:names:tc:opendocument:xmlns:manifest:1.0'>" . "<manifest:file-entry manifest:media-type='application/vnd.oasis.opendocument.text' manifest:full-path='/'/>" . "<manifest:file-entry manifest:media-type='application/vnd.sun.xml.ui.configuration' manifest:full-path='Configurations2/'/>" . "<manifest:file-entry manifest:media-type='' manifest:full-path='Pictures/'/>" . "<manifest:file-entry manifest:media-type='text/xml' manifest:full-path='content.xml'/>" . "<manifest:file-entry manifest:media-type='text/xml' manifest:full-path='styles.xml'/>" . "<manifest:file-entry manifest:media-type='text/xml' manifest:full-path='meta.xml'/>" . "<manifest:file-entry manifest:media-type='' manifest:full-path='Thumbnails/'/>" . "<manifest:file-entry manifest:media-type='text/xml' manifest:full-path='settings.xml'/>";
     // Do not include the thumnail file.
     // "<manifest:file-entry manifest:media-type='' manifest:full-path='Thumbnails/thumbnail.png'/>" .
     foreach ($this->ImageFileArray as $imageFile) {
         $manifestXML .= "<manifest:file-entry manifest:media-type='' manifest:full-path='{$imageFile}'/>\n";
     }
     $manifestXML .= "</manifest:manifest>";
     file_put_contents($this->OOExportDir . "META-INF/manifest.xml", $manifestXML);
     $fileName = $this->OORootDir . "ootest.odt";
     $zipArchive = ezcArchive::open($fileName, ezcArchive::ZIP);
     $zipArchive->truncate();
     $prefix = $this->OOExportDir;
     $fileList = array();
     eZDir::recursiveList($this->OOExportDir, $this->OOExportDir, $fileList);
     foreach ($fileList as $fileInfo) {
         $path = $fileInfo['type'] === 'dir' ? $fileInfo['path'] . '/' . $fileInfo['name'] . '/' : $fileInfo['path'] . '/' . $fileInfo['name'];
         $zipArchive->append(array($path), $prefix);
     }
     $zipArchive->close();
     // Clean up
     eZDir::recursiveDelete($this->OOExportDir);
     eZDir::recursiveDelete($this->OOTemplateDir);
     // Clean up temporary image files if any
     $fileHandler = eZClusterFileHandler::instance();
     foreach ($this->SourceImageArray as $sourceImageFile) {
         $fileHandler->fileDeleteLocal($sourceImageFile);
     }
     return $fileName;
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:78,代码来源:ezoogenerator.php

示例3: exportToArchive

 function exportToArchive($archivePath)
 {
     $temporaryExportPath = eZPackage::temporaryExportPath();
     $tempPath = $temporaryExportPath . '/' . $this->attribute('name');
     $this->removeFiles($tempPath);
     // Create package temp dir and copy package's XML file there
     $this->storePackageFile($tempPath, false);
     // Copy package's directories
     $directoryList = array($this->documentDirectory(), $this->filesDirectory(), $this->simpleFilesDirectory(), $this->settingsDirectory());
     $installItems = $this->Parameters['install'];
     foreach ($installItems as $installItem) {
         if (!in_array($installItem['sub-directory'], $directoryList)) {
             $directoryList[] = $installItem['sub-directory'];
         }
     }
     $path = $this->path();
     foreach ($directoryList as $dirName) {
         $destDir = $tempPath;
         $dir = $path . '/' . $dirName;
         if (file_exists($dir)) {
             eZDir::copy($dir, $destDir);
         }
     }
     $tarArchivePath = $temporaryExportPath . '/archive.tmp';
     $tarArchive = ezcArchive::open($tarArchivePath, ezcArchive::TAR_USTAR);
     $tarArchive->truncate();
     $prefix = $tempPath . '/';
     $fileList = array();
     eZDir::recursiveList($tempPath, $tempPath, $fileList);
     foreach ($fileList as $fileInfo) {
         $path = $fileInfo['type'] === 'dir' ? $fileInfo['path'] . '/' . $fileInfo['name'] . '/' : $fileInfo['path'] . '/' . $fileInfo['name'];
         $tarArchive->append(array($path), $prefix);
     }
     $tarArchive->close();
     copy($tarArchivePath, "compress.zlib://{$archivePath}");
     unlink($tarArchivePath);
     $this->removeFiles($tempPath);
     return $archivePath;
 }
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:39,代码来源:ezpackage.php

示例4: addExtension

    static function addExtension( $package, $extensionName )
    {
        $siteINI = eZINI::instance();
        $extensionDir = $siteINI->variable( 'ExtensionSettings', 'ExtensionDirectory' );

        $fileList = array();
        $sourceDir = $extensionDir . '/' . $extensionName;
        $targetDir = $package->path() . '/ezextension';

        eZDir::mkdir( $targetDir, false, true );
        eZDir::copy( $sourceDir, $targetDir );

        eZDir::recursiveList( $targetDir, '', $fileList );

        $doc = new DOMDocument;

        $packageRoot = $doc->createElement( 'extension' );
        $packageRoot->setAttribute( 'name', $extensionName );

        foreach( $fileList as $file )
        {
            $fileNode = $doc->createElement( 'file' );
            $fileNode->setAttribute( 'name', $file['name'] );

            if ( $file['path'] )
                $fileNode->setAttribute( 'path', $file['path'] );

            $fullPath = $targetDir . $file['path'] . '/' . $file['name'];
            $fileNode->setAttribute( 'md5sum', $package->md5sum( $fullPath ) );

            if ( $file['type'] == 'dir' )
                 $fileNode->setAttribute( 'type', 'dir' );

            $packageRoot->appendChild( $fileNode );
            unset( $fileNode );
        }

        $filename = 'extension-' . $extensionName;

        $package->appendInstall( 'ezextension', false, false, true,
                                 $filename, 'ezextension',
                                 array( 'content' => $packageRoot ) );
        $package->appendInstall( 'ezextension', false, false, false,
                                 $filename, 'ezextension',
                                 array( 'content' => false ) );
    }
开发者ID:robinmuilwijk,项目名称:ezpublish,代码行数:46,代码来源:ezextensionpackagehandler.php

示例5: recursiveList

 static function recursiveList( $dir, $path, &$fileList )
 {
     if ( $handle = @opendir( $dir ) )
     {
         while ( ( $file = readdir( $handle ) ) !== false )
         {
             if ( ( $file == "." ) || ( $file == ".." ) )
             {
                 continue;
             }
             if ( is_dir( $dir . '/' . $file ) )
             {
                 $fileList[] = array( 'path' => $path, 'name' => $file, 'type' => 'dir' );
                 eZDir::recursiveList( $dir . '/' . $file, $path . '/' . $file, $fileList );
             }
             else
             {
                 $fileList[] = array( 'path' => $path, 'name' => $file, 'type' => 'file'  );
             }
         }
         @closedir( $handle );
     }
 }
开发者ID:nottavi,项目名称:ezpublish,代码行数:23,代码来源:ezdir.php


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