本文整理汇总了PHP中Shop::getTheme方法的典型用法代码示例。如果您正苦于以下问题:PHP Shop::getTheme方法的具体用法?PHP Shop::getTheme怎么用?PHP Shop::getTheme使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Shop
的用法示例。
在下文中一共展示了Shop::getTheme方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTemplate
/**
* If the template is not present in the theme directory, it will return the default template
* in _PS_PDF_DIR_ directory
*
* @param $template_name
*
* @return string
*/
protected function getTemplate($template_name)
{
$template = false;
$default_template = rtrim(_PS_PDF_DIR_, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $template_name . '.tpl';
$overridden_template = _PS_ALL_THEMES_DIR_ . $this->shop->getTheme() . DIRECTORY_SEPARATOR . 'pdf' . DIRECTORY_SEPARATOR . $template_name . '.tpl';
if (file_exists($overridden_template)) {
$template = $overridden_template;
} elseif (file_exists($default_template)) {
$template = $default_template;
}
return $template;
}
示例2: Send
/**
* Send Email
*
* @param int $id_lang Language of the email (to translate the template)
* @param string $template Template: the name of template not be a var but a string !
* @param string $subject
* @param string $template_vars
* @param string $to
* @param string $to_name
* @param string $from
* @param string $from_name
* @param array $file_attachment Array with three parameters (content, mime and name). You can use an array of array to attach multiple files
* @param bool $modeSMTP
* @param string $template_path
* @param bool $die
*/
public static function Send($id_lang, $template, $subject, $template_vars, $to, $to_name = null, $from = null, $from_name = null, $file_attachment = null, $mode_smtp = null, $template_path = _PS_MAIL_DIR_, $die = false, $id_shop = null)
{
$theme_path = _PS_THEME_DIR_;
// Get the path of theme by id_shop if exist
if (is_numeric($id_shop) && $id_shop) {
$shop = new Shop((int) $id_shop);
$theme_name = $shop->getTheme();
if (_THEME_NAME_ != $theme_name) {
$theme_path = _PS_ROOT_DIR_ . '/themes/' . $theme_name . '/';
}
}
$configuration = Configuration::getMultiple(array('PS_SHOP_EMAIL', 'PS_MAIL_METHOD', 'PS_MAIL_SERVER', 'PS_MAIL_USER', 'PS_MAIL_PASSWD', 'PS_SHOP_NAME', 'PS_MAIL_SMTP_ENCRYPTION', 'PS_MAIL_SMTP_PORT', 'PS_MAIL_METHOD', 'PS_MAIL_TYPE'));
if (!isset($configuration['PS_MAIL_SMTP_ENCRYPTION'])) {
$configuration['PS_MAIL_SMTP_ENCRYPTION'] = 'off';
}
if (!isset($configuration['PS_MAIL_SMTP_PORT'])) {
$configuration['PS_MAIL_SMTP_PORT'] = 'default';
}
// Sending an e-mail can be of vital importance for the merchant, when his password is lost for example, so we must not die but do our best to send the e-mail
if (!isset($from) || !Validate::isEmail($from)) {
$from = $configuration['PS_SHOP_EMAIL'];
}
if (!Validate::isEmail($from)) {
$from = null;
}
// $from_name is not that important, no need to die if it is not valid
if (!isset($from_name) || !Validate::isMailName($from_name)) {
$from_name = $configuration['PS_SHOP_NAME'];
}
if (!Validate::isMailName($from_name)) {
$from_name = null;
}
// It would be difficult to send an e-mail if the e-mail is not valid, so this time we can die if there is a problem
if (!is_array($to) && !Validate::isEmail($to)) {
Tools::dieOrLog(Tools::displayError('Error: parameter "to" is corrupted'), $die);
return false;
}
if (!is_array($template_vars)) {
$template_vars = array();
}
// Do not crash for this error, that may be a complicated customer name
if (is_string($to_name) && !empty($to_name) && !Validate::isMailName($to_name)) {
$to_name = null;
}
if (!Validate::isTplName($template)) {
Tools::dieOrLog(Tools::displayError('Error: invalid e-mail template'), $die);
return false;
}
if (!Validate::isMailSubject($subject)) {
Tools::dieOrLog(Tools::displayError('Error: invalid e-mail subject'), $die);
return false;
}
/* Construct multiple recipients list if needed */
if (is_array($to) && isset($to)) {
$to_list = new Swift_RecipientList();
foreach ($to as $key => $addr) {
$to_name = null;
$addr = trim($addr);
if (!Validate::isEmail($addr)) {
Tools::dieOrLog(Tools::displayError('Error: invalid e-mail address'), $die);
return false;
}
if (is_array($to_name)) {
if ($to_name && is_array($to_name) && Validate::isGenericName($to_name[$key])) {
$to_name = $to_name[$key];
}
}
if ($to_name == null) {
$to_name = $addr;
}
/* Encode accentuated chars */
$to_list->addTo($addr, '=?UTF-8?B?' . base64_encode($to_name) . '?=');
}
$to_plugin = $to[0];
$to = $to_list;
} else {
/* Simple recipient, one address */
$to_plugin = $to;
if ($to_name == null) {
$to_name = $to;
}
$to = new Swift_Address($to, '=?UTF-8?B?' . base64_encode($to_name) . '?=');
}
try {
//.........这里部分代码省略.........
示例3: Send
/**
* Send Email
*
* @param int $id_lang Language of the email (to translate the template)
* @param string $template Template: the name of template not be a var but a string !
* @param string $subject
* @param string $template_vars
* @param string $to
* @param string $to_name
* @param string $from
* @param string $from_name
* @param array $file_attachment Array with three parameters (content, mime and name). You can use an array of array to attach multiple files
* @param bool $modeSMTP
* @param string $template_path
* @param bool $die
* @param string $bcc Bcc recipient
*/
public static function Send($id_lang, $template, $subject, $template_vars, $to, $to_name = null, $from = null, $from_name = null, $file_attachment = null, $mode_smtp = null, $template_path = _PS_MAIL_DIR_, $die = false, $id_shop = null, $bcc = null)
{
$configuration = Configuration::getMultiple(array('PS_SHOP_EMAIL', 'PS_MAIL_METHOD', 'PS_MAIL_SERVER', 'PS_MAIL_USER', 'PS_MAIL_PASSWD', 'PS_SHOP_NAME', 'PS_MAIL_SMTP_ENCRYPTION', 'PS_MAIL_SMTP_PORT', 'PS_MAIL_TYPE'), null, null, $id_shop);
// Returns immediatly if emails are deactivated
if ($configuration['PS_MAIL_METHOD'] == 3) {
return true;
}
$theme_path = _PS_THEME_DIR_;
// Get the path of theme by id_shop if exist
if (is_numeric($id_shop) && $id_shop) {
$shop = new Shop((int) $id_shop);
$theme_name = $shop->getTheme();
if (_THEME_NAME_ != $theme_name) {
$theme_path = _PS_ROOT_DIR_ . '/themes/' . $theme_name . '/';
}
}
if (!isset($configuration['PS_MAIL_SMTP_ENCRYPTION'])) {
$configuration['PS_MAIL_SMTP_ENCRYPTION'] = 'off';
}
if (!isset($configuration['PS_MAIL_SMTP_PORT'])) {
$configuration['PS_MAIL_SMTP_PORT'] = 'default';
}
// Sending an e-mail can be of vital importance for the merchant, when his password is lost for example, so we must not die but do our best to send the e-mail
if (!isset($from) || !Validate::isEmail($from)) {
$from = $configuration['PS_SHOP_EMAIL'];
}
if (!Validate::isEmail($from)) {
$from = null;
}
// $from_name is not that important, no need to die if it is not valid
if (!isset($from_name) || !Validate::isMailName($from_name)) {
$from_name = $configuration['PS_SHOP_NAME'];
}
if (!Validate::isMailName($from_name)) {
$from_name = null;
}
// It would be difficult to send an e-mail if the e-mail is not valid, so this time we can die if there is a problem
if (!is_array($to) && !Validate::isEmail($to)) {
Tools::dieOrLog(Tools::displayError('Error: parameter "to" is corrupted'), $die);
return false;
}
if (!is_array($template_vars)) {
$template_vars = array();
}
// Do not crash for this error, that may be a complicated customer name
if (is_string($to_name) && !empty($to_name) && !Validate::isMailName($to_name)) {
$to_name = null;
}
if (!Validate::isTplName($template)) {
Tools::dieOrLog(Tools::displayError('Error: invalid e-mail template'), $die);
return false;
}
if (!Validate::isMailSubject($subject)) {
Tools::dieOrLog(Tools::displayError('Error: invalid e-mail subject'), $die);
return false;
}
/* Construct multiple recipients list if needed */
$to_list = new Swift_RecipientList();
if (is_array($to) && isset($to)) {
foreach ($to as $key => $addr) {
$addr = trim($addr);
if (!Validate::isEmail($addr)) {
Tools::dieOrLog(Tools::displayError('Error: invalid e-mail address'), $die);
return false;
}
if (is_array($to_name)) {
if ($to_name && is_array($to_name) && Validate::isGenericName($to_name[$key])) {
$to_name = $to_name[$key];
}
}
if ($to_name == null || $to_name == $addr) {
$to_name = '';
} else {
if (function_exists('mb_encode_mimeheader')) {
$to_name = mb_encode_mimeheader($to_name, 'utf-8');
} else {
$to_name = self::mimeEncode($to_name);
}
}
$to_list->addTo($addr, $to_name);
}
$to_plugin = $to[0];
} else {
//.........这里部分代码省略.........
示例4: Send
/**
* Send Email
*
* @param int $id_lang Language ID of the email (to translate the template)
* @param string $template Template: the name of template not be a var but a string !
* @param string $subject Subject of the email
* @param string $template_vars Template variables for the email
* @param string $to To email
* @param string $to_name To name
* @param string $from From email
* @param string $from_name To email
* @param array $file_attachment Array with three parameters (content, mime and name). You can use an array of array to attach multiple files
* @param bool $mode_smtp SMTP mode (deprecated)
* @param string $template_path Template path
* @param bool $die Die after error
* @param string $bcc Bcc recipient
* @return bool|int Whether sending was successful. If not at all, false, otherwise amount of recipients succeeded.
*/
public static function Send($id_lang, $template, $subject, $template_vars, $to, $to_name = null, $from = null, $from_name = null, $file_attachment = null, $mode_smtp = null, $template_path = _PS_MAIL_DIR_, $die = false, $id_shop = null, $bcc = null, $reply_to = null)
{
if (!$id_shop) {
$id_shop = Context::getContext()->shop->id;
}
$configuration = Configuration::getMultiple(array('PS_SHOP_EMAIL', 'PS_MAIL_METHOD', 'PS_MAIL_SERVER', 'PS_MAIL_USER', 'PS_MAIL_PASSWD', 'PS_SHOP_NAME', 'PS_MAIL_SMTP_ENCRYPTION', 'PS_MAIL_SMTP_PORT', 'PS_MAIL_TYPE'), null, null, $id_shop);
// Returns immediatly if emails are deactivated
if ($configuration['PS_MAIL_METHOD'] == 3) {
return true;
}
$theme_path = _PS_THEME_DIR_;
// Get the path of theme by id_shop if exist
if (is_numeric($id_shop) && $id_shop) {
$shop = new Shop((int) $id_shop);
$theme_name = $shop->getTheme();
if (_THEME_NAME_ != $theme_name) {
$theme_path = _PS_ROOT_DIR_ . '/themes/' . $theme_name . '/';
}
}
if (!isset($configuration['PS_MAIL_SMTP_ENCRYPTION']) || Tools::strtolower($configuration['PS_MAIL_SMTP_ENCRYPTION']) === 'off') {
$configuration['PS_MAIL_SMTP_ENCRYPTION'] = false;
}
if (!isset($configuration['PS_MAIL_SMTP_PORT'])) {
$configuration['PS_MAIL_SMTP_PORT'] = 'default';
}
// Sending an e-mail can be of vital importance for the merchant, when his password is lost for example, so we must not die but do our best to send the e-mail
if (!isset($from) || !Validate::isEmail($from)) {
$from = $configuration['PS_SHOP_EMAIL'];
}
if (!Validate::isEmail($from)) {
$from = null;
}
// $from_name is not that important, no need to die if it is not valid
if (!isset($from_name) || !Validate::isMailName($from_name)) {
$from_name = $configuration['PS_SHOP_NAME'];
}
if (!Validate::isMailName($from_name)) {
$from_name = null;
}
// It would be difficult to send an e-mail if the e-mail is not valid, so this time we can die if there is a problem
if (!is_array($to) && !Validate::isEmail($to)) {
Tools::dieOrLog(Tools::displayError('Error: parameter "to" is corrupted'), $die);
return false;
}
// if bcc is not null, make sure it's a vaild e-mail
if (!is_null($bcc) && !is_array($bcc) && !Validate::isEmail($bcc)) {
Tools::dieOrLog(Tools::displayError('Error: parameter "bcc" is corrupted'), $die);
$bcc = null;
}
if (!is_array($template_vars)) {
$template_vars = array();
}
// Do not crash for this error, that may be a complicated customer name
if (is_string($to_name) && !empty($to_name) && !Validate::isMailName($to_name)) {
$to_name = null;
}
if (!Validate::isTplName($template)) {
Tools::dieOrLog(Tools::displayError('Error: invalid e-mail template'), $die);
return false;
}
if (!Validate::isMailSubject($subject)) {
Tools::dieOrLog(Tools::displayError('Error: invalid e-mail subject'), $die);
return false;
}
/* Construct multiple recipients list if needed */
$message = Swift_Message::newInstance();
if (is_array($to) && isset($to)) {
foreach ($to as $key => $addr) {
$addr = trim($addr);
if (!Validate::isEmail($addr)) {
Tools::dieOrLog(Tools::displayError('Error: invalid e-mail address'), $die);
return false;
}
if (is_array($to_name) && $to_name && is_array($to_name) && Validate::isGenericName($to_name[$key])) {
$to_name = $to_name[$key];
}
$to_name = $to_name == null || $to_name == $addr ? '' : self::mimeEncode($to_name);
$message->addTo($addr, $to_name);
}
$to_plugin = $to[0];
} else {
/* Simple recipient, one address */
//.........这里部分代码省略.........