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


PHP eZDir::directoryPermission方法代码示例

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


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

示例1: tempDirectory

 /**
  * Returns the path to the WebDAV temporary directory.
  *
  * If the directory does not exist yet, it will be created first.
  *
  * @return string
  * @todo remove or replace with eZ Components functionality
  */
 protected static function tempDirectory()
 {
     $tempDir = eZSys::varDirectory() . '/webdav/tmp';
     if (!file_exists($tempDir)) {
         eZDir::mkdir($tempDir, eZDir::directoryPermission(), true);
     }
     return $tempDir;
 }
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:16,代码来源:ezwebdavcontentbackend.php

示例2: copy

    static function copy( $sourceDirectory, &$destinationDirectory,
                   $asChild = true, $recursive = true, $includeHidden = false, $excludeItems = false )
    {
        if ( !is_dir( $sourceDirectory ) )
        {
            eZDebug::writeError( "Source $sourceDirectory is not a directory, cannot copy from it", __METHOD__ );
            return false;
        }
        if ( !is_dir( $destinationDirectory ) )
        {
            eZDebug::writeError( "Destination $destinationDirectory is not a directory, cannot copy to it", __METHOD__ );
            return false;
        }
        if ( $asChild )
        {
            if ( preg_match( "#^.+/([^/]+)$#", $sourceDirectory, $matches ) )
            {
                eZDir::mkdir( $destinationDirectory . '/' . $matches[1], eZDir::directoryPermission(), false );
                $destinationDirectory .= '/' . $matches[1];
            }
        }
        $items = eZDir::findSubitems( $sourceDirectory, 'df', false, $includeHidden, $excludeItems );
        $totalItems = $items;
        while ( count( $items ) > 0 )
        {
            $currentItems = $items;
            $items = array();
            foreach ( $currentItems as $item )
            {
                $fullPath = $sourceDirectory . '/' . $item;
                if ( is_file( $fullPath ) )
                    eZFileHandler::copy( $fullPath, $destinationDirectory . '/' . $item );
                else if ( is_dir( $fullPath ) )
                {
                    eZDir::mkdir( $destinationDirectory . '/' . $item, eZDir::directoryPermission(), false );
                    $newItems = eZDir::findSubitems( $fullPath, 'df', $item, $includeHidden, $excludeItems );
                    $items = array_merge( $items, $newItems );
                    $totalItems = array_merge( $totalItems, $newItems );
                    unset( $newItems );
                }
            }
        }
//         eZDebugSetting::writeNotice( 'lib-ezfile-copy',
//                                      "Copied directory $sourceDirectory to destination $destinationDirectory",
//                                      'eZDir::copy' );
        return $totalItems;
    }
开发者ID:nottavi,项目名称:ezpublish,代码行数:47,代码来源:ezdir.php

示例3: generatePDF

 /**
  * Converts xhtml to pdf
  *
  * @param $xhtml
  * @return Binary pdf content or false if error
  */
 public function generatePDF($xhtml)
 {
     //check if $tmpdir exists else try to create it
     if (!eZFileHandler::doExists($this->tmpDir)) {
         if (!eZDir::mkdir($this->tmpDir, eZDir::directoryPermission(), true)) {
             eZDebug::writeWarning("ParadoxPDF::generatePDF Error : could not create temporary directory {$this->tmpDir} ", 'ParadoxPDF::generatePDF');
             eZLog::write("ParadoxPDF::generatePDF Error : could not create temporary directory {$this->tmpDir} ", 'paradoxpdf.log');
             return false;
         }
     } elseif (!eZFileHandler::doIsWriteable($this->tmpDir)) {
         //check if $tmpdir is writable
         eZDebug::writeWarning("ParadoxPDF::generatePDF Error : please make {$this->tmpDir} writable ", 'ParadoxPDF::generatePDF');
         eZLog::write("ParadoxPDF::generatePDF Error : please make {$this->tmpDir} writable ", 'paradoxpdf.log');
         return false;
     }
     $rand = md5('paradoxpdf' . getmypid() . mt_rand());
     $tmpXHTMLFile = eZDir::path(array($this->tmpDir, "{$rand}.xhtml"));
     $tmpPDFFile = eZDir::path(array($this->tmpDir, "{$rand}.pdf"));
     //fix relative urls to match ez root directory
     $xhtml = $this->fixURL($xhtml);
     eZFile::create($tmpXHTMLFile, false, $xhtml);
     $pdfContent = '';
     //run jar in headless mode
     $command = $this->javaExec . " -Djava.awt.headless=true";
     if ($this->debugEnabled && $this->debugVerbose) {
         $command .= " -Dxr.util-logging.loggingEnabled=true";
     }
     $command .= " -jar " . $this->paradoxPDFExec . " {$tmpXHTMLFile} {$tmpPDFFile}";
     //fix to get all command output
     $command .= "  2>&1";
     //Enter the Matrix
     exec($command, $output, $returnCode);
     //Cant trust java return code so we test if a plain pdf file is genereated
     if (!(eZFileHandler::doExists($tmpPDFFile) && ($this->size = filesize($tmpPDFFile)))) {
         $this->writeCommandLog($command, $output, false);
         return false;
     }
     $this->writeCommandLog($command, $output, true);
     $pdfContent = file_get_contents($tmpPDFFile);
     //cleanup temporary files
     //if debug enabled preseves the temporary pdf file
     //else remove all temporary files
     if (!$this->debugEnabled) {
         eZFileHandler::unlink($tmpPDFFile);
         eZFileHandler::unlink($tmpXHTMLFile);
     }
     return $pdfContent;
 }
