• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CFileHelper类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: _installExampleTemplates

 /**
  * Install templates
  *
  * @return void
  */
 private function _installExampleTemplates()
 {
     try {
         $fileHelper = new \CFileHelper();
         @mkdir(craft()->path->getSiteTemplatesPath() . 'sproutemail');
         $fileHelper->copyDirectory(craft()->path->getPluginsPath() . 'sproutemail/templates/_special/examples/emails', craft()->path->getSiteTemplatesPath() . 'sproutemail');
     } catch (\Exception $e) {
         $this->_handleError($e);
     }
 }
开发者ID:aladrach,项目名称:Bluefoot-Craft-Starter,代码行数:15,代码来源:SproutEmail_ExamplesController.php


示例2: run

 public function run($args = null)
 {
     $theme = $args[0];
     $themePath = realpath(dirname(__FILE__) . '/../../themes') . DIRECTORY_SEPARATOR . $theme;
     if (!file_exists($themePath)) {
         mkdir($themePath);
         mkdir($themePath . '/views');
     }
     // Find all modules views and copy to theme directory
     $files = glob(realpath(dirname(__FILE__) . '/../') . '/modules/*', GLOB_ONLYDIR);
     foreach ($files as $file) {
         $parts = explode('/', $file);
         $module = end($parts);
         $moduleThemePath = $themePath . '/views/' . $module;
         $moduleViews = glob($file . '/views/*', GLOB_ONLYDIR);
         foreach ($moduleViews as $viewsDirPath) {
             $parts = explode('/', $viewsDirPath);
             if (end($parts) != 'admin') {
                 if (!file_exists($moduleThemePath)) {
                     mkdir($moduleThemePath);
                 }
                 CFileHelper::copyDirectory($viewsDirPath, $moduleThemePath . '/' . end($parts));
             }
         }
     }
 }
开发者ID:Aplay,项目名称:Fastreview_site,代码行数:26,代码来源:ThemeCommand.php


示例3: run

 public function run($args = null)
 {
     $theme = $args[0];
     $themePath = realpath(dirname(__FILE__) . '/../../themes') . '/' . $theme;
     if (!file_exists($themePath)) {
         mkdir($themePath);
         mkdir($themePath . '/views');
     }
     // Find all modules views and copy to theme directory
     $files = glob(realpath(dirname(__FILE__) . '/../') . '/modules/*', GLOB_ONLYDIR);
     foreach ($files as $file) {
         $parts = explode('/', $file);
         $module = end($parts);
         // Don't copy next modules to theme dir.
         if (in_array($module, array('admin', 'install', 'rights'))) {
             continue;
         }
         $moduleThemePath = $themePath . '/views/' . $module;
         $moduleViews = glob($file . '/views/*', GLOB_ONLYDIR);
         foreach ($moduleViews as $viewsDirPath) {
             $parts = explode('/', $viewsDirPath);
             if (end($parts) != 'admin') {
                 if (!file_exists($moduleThemePath)) {
                     mkdir($moduleThemePath, 0777, true);
                 }
                 CFileHelper::copyDirectory($viewsDirPath, $moduleThemePath . '/' . end($parts));
             }
         }
     }
 }
开发者ID:kolbensky,项目名称:rybolove,代码行数:30,代码来源:ThemeCommand.php


示例4: getModels

 protected function getModels()
 {
     $models = array();
     $files = scandir(Yii::getPathOfAlias('application.models'));
     foreach ($files as $file) {
         if ($file[0] !== '.' && CFileHelper::getExtension($file) === 'php') {
             $fileClassName = substr($file, 0, strpos($file, '.'));
             if (class_exists($fileClassName) && is_subclass_of($fileClassName, 'GiiyActiveRecord')) {
                 $fileClass = new ReflectionClass($fileClassName);
                 if (!$fileClass->isAbstract() && !is_array(GiiyActiveRecord::model($fileClassName)->getPrimaryKey())) {
                     $models[] = $fileClassName;
                 }
             }
         }
     }
     foreach (Yii::app()->getModules() as $module => $moduleConf) {
         if (Yii::getPathOfAlias($module . '.models')) {
             $files = scandir(Yii::getPathOfAlias($module . '.models'));
             foreach ($files as $file) {
                 if ($file[0] !== '.' && CFileHelper::getExtension($file) === 'php') {
                     $fileClassName = substr($file, 0, strpos($file, '.'));
                     if (class_exists($fileClassName) && is_subclass_of($fileClassName, 'GiiyActiveRecord')) {
                         $fileClass = new ReflectionClass($fileClassName);
                         if (!$fileClass->isAbstract() && !is_array(GiiyActiveRecord::model($fileClassName)->getPrimaryKey())) {
                             $models[] = $fileClassName;
                         }
                     }
                 }
             }
         }
     }
     return $models;
 }
