本文整理汇总了PHP中ClassLoader::ignoreMissingClasses方法的典型用法代码示例。如果您正苦于以下问题:PHP ClassLoader::ignoreMissingClasses方法的具体用法?PHP ClassLoader::ignoreMissingClasses怎么用?PHP ClassLoader::ignoreMissingClasses使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ClassLoader
的用法示例。
在下文中一共展示了ClassLoader::ignoreMissingClasses方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ignoreMissingClasses
public static function ignoreMissingClasses($ignore = true)
{
self::$ignoreMissingClasses = $ignore;
}
示例2: send
public function send()
{
ClassLoader::ignoreMissingClasses();
$this->application->processInstancePlugins('email-prepare-send', $this);
$this->application->processInstancePlugins('email-prepare-send/' . $this->relativeTemplatePath, $this);
if ($this->template) {
$originalLocale = $this->application->getLocale();
$emailLocale = Locale::getInstance($this->getLocale());
$this->application->setLocale($emailLocale);
$this->application->getLocale()->translationManager()->loadFile('User');
$this->application->loadLanguageFiles();
$smarty = $this->application->getRenderer()->getSmartyInstance();
foreach ($this->values as $key => $value) {
$smarty->assign($key, $value);
}
$router = $this->application->getRouter();
$smarty->assign('html', false);
$smarty->disableTemplateLocator();
$text = $smarty->fetch($this->template);
$smarty->enableTemplateLocator();
$parts = explode("\n", $text, 2);
$this->subject = array_shift($parts);
$this->setText(array_shift($parts));
// fix URLs
$this->text = str_replace('&', '&', $this->text);
if ($this->application->getConfig()->get('HTML_EMAIL')) {
$smarty->assign('html', true);
$html = array_pop(explode("\n", $smarty->fetch($this->template), 2));
$css = new EditedCssFile('email');
$smarty->assign('cssStyle', str_replace("\n", ' ', $css->getCode()));
$smarty->assign('messageHtml', $html);
$html = $smarty->fetch($this->getTemplatePath('htmlWrapper'));
$this->setHtml($html);
}
$this->application->setLocale($originalLocale);
}
$this->application->processInstancePlugins('email-before-send', $this);
$this->application->processInstancePlugins('email-before-send/' . $this->relativeTemplatePath, $this);
$this->message->setSubject($this->subject);
if ($this->html) {
preg_match_all('/\\#\\#([_\\-\\.a-zA-Z0-9\\/]+)\\#\\#/msU', $this->html, $matches);
$html = $this->html;
if (!empty($matches[1])) {
foreach ($matches[1] as $match) {
$html = str_replace('##' . $match . '##', $this->message->embed(Swift_Image::fromPath(ClassLoader::getRealPath('public.') . $match)), $html);
}
}
preg_match_all('/src\\=\\"([\\:_\\-\\.a-zA-Z0-9\\/]+)\\"/msU', $this->html, $matches);
if (!empty($matches[1])) {
foreach ($matches[1] as $match) {
if (substr($match, 0, 4) == 'http') {
if (substr($match, 0, strlen($this->url)) == $this->url) {
$match = substr($match, strlen($this->url));
}
}
if (!substr($match, 0, 4) == 'http') {
$match = $this->message->embed(Swift_Image::fromPath(ClassLoader::getRealPath('public.') . $match));
}
$html = str_replace('src="' . $match . '"', 'src="' . $match . '"', $html);
}
$html = str_replace('src="upload', 'src="' . $this->url . '/upload', $html);
}
$this->message->setBody($html, 'text/html');
}
if ($this->text) {
if (!$this->html) {
$this->message->setBody($this->text, 'text/plain');
} else {
$this->message->addPart($this->text, 'text/plain');
}
}
if (!$this->text && !$this->html) {
return false;
}
try {
$res = $this->swiftInstance->send($this->message);
ClassLoader::ignoreMissingClasses(false);
} catch (Exception $e) {
$this->application->processInstancePlugins('email-fail-send/' . $this->relativeTemplatePath, $this, array('exception' => $e));
$this->application->processInstancePlugins('email-fail-send', $this, array('exception' => $e));
ClassLoader::ignoreMissingClasses(false);
return false;
}
$this->application->processInstancePlugins('email-after-send/' . $this->relativeTemplatePath, $this);
$this->application->processInstancePlugins('email-after-send', $this);
return $res;
}
示例3: loadSession
private function loadSession()
{
ClassLoader::import("framework.request.Session");
// avoid unserialize failures (3rd party application instances, etc.)
ClassLoader::ignoreMissingClasses(true);
$this->session = new Session();
ClassLoader::ignoreMissingClasses(false);
return $this->session;
}
示例4: send
public function send()
{
ClassLoader::ignoreMissingClasses();
$this->application->processInstancePlugins('email-prepare-send', $this);
$this->application->processInstancePlugins('email-prepare-send/' . $this->relativeTemplatePath, $this);
if ($this->template) {
$originalLocale = $this->application->getLocale();
$emailLocale = Locale::getInstance($this->getLocale());
$this->application->setLocale($emailLocale);
$this->application->getLocale()->translationManager()->loadFile('User');
$this->application->loadLanguageFiles();
$smarty = $this->application->getRenderer()->getSmartyInstance();
foreach ($this->values as $key => $value) {
$smarty->assign($key, $value);
}
$router = $this->application->getRouter();
$smarty->assign('html', false);
$smarty->disableTemplateLocator();
$text = $smarty->fetch($this->template);
$smarty->enableTemplateLocator();
$parts = explode("\n", $text, 2);
$this->subject = array_shift($parts);
$this->setText(array_shift($parts));
// fix URLs
$this->text = str_replace('&', '&', $this->text);
if ($this->application->getConfig()->get('HTML_EMAIL')) {
$smarty->assign('html', true);
$html = array_pop(explode("\n", $smarty->fetch($this->template), 2));
$css = new EditedCssFile('email');
$smarty->assign('cssStyle', str_replace("\n", ' ', $css->getCode()));
$smarty->assign('messageHtml', $html);
$html = $smarty->fetch($this->getTemplatePath('htmlWrapper'));
$this->setHtml($html);
}
$this->application->setLocale($originalLocale);
}
$this->application->processInstancePlugins('email-before-send', $this);
$this->application->processInstancePlugins('email-before-send/' . $this->relativeTemplatePath, $this);
$this->message->setSubject($this->subject);
if ($this->html) {
$this->message->setBody($this->html, 'text/html');
}
if ($this->text) {
if (!$this->html) {
$this->message->setBody($this->text, 'text/plain');
} else {
$this->message->addPart($this->text, 'text/plain');
}
}
if (!$this->text && !$this->html) {
return false;
}
try {
$res = $this->swiftInstance->send($this->message);
ClassLoader::ignoreMissingClasses(false);
} catch (Exception $e) {
$this->application->processInstancePlugins('email-fail-send/' . $this->relativeTemplatePath, $this, array('exception' => $e));
$this->application->processInstancePlugins('email-fail-send', $this, array('exception' => $e));
ClassLoader::ignoreMissingClasses(false);
return false;
}
$this->application->processInstancePlugins('email-after-send/' . $this->relativeTemplatePath, $this);
$this->application->processInstancePlugins('email-after-send', $this);
return $res;
}