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


PHP JUDownloadHelper::fileNameFilter方法代码示例

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


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

示例1: insertUpdateDocument


//.........这里部分代码省略.........
     $query->join("", "#__judownload_documents AS d ON dxref.doc_id = d.id");
     $query->where("d.id = {$docId}");
     $query->where("field.field_name != 'id'");
     $query->where("field.field_name != 'cat_id'");
     $query->group('field.id');
     $query->order('ordering ASC');
     $db->setQuery($query);
     $fields = $db->loadObjectList();
     $docObj = JUDownloadHelper::getDocumentById($docId);
     foreach ($fields as $field) {
         if (isset($fieldsData[$field->id])) {
             $fieldObj = JUDownloadFrontHelperField::getField($field, $docObj);
             $fieldObj->fields_data = $fieldsData;
             $fieldValue = $fieldsData[$field->id];
             $fieldObj->is_new_doc = $isInsert;
             $fieldValue = $fieldObj->onImportDocument($fieldValue);
             $fieldObj->storeValue($fieldValue);
         }
     }
     if ($iconPath) {
         $iconPath = JUDownloadHelper::getPhysicalPath($iconPath);
         if (!$iconPath) {
             $messages[] = JText::sprintf('COM_JUDOWNLOAD_CSV_PROCESS_FILE_S_NOT_FOUND', $iconPath);
         } else {
             if ($data['id'] > 0) {
                 if ($table->icon) {
                     if (JFile::exists($iconDir . $table->icon)) {
                         JFile::delete($iconDir . $table->icon);
                         JFile::delete($originalDir . $table->icon);
                     }
                 }
             }
             $iconName = basename($iconPath);
             $iconName = $docId . "_" . JUDownloadHelper::fileNameFilter($iconName);
             if (JFile::copy($iconPath, $originalDir . $iconName) && JUDownloadHelper::renderImages($originalDir . $iconName, $iconDir . $iconName, 'document_icon', true, null, $data['id'])) {
                 $table->icon = $iconName;
                 $table->store();
             }
         }
     }
     $imageTable = JTable::getInstance("Image", "JUDownloadTable");
     if (!empty($gallery)) {
         $dir_document_ori = JPATH_SITE . "/" . JUDownloadFrontHelper::getDirectory("document_original_image_directory", "media/com_judownload/images/gallery/original/") . $docId . "/";
         $dir_document_small = JPATH_SITE . "/" . JUDownloadFrontHelper::getDirectory("document_small_image_directory", "media/com_judownload/images/gallery/small/") . $docId . "/";
         $dir_document_big = JPATH_SITE . "/" . JUDownloadFrontHelper::getDirectory("document_big_image_directory", "media/com_judownload/images/gallery/big/") . $docId . "/";
         if (!JFolder::exists($dir_document_ori)) {
             $file_index = $dir_document_ori . 'index.html';
             $buffer = "<!DOCTYPE html><title></title>";
             JFile::write($file_index, $buffer);
         }
         if (!JFolder::exists($dir_document_small)) {
             $file_index = $dir_document_small . 'index.html';
             $buffer = "<!DOCTYPE html><title></title>";
             JFile::write($file_index, $buffer);
         }
         if (!JFolder::exists($dir_document_big)) {
             $file_index = $dir_document_big . 'index.html';
             $buffer = "<!DOCTYPE html><title></title>";
             JFile::write($file_index, $buffer);
         }
         $image_ordering = 1;
         $date = JFactory::getDate();
         foreach ($gallery as $imagePath) {
             $imagePath = JUDownloadHelper::getPhysicalPath($imagePath);
             if (!$imagePath) {
                 $messages[] = JText::sprintf('COM_JUDOWNLOAD_CSV_PROCESS_FILE_S_NOT_FOUND', $imagePath);
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:67,代码来源:csvprocess.php

示例2: storeValue

	public function storeValue($value, $type = 'default', $inputData = null)
	{
		if ($type == 'migrate')
		{
			
			$iconKeyArray = $this->getId() . "_icon";
			$icon         = $inputData[$iconKeyArray];

			
			$mime_types = array("image/jpeg", "image/pjpeg", "image/png", "image/gif", "image/bmp", "image/x-windows-bmp");
			if ($icon['name'])
			{
				if (in_array($icon['type'], $mime_types))
				{
					
					

					
					$iconDirectory  = JPATH_ROOT . "/" . JUDownloadFrontHelper::getDirectory("document_icon_directory", "media/com_judownload/images/document/");
					$icon_file_name = $this->doc_id . "_" . JUDownloadHelper::fileNameFilter($icon['name']);
					if (JFile::copy($icon['tmp_name'], $iconDirectory . "original/" . $icon_file_name)
						&& JUDownloadHelper::renderImages($iconDirectory . "original/" . $icon_file_name, $iconDirectory . $icon_file_name, 'doc_icon', true, null, $this->doc_id)
					)
					{
						$value = $icon_file_name;
						parent::storeValue($value, $type, $inputData);
					}
				}
			}
			elseif ($value == "" || strpos($value, 'default/') === 0)
			{
				if ($this->doc && $this->doc->icon && strpos($this->doc->icon, 'default/') === false)
				{
					$this->removeIcon();
				}
				parent::storeValue($value, $type, $inputData);
			}
		}
		else
		{
			$app = JFactory::getApplication();

			
			$icon = $app->input->files->get($this->getId() . "_icon");
			
			$mime_types = array("image/jpeg", "image/pjpeg", "image/png", "image/gif", "image/bmp", "image/x-windows-bmp");
			if ($icon['name'])
			{
				if (in_array($icon['type'], $mime_types))
				{
					
					$this->removeIcon();

					
					$iconDirectory  = JPATH_ROOT . "/" . JUDownloadFrontHelper::getDirectory("document_icon_directory", "media/com_judownload/images/document/");
					$icon_file_name = $this->doc_id . "_" . JUDownloadHelper::fileNameFilter($icon['name']);
					if (JFile::upload($icon['tmp_name'], $iconDirectory . "original/" . $icon_file_name)
						&& JUDownloadHelper::renderImages($iconDirectory . "original/" . $icon_file_name, $iconDirectory . $icon_file_name, 'doc_icon', true, null, $this->doc_id)
					)
					{
						$value = $icon_file_name;
						parent::storeValue($value, $type, $inputData);
					}
				}
				else
				{
					JError::raise(
						E_NOTICE,
						500,
						JText::sprintf('COM_JUDOWNLOAD_ICON_IS_NOT_VALID_MIME_TYPE')
					);
				}
			}
			elseif ($value == "" || strpos($value, 'default/') === 0)
			{
				if ($this->doc && $this->doc->icon && strpos($this->doc->icon, 'default/') === false)
				{
					$this->removeIcon();
				}
				parent::storeValue($value, $type, $inputData);
			}
		}
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:83,代码来源:core_icon.php


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