开发者ID:schyzoo,项目名称:giiy,代码行数:33,代码来源:GiiyCrudGenerator.php


示例5: prepare

 public function prepare()
 {
     $this->files = array();
     $templatePath = $this->templatePath;
     $modulePath = $this->modulePath;
     $moduleTemplateFile = $templatePath . DIRECTORY_SEPARATOR . 'module.php';
     $this->files[] = new CCodeFile($modulePath . '/' . $this->moduleClass . '.php', $this->render($moduleTemplateFile));
     $files = CFileHelper::findFiles($templatePath, array('exclude' => array('.svn', '.gitignore')));
     foreach ($files as $file) {
         if ($file !== $moduleTemplateFile && !$this->isIgnireFile($file)) {
             if (CFileHelper::getExtension($file) === 'php') {
                 $content = $this->render($file);
             } elseif (basename($file) === '.gitkeep') {
                 $file = dirname($file);
                 $content = null;
             } else {
                 $content = file_get_contents($file);
             }
             $modifiedFile = $this->getModifiedFile($file);
             if ($modifiedFile !== false) {
                 $file = $modifiedFile;
             }
             $this->files[] = new CCodeFile($modulePath . substr($file, strlen($templatePath)), $content);
         }
     }
 }
开发者ID:alextravin,项目名称:yupe,代码行数:26,代码来源:YupeModuleCode.php


示例6: prepare

 public function prepare()
 {
     $this->files = array();
     $templatePath = $this->templatePath;
     $modulePath = $this->modulePath;
     $moduleTemplateFile = $templatePath . DIRECTORY_SEPARATOR . 'module.php';
     $this->files[] = new CCodeFile($modulePath . '/' . $this->moduleClass . '.php', $this->render($moduleTemplateFile));
     $files = CFileHelper::findFiles($templatePath, array('exclude' => array('.svn')));
     foreach ($files as $file) {
         if ($file !== $moduleTemplateFile) {
             if (CFileHelper::getExtension($file) === 'php') {
                 $content = $this->render($file);
             } else {
                 if (basename($file) === '.yii') {
                     // an empty directory
                     $file = dirname($file);
                     $content = null;
                 } else {
                     $content = file_get_contents($file);
                 }
             }
             $this->files[] = new CCodeFile($modulePath . substr($file, strlen($templatePath)), $content);
         }
     }
 }
开发者ID:code-4-england,项目名称:OpenEyes,代码行数:25,代码来源:BaseModuleCode.php


示例7: run

 public function run($attr)
 {
     $name = strtolower($this->getController()->getId());
     $attribute = strtolower((string) $attr);
     if ($this->uploadPath === null) {
         $path = Yii::app()->basePath . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'uploads';
         $this->uploadPath = realpath($path);
         if ($this->uploadPath === false) {
             exit;
         }
     }
     if ($this->uploadUrl === null) {
         $this->uploadUrl = Yii::app()->request->baseUrl . '/uploads';
     }
     $attributePath = $this->uploadPath . DIRECTORY_SEPARATOR . $name . DIRECTORY_SEPARATOR . $attribute;
     $attributeUrl = $this->uploadUrl . '/' . $name . '/' . $attribute . '/';
     $files = CFileHelper::findFiles($attributePath, array('fileTypes' => array('gif', 'png', 'jpg', 'jpeg')));
     $data = array();
     if ($files) {
         foreach ($files as $file) {
             $data[] = array('thumb' => $attributeUrl . basename($file), 'image' => $attributeUrl . basename($file));
         }
     }
     echo CJSON::encode($data);
     exit;
 }
开发者ID:RodolfoRobles,项目名称:SiteNayarit,代码行数:26,代码来源:ImageList.php


