本文整理汇总了PHP中Model_Ad::is_valid_file方法的典型用法代码示例。如果您正苦于以下问题:PHP Model_Ad::is_valid_file方法的具体用法?PHP Model_Ad::is_valid_file怎么用?PHP Model_Ad::is_valid_file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Model_Ad
的用法示例。
在下文中一共展示了Model_Ad::is_valid_file方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: content
/**
* sends an email using content from model_content
* @param string $to
* @param string $to_name
* @param string $from
* @param string $from_name
* @param string $content seotitle from Model_Content
* @param array $replace key value to replace at subject and body
* @param array $file file to attach to email
* @return boolean s
*/
public static function content($to, $to_name = '', $from = NULL, $from_name = NULL, $content, $replace, $file = NULL)
{
$email = Model_Content::get($content, 'email');
$ad_obj = new Model_Ad();
//content found
if ($email->loaded()) {
if ($replace === NULL) {
$replace = array();
}
if ($from === NULL) {
$from = $email->from_email;
}
if ($from_name === NULL) {
$from_name = core::config('general.site_name');
}
if (isset($file) and $ad_obj->is_valid_file($file)) {
$file_upload = $file;
} else {
$file_upload = NULL;
}
//adding extra replaces
$replace += array('[SITE.NAME]' => core::config('general.site_name'), '[SITE.URL]' => core::config('general.base_url'), '[USER.NAME]' => $to_name, '[USER.EMAIL]' => $to);
//adding anchor tags to any [URL.* match
foreach ($replace as $key => $value) {
if (strpos($key, '[URL.') === 0 or $key == '[SITE.URL]') {
$replace[$key] = '[url=' . $value . ']' . $value . '[/url]';
}
}
$subject = str_replace(array_keys($replace), array_values($replace), $email->title);
$body = str_replace(array_keys($replace), array_values($replace), $email->description);
return Email::send($to, $to_name, $subject, $body, $from, $from_name, $file_upload);
} else {
return FALSE;
}
}