本文整理匯總了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;
}
}