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


PHP JUDirectoryHelper::fileNameFilter方法代码示例

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


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

示例1: addIcon

 protected function addIcon($image, $locationTable)
 {
     if ($image['name']) {
         $mime_types = array("image/jpeg", "image/pjpeg", "image/png", "image/gif", "image/bmp", "image/x-windows-bmp");
         if (in_array($image['type'], $mime_types)) {
             $this->removeIcon($locationTable);
             $imageOriginalDirectory = JPATH_ROOT . "/media/com_judirectory/images/location/original/" . $this->listing_id . "/";
             $imageDirectory = JPATH_ROOT . "/media/com_judirectory/images/location/" . $this->listing_id . "/";
             if (!JFolder::exists($imageOriginalDirectory)) {
                 $file_index = $imageOriginalDirectory . 'index.html';
                 $buffer = "<!DOCTYPE html><title></title>";
                 JFile::write($file_index, $buffer);
             }
             if (!JFolder::exists($imageDirectory)) {
                 $file_index = $imageDirectory . 'index.html';
                 $buffer = "<!DOCTYPE html><title></title>";
                 JFile::write($file_index, $buffer);
             }
             $image_file_name = $locationTable->id . "_" . JUDirectoryHelper::fileNameFilter($image['name']);
             if (JFile::upload($image['tmp_name'], $imageOriginalDirectory . $image_file_name) && JUDirectoryHelper::renderImages($imageOriginalDirectory . $image_file_name, $imageDirectory . $image_file_name, 'location_image', true, null, $this->listing_id)) {
                 $locationTable->image = $image_file_name;
                 $locationTable->store();
             }
         } else {
             JError::raise(E_NOTICE, 500, JText::sprintf('COM_JUDIRECTORY_LOCATION_ICON_IS_NOT_VALID_MIME_TYPE', implode(",", $mime_types)));
         }
     }
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:28,代码来源:core_locations.php

示例2: onImport

 public function onImport($value, &$message = '')
 {
     $imageDir = JPATH_ROOT . '/' . JUDirectoryFrontHelper::getDirectory('listing_image_directory', 'media/com_judirectory/images/listing/');
     $originalDir = $imageDir . 'original/';
     $imagePath = JUDirectoryHelper::getPhysicalPath($value);
     $oldImagePath = '';
     if (!$this->is_new && $this->listing->image) {
         $oldImagePath = JPath::clean($originalDir . $this->listing->image);
     }
     if ($imagePath != $oldImagePath) {
         if ($imagePath && JFile::exists($imagePath)) {
             if (JFile::exists($oldImagePath)) {
                 JFile::delete($imageDir . $this->listing->image);
                 JFile::delete($originalDir . $this->listing->image);
             }
             $imageName = basename($imagePath);
             $imageName = $this->listing_id . "_" . JUDirectoryHelper::fileNameFilter($imageName);
             JFile::copy($imagePath, $originalDir . $imageName);
             JUDirectoryHelper::renderImages($originalDir . $imageName, $imageDir . $imageName, 'listing_image', true, null, $this->listing_id);
             $value = $imageName;
             return basename($value);
         } else {
             $message = $value . JText::_(' does not exist');
         }
     }
     return false;
 }
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:27,代码来源:core_image.php


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