本文整理汇总了PHP中Smarty::configLoad方法的典型用法代码示例。如果您正苦于以下问题:PHP Smarty::configLoad方法的具体用法?PHP Smarty::configLoad怎么用?PHP Smarty::configLoad使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Smarty
的用法示例。
在下文中一共展示了Smarty::configLoad方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __invoke
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
{
$config = $container->get('Configuration');
$config = $config['smarty'];
/** @var $pathResolver \Zend\View\Resolver\TemplatePathStack */
$pathResolver = clone $container->get('ViewTemplatePathStack');
$pathResolver->setDefaultSuffix($config['suffix']);
/** @var $resolver \Zend\View\Resolver\AggregateResolver */
$resolver = $container->get('ViewResolver');
$resolver->attach($pathResolver);
$engine = new \Smarty();
$engine->setCompileDir($config['compile_dir']);
$engine->setEscapeHtml($config['escape_html']);
$engine->setTemplateDir($pathResolver->getPaths()->toArray());
$engine->setCaching($config['caching']);
$engine->setCacheDir($config['cache_dir']);
$engine->addPluginsDir($config['plugins_dir']);
if (file_exists($config['config_file'])) {
$engine->configLoad($config['config_file']);
}
$renderer = new Renderer();
$renderer->setEngine($engine);
$renderer->setSuffix($config['suffix']);
$renderer->setResolver($resolver);
return $renderer;
}
示例2: translate
function translate($TranslationFile)
{
global $FreedomCore;
$Language = str_replace('.language', '', $FreedomCore->loadLanguage());
try {
Smarty::configLoad($Language . DS . $TranslationFile . '.language');
} catch (Exception $e) {
Debugger::ReportError(3, 2, $TranslationFile . '.language in ' . $Language . ' language folder');
die;
}
}
示例3: setSmarty
protected function setSmarty()
{
$smarty = new \Smarty();
$smarty->setCompileDir(IE_SMARTY_COMPILE_DIR);
$smarty->configLoad(IE_CORE_DIR . 'config.conf');
//load optional master config file
$customConf = IE_CUSTOM_DIR . 'config.conf';
if (file_exists($customConf)) {
$smarty->configLoad($customConf);
}
//load project config file
$configFile = $this->config['configsDir'] . 'config.conf';
if (file_exists($configFile)) {
$smarty->configLoad($configFile);
}
//load script config file
$configFileScript = $this->config['configsScriptsDir'] . $this->script . '.conf';
if (file_exists($configFileScript)) {
$smarty->configLoad($configFileScript);
}
$this->smarty = $smarty;
}
示例4: Smarty
}
$order_status_query = xos_db_query("select orders_status_name from " . TABLE_ORDERS_STATUS . " where orders_status_id = '" . (int) $status . "' and language_id = '" . (int) $languages['languages_id'] . "'");
$order_status = xos_db_fetch_array($order_status_query);
include DIR_FS_SMARTY . 'catalog/languages/' . $check_status['language_directory'] . '/email/order_status_email.php';
$smarty_order = new Smarty();
$smarty_order->template_dir = DIR_FS_SMARTY . 'catalog/templates/';
$smarty_order->compile_dir = DIR_FS_SMARTY . 'catalog/templates_c/';
$smarty_order->config_dir = DIR_FS_SMARTY . 'catalog/';
$smarty_order->cache_dir = DIR_FS_SMARTY . 'catalog/cache/';
$smarty_order->left_delimiter = '[@{';
$smarty_order->right_delimiter = '}@]';
if (isset($_POST['notify_comments']) && $_POST['notify_comments'] == 'on') {
$smarty_order->assign('order_comments', $comments);
}
$smarty_order->assign(array('html_params' => HTML_PARAMS, 'xhtml_lang' => $languages['code'], 'charset' => CHARSET, 'store_name_address' => STORE_NAME_ADDRESS, 'store_name' => STORE_NAME, 'src_embedded_shop_logo' => 'cid:shop_logo', 'src_shop_logo' => HTTP_SERVER . DIR_WS_CATALOG . DIR_WS_IMAGES . (is_file(DIR_FS_CATALOG_IMAGES . 'email_shop_logo/' . EMAIL_SHOP_LOGO) ? 'email_shop_logo/' : 'catalog/templates/' . DEFAULT_TPL . '/') . EMAIL_SHOP_LOGO, 'date_ordered' => xos_order_status_email_date_long($check_status['date_purchased']), 'order_id' => $oID, 'order_status' => $order_status['orders_status_name'], 'link_invoice' => xos_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL')));
$smarty_order->configLoad('languages/' . $check_status['language_directory'] . '_email.conf', 'order_status_email_html');
$output_order_status_email_html = $smarty_order->fetch(DEFAULT_TPL . '/includes/email/order_status_email_html.tpl');
$smarty_order->configLoad('languages/' . $check_status['language_directory'] . '_email.conf', 'order_status_email_text');
$output_order_status_email_text = $smarty_order->fetch(DEFAULT_TPL . '/includes/email/order_status_email_text.tpl');
$email_to_customer = new mailer($check_status['customers_name'], $check_status['customers_email_address'], EMAIL_TEXT_SUBJECT, $output_order_status_email_html, $output_order_status_email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SHOP_LOGO);
if (!$email_to_customer->send()) {
$messageStack->add_session('header', sprintf(ERROR_PHPMAILER, $email_to_customer->ErrorInfo), 'error');
}
}
$customer_notified = '1';
}
xos_db_query("insert into " . TABLE_ORDERS_STATUS_HISTORY . " (orders_id, orders_status_id, date_added, customer_notified, comments) values ('" . (int) $oID . "', '" . xos_db_input($status) . "', now(), '" . xos_db_input($customer_notified) . "', '" . xos_db_input($comments) . "')");
$order_updated = true;
}
if ($order_updated == true) {
$messageStack->add_session('header', SUCCESS_ORDER_UPDATED, 'success');
示例5: send
function send($newsletter_id)
{
global $messageStack;
if (SEND_EMAILS != 'true') {
$messageStack->add('news_email', ERROR_EMAIL_WAS_NOT_SENT, 'error');
return false;
}
$ids = $_GET['customers_chosen'];
$mail_query = xos_db_query("select s.subscriber_id, s.subscriber_email_address, s.subscriber_identity_code, c.customers_firstname, c.customers_lastname from " . TABLE_NEWSLETTER_SUBSCRIBERS . " s left join " . TABLE_CUSTOMERS . " c on s.customers_id = c.customers_id where s.subscriber_id in (" . $ids . ") order by s.customers_id");
if (empty($this->language_directory)) {
$lang_query = xos_db_query("select directory from " . TABLE_LANGUAGES . " where code = '" . xos_db_input(DEFAULT_LANGUAGE) . "'");
$lang = xos_db_fetch_array($lang_query);
$this->language_directory = $lang['directory'];
}
//Let's build a message object using the mailer class
$email_to_subscriber = new mailer();
$email_from_value = EMAIL_FROM;
$from = html_entity_decode($email_from_value, ENT_QUOTES, 'UTF-8');
$address = '';
$name = '';
$pieces = explode('<', $from);
if (count($pieces) == 2) {
$address = trim($pieces[1], " >");
$name = trim($pieces[0]);
} elseif (count($pieces) == 1) {
$pos = stripos($pieces[0], '@');
$address = $pos ? trim($pieces[0], " >") : '';
}
$email_to_subscriber->From = $address;
$email_to_subscriber->FromName = $name;
$email_to_subscriber->WordWrap = '100';
$email_to_subscriber->Subject = $this->title;
$smarty_newsletter = new Smarty();
$smarty_newsletter->template_dir = DIR_FS_SMARTY . 'catalog/templates/';
$smarty_newsletter->compile_dir = DIR_FS_SMARTY . 'catalog/templates_c/';
$smarty_newsletter->config_dir = DIR_FS_SMARTY . 'catalog/';
$smarty_newsletter->cache_dir = DIR_FS_SMARTY . 'catalog/cache/';
$smarty_newsletter->left_delimiter = '[@{';
$smarty_newsletter->right_delimiter = '}@]';
$is_html = false;
if ($this->content_text_htlm != '' && EMAIL_USE_HTML == 'true') {
$is_html = true;
$smarty_newsletter->assign(array('nl' => "\n", 'html_params' => HTML_PARAMS, 'xhtml_lang' => !empty($this->language_code) ? $this->language_code : DEFAULT_LANGUAGE, 'charset' => CHARSET, 'base_href' => substr(HTTP_SERVER, -1) == '/' ? HTTP_SERVER : '', 'content_text_htlm' => $this->content_text_htlm, 'content_text_plain' => $this->content_text_plain));
$smarty_newsletter->configLoad('languages/' . $this->language_directory . '_email.conf', 'newsletter_email_html');
$output_newsletter_email_html = $smarty_newsletter->fetch(DEFAULT_TPL . '/includes/email/newsletter_email_html.tpl');
$smarty_newsletter->configLoad('languages/' . $this->language_directory . '_email.conf', 'newsletter_email_text');
$output_newsletter_email_text = $smarty_newsletter->fetch(DEFAULT_TPL . '/includes/email/newsletter_email_text.tpl');
$email_to_subscriber->isHTML(true);
} else {
$smarty_newsletter->assign(array('nl' => "\n", 'content_text_plain' => $this->content_text_plain));
$smarty_newsletter->configLoad('languages/' . $this->language_directory . '_email.conf', 'newsletter_email_text');
$output_newsletter_email_text = $smarty_newsletter->fetch(DEFAULT_TPL . '/includes/email/newsletter_email_text.tpl');
$email_to_subscriber->isHTML(false);
}
while ($mail = xos_db_fetch_array($mail_query)) {
$link_unsubscribe = xos_catalog_href_link('newsletter_subscribe.php', 'action=unsubscribe&identity_code=' . $mail['subscriber_identity_code'], 'SSL');
if ($is_html) {
$email_to_subscriber->Body = $output_newsletter_email_html . '<a href="' . $link_unsubscribe . '" target="_blank">' . $link_unsubscribe . '</a>' . "\n" . '</div>' . "\n" . '</body>' . "\n" . '</html>' . "\n";
$email_to_subscriber->AltBody = html_entity_decode(strip_tags($output_newsletter_email_text . $link_unsubscribe), ENT_QUOTES, 'UTF-8');
} else {
$email_to_subscriber->Body = html_entity_decode(strip_tags($output_newsletter_email_text . $link_unsubscribe), ENT_QUOTES, 'UTF-8');
}
$email_to_subscriber->addAddress($mail['subscriber_email_address'], $mail['customers_firstname'] . ' ' . $mail['customers_lastname']);
if (!$email_to_subscriber->send()) {
$messageStack->add('news_email', sprintf(ERROR_PHP_MAILER, $email_to_subscriber->ErrorInfo, '<' . $mail['subscriber_email_address'] . '>'), 'error');
} else {
$messageStack->add('news_email', sprintf(NOTICE_EMAIL_SENT_TO, '<' . $mail['subscriber_email_address'] . '>'), 'success');
}
$email_to_subscriber->clearAddresses();
}
$newsletter_id = xos_db_prepare_input($newsletter_id);
xos_db_query("update " . TABLE_NEWSLETTERS . " set date_sent = now(), status = '1', locked = '0' where newsletters_id = '" . xos_db_input($newsletter_id) . "'");
}
示例6: Request
}
$userRequest = new Request($_REQUEST);
$session = SessionController::apiCurrentSession($userRequest);
if ($session['valid']) {
$smarty->assign("LOGGED_IN", "1");
UITools::$IsLoggedIn = true;
$smarty->assign("CURRENT_USER_USERNAME", $session["username"]);
$smarty->assign("CURRENT_USER_EMAIL", $session["email"]);
$smarty->assign("CURRENT_USER_IS_EMAIL_VERIFIED", $session["is_email_verified"]);
$smarty->assign("CURRENT_USER_IS_ADMIN", $session["is_admin"]);
$smarty->assign("CURRENT_USER_PRIVATE_CONTESTS_COUNT", $session["private_contests_count"]);
$smarty->assign("CURRENT_USER_PRIVATE_PROBLEMS_COUNT", $session["private_problems_count"]);
$smarty->assign("CURRENT_USER_AUTH_TOKEN", $session["auth_token"]);
$smarty->assign("CURRENT_USER_GRAVATAR_URL_128", '<img src="https://secure.gravatar.com/avatar/' . md5($session["email"]) . '?s=92">');
$smarty->assign("CURRENT_USER_GRAVATAR_URL_16", '<img src="https://secure.gravatar.com/avatar/' . md5($session["email"]) . '?s=16">');
$smarty->assign("CURRENT_USER_GRAVATAR_URL_32", '<img src="https://secure.gravatar.com/avatar/' . md5($session["email"]) . '?s=32">');
UITools::$isAdmin = $session["is_admin"];
$userRequest["username"] = $session["username"];
} else {
$smarty->assign("CURRENT_USER_GRAVATAR_URL_128", '<img src="/media/avatar_92.png">');
$smarty->assign("CURRENT_USER_GRAVATAR_URL_16", '<img src="/media/avatar_16.png">');
}
$lang = UserController::getPreferredLanguage($userRequest);
if (defined("OMEGAUP_DEVELOPMENT_MODE") && OMEGAUP_DEVELOPMENT_MODE) {
$smarty->force_compile = true;
$smarty->caching = 0;
}
$smarty->configLoad(__DIR__ . "/../templates/" . $lang . ".lang");
}
// Load pager class
require_once 'libs/Pager.php';
示例7: Request
$userRequest = new Request($_REQUEST);
$session = SessionController::apiCurrentSession($userRequest);
if ($session['valid']) {
$smarty->assign('LOGGED_IN', '1');
UITools::$IsLoggedIn = true;
$smarty->assign('CURRENT_USER_USERNAME', $session['username']);
$smarty->assign('CURRENT_USER_EMAIL', $session['email']);
$smarty->assign('CURRENT_USER_IS_EMAIL_VERIFIED', $session['is_email_verified']);
$smarty->assign('CURRENT_USER_IS_ADMIN', $session['is_admin']);
$smarty->assign('CURRENT_USER_PRIVATE_CONTESTS_COUNT', $session['private_contests_count']);
$smarty->assign('CURRENT_USER_PRIVATE_PROBLEMS_COUNT', $session['private_problems_count']);
$smarty->assign('CURRENT_USER_AUTH_TOKEN', $session['auth_token']);
$smarty->assign('CURRENT_USER_GRAVATAR_URL_128', '<img src="https://secure.gravatar.com/avatar/' . md5($session['email']) . '?s=92">');
$smarty->assign('CURRENT_USER_GRAVATAR_URL_16', '<img src="https://secure.gravatar.com/avatar/' . md5($session['email']) . '?s=16">');
$smarty->assign('CURRENT_USER_GRAVATAR_URL_32', '<img src="https://secure.gravatar.com/avatar/' . md5($session['email']) . '?s=32">');
$smarty->assign('CURRENT_USER_GRAVATAR_URL_51', '<img src="https://secure.gravatar.com/avatar/' . md5($session['email']) . '?s=51">');
UITools::$isAdmin = $session['is_admin'];
$userRequest['username'] = $session['username'];
} else {
$smarty->assign('CURRENT_USER_GRAVATAR_URL_128', '<img src="/media/avatar_92.png">');
$smarty->assign('CURRENT_USER_GRAVATAR_URL_16', '<img src="/media/avatar_16.png">');
}
$lang = UserController::getPreferredLanguage($userRequest);
if (defined('OMEGAUP_DEVELOPMENT_MODE') && OMEGAUP_DEVELOPMENT_MODE) {
$smarty->force_compile = true;
$smarty->caching = 0;
}
$smarty->configLoad(__DIR__ . '/../templates/' . $lang . '.lang');
}
// Load pager class
require_once 'libs/Pager.php';
示例8: getInstance
public static function getInstance($param = null)
{
// 初始化Smarty自动加载
if (!self::$isInit) {
Bd_Autoloader::addClassMap(self::$smartyClassMap);
self::$isInit = true;
}
// 从配置中读取参数
if (!is_array($param)) {
// 加载配置
if (empty(self::$arrConf)) {
self::$arrConf = Bd_Conf::getConf('/smarty/');
if (empty(self::$arrConf)) {
self::$arrConf = null;
return null;
}
}
// 取指定的配置组
if ($param != null) {
$param = self::$arrConf[$param];
// 不存在则出错
if (!$param) {
return null;
}
} else {
$param = current(self::$arrConf);
}
}
// new一个smarty
$smarty = new Smarty();
// 根据参数初始化该smarty对象
$smarty->setTemplateDir(self::__absPath($param['template_dir']));
$smarty->setCompileDir(self::__absPath($param['compile_dir']));
$smarty->setCompileCheck($param['compile_check'] != '0');
$smarty->setConfigDir(self::__absPath($param['config_dir']));
if (!empty($param['config_load'])) {
$smarty->configLoad($param['config_load']);
}
$smarty->addPluginsDir(self::__absPath($param['plugins_dir']));
$smarty->left_delimiter = $param['left_delimiter'];
$smarty->right_delimiter = $param['right_delimiter'];
if (isset($_COOKIE['FIS_DEBUG']) && $_COOKIE['FIS_DEBUG'] === 'YlwtSmt' && self::isInternalIp(Bd_Ip::getClientIp())) {
return new Bd_TplFactory($smarty);
}
return $smarty;
}
示例9: currencies
$mailer_error = false;
if (!empty($_POST['email_to'])) {
$id1 = create_coupon_code($mail_sent_to);
$languages_query = xos_db_query("select languages_id, code, directory from " . TABLE_LANGUAGES . " where use_in_id > '1' and directory = '" . $language_directory . "'");
if (!xos_db_num_rows($languages_query)) {
$lang_query = xos_db_query("select languages_id, code, directory from " . TABLE_LANGUAGES . " where code = '" . xos_db_input(DEFAULT_LANGUAGE) . "'");
$languages = xos_db_fetch_array($lang_query);
} else {
$languages = xos_db_fetch_array($languages_query);
}
$used_lang_id = $_SESSION['used_lng_id'];
$_SESSION['used_lng_id'] = $languages['languages_id'];
$currencies = new currencies();
if (EMAIL_USE_HTML == 'true') {
$smarty_gv_email->assign(array('html_params' => HTML_PARAMS, 'xhtml_lang' => $languages['code'], 'charset' => CHARSET, 'store_name_address' => STORE_NAME_ADDRESS, 'store_name' => STORE_NAME, 'src_embedded_shop_logo' => 'cid:shop_logo', 'src_shop_logo' => HTTP_SERVER . DIR_WS_CATALOG . DIR_WS_IMAGES . (is_file(DIR_FS_CATALOG_IMAGES . 'email_shop_logo/' . EMAIL_SHOP_LOGO) ? 'email_shop_logo/' : 'catalog/templates/' . DEFAULT_TPL . '/') . EMAIL_SHOP_LOGO, 'gv_message' => $message, 'gv_id' => $id1, 'gv_amount' => $currencies->format($amount), 'link_shop' => xos_catalog_href_link(), 'link_gv_redeem' => xos_catalog_href_link(FILENAME_CATALOG_GV_REDEEM, 'gv_no=' . $id1, 'SSL')));
$smarty_gv_email->configLoad('languages/' . $languages['directory'] . '_email.conf', 'gv_email_html');
$output_gv_email_html = $smarty_gv_email->fetch(DEFAULT_TPL . '/includes/email/gv_email_html.tpl');
$smarty_gv_email->configLoad('languages/' . $languages['directory'] . '_email.conf', 'gv_email_text');
$output_gv_email_text = $smarty_gv_email->fetch(DEFAULT_TPL . '/includes/email/gv_email_text.tpl');
$gv_email->isHTML(true);
$gv_email->Body = $output_gv_email_html;
$gv_email->AltBody = $output_gv_email_text;
$gv_email->addEmbeddedImage(DIR_FS_CATALOG . (is_file(DIR_FS_CATALOG . 'images/email_shop_logo/' . EMAIL_SHOP_LOGO) ? 'images/email_shop_logo/' : 'images/catalog/templates/' . DEFAULT_TPL . '/') . EMAIL_SHOP_LOGO, 'shop_logo', '', 'base64', 'image/' . substr(strrchr(EMAIL_SHOP_LOGO, '.'), 1));
} else {
$smarty_gv_email->assign(array('store_name_address' => STORE_NAME_ADDRESS, 'store_name' => STORE_NAME, 'gv_message' => $message, 'gv_id' => $id1, 'gv_amount' => $currencies->format($amount), 'link_shop' => xos_catalog_href_link(), 'link_gv_redeem' => xos_catalog_href_link(FILENAME_CATALOG_GV_REDEEM, 'gv_no=' . $id1, 'SSL')));
$smarty_gv_email->configLoad('languages/' . $languages['directory'] . '_email.conf', 'gv_email_text');
$output_gv_email_text = $smarty_gv_email->fetch(DEFAULT_TPL . '/includes/email/gv_email_text.tpl');
$gv_email->isHTML(false);
$gv_email->Body = $output_gv_email_text;
}
$gv_email->addAddress($mail_sent_to);
示例10: messageStack
$site_trail->add($name['products_name'], xos_href_link(FILENAME_PRODUCT_INFO, 'm=' . $_GET['m'] . '&p=' . $_GET['p']));
} else {
$site_trail->add($name['products_name'], xos_href_link(FILENAME_PRODUCT_INFO, 'c=' . $cPath . '&p=' . $_GET['p']));
}
}
}
// initialize the message stack for output messages
require DIR_WS_CLASSES . 'message_stack.php';
$messageStack = new messageStack();
require DIR_WS_CLASSES . 'template_integration.php';
$templateIntegration = new templateIntegration();
$templateIntegration->buildBlocks();
// check for active product categories in Level 0
$check_is_shop_query = xos_db_query("select count(*) as count from " . TABLE_CATEGORIES_OR_PAGES . " where parent_id = '0' and is_page = 'false' and categories_or_pages_status = '1'");
$check_is_shop = xos_db_fetch_array($check_is_shop_query);
$is_shop = false;
if ($check_is_shop['count'] > 0) {
$is_shop = true;
}
// set which precautions should be checked
define('WARN_SESSION_DIRECTORY_NOT_WRITEABLE', 'true');
define('WARN_SESSION_AUTO_START', 'true');
define('WARN_DOWNLOAD_DIRECTORY_NOT_READABLE', 'true');
$smarty->caching = 0;
$smarty->cache_lifetime = -1;
$smarty->compile_check = constant(COMPILE_CHECK);
$smarty->configLoad('languages/' . $_SESSION['language'] . '.conf', 'general');
$smarty->configLoad('templates/' . SELECTED_TPL . '/includes/configuration/config.conf');
$smarty->loadFilter('output', 'set_internal_link');
// $smarty->loadFilter('output','trimwhitespace');
$smarty->assign(array('nl' => "\n", 'is_shop' => $is_shop, 'page_info' => $page_info, 'request_type' => $request_type, 'link_filename_popup_content_6' => STATUS_POPUP_CONTENT_6 == '1' ? xos_href_link(FILENAME_POPUP_CONTENT, 'co=6', $request_type) : '', 'end_tags' => DISPLAY_PAGE_PARSE_TIME == 'true' && STORE_PAGE_PARSE_TIME == 'true' ? $templateIntegration->getBlocks('footer_scripts') : $templateIntegration->getBlocks('footer_scripts') . "</body>\n</html>", 'date_format_long' => xos_date_format(DATE_FORMAT_LONG), 'languages_path' => DIR_WS_CATALOG . DIR_WS_IMAGES . 'catalog/templates/' . SELECTED_TPL . '/' . $_SESSION['language'] . '/', 'buttons_path' => DIR_WS_CATALOG . DIR_WS_IMAGES . 'catalog/templates/' . SELECTED_TPL . '/' . $_SESSION['language'] . '/buttons/', 'images_path' => DIR_WS_CATALOG . DIR_WS_IMAGES . 'catalog/templates/' . SELECTED_TPL . '/'));
示例11: translate
function translate($TranslationFile)
{
global $FreedomCore;
$Language = str_replace('.language', '', $FreedomCore->loadLanguage());
Smarty::configLoad($Language . DS . $TranslationFile . '.language');
}
示例12: send
function send($newsletter_id)
{
global $messageStack;
if (SEND_EMAILS != 'true') {
$messageStack->add('news_email', ERROR_EMAIL_WAS_NOT_SENT, 'error');
return false;
}
$audience = array();
$ids = $_GET['customers_chosen'];
$customers_query = xos_db_query("select c.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address from " . TABLE_CUSTOMERS . " c where c.customers_id in (" . $ids . ")");
while ($customers = xos_db_fetch_array($customers_query)) {
$audience[$customers['customers_id']] = array('firstname' => $customers['customers_firstname'], 'lastname' => $customers['customers_lastname'], 'email_address' => $customers['customers_email_address']);
}
if (empty($this->language_directory)) {
$lang_query = xos_db_query("select directory from " . TABLE_LANGUAGES . " where code = '" . xos_db_input(DEFAULT_LANGUAGE) . "'");
$lang = xos_db_fetch_array($lang_query);
$this->language_directory = $lang['directory'];
}
//Let's build a message object using the mailer class
$email_to_customer = new mailer();
$email_from_value = EMAIL_FROM;
$from = html_entity_decode($email_from_value, ENT_QUOTES, 'UTF-8');
$address = '';
$name = '';
$pieces = explode('<', $from);
if (count($pieces) == 2) {
$address = trim($pieces[1], " >");
$name = trim($pieces[0]);
} elseif (count($pieces) == 1) {
$pos = stripos($pieces[0], '@');
$address = $pos ? trim($pieces[0], " >") : '';
}
$email_to_customer->From = $address;
$email_to_customer->FromName = $name;
$email_to_customer->WordWrap = '100';
$email_to_customer->Subject = $this->title;
$smarty_product_notification = new Smarty();
$smarty_product_notification->template_dir = DIR_FS_SMARTY . 'catalog/templates/';
$smarty_product_notification->compile_dir = DIR_FS_SMARTY . 'catalog/templates_c/';
$smarty_product_notification->config_dir = DIR_FS_SMARTY . 'catalog/';
$smarty_product_notification->cache_dir = DIR_FS_SMARTY . 'catalog/cache/';
$smarty_product_notification->left_delimiter = '[@{';
$smarty_product_notification->right_delimiter = '}@]';
$is_html = false;
if ($this->content_text_htlm != '' && EMAIL_USE_HTML == 'true') {
$is_html = true;
$smarty_product_notification->assign(array('html_params' => HTML_PARAMS, 'xhtml_lang' => !empty($this->language_code) ? $this->language_code : DEFAULT_LANGUAGE, 'charset' => CHARSET, 'base_href' => substr(HTTP_SERVER, -1) == '/' ? HTTP_SERVER : '', 'content_text_htlm' => $this->content_text_htlm, 'content_text_plain' => $this->content_text_plain));
$smarty_product_notification->configLoad('languages/' . $this->language_directory . '_email.conf', 'product_notification_email_html.tpl');
$output_product_notification_email_html = $smarty_product_notification->fetch(DEFAULT_TPL . '/includes/email/product_notification_email_html.tpl');
$smarty_product_notification->configLoad('languages/' . $this->language_directory . '_email.conf', 'product_notification_email_text.tpl');
$output_product_notification_email_text = $smarty_product_notification->fetch(DEFAULT_TPL . '/includes/email/product_notification_email_text.tpl');
$email_to_customer->isHTML(true);
} else {
$smarty_product_notification->assign('content_text_plain', $this->content_text_plain);
$smarty_product_notification->configLoad('languages/' . $this->language_directory . '_email.conf', 'product_notification_email_text.tpl');
$output_product_notification_email_text = $smarty_product_notification->fetch(DEFAULT_TPL . '/includes/email/product_notification_email_text.tpl');
$email_to_customer->isHTML(false);
}
reset($audience);
while (list($key, $value) = each($audience)) {
if ($is_html) {
$email_to_customer->Body = $output_product_notification_email_html;
$email_to_customer->AltBody = html_entity_decode(strip_tags($output_product_notification_email_text), ENT_QUOTES, 'UTF-8');
} else {
$email_to_customer->Body = html_entity_decode(strip_tags($output_product_notification_email_text), ENT_QUOTES, 'UTF-8');
}
$email_to_customer->addAddress($value['email_address'], $value['firstname'] . ' ' . $value['lastname']);
if (!$email_to_customer->send()) {
$messageStack->add('news_email', sprintf(ERROR_PHP_MAILER, $email_to_customer->ErrorInfo, '<' . $value['email_address'] . '>'), 'error');
} else {
$messageStack->add('news_email', sprintf(NOTICE_EMAIL_SENT_TO, '<' . $value['email_address'] . '>'), 'success');
}
$email_to_customer->clearAddresses();
}
$newsletter_id = xos_db_prepare_input($newsletter_id);
xos_db_query("update " . TABLE_NEWSLETTERS . " set date_sent = now(), status = '1', locked = '0' where newsletters_id = '" . xos_db_input($newsletter_id) . "'");
}
示例13: substr
$page_contents = 'install_1.php';
}
break;
case '4':
if (xos_in_array('configure', $_POST['install'])) {
$page_contents = 'install_4.php';
} else {
$page_contents = 'install_1.php';
}
break;
case '5':
if (xos_in_array('configure', $_POST['install'])) {
$page_contents = 'install_5.php';
} else {
$page_contents = 'install_1.php';
}
break;
case '6':
if (xos_in_array('configure', $_POST['install'])) {
$page_contents = 'install_6.php';
} else {
$page_contents = 'install_1.php';
}
break;
default:
$page_contents = 'install_1.php';
}
$smarty->configLoad('languages/' . $_POST['language_file_name'] . '.conf', substr($page_contents, 0, -4));
$smarty->configLoad('configuration/config.conf');
require 'includes/' . $page_contents;
$smarty->display('install.tpl');
示例14: Smarty
<?php
// start session:
session_start();
// error reporting level:
error_reporting(E_ALL ^ E_STRICT);
include "config.php";
// looooooaaaadddiiiiiinnnnnnggggg.....
include $magrathea_path . "/LOAD.php";
// initialize Smarty. eh.. I don't think there is a more beautiful way of doing this
$Smarty = new Smarty();
$Smarty->template_dir = $site_path . "/app/Views/";
$Smarty->compile_dir = $site_path . "/app/Views/_compiled";
$Smarty->config_dir = $site_path . "/app/Views/configs";
$Smarty->cache_dir = $site_path . "/app/Views/_cache";
$Smarty->error_reporting = E_ALL & ~E_NOTICE;
$Smarty->configLoad("site.conf");
// initialize the MagratheaView and sets it to Smarty
$Smarty->assign("View", MagratheaView::Instance());
// for printing the paths of your css and javascript (that will be included in the index.php)
MagratheaView::Instance()->IsRelativePath(false);
// debugging settings:
// options: dev; debug; log; none;
MagratheaDebugger::Instance()->SetType(MagratheaDebugger::DEV)->LogQueries(false);
示例15: execute
/**
* Execute compile command
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
//get project name & set source/output dirs
$project = $input->getArgument('project');
$this->config = new \Implico\Email\Config($project, $input->getOption('dir'));
if ($error = $this->config->getErrors()) {
switch ($error) {
case 'projectNotFound':
$output->writeln('<fg=red>ERROR: project directory not found</fg=red>');
exit(1);
break;
}
}
SmartyUtils::init($this->config);
//get script name(s)
$scripts = $input->getOption('script');
//if script name(s) not passed, set all scripts (exclude dirs)
if (!$scripts) {
$scripts = array_filter(array_diff(scandir($this->config['scriptsDir']), array('.', '..')), function ($script) {
return !is_dir($this->config['scriptsDir'] . $script);
});
}
//add ".tpl" extension when applicable
foreach ($scripts as $i => $script) {
if (strpos($script, '.') === false) {
$scripts[$i] = $script . '.tpl';
}
}
//get watch option
$watch = $input->getOption('watch');
//get output option
$outputMode = $input->getOption('output');
//create & configure Smarty object
$smarty = new \Smarty();
$smarty->setCompileDir(IE_SMARTY_COMPILE_DIR);
$smarty->addPluginsDir(IE_SMARTY_PLUGINS_DIR);
$smarty->addPluginsDir(IE_SMARTY_CUSTOM_PLUGINS_DIR);
$smarty->compile_check = false;
$smarty->force_compile = true;
$smarty->error_reporting = E_ALL;
$smarty->registerClass('SmartyUtils', 'Implico\\Email\\Utils\\Smarty');
//set directories
$smarty->setTemplateDir(array(0 => $this->config['dir'], 'core' => IE_CORE_DIR, 'layouts' => $this->config['layoutsDir'], 'scripts' => $this->config['scriptsDir'], 'styles' => $this->config['stylesDir']));
//master config file
$smarty->configLoad(IE_CORE_DIR . 'config.conf');
//optional master custom config file
$customConf = IE_CUSTOM_DIR . 'config.conf';
if (file_exists($customConf)) {
$smarty->configLoad($customConf);
}
//console message for watching
if ($watch) {
$output->writeln('Watching for changes...');
}
//main loop - watch for changes (or execute once if not watching)
$compileNo = 1;
$compileDirStamp = '';
//dirs to inspect file change
$checkDirs = array($this->config['configsDir'], $this->config['configsScriptsDir'], $this->config['layoutsDir'], $this->config['scriptsDir'], $this->config['stylesDir']);
//set output mode variables
$outputMinified = in_array('m', $outputMode);
$outputFormatted = in_array('f', $outputMode);
//formatter object
$formatter = null;
//css inliner object
$cssToInlineStyles = new CssToInlineStyles();
while (true) {
//compile only if not watching or the dirs filestamp changes
if (!$watch || $compileDirStamp != $this->getDirStamp($checkDirs)) {
//clear compiled templates
$smarty->clearCompiledTemplate();
//Smarty assign project-specific config file path
$configFile = $this->config['configsDir'] . 'config.conf';
$loadConfigFile = file_exists($configFile);
//set random complile_id (forces Smarty to compile)
$smarty->compile_id = uniqid();
//list of compiled scripts
$compiledScripts = $scripts;
//fetch & save templates
foreach ($scripts as $i => $script) {
//script name without extension
$scriptName = substr($script, 0, strrpos($script, '.'));
$smarty->clearConfig();
if ($loadConfigFile) {
$smarty->configLoad($configFile);
}
//set script-specific config file path if exists
$configFileScript = $this->config['configsScriptsDir'] . $scriptName . '.conf';
if (file_exists($configFileScript)) {
$smarty->configLoad($configFileScript);
}
//lazy create indenter
if ($outputFormatted && !$formatter) {
$formatter = new \Gajus\Dindent\Indenter(array('indentation_character' => $smarty->getConfigVars('indentChar')));
}
//set encoding
$outputEncoding = $smarty->getConfigVars('encoding');
//.........这里部分代码省略.........