示例8: afterSave

 public function afterSave($event)
 {
     if (!empty($_FILES)) {
         $model = $this->getOwner();
         $file = new File();
         $file->filename = UploadUtils::createUniquefilename($_FILES[self::NAME]['name'], UploadUtils::getPath(self::$fileDir));
         if (move_uploaded_file($_FILES[self::NAME]['tmp_name'], UploadUtils::getPath(self::$fileDir) . DIRECTORY_SEPARATOR . $file->filename)) {
             $file->entity = get_class($model);
             $file->EXid = $model->getPrimaryKey();
             $file->uid = Yii::app()->user->id;
             $file->tag = $this->tag;
             $file->weight = 0;
             $file->timestamp = time();
             $file->filemime = CFileHelper::getMimeTypeByExtension($_FILES[self::NAME]['name']);
             $file->filesize = $_FILES[self::NAME]['size'];
             $file->status = File::STATUS_SAVED;
             // Ensure all other files of the entity are deleted
             //UploadUtils::deleteAllFiles(get_class($this->getOwner()), self::$fileDir);
             if ($file->save()) {
                 Yii::trace("File saved " . $file . "!!!!");
             } else {
                 Yii::log("Could not save File " . print_r($file->getErrors(), true), CLogger::LEVEL_ERROR);
             }
         } else {
             Yii::log("Couldnt move the file", CLogger::LEVEL_ERROR);
         }
     } else {
         Yii::log("Files empty!!!", CLogger::LEVEL_ERROR);
     }
 }
开发者ID:CHILMEX,项目名称:amocasion,代码行数:30,代码来源:SimpleUploadWidget.php


示例9: run

 public function run($thumb)
 {
     $key = key($_GET);
     if (NULL == ($file = Files::model()->findByPk($key))) {
         throw new CException('Page not found', 404);
     }
     $path = Yii::getPathOfAlias('webroot') . DIRECTORY_SEPARATOR . 'upload' . DIRECTORY_SEPARATOR . 'photos';
     $src_file = $file->id . '.' . $file->extension;
     $in_file = $path . DIRECTORY_SEPARATOR . $src_file;
     $out_file = $path . DIRECTORY_SEPARATOR . $thumb . DIRECTORY_SEPARATOR . $src_file;
     if (is_file($out_file)) {
         $mime = CFileHelper::getMimeType($out_file);
         header('Content-Type: ' . $mime);
         readfile($out_file);
         exit;
     }
     if (is_file($in_file)) {
         $dir = $path . DIRECTORY_SEPARATOR . $thumb;
         if (YII_DEBUG && !file_exists($dir)) {
             mkdir($dir, 0777);
         }
         if (file_exists($dir)) {
             if (($out_file = $file->resize($thumb)) == 0) {
                 throw new CException('Page not found', 404);
             }
             $mime = CFileHelper::getMimeType($in_file);
             header('Content-Type: ' . $mime);
             readfile($out_file);
             exit;
         }
     }
     return parent::run($thumb);
 }
开发者ID:BGCX067,项目名称:facecom-svn-to-git,代码行数:33,代码来源:ImagesController.php


示例10: up

 public function up()
 {
     CFileHelper::removeDirectory(Yii::app()->basePath . "/components/dashboard/");
     CFileHelper::removeDirectory(Yii::app()->basePath . "/../update/");
     CFileHelper::removeDirectory(Yii::app()->basePath . "/../assets/lib/chosen/");
     $this->update('openformat', array("export" => "this.reg_date", "import" => 'this.reg_date'), "id='1362'");
 }
开发者ID:hkhateb,项目名称:linet3,代码行数:7,代码来源:m301120_250215_0031.php


示例11: actionGet

 public function actionGet()
 {
     $dir = Yii::getPathOfAlias(Yii::app()->params['sharedMemory']['flushDirectory']);
     $files = CFileHelper::findFiles($dir, array('fileTypes' => array(Yii::app()->params['sharedMemory']['flushExtension'])));
     if (isset($files[0])) {
         $size = filesize($files[0]);
         $file = fopen($files[0], 'r');
         $descriptor = $files[0] . ".descr";
         if (is_file($descriptor)) {
             $descr = fopen($descriptor, "r");
             $pos = fread($descr, filesize($descriptor));
             fclose($descr);
         } else {
             $pos = 0;
         }
         fseek($file, $pos);
         $content = fread($file, self::CHUNK_SIZE);
         $position = strrpos($content, '##') + 2;
         $pos += $position;
         echo substr($content, 0, $position);
         fclose($file);
         $descr = fopen($descriptor, "w");
         fwrite($descr, $pos);
         fclose($descr);
         if ($pos >= $size) {
             unlink($files[0]);
             unlink($descriptor);
         }
         Yii::app()->end();
     }
 }
