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


PHP eZDir::dirpath方法代码示例

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


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

示例1: cleanupEmptyDirectories

 /**
  * Goes trough the directory path and removes empty directories, starting at
  * the leaf and deleting down until a non empty directory is reached.
  * If the path is not a directory, nothing will happen.
  *
  * @param string $path
  */
 public static function cleanupEmptyDirectories($path)
 {
     $dirpath = eZDir::dirpath($path);
     eZDebugSetting::writeDebug('kernel-clustering', "eZClusterFileHandler::cleanupEmptyDirectories( '{$dirpath}' )");
     if (is_dir($dirpath)) {
         eZDir::cleanupEmptyDirectories($dirpath);
     }
 }
开发者ID:mugoweb,项目名称:ezpublish-legacy,代码行数:15,代码来源:ezclusterfilehandler.php

示例2: eZIEImagePreAction

<?php

/**
 * File containing the ezie no save & quit menu item handler
 *
 * @copyright Copyright (C) eZ Systems AS.
 * @license For full copyright and license information view LICENSE file distributed with this source code.
 * @version //autogentag//
 * @package ezie
 */
$prepare_action = new eZIEImagePreAction();
// @todo Use the cluster handler code
// delete all the images in working directory
// delete working directory
$working_folder = eZDir::dirpath($prepare_action->getImagePath());
// deletes the working folder recursively
eZDir::recursiveDelete($working_folder);
// @todo delete the user directory if empty
echo json_encode(new StdClass());
eZExecution::cleanExit();
开发者ID:ezsystemstraining,项目名称:ez54training,代码行数:20,代码来源:no_save_and_quit.php

示例3: installTemplates

    function installTemplates( $templateList, $package, $subdirectory, &$installParameters )
    {
        if ( !$templateList )
        {
            return true;
        }
        $siteAccessDesignPathArray = array();
        $templateRootPath = $package->path() . '/' . $subdirectory;
        foreach( $templateList->getElementsByTagName( 'file' ) as $fileNode )
        {
            $originalSiteAccess = $fileNode->getAttribute( 'site-access' );
            if ( isset( $installParameters['site_access_map'][$originalSiteAccess] ) )
            {
                $newSiteAccess = $installParameters['site_access_map'][$originalSiteAccess];
            }
            else
            {
                $newSiteAccess = $installParameters['site_access_map']['*'];
            }

            if ( !isset( $siteAccessDesignPathArray[$newSiteAccess] ) )
            {
                $ini = eZINI::instance( 'site.ini', 'settings', null, null, true );
                $ini->prependOverrideDir( "siteaccess/$newSiteAccess", false, 'siteaccess' );
                $ini->loadCache();

                if ( isset( $installParameters['design_map'] ) )
                {
                    $designMap = $installParameters['design_map'];
                    if ( isset( $designMap[$originalSiteAccess] ) )
                        $siteAccessDesignPathArray[$newSiteAccess] = eZTemplateDesignResource::designStartPath() . '/' . $designMap[$originalSiteAccess];
                    else
                        $siteAccessDesignPathArray[$newSiteAccess] = eZTemplateDesignResource::designStartPath() . '/' . $designMap['*'];
                }
                else
                {
                    $siteAccessDesignPathArray[$newSiteAccess] = eZTemplateDesignResource::designStartPath() . '/' . $ini->variable( "DesignSettings", "StandardDesign" );
                }
            }

            $path = '';
            foreach( $fileNode->childNodes as $pathNode )
            {
                if ( $pathNode->nodeName == 'path' )
                {
                    $path = $pathNode->nodeValue;
                    break;
                }
            }

            $sourcePath = $templateRootPath . $path;
            $destinationPath = $siteAccessDesignPathArray[$newSiteAccess] . $path;

            eZDir::mkdir( eZDir::dirpath( $destinationPath ), false, true );
            if ( !eZFileHandler::copy( $sourcePath, $destinationPath ) )
                return false;

//             eZDebug::writeNotice( 'Copied: "' . $sourcePath . '" to: "' . $destinationPath . '"', __METHOD__ );
        }
        return true;
    }
开发者ID:robinmuilwijk,项目名称:ezpublish,代码行数:61,代码来源:ezcontentobjectpackagehandler.php

