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


PHP eZDir类代码示例

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


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

示例1: getArchiveFileName

    public function getArchiveFileName( $path, $seeds, $prefix = null, $realm = null )
    {
        $dirElements = array();
        $dirElements[] = $this->ArchiveDir;
        if ( isset( $realm ) )
        {
            $dirElements[]= $realm;
        }
        $seed = implode ( '', $seeds );
        $hash = hash( $this->hashAlgorithm, $seed );
        $multiLevelDir = eZDir::createMultiLevelPath( substr( $hash, 0 , $this->ArchiveDirLevels ), $this->ArchiveDirLevels );
        $dirElements[] = $multiLevelDir;
        $fileDirectory = implode( '/', $dirElements );
        if ( !file_exists( $fileDirectory ) )
        {
            eZDir::mkdir( $fileDirectory, false, true );
        }
        $archiveFileName = $fileDirectory . '/';
        if ( isset( $prefix ) )
        {
            $archiveFileName .= $prefix . '-';
        }
        $archiveFileName .= $hash;

        return $archiveFileName;
    }
开发者ID:ataxel,项目名称:tp,代码行数:26,代码来源:ezpfilearchivefilesystem.php

示例2: getContributors

function getContributors( $pathToDir )
{
    $contribFiles = eZDir::recursiveFind( $pathToDir, "php" );
    $contributors = array();
    if ( count( $contribFiles ) )
    {
        foreach ( $contribFiles as $contribFile )
        {
            include_once( $contribFile );
            if ( !isset( $contributorSettings ) )
                continue;

            $tmpFiles = explode( ',', $contributorSettings['files'] );
            $updatedFiles = array();
            foreach ( $tmpFiles as $file )
            {
                if ( trim( $file ) )
                    $updatedFiles[] = trim( $file,"\n\r" );
            }
            $files = implode( ', ', $updatedFiles );
            $contributorSettings['files'] = $files;
            $contributors[] = $contributorSettings;
        }
    }
    return $contributors;
}
开发者ID:nottavi,项目名称:ezpublish,代码行数:26,代码来源:about.php

示例3: checkRecurrenceCondition

 function checkRecurrenceCondition($newsletter)
 {
     if (!$newsletter->attribute('recurrence_condition')) {
         return true;
     }
     if (0 < count($this->conditionExtensions)) {
         foreach ($this->conditionExtensions as $conditionExtension) {
             // TODO: Extend to ask multiple condition extensions to allow more complex checks
             $siteINI = eZINI::instance();
             $siteINI->loadCache();
             $extensionDirectory = $siteINI->variable('ExtensionSettings', 'ExtensionDirectory');
             $extensionDirectories = eZDir::findSubItems($extensionDirectory);
             $directoryList = eZExtension::expandedPathList($extensionDirectories, 'condition_handler');
             foreach ($directoryList as $directory) {
                 $handlerFile = $directory . '/' . strtolower($conditionExtension) . 'handler.php';
                 // we only check one extension for now
                 if ($conditionExtension === $newsletter->attribute('recurrence_condition') && file_exists($handlerFile)) {
                     include_once $handlerFile;
                     $className = $conditionExtension . 'Handler';
                     if (class_exists($className)) {
                         $impl = new $className();
                         // Ask if condition is fullfilled
                         return $impl->checkCondition($newsletter);
                     } else {
                         eZDebug::writeError("Class {$className} not found. Unable to verify recurrence condition. Blocked recurrence.");
                         return false;
                     }
                 }
             }
         }
     }
     // If we have a condition but no match we prevent the sendout
     eZDebug::writeError("Newsletter recurrence condition '" . $newsletter->attribute('recurrence_condition') . "' extension not found ");
     return false;
 }
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:35,代码来源:ezrecurrence.php

示例4: moveIfNeeded

function moveIfNeeded($oldPath, $newPath) {
    global $fileToRemove;
    
    $success = true;
    $cli = eZCLI::instance();
    
    if (!file_exists($newPath)) {
        if (!file_exists($oldPath)) {
            $cli->warning('Source file not exist : ' . $oldPath);
            return false;
        }
    
        eZDir::mkdir( dirname( $newPath ), false, true );
        $success = copy($oldPath, $newPath);
        
        $cli = eZCLI::instance();
        if ($success) {
            $fileToRemove[] = $oldPath;
            $cli->notice('Move ' . $oldPath . ' => ' . $newPath);
        } else {
            $cli->warning('Fail to move ' . $oldPath . ' => ' . $newPath);
        }
    } else {
        $fileToRemove[] = $oldPath;
    }
    
    return $success;
}
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:28,代码来源:image_refactor.php