开发者ID:niranjan2m,项目名称:Voyanga,代码行数:31,代码来源:SyncController.php


示例12: actionUpload

 /**
  * Feltölt egy fájlt a megadott tantárgyhoz.
  * @param int $id A tantárgy azonosítója
  */
 public function actionUpload($id)
 {
     if (!Yii::app()->user->getId()) {
         throw new CHttpException(403, 'A funkció használatához be kell jelentkeznie');
     }
     $id = (int) $id;
     $file = CUploadedFile::getInstanceByName("to_upload");
     if ($file == null) {
         throw new CHttpException(404, 'Nem lett fájl kiválasztva a feltöltéshez');
     }
     $filename = $file->getName();
     $localFileName = sha1($filename . microtime()) . "." . CFileHelper::getExtension($filename);
     if (in_array(strtolower(CFileHelper::getExtension($filename)), Yii::app()->params["deniedexts"])) {
         throw new CHttpException(403, ucfirst(CFileHelper::getExtension($filename)) . ' kiterjesztésű fájl nem tölthető fel a szerverre');
     }
     $model = new File();
     $model->subject_id = $id;
     $model->filename_real = $filename;
     $model->filename_local = $localFileName;
     $model->description = htmlspecialchars($_POST["description"]);
     $model->user_id = Yii::app()->user->getId();
     $model->date_created = new CDbExpression('NOW()');
     $model->date_updated = new CDbExpression('NOW()');
     $model->downloads = 0;
     $model->save();
     if ($file->saveAs("upload/" . $localFileName)) {
         $this->redirect(Yii::App()->createUrl("file/list", array("id" => $id)));
     }
 }
开发者ID:std66,项目名称:de-pti,代码行数:33,代码来源:FileController.php


示例13: actionImagelist

 public function actionImagelist($attr)
 {
     $attribute = strtolower($attr);
     $uploadPath = Yii::app()->basePath . '/../images';
     $uploadUrl = bu('images');
     if ($uploadPath === null) {
         $path = Yii::app()->basePath . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'uploads';
         $uploadPath = realpath($path);
         if ($uploadPath === false) {
             exit;
         }
     }
     if ($uploadUrl === null) {
         $uploadUrl = Yii::app()->request->baseUrl . '/uploads';
     }
     $attributePath = $uploadPath . DIRECTORY_SEPARATOR . $attribute;
     $attributeUrl = $uploadUrl . '/' . $attribute . '/';
     $files = CFileHelper::findFiles($attributePath, array('fileTypes' => array('gif', 'png', 'jpg', 'jpeg'), 'level' => 0));
     $data = array();
     if ($files) {
         foreach ($files as $file) {
             $data[] = array('thumb' => $attributeUrl . basename($file), 'image' => $attributeUrl . basename($file));
         }
     }
     echo CJSON::encode($data);
     exit;
 }
开发者ID:Telemedellin,项目名称:tm,代码行数:27,代码来源:PaginaController.php


示例14: actionIndex

 public function actionIndex($path = null, $fix = null)
 {
     if ($path === null) {
         $path = YII_PATH;
     }
     echo "Checking {$path} for files with BOM.\n";
     $checkFiles = CFileHelper::findFiles($path, array('exclude' => array('.gitignore')));
     $detected = false;
     foreach ($checkFiles as $file) {
         $fileObj = new SplFileObject($file);
         if (!$fileObj->eof() && false !== strpos($fileObj->fgets(), self::BOM)) {
             if (!$detected) {
                 echo "Detected BOM in:\n";
                 $detected = true;
             }
             echo $file . "\n";
             if ($fix) {
                 file_put_contents($file, substr(file_get_contents($file), 3));
             }
         }
     }
     if (!$detected) {
         echo "No files with BOM were detected.\n";
     } else {
         if ($fix) {
             echo "All files were fixed.\n";
         }
     }
 }