示例4: appendSimpleFile

 function appendSimpleFile($key, $filepath)
 {
     if (!isset($this->Parameters['simple-file-list'])) {
         $this->Parameters['simple-file-list'] = array();
     }
     $suffix = eZFile::suffix($filepath);
     //$sourcePath = $fileInfo['original-path'];
     $packagePath = eZPackage::simpleFilesDirectory() . '/' . substr(md5(mt_rand()), 0, 8) . '.' . $suffix;
     $destinationPath = $this->path() . '/' . $packagePath;
     eZDir::mkdir(eZDir::dirpath($destinationPath), false, true);
     //SP DBfile
     $fileHandler = eZClusterFileHandler::instance();
     $fileHandler->fileFetch($filepath);
     eZFileHandler::copy($filepath, $destinationPath);
     $this->Parameters['simple-file-list'][$key] = array('original-path' => $filepath, 'package-path' => $packagePath);
 }
开发者ID:jordanmanning,项目名称:ezpublish,代码行数:16,代码来源:ezpackage.php

示例5: modify


//.........这里部分代码省略.........

                eZDebug::writeNotice( 'PDF: Added Image '.$image['src'].' to PDF file', __METHOD__ );
            } break;

            case 'anchor':
            {
                $name = $tpl->elementValue( $operatorParameters[1], $rootNamespace, $currentNamespace );

                $operatorValue = '<C:callAnchor:'. $name['name'] .':FitH:>';
                eZDebug::writeNotice( 'PDF: Added anchor: '.$name['name'], __METHOD__ );
            } break;

            case 'link': // external link
            {
                $link = $tpl->elementValue( $operatorParameters[1], $rootNamespace, $currentNamespace );

                $link['text'] = str_replace( '&quot;',
                                             '"',
                                             $link['text'] );

                $operatorValue = '<c:alink:'. rawurlencode( $link['url'] ) .'>'. $link['text'] .'</c:alink>';
                eZDebug::writeNotice( 'PDF: Added link: '. $link['text'] .', url: '.$link['url'], __METHOD__ );
            } break;

            case 'stream':
            {
                $this->PDF->ezStream();
            }

            case 'close':
            {
                $filename = $tpl->elementValue( $operatorParameters[1], $rootNamespace, $currentNamespace );

                eZDir::mkdir( eZDir::dirpath( $filename ), false, true );

                $file = eZClusterFileHandler::instance( $filename );
                $file->storeContents( $this->PDF->ezOutput(), 'viewcache', 'pdf' );

                eZDebug::writeNotice( 'PDF file closed and saved to '. $filename, __METHOD__ );
            } break;

            case 'strike':
            {
                $text = $tpl->elementValue( $operatorParameters[1], $rootNamespace, $currentNamespace );
                $operatorValue = '<c:strike>'. $text .'</c:strike>';
                eZDebug::writeNotice( 'Striked text added to PDF: "'. $text .'"', __METHOD__ );
            } break;

            /* usage : execute/add text to pdf file, pdf(execute,<text>) */
            case 'execute':
            {
                $text = $tpl->elementValue( $operatorParameters[1], $rootNamespace, $currentNamespace );

                if ( count ( $operatorParameters ) > 2 )
                {
                    $options = $tpl->elementValue( $operatorParameters[2], $rootNamespace, $currentNamespace );

                    $size = isset( $options['size'] ) ? $options['size'] : $config->variable( 'PDFGeneral', 'Format' );
                    $orientation = isset( $options['orientation'] ) ? $options['orientation'] : $config->variable( 'PDFGeneral', 'Orientation' );

                    $this->createPDF( $size, $orientation );
                }
                else
                {
                    $this->createPDF( $config->variable( 'PDFGeneral', 'Format' ), $config->variable( 'PDFGeneral', 'Orientation' ) );
                }
开发者ID:nottavi,项目名称:ezpublish,代码行数:67,代码来源:ezpdf.php

示例6: removeByAttribute

 /**
  * Attempt to remove content object 'image' attribute image variations by content object attribute
  *
  * @param object $contentClassImageAttribute object of objects of class eZContentObjectAttribute
  * @param array $class Array of object class identifiers to remove aliases for only these classes. Optional. Defaults to false
  * @param array $attributes Array of object image attribute identifiers to remove aliases from. Optional. Defaults to false
  * @param array $aliases Array of object image attribute image aliases to remove. Optional. Defaults to false
  *
  * @return bool true if successful, false otherwise
  * @static
  */
 static function removeByAttribute($contentObjectAttribute = false, $classes = false, $attributes = false, $aliases = false)
 {
     if (!is_object($contentObjectAttribute)) {
         return false;
     }
     // Test that content object class attribute identifier matches provided classes
     if ($classes != false && is_array($classes) && !in_array($contentObjectAttribute->attribute('object')->attribute('class_identifier'), $classes)) {
         return false;
     }
     // Test that content object class attribute identifier matches provided classes
     if ($attributes != false && is_array($attributes) && !in_array($contentObjectAttribute->attribute('contentclass_attribute_identifier'), $attributes)) {
         return false;
     }
     // Default datatypes to create image alias variations
     $imageDataTypeStrings = eZINI::instance('bcimagealias.ini')->variable('BCImageAliasSettings', 'ImageDataTypeStringList');
     // Check that content object attribute data type string matches allowed datatype settings
     if (!in_array($contentObjectAttribute->attribute('data_type_string'), $imageDataTypeStrings) || !$contentObjectAttribute->attribute('has_content')) {
         return false;
     }
     $filePaths = array();
     $results = array();
     $executionOptions = self::executionOptions();
     $messageCount = 0;
     $imageHandler = $contentObjectAttribute->attribute('content');
     $aliasList = $imageHandler->aliasList(false);
     // Do not process the orginal image alias
     unset($aliasList['original']);
     if (count($aliasList) == 0) {
         return false;
     }
     // Optional debug output
     if ($executionOptions['troubleshoot'] && $executionOptions['verboseLevel'] >= 2) {
         if ($executionOptions['verboseLevel'] >= 3) {
             self::displayMessage('All attribute image aliases stored in content data text field:', false);
             self::displayMessage($contentObjectAttribute->attribute('data_text'), "\n");
         }
         if ($executionOptions['verboseLevel'] >= 4) {
             self::displayMessage('All attribute image aliases stored in content alias list:', false);
             print_r($aliasList);
             self::displayMessage('', "\n\n");
         } elseif ($executionOptions['verboseLevel'] >= 3) {
             self::displayMessage('All attribute image aliases stored in content alias list:', false);
             print_r(array_keys($aliasList));
             self::displayMessage('', "\n");
         }
     }
     $contentObjectID = $contentObjectAttribute->attribute('contentobject_id');
     $contentObjectAttributeID = $contentObjectAttribute->attribute('id');
     $contentObjectAttributeVersion = $contentObjectAttribute->attribute('version');
     if ($contentObjectAttributeVersion === null) {
         $files = eZImageFile::fetchForContentObjectAttribute($contentObjectAttributeID, true);
         $dirs = array();
         $count = 0;
         // Iterate over files
         foreach ($files as $filepath) {
             // Test $filepath from $files is in contains one of the $aliases items
             if ($aliases != false && is_array($aliases)) {
                 foreach ($aliases as $alias) {
                     if (!stristr('_' . $alias, $filepath)) {
                         continue 1;
                     }
                 }
             }
             $file = eZClusterFileHandler::instance($filepath);
             if ($file->exists()) {
                 $filePaths[] = $filepath;
                 if (!$executionOptions['dry']) {
                     $file->fileDelete($filepath);
                     $dirs[] = eZDir::dirpath($filepath);
                 }
                 $count++;
             }
         }
         if (!$executionOptions['dry']) {
             $dirs = array_unique($dirs);
             foreach ($dirs as $dirpath) {
                 eZDir::cleanupEmptyDirectories($dirpath);
             }
             eZImageFile::removeForContentObjectAttribute($contentObjectAttributeID);
             $message = "Removed datatype " . $contentObjectAttribute->attribute('data_type_string') . "type image alias variation " . $filePaths[$messageCount] . "\n";
         } else {
             $message = "Dry run: Remove datatype " . $contentObjectAttribute->attribute('data_type_string') . "type image alias variation " . $filePaths[$messageCount] . "\n";
         }
         while ($messageCount < $count) {
             self::scriptIterate($message);
             $messageCount++;
             $result = true;
         }
     } else {
//.........这里部分代码省略.........
开发者ID:philandteds,项目名称:bcimagealias,代码行数:101,代码来源:bcimagealias.php


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