开发者ID:informaticatrentina,项目名称:paradoxpdf,代码行数:54,代码来源:paradoxpdf.php

示例4: unserializeContentObjectAttribute

 function unserializeContentObjectAttribute($package, $objectAttribute, $attributeNode)
 {
     $fileNode = $attributeNode->getElementsByTagName('binary-file')->item(0);
     if (!is_object($fileNode) or !$fileNode->hasAttributes()) {
         return;
     }
     $binaryFile = eZBinaryFile::create($objectAttribute->attribute('id'), $objectAttribute->attribute('version'));
     $sourcePath = $package->simpleFilePath($fileNode->getAttribute('filekey'));
     if (!file_exists($sourcePath)) {
         eZDebug::writeError("The file '{$sourcePath}' does not exist, cannot initialize file attribute with it", 'EnhancedeZBinaryFileType::unserializeContentObjectAttribute');
         return false;
     }
     //include_once( 'lib/ezfile/classes/ezdir.php' );
     $ini = eZINI::instance();
     $mimeType = $fileNode->getAttribute('mime-type');
     list($mimeTypeCategory, $mimeTypeName) = explode('/', $mimeType);
     $destinationPath = eZSys::storageDirectory() . '/original/' . $mimeTypeCategory . '/';
     if (!file_exists($destinationPath)) {
         $oldumask = umask(0);
         if (!eZDir::mkdir($destinationPath, eZDir::directoryPermission(), true)) {
             umask($oldumask);
             return false;
         }
         umask($oldumask);
     }
     $basename = basename($fileNode->getAttribute('filename'));
     while (file_exists($destinationPath . $basename)) {
         $basename = substr(md5(mt_rand()), 0, 8) . '.' . eZFile::suffix($fileNode->getAttribute('filename'));
     }
     //include_once( 'lib/ezfile/classes/ezfilehandler.php' );
     eZFileHandler::copy($sourcePath, $destinationPath . $basename);
     eZDebug::writeNotice('Copied: ' . $sourcePath . ' to: ' . $destinationPath . $basename, 'EnhancedeZBinaryFileType::unserializeContentObjectAttribute()');
     $binaryFile->setAttribute('contentobject_attribute_id', $objectAttribute->attribute('id'));
     $binaryFile->setAttribute('filename', $basename);
     $binaryFile->setAttribute('original_filename', $fileNode->getAttribute('original-filename'));
     $binaryFile->setAttribute('mime_type', $fileNode->getAttribute('mime-type'));
     $binaryFile->store();
     // VS-DBFILE + SP DBFile fix
     require_once 'kernel/classes/ezclusterfilehandler.php';
     $fileHandler = eZClusterFileHandler::instance();
     $fileHandler->fileStore($destinationPath . $basename, 'binaryfile', true);
 }
开发者ID:Alexnder,项目名称:enhancedezbinaryfile,代码行数:42,代码来源:enhancedezbinaryfiletype.php

示例5: array

require 'autoload.php';
//require_once( 'extension/mytwitter/lib/oauth/twitterOAuth.php' );
$cli = eZCLI::instance();
$script = eZScript::instance(array('description' => "Twitter credentials registration / validation\n" . "Script to register and validate OAuth credentials for Twitter\n" . "\n" . "extension/mytwitter/lib/setup.php", 'use-session' => false, 'use-modules' => false, 'use-extensions' => true));
$script->startup();
// CLI parameters
$options = $script->getOptions("[register][validate:]", "", array('register' => 'generate a registration URL', 'validate' => 'validate the PIN returned by the registration URL'));
$script->initialize();
$myTwitterINI = eZINI::instance('mytwitter.ini');
$consumerKey = $myTwitterINI->variable('TwitterSettings', 'ConsumerKey');
$consumerSecret = $myTwitterINI->variable('TwitterSettings', 'ConsumerSecret');
$accessToken = $myTwitterINI->variable('TwitterSettings', 'AccessToken');
$varDir = eZSys::varDirectory();
$myTwitterTmpDir = $varDir . '/mytwitter';
if (!file_exists($myTwitterTmpDir)) {
    eZDir::mkdir($myTwitterTmpDir, eZDir::directoryPermission(), true);
}
$noAction = true;
$register = isset($options['register']);
$noAction = !$register;
$pin = false;
if ($options['validate']) {
    $noAction = false;
    $pin = $options['validate'];
}
if ($register) {
    // instantiate a TwitterOAuth object and request a token
    $oauth = new TwitterOAuth($consumerKey, $consumerSecret);
    $request = $oauth->getRequestToken();
    $request_token = $request["oauth_token"];
    $request_token_secret = $request["oauth_token_secret"];
开发者ID:nfrp,项目名称:eZ-Publish-Twitter-Update-Worlflow--by-Quoc-Huy-Nguyen-Dinh-,代码行数:31,代码来源:setup.php


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