开发者ID:super-d2,项目名称:codeigniter_demo,代码行数:29,代码来源:CheckBomCommand.php


示例15: run

 /**
  * Execute the action.
  * @param array command line parameters specific for this command
  */
 public function run($args)
 {
     if (!isset($args[0])) {
         $this->usageError('the CLDR data directory is not specified.');
     }
     if (!is_dir($path = $args[0])) {
         $this->usageError("directory '{$path}' does not exist.");
     }
     // collect XML files to be processed
     $options = array('exclude' => array('.svn'), 'fileTypes' => array('xml'), 'level' => 0);
     $files = CFileHelper::findFiles(realpath($path), $options);
     $sourceFiles = array();
     foreach ($files as $file) {
         $sourceFiles[basename($file)] = $file;
     }
     // sort by file name so that inheritances can be processed properly
     ksort($sourceFiles);
     // process root first because it is inherited by all
     if (isset($sourceFiles['root.xml'])) {
         $this->process($sourceFiles['root.xml']);
         unset($sourceFiles['root.xml']);
         foreach ($sourceFiles as $sourceFile) {
             $this->process($sourceFile);
         }
     } else {
         die('Unable to find the required root.xml under CLDR data directory.');
     }
 }
开发者ID:kdambekalns,项目名称:framework-benchs,代码行数:32,代码来源:CldrCommand.php


示例16: run

 public function run($class_name)
 {
     $path = realpath(Yii::app()->basePath . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'upload' . DIRECTORY_SEPARATOR . $class_name);
     $class_name = ucfirst($class_name);
     if ($path && is_dir($path) && is_writable($path)) {
         $dir = key($_GET);
         $filename = $_GET[$dir];
         $pk = pathinfo($filename, PATHINFO_FILENAME);
         $image = Images::model()->findByPk($pk);
         if ($image != null) {
             $image->resize($dir);
         }
     } elseif (class_exists($class_name)) {
         $dir = key($_GET);
         $filename = $_GET[$dir];
         $size = explode('x', $dir);
         $path = realpath(Yii::app()->basePath . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'upload' . DIRECTORY_SEPARATOR . $class_name);
         if (YII_DEBUG && !file_exists($path . DIRECTORY_SEPARATOR . $dir)) {
             mkdir($path . DIRECTORY_SEPARATOR . $dir, 0777);
         }
         if ($path !== FALSE && file_exists($path . DIRECTORY_SEPARATOR . $dir) && is_file($path . DIRECTORY_SEPARATOR . $filename) && $size[0] > 0 && $size[1] > 0) {
             Yii::import('ext.iwi.Iwi');
             $image = new Iwi($path . DIRECTORY_SEPARATOR . $filename);
             $image->adaptive($size[0], $size[1]);
             $image->save($path . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR . $filename, 0644, TRUE);
             $mime = CFileHelper::getMimeType($path . DIRECTORY_SEPARATOR . $filename);
             header('Content-Type: ' . $mime);
             $image->render();
             exit;
         }
     }
     return parent::run($class_name);
 }
开发者ID:BGCX067,项目名称:facecom-svn-to-git,代码行数:33,代码来源:UploadController.php


