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


PHP SpoonFilter::isFilename方法代码示例

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


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

示例1: testIsFilename

 public function testIsFilename()
 {
     $this->assertTrue(SpoonFilter::isFilename('test.tpl'));
     $this->assertTrue(SpoonFilter::isFilename('spoon_template.php'));
     $this->assertFalse(SpoonFilter::isFilename('/Users/bauffman/Desktop/test.txt'));
     // Simulating PHP < 5.4 behaviour
     $this->assertTrue(SpoonFilter::isFilename(array()));
 }
开发者ID:jeroendesloovere,项目名称:library,代码行数:8,代码来源:SpoonFilterTest.php

示例2: isFilename

 /**
  * Checks for a valid file name (including dots but no slashes and other forbidden characters).
  *
  * @return	bool
  * @param	string[optional] $error		The error message to set.
  */
 public function isFilename($error = null)
 {
     // filled
     if ($this->isFilled()) {
         // post/get data
         $data = $this->getMethod(true);
         // validate
         if (!isset($data[$this->attributes['name']]) || !SpoonFilter::isFilename($data[$this->attributes['name']])) {
             if ($error !== null) {
                 $this->setError($error);
             }
             return false;
         }
         return true;
     }
     // has error
     if ($error !== null) {
         $this->setError($error);
     }
     return false;
 }
开发者ID:szLuis,项目名称:oac,代码行数:27,代码来源:text.php

示例3: processContent

 /**
  * Function to store the actual content for either HTML or plain text.
  *
  * @param	string $content			The body of the e-mail you wish to send.
  * @param	array $variables		The variables to parse into the content.
  * @param	string[optional] $type	The e-mail type. Either 'html' or 'plain'.
  */
 private function processContent($content, $variables, $type = 'html')
 {
     // check for type
     $type = SpoonFilter::getValue($type, array('html', 'plain'), 'html');
     // exploded string
     $exploded = explode('/', str_replace('\\', '/', $content));
     $filename = end($exploded);
     // check if the string provided is a formatted as a file
     if (SpoonFilter::isFilename($filename) && preg_match('/^[\\S]+\\.\\w{2,3}[\\S]$/', $filename) && !strstr($filename, ' ')) {
         // check if template exists
         if (!SpoonFile::exists($content)) {
             throw new SpoonEmailException('Template not found. (' . $content . ')');
         }
         // store content
         $this->content[$type] = (string) $this->getTemplateContent($content, $variables);
     } else {
         // set the name for the temporary file
         $tempFile = $this->compileDirectory . '/' . md5(uniqid()) . '.tpl';
         // write temp file
         SpoonFile::setContent($tempFile, $content);
         // store content
         $this->content[$type] = (string) $this->getTemplateContent($tempFile, $variables);
         // delete the temporary
         SpoonFile::delete($tempFile);
     }
 }
开发者ID:richsage,项目名称:forkcms,代码行数:33,代码来源:email.php

示例4: isFilename

 /**
  * Checks for a valid file name (including dots but no slashes and other forbidden characters).
  *
  * @return	bool
  * @param	string[optional] $error		The error message to set.
  */
 public function isFilename($error = null)
 {
     // correct filename
     if ($this->isFilled() && SpoonFilter::isFilename($this->getFileName())) {
         return true;
     }
     // has error
     if ($error !== null) {
         $this->setError($error);
     }
     return false;
 }
开发者ID:sunkangtaichi,项目名称:library,代码行数:18,代码来源:file.php

示例5: testIsFilename

 public function testIsFilename()
 {
     $this->assertTrue(SpoonFilter::isFilename('test.tpl'));
     $this->assertTrue(SpoonFilter::isFilename('spoon_template.php'));
     $this->assertFalse(SpoonFilter::isFilename('/Users/bauffman/Desktop/test.txt'));
 }
开发者ID:sunkangtaichi,项目名称:library,代码行数:6,代码来源:SpoonFilterTest.php


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