示例5: create

 static function create($filename, $directory = false, $data = false, $atomic = false)
 {
     $filepath = $filename;
     if ($directory) {
         if (!file_exists($directory)) {
             eZDir::mkdir($directory, false, true);
             //                 eZDebugSetting::writeNotice( 'ezfile-create', "Created directory $directory", 'eZFile::create' );
         }
         $filepath = $directory . '/' . $filename;
     }
     // If atomic creation is needed we will use a temporary
     // file when writing the data, then rename it to the correct path.
     if ($atomic) {
         $realpath = $filepath;
         $dirname = dirname($filepath);
         if (strlen($dirname) != 0) {
             $dirname .= "/";
         }
         $filepath = $dirname . "ezfile-tmp." . md5($filepath . getmypid() . mt_rand());
     }
     $file = fopen($filepath, 'wb');
     if ($file) {
         //             eZDebugSetting::writeNotice( 'ezfile-create', "Created file $filepath", 'eZFile::create' );
         if ($data) {
             fwrite($file, $data);
         }
         fclose($file);
         if ($atomic) {
             eZFile::rename($filepath, $realpath);
         }
         return true;
     }
     //         eZDebugSetting::writeNotice( 'ezfile-create', "Failed creating file $filepath", 'eZFile::create' );
     return false;
 }
开发者ID:runelangseid,项目名称:ezpublish,代码行数:35,代码来源:ezfile.php

示例6: eZMutex

 function eZMutex($name)
 {
     $this->Name = md5($name);
     $mutexPath = eZDir::path(array(eZSys::cacheDirectory(), 'ezmutex'));
     eZDir::mkdir($mutexPath, false, true);
     $this->FileName = eZDir::path(array($mutexPath, $this->Name));
     $this->MetaFileName = eZDir::path(array($mutexPath, $this->Name . '_meta'));
 }
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:8,代码来源:ezmutex.php

示例7: 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

示例8: __construct

 /**
  * Constructs a new CjwNewsletterTransportFile
  *
  * @param string $mailDir
  * @return void
  */
 public function __construct($mailDir = 'var/log/mail')
 {
     // $this->mailDir = eZSys::siteDir().eZSys::varDirectory().'/log/mail';
     if (is_dir($mailDir) or eZDir::mkdir($mailDir, false, true)) {
         $this->mailDir = $mailDir;
     } else {
         // TODO Fehlerbehandlung wenn verzeichnis nicht angelegt werden kann
     }
 }
开发者ID:heliopsis,项目名称:cjw_newsletter,代码行数:15,代码来源:cjwnewslettertransportfile.php

示例9: copyDir

function copyDir( $source, $destination )
{
    // Attempt to create destination dir.
    $status = eZDir::mkdir( $destination );

    // If no success: bail out.
    if ( !$status )
    {
        return false;
    }

    // Get the contents of the directory.
    $entries = getDirEntries( $source );

    // Bail if contents is unavailable.
    if ( $entries == false )
    {
        return false;
    }
    // Else: contents is OK:
    else
    {
        // Copy each and every entry:
        foreach ( $entries as $entry )
        {
            if ( $entry )
            {
                $from = "$source/$entry";
                $to   = "$destination/$entry";

                // Is this a directory? -> special case.
                if ( is_dir( $from ) )
                {
                    $status = copyDir( $from, $to );
                    if (!$status)
                    {
                        return false;
                    }
                }
                // Else: simple file case.
                else
                {
                    $status = copy( $from, $to );
                    if (!$status)
                    {
                        return false;
                    }
                }
            }
        }

    }

    // Phew: if we got this far then everything is OK.
    return true;
}
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:56,代码来源:ezwebdavfileserver.php