示例17: prepare

 public function prepare()
 {
     $this->files = array();
     $templatePath = $this->templatePath;
     $controllerTemplateFile = $templatePath . DIRECTORY_SEPARATOR . 'controller.php';
     $this->files[] = new CCodeFile($this->controllerFile, $this->render($controllerTemplateFile));
     $this->files[] = new CCodeFile(str_replace("Controller.php", "AdminController.php", $this->controllerFile), $this->render(str_replace("controller.php", "adminController.php", $controllerTemplateFile)));
     $files = scandir($templatePath);
     foreach ($files as $file) {
         if (is_file($templatePath . '/' . $file) && CFileHelper::getExtension($file) === 'php' && $file !== 'controller.php') {
             $path = $this->viewPath . DIRECTORY_SEPARATOR . $file;
             if ($file == "adminController.php") {
                 continue;
             }
             if ($file == "form.php") {
                 //                    $path = str_replace('\\', '/', $path);
                 //
                 //                    $path_params = str_replace(
                 //                        array("/form.php", MODULES_PATH),
                 //                        null,
                 //                        $path
                 //                    );
                 //
                 //                    $path_params = explode("/", $path_params);
                 //
                 //                    $module_name = $path_params[0];
                 //                    $model_name  = ucfirst($path_params[2]);
                 //
                 //                    $module_dir = MODULES_PATH . $module_name . "/";
                 //
                 //                    $forms_dir = $module_dir . "forms/";
                 //
                 //
                 //                    if (!is_dir($forms_dir))
                 //                    {
                 //                        mkdir($forms_dir);
                 //                        chmod($forms_dir, 0777);
                 //                    }
                 //
                 //                    $path = $forms_dir . $model_name . "Form.php";
             }
             $this->files[] = new CCodeFile($path, $this->render($templatePath . '/' . $file));
         }
     }
     $templatePath = $templatePath . "/admin/";
     $viewPath = $this->viewPath . "Admin/";
     //        if (!is_dir($viewPath))
     //        {
     //            mkdir($viewPath);
     //            chmod($viewPath, 0777);
     //        }
     $files = scandir($templatePath);
     foreach ($files as $file) {
         if ($file[0] == ".") {
             continue;
         }
         $path = $viewPath . $file;
         $this->files[] = new CCodeFile($path, $this->render($templatePath . '/' . $file));
     }
 }
开发者ID:nizsheanez,项目名称:alp.ru,代码行数:60,代码来源:CrudCode.php


示例18: run

 /**
  * Execute the action.
  * @param array command line parameters specific for this command
  */
 public function run($args)
 {
     $options = array('fileTypes' => array('php'), 'exclude' => array('.gitignore', '/messages', '/views', '/cli', '/yii.php', '/yiit.php', '/yiilite.php', '/web/js', '/vendors', '/i18n/data', '/utils/mimeTypes.php', '/test', '/zii', '/gii'));
     $files = CFileHelper::findFiles(YII_PATH, $options);
     $map = array();
     foreach ($files as $file) {
         if (($pos = strpos($file, YII_PATH)) !== 0) {
             die("Invalid file '{$file}' found.");
         }
         $path = str_replace('\\', '/', substr($file, strlen(YII_PATH)));
         $className = substr(basename($path), 0, -4);
         if ($className[0] === 'C') {
             $map[$path] = "\t\t'{$className}' => '{$path}',\n";
         }
     }
     ksort($map);
     $map = implode($map);
     $yiiBase = file_get_contents(YII_PATH . '/YiiBase.php');
     $newYiiBase = preg_replace('/private\\s+static\\s+\\$_coreClasses\\s*=\\s*array\\s*\\([^\\)]*\\)\\s*;/', "private static \$_coreClasses=array(\n{$map}\t);", $yiiBase);
     if ($yiiBase !== $newYiiBase) {
         file_put_contents(YII_PATH . '/YiiBase.php', $newYiiBase);
         echo "YiiBase.php is updated successfully.\n";
     } else {
         echo "Nothing changed.\n";
     }
 }
开发者ID:super-d2,项目名称:codeigniter_demo,代码行数:30,代码来源:AutoloadCommand.php


示例19: isAllowedType

 /**
  * @param CUploadedFile $image
  * @return bool
  */
 public static function isAllowedType(CUploadedFile $image)
 {
     $type = CFileHelper::getMimeType($image->getTempName());
     if (!$type) {
         $type = CFileHelper::getMimeTypeByExtension($image->getName());
     }
     return in_array($type, EventsImagesConfig::get('types'));
 }
开发者ID:bahdall,项目名称:karbella_event,代码行数:12,代码来源:EventsUploadedImage.php


示例20: isAllowedType

 /**
  * @param CUploadedFile $image
  * @return bool
  */
 public static function isAllowedType(CUploadedFile $image)
 {
     $type = CFileHelper::getMimeType($image->getTempName());
     if (!$type) {
         $type = CFileHelper::getMimeTypeByExtension($image->getName());
     }
     return in_array($type, array('image/gif', 'image/jpeg', 'image/pjpeg', 'image/png', 'image/x-png'));
 }
开发者ID:buildshop,项目名称:bs-common,代码行数:12,代码来源:ShopUploadedImage.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP CFileInput类代码示例发布时间:2022-05-23
下一篇:
PHP CFile类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap