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


PHP CFileHelper::createDirectory方法代码示例

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


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

示例1: setUp

 public function setUp()
 {
     $this->mockApplication(['components' => ['mailer' => ['class' => 'bashkarev\\swiftmailer\\swift\\Mailer', 'useFileTransport' => true]]]);
     $filePath = $this->getTestFilePath();
     if (!file_exists($filePath)) {
         FileHelper::createDirectory($filePath);
     }
 }
开发者ID:bashkarev,项目名称:yii-swiftmailer,代码行数:8,代码来源:MessageTest.php

示例2: afterInstall

 public function afterInstall()
 {
     Yii::app()->settings->set('shop', SettingsShopForm::defaultSettings());
     Yii::app()->database->import($this->id);
     Yii::app()->widgets->set('system', array('alias_wgt' => 'mod.shop.blocks.popular.PopularBlock', 'name' => 'Поп товары'));
     Yii::app()->widgets->set('module', array('alias_wgt' => 'mod.shop.blocks.search.SearchWidget', 'name' => 'Поиск товаров'));
     CFileHelper::createDirectory(Yii::getPathOfAlias('webroot.uploads.product'), 0777);
     CFileHelper::createDirectory(Yii::getPathOfAlias('webroot.uploads.manufacturer'), 0777);
     CFileHelper::createDirectory(Yii::getPathOfAlias('webroot.uploads.categories'), 0777);
     Yii::app()->intallComponent('currency', 'mod.shop.components.CurrencyManager');
     return parent::afterInstall();
 }
开发者ID:buildshop,项目名称:bs-common,代码行数:12,代码来源:ShopModule.php

示例3: actionIndex

 public function actionIndex()
 {
     $dir = Yii::getPathOfAlias('webroot') . '/uploads/partner/';
     CFileHelper::removeDirectory($dir);
     if (is_dir($dir) == false) {
         CFileHelper::createDirectory($dir, Yii::app()->params['storeImages']['dirMode']);
     }
     $dir = Yii::getPathOfAlias('webroot') . '/assets/thumbs/';
     CFileHelper::removeDirectory($dir);
     if (is_dir($dir) == false) {
         CFileHelper::createDirectory($dir, Yii::app()->params['storeImages']['dirMode']);
     }
 }
开发者ID:Aplay,项目名称:myhistorypark_site,代码行数:13,代码来源:TestController.php

示例4: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     Yii::app()->mailer->attachEventHandler(BaseMailer::EVENT_AFTER_SEND, function ($event) {
         /* @var $message MessageInterface */
         $message = $event->params['message'];
         $messageData = ['isSuccessful' => $event->params['isSuccessful'], 'from' => $this->convertParams($message->getFrom()), 'to' => $this->convertParams($message->getTo()), 'reply' => $this->convertParams($message->getReplyTo()), 'cc' => $this->convertParams($message->getCc()), 'bcc' => $this->convertParams($message->getBcc()), 'subject' => $message->getSubject(), 'charset' => $message->getCharset()];
         // add more information when message is a SwiftMailer message
         if ($message instanceof \bashkarev\swiftmailer\swift\Message) {
             /* @var $swiftMessage \Swift_Message */
             $swiftMessage = $message->getSwiftMessage();
             $body = $swiftMessage->getBody();
             if (empty($body)) {
                 $parts = $swiftMessage->getChildren();
                 foreach ($parts as $part) {
                     if (!$part instanceof \Swift_Mime_Attachment) {
                         /* @var $part \Swift_Mime_MimePart */
                         if ($part->getContentType() == 'text/plain') {
                             $messageData['charset'] = $part->getCharset();
                             $body = $part->getBody();
                             break;
                         }
                     }
                 }
             }
             $messageData['body'] = $body;
             $messageData['time'] = $swiftMessage->getDate();
             $messageData['headers'] = $swiftMessage->getHeaders();
         }
         // store message as file
         $fileName = $event->sender->generateMessageFileName();
         $path = Yii::getPathOfAlias($this->mailPath);
         if (!is_dir($path)) {
             \CFileHelper::createDirectory($path);
         }
         file_put_contents($path . '/' . $fileName, $message->toString());
         $messageData['file'] = $fileName;
         $this->_messages[] = $messageData;
     });
 }
开发者ID:bashkarev,项目名称:yii-swiftmailer,代码行数:43,代码来源:MailPanel.php

示例5: getFolderPath

 protected function getFolderPath()
 {
     $dir = Yii::getPathOfAlias(Yii::app()->params['storeImages']['uploads']) . DIRECTORY_SEPARATOR . $this->ownerName . DIRECTORY_SEPARATOR . $this->owner->id;
     if (is_dir($dir) == false) {
         CFileHelper::createDirectory($dir, Yii::app()->params['storeImages']['dirMode'], true);
     }
     return $dir;
 }