示例10: __construct

 /**
  * Creates a new cache storage for a given location through eZ Publish cluster mechanism
  * Options can contain the 'ttl' ( Time-To-Life ). This is per default set
  * to 1 day.
  *
  * @param string $location Path to the cache location inside the cluster
  * @param array(string=>string) $options Options for the cache.
  */
 public function __construct($location, $options = array())
 {
     $path = eZSys::cacheDirectory() . '/rest/' . $location;
     if (!file_exists($path)) {
         if (!eZDir::mkdir($path, false, true)) {
             throw new ezcBaseFilePermissionException($path, ezcBaseFileException::WRITE, 'Cache location is not writeable.');
         }
     }
     parent::__construct($path);
     $this->properties['options'] = new ezpCacheStorageClusterOptions($options);
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:19,代码来源:cluster.php

示例11: nameFromPath

/**
 * eZExtension::nameFromPath( __FILE__ ) executed in any file of an extension
 * can help you to find the path to additional resources
 *
 * @param $path Path to check.
 * @return Name of the extension a path belongs to.
 * @deprecated Since 4.3, use {@link eZExtension::nameFromPath()} instead
 */
function nameFromPath($path)
{
    $path = eZDir::cleanPath($path);
    $base = eZExtension::baseDirectory() . '/';
    $base = preg_quote($base, '/');
    $pattern = '/' . $base . '([^\\/]+)/';
    if (preg_match($pattern, $path, $matches)) {
        return $matches[1];
    } else {
        false;
    }
}
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:20,代码来源:ezincludefunctions.php

示例12: store

 function store($sub_dir = false, $suffix = false, $mimeData = false)
 {
     if (!$this->IsTemporary) {
         eZDebug::writeError("Cannot store non temporary file: " . $this->Filename, "eZHTTPFile");
         return false;
     }
     $this->IsTemporary = false;
     $ini = eZINI::instance();
     //         $storage_dir = $ini->variable( "FileSettings", "VarDir" ) . '/' . $ini->variable( "FileSettings", "StorageDir" );
     $storage_dir = eZSys::storageDirectory();
     if ($sub_dir !== false) {
         $dir = $storage_dir . "/{$sub_dir}/";
     } else {
         $dir = $storage_dir . "/";
     }
     if ($mimeData) {
         $dir = $mimeData['dirpath'];
     }
     if (!$mimeData) {
         $dir .= $this->MimeCategory;
     }
     if (!file_exists($dir)) {
         if (!eZDir::mkdir($dir, false, true)) {
             return false;
         }
     }
     $suffixString = false;
     if ($suffix != false) {
         $suffixString = ".{$suffix}";
     }
     if ($mimeData) {
         $dest_name = $mimeData['url'];
     } else {
         $dest_name = $dir . "/" . md5(basename($this->Filename) . microtime() . mt_rand()) . $suffixString;
     }
     if (!move_uploaded_file($this->Filename, $dest_name)) {
         eZDebug::writeError("Failed moving uploaded file " . $this->Filename . " to destination {$dest_name}");
         unlink($dest_name);
         $ret = false;
     } else {
         $ret = true;
         $this->Filename = $dest_name;
         $perm = $ini->variable("FileSettings", "StorageFilePermissions");
         $oldumask = umask(0);
         chmod($dest_name, octdec($perm));
         umask($oldumask);
         // Write log message to storage.log
         $storageDir = $dir . "/";
         eZLog::writeStorageLog(basename($this->Filename), $storageDir);
     }
     return $ret;
 }
开发者ID:patrickallaert,项目名称:ezpublish-legacy-php7,代码行数:52,代码来源:ezhttpfile.php

示例13: getCssFilePath

    /**
     * @return mixed
     */
    public function getCssFilePath()
    {
        if ( is_null($this->_cssFilePath) )
        {
            $cssDirectory = eZSys::cacheDirectory() . '/css';
            $this->_cssFilePath = $cssDirectory .'/' . md5( $this->getLessFilePath() ) . '.css';
            if ( !file_exists( $cssDirectory ))
            {
                eZDir::mkdir( $cssDirectory );
            }
        }

        return $this->_cssFilePath;
    }
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:17,代码来源:KLessFile.php

示例14: tearDown

 public function tearDown()
 {
     // restore the previous file handler
     if ($this->previousFileHandler !== null) {
         $fileINI = eZINI::instance('file.ini');
         $fileINI->setVariable('ClusteringSettings', 'FileHandler', $this->previousFileHandler);
         $this->previousFileHandler = null;
         eZClusterFileHandler::resetHandler();
     }
     if ($this->haveToRemoveDFSPath) {
         eZDir::recursiveDelete($this->DFSPath);
     }
     parent::tearDown();
 }
开发者ID:brookinsconsulting,项目名称:ezecosystem,代码行数:14,代码来源:ezdfsclusterstalecache_test.php

示例15: getTmpDir

 /**
  * tmp dir for mail parser
  *    ezvardir / cjw_newsletter/tmp/
  * @return string dirname
  */
 public function getTmpDir($createDirIfNotExists = true)
 {
     $varDir = eZSys::varDirectory();
     // $dir = $varDir . "/cjw_newsletter/tmp/";
     $dir = eZDir::path(array($varDir, 'cjw_newsletter', 'tmp'));
     $fileSep = eZSys::fileSeparator();
     $filePath = $dir . $fileSep;
     if ($createDirIfNotExists === true) {
         if (!file_exists($filePath)) {
             eZDir::mkdir($filePath, false, true);
         }
     }
     return $filePath;
 }
开发者ID:hudri,项目名称:cjw_newsletter,代码行数:19,代码来源:cjwnewslettermailparser.php


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