开发者ID:Aplay,项目名称:myhistorypark_site,代码行数:8,代码来源:FileBehavior.php

示例6: getFolderPath

 /**
  * get the path folder of the stored files
  */
 protected function getFolderPath()
 {
     $dir = Yii::getPathOfAlias('webroot') . DIRECTORY_SEPARATOR . $this->relativeWebRootFolder;
     if ($this->relativeWebRootFolderModel) {
         $dir .= DIRECTORY_SEPARATOR . $this->relativeWebRootFolderModel;
     }
     if ($this->owner->id) {
         $dir .= DIRECTORY_SEPARATOR . $this->owner->id;
     }
     if (is_dir($dir) == false) {
         CFileHelper::createDirectory($dir, Yii::app()->params['storeImages']['dirMode']);
     }
     return $dir;
 }
开发者ID:Aplay,项目名称:myhistorypark_site,代码行数:17,代码来源:FileARBehavior.php

示例7: getFileFolder

 public function getFileFolder()
 {
     $dir = Yii::getPathOfAlias('webroot') . '/uploads/user/' . $this->id . '/';
     if (is_dir($dir) == false) {
         CFileHelper::createDirectory($dir, Yii::app()->params['storeImages']['dirMode']);
     }
     return $dir;
 }
开发者ID:Aplay,项目名称:anetika_site,代码行数:8,代码来源:User.php

示例8: testCreateDirectory

 public function testCreateDirectory()
 {
     $path = $this->testDir . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR . 'path';
     $this->assertTrue(CFileHelper::createDirectory($path, null, true));
     $this->assertTrue(is_dir($path));
 }
开发者ID:super-d2,项目名称:codeigniter_demo,代码行数:6,代码来源:CFileHelperTest.php

示例9: getUrl

	/**
	 * Get url to product image. Enter $size to resize image.
	 * @param mixed $size New size of the image. e.g. '150x150'
	 * @param mixed $resizeMethod Resize method name to override config. resize/adaptiveResize
	 * @param mixed $random Add random number to the end of the string
	 * @return string
	 */
	public function getUrl($subfolder = '', $id, $size = false, $resizeMethod = false, $random = false)
	{
		// Path to source image
		$fullPath  = Yii::getPathOfAlias(FileImageConfig::get('path'));
		if($subfolder)
			$fullPath  .= '/'.$subfolder.'/';
		if($id)
			$fullPath  .= '/'.$id;
		$fullPath  .= '/'.$this->id_photo.'.'.$this->extention;

		if($size !== false)
		{
			//$thumbPath = Yii::getPathOfAlias(Yii::app()->params['storeImages']['thumbPath']).'/'.$size;
            $thumbPath = Yii::getPathOfAlias(FileImageConfig::get('thumbPath')).'/'.$size;
			if(!file_exists($thumbPath)){
				CFileHelper:: createDirectory($thumbPath, Yii::app()->params['storeImages']['dirMode']);
             }

			
			// Path to thumb
			$thumbPath = $thumbPath.'/'.$this->id_photo.'.'.$this->extention;

			if(!file_exists($fullPath)){
				return false;
			}
		
			if(!file_exists($thumbPath) && file_exists($fullPath))
			{
                            
				// Resize if needed
				Yii::import('ext.phpthumb.PhpThumbFactory');
				$sizes  = explode('x', $size);
				$thumb  = PhpThumbFactory::create($fullPath);

				if($resizeMethod === false)
                   $resizeMethod = FileImageConfig::get('resizeThumbMethod');
				if(!empty($sizes[1])){
                   $thumb->$resizeMethod($sizes[0],$sizes[1])->save($thumbPath); 
                } else {
                    $thumb->$resizeMethod($size)->save($thumbPath);
                }
                            
			} 

			return ImagesConfig::get('thumbUrl').$size.'/'.$this->id_photo.'.'.$this->extention;
		}
		
		if ($random === true){
			return $fullPath.'?'.rand(1, 10000);
		}
		return $fullPath;
	}
开发者ID:Aplay,项目名称:Fastreview_site,代码行数:59,代码来源:SitePhotos.php

示例10: mkdir

 static function mkdir($dir, $mode = 0777, $recursive = false)
 {
     if (!is_dir($dir)) {
         CFileHelper::createDirectory($dir, $mode, $recursive);
     }
 }
开发者ID:bruno-melo,项目名称:components,代码行数:6,代码来源:Helper.php


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