本文整理汇总了PHP中nl2br2函数的典型用法代码示例。如果您正苦于以下问题:PHP nl2br2函数的具体用法?PHP nl2br2怎么用?PHP nl2br2使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了nl2br2函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postProcess
function postProcess()
{
// we retrieve the potential currencies to make sure the selected currency exists in this shop
$currencies = TotCompatibility::getCurrenciesByIdShop($this->ebay_profile->id_shop);
$currencies_ids = array_map(array($this, 'getCurrencyId'), $currencies);
if ($this->ebay_profile->setConfiguration('EBAY_PAYPAL_EMAIL', pSQL(Tools::getValue('ebay_paypal_email'))) && $this->ebay_profile->setConfiguration('EBAY_SHOP', pSQL(Tools::getValue('ebay_shop'))) && $this->ebay_profile->setConfiguration('EBAY_SHOP_POSTALCODE', pSQL(Tools::getValue('ebay_shop_postalcode'))) && $this->ebay_profile->setConfiguration('EBAY_SHOP_COUNTRY', pSQL(Tools::getValue('ebay_shop_country'))) && $this->ebay_profile->setConfiguration('EBAY_LISTING_DURATION', Tools::getValue('listingdurations')) && $this->ebay_profile->setConfiguration('EBAY_AUTOMATICALLY_RELIST', Tools::getValue('automaticallyrelist')) && $this->ebay_profile->setReturnsPolicyConfiguration(pSQL(Tools::getValue('returnswithin')), pSQL(Tools::getValue('returnswhopays')), version_compare(_PS_VERSION_, '1.5', '>') ? Tools::nl2br(Tools::getValue('ebay_returns_description')) : nl2br2(Tools::getValue('ebay_returns_description')), pSQL(Tools::getValue('ebay_returns_accepted_option'))) && $this->ebay->setConfiguration('EBAY_ACTIVATE_MAILS', Tools::getValue('activate_mails') ? 1 : 0) && in_array((int) Tools::getValue('currency'), $currencies_ids) && $this->ebay_profile->setConfiguration('EBAY_CURRENCY', (int) Tools::getValue('currency')) && $this->ebay_profile->setConfiguration('EBAY_SEND_TRACKING_CODE', (int) Tools::getValue('send_tracking_code')) && $this->ebay_profile->setConfiguration('EBAY_SHIPPED_ORDER_STATE', (int) Tools::getValue('shipped_order_state')) && $this->ebay_profile->setConfiguration('EBAY_IMMEDIATE_PAYMENT', (int) Tools::getValue('immediate_payment'))) {
return $this->ebay->displayConfirmation($this->ebay->l('Settings updated'));
} else {
return $this->ebay->displayError($this->ebay->l('Settings failed'));
}
}
示例2: getFields
public function getFields()
{
parent::validateFields();
$fields['id_customer'] = pSQL($this->id_customer);
$fields['id_order'] = pSQL($this->id_order);
$fields['state'] = pSQL($this->state);
$fields['date_add'] = pSQL($this->date_add);
$fields['date_upd'] = pSQL($this->date_upd);
$fields['question'] = pSQL(nl2br2($this->question), true);
return $fields;
}
示例3: processData
public function processData()
{
if (Module::isInstalled('agilemultipleshop') && Shop::$id_shop_owner > 0) {
if (!Validate::isLoadedObject($this->seller)) {
$this->errors[] = Tools::displayError('Seller does not exist');
} elseif (!$this->seller->active) {
self::$smarty->assign('seller', $this->seller);
} else {
$rewrited_url = self::$link->getAgileSellerLink((int) $this->seller->id, $this->getSellerLinkRwrite());
$this->seller_info->description = _PS_VERSION_ > '1.5' ? Tools::nl2br($this->seller_info->description) : nl2br2($this->seller_info->description);
self::$smarty->assign('seller', $this->seller);
self::$smarty->assign('seller_info', $this->seller_info);
$sellermodule = new AgileMultipleSeller();
$conf = Configuration::getMultiple($sellermodule->getCustomFields());
$custom_labels = $sellermodule->getCustomLabels();
self::$smarty->assign('conf', $conf);
self::$smarty->assign('custom_labels', $custom_labels);
$nbProducts = $this->getProducts(NULL, NULL, NULL, $this->orderBy, $this->orderWay, true);
$this->pagination((int) $nbProducts);
self::$smarty->assign('nb_products', (int) $nbProducts);
$seller_products = $this->getProducts((int) self::$cookie->id_lang, (int) $this->p, (int) $this->n, $this->orderBy, $this->orderWay);
AgileHelper::AssignProductImgs($seller_products);
$si_1531_later = version_compare(_PS_VERSION_, '1.5.3.1', ">=");
$HOOK_SELLER_RATINGS = '';
if (Module::isInstalled('agilesellerratings')) {
require_once _PS_ROOT_DIR_ . "/modules/agilesellerratings/agilesellerratings.php";
$rmodule = new AgileSellerRatings();
$HOOK_SELLER_RATINGS = $rmodule->getAverageRating($this->id_seller, AgileSellerRatings::RATING_TYPE_SELLER);
}
self::$smarty->assign(array('products' => (isset($seller_products) and $seller_products) ? $seller_products : NULL, 'id_seller' => (int) $this->seller->id, 'path' => $this->seller_info->company, 'agilesellerproducts_tpl' => _PS_ROOT_DIR_ . "/modules/agilesellerproducts/", 'agilemultipleshop_tpl' => _PS_ROOT_DIR_ . "/modules/agilemultipleshop/", 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'categorySize' => Image::getSize($si_1531_later ? ImageType::getFormatedName('category') : 'category'), 'mediumSize' => Image::getSize($si_1531_later ? ImageType::getFormatedName('medium') : 'medium'), 'thumbSceneSize' => Image::getSize($si_1531_later ? ImageType::getFormatedName('thumb_scene') : 'thumb_scene'), 'homeSize' => Image::getSize($si_1531_later ? ImageType::getFormatedName('home') : 'home'), 'HOOK_SELLER_RATINGS' => $HOOK_SELLER_RATINGS, 'page_name' => 'agileseller'));
$ver = (int) str_replace(".", "", _PS_VERSION_);
if ($ver <= 1430) {
} else {
if ($ver <= 1451) {
if (isset(self::$cookie->id_customer)) {
self::$smarty->assign('compareProducts', CompareProduct::getCustomerCompareProducts((int) self::$cookie->id_customer));
} elseif (isset(self::$cookie->id_guest)) {
self::$smarty->assign('compareProducts', CompareProduct::getGuestCompareProducts((int) self::$cookie->id_guest));
}
} else {
if (isset(self::$cookie->id_compare)) {
self::$smarty->assign('compareProducts', CompareProduct::getCompareProducts((int) self::$cookie->id_compare));
}
}
}
}
self::$smarty->assign(array('allow_oosp' => (int) Configuration::get('PS_ORDER_OUT_OF_STOCK'), 'comparator_max_item' => (int) Configuration::get('PS_COMPARATOR_MAX_ITEM'), 'suppliers' => Supplier::getSuppliers()));
}
}
示例4: process
public function process()
{
parent::process();
if (!($id_category = (int) Tools::getValue('id_category')) or !Validate::isUnsignedId($id_category)) {
$this->errors[] = Tools::displayError('Missing category ID');
} else {
if (!Validate::isLoadedObject($this->category)) {
$this->errors[] = Tools::displayError('Category does not exist');
} elseif (!$this->category->checkAccess((int) self::$cookie->id_customer)) {
$this->errors[] = Tools::displayError('You do not have access to this category.');
} elseif (!$this->category->active) {
self::$smarty->assign('category', $this->category);
} else {
$rewrited_url = self::$link->getCategoryLink((int) $this->category->id, $this->category->link_rewrite);
/* Scenes (could be externalised to another controler if you need them */
self::$smarty->assign('scenes', Scene::getScenes((int) $this->category->id, (int) self::$cookie->id_lang, true, false));
/* Scenes images formats */
if ($sceneImageTypes = ImageType::getImagesTypes('scenes')) {
foreach ($sceneImageTypes as $sceneImageType) {
if ($sceneImageType['name'] == 'thumb_scene') {
$thumbSceneImageType = $sceneImageType;
} elseif ($sceneImageType['name'] == 'large_scene') {
$largeSceneImageType = $sceneImageType;
}
}
self::$smarty->assign('thumbSceneImageType', isset($thumbSceneImageType) ? $thumbSceneImageType : NULL);
self::$smarty->assign('largeSceneImageType', isset($largeSceneImageType) ? $largeSceneImageType : NULL);
}
$this->category->description = nl2br2($this->category->description);
$subCategories = $this->category->getSubCategories((int) self::$cookie->id_lang);
self::$smarty->assign('category', $this->category);
if (isset($subCategories) and !empty($subCategories) and $subCategories) {
self::$smarty->assign('subcategories', $subCategories);
self::$smarty->assign(array('subcategories_nb_total' => sizeof($subCategories), 'subcategories_nb_half' => ceil(sizeof($subCategories) / 2)));
}
if ($this->category->id != 1) {
$this->productListAssign();
}
self::$smarty->assign(array('products' => (isset($this->cat_products) and $this->cat_products) ? $this->cat_products : NULL, 'id_category' => (int) $this->category->id, 'id_category_parent' => (int) $this->category->id_parent, 'return_category_name' => Tools::safeOutput($this->category->name), 'path' => Tools::getPath((int) $this->category->id), 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'categorySize' => Image::getSize('category'), 'mediumSize' => Image::getSize('medium'), 'thumbSceneSize' => Image::getSize('thumb_scene'), 'homeSize' => Image::getSize('home')));
if (isset(self::$cookie->id_customer)) {
self::$smarty->assign('compareProducts', CompareProduct::getCustomerCompareProducts((int) self::$cookie->id_customer));
} elseif (isset(self::$cookie->id_guest)) {
self::$smarty->assign('compareProducts', CompareProduct::getGuestCompareProducts((int) self::$cookie->id_guest));
}
}
}
self::$smarty->assign(array('allow_oosp' => (int) Configuration::get('PS_ORDER_OUT_OF_STOCK'), 'comparator_max_item' => (int) Configuration::get('PS_COMPARATOR_MAX_ITEM'), 'suppliers' => Supplier::getSuppliers()));
}
示例5: hookPaymentReturn
public function hookPaymentReturn($params)
{
if (!$this->active) {
return;
}
global $smarty;
$state = $params['objOrder']->getCurrentState();
if ($state == Configuration::get('PS_OS_CHEQUE') or $state == Configuration::get('PS_OS_OUTOFSTOCK')) {
$smarty->assign(array('total_to_pay' => Tools::displayPrice($params['total_to_pay'], $params['currencyObj'], false), 'chequeName' => $this->chequeName, 'chequeAddress' => nl2br2($this->address), 'status' => 'ok', 'id_order' => $params['objOrder']->id));
} else {
$smarty->assign('status', 'failed');
}
return $this->display(__FILE__, 'payment_return.tpl');
}
示例6: dirname
// if we want our own tpl name, we can "steal" translations from other tpl files using our l2
include_once dirname(__FILE__) . '/../../Helpers.php';
CartAPI_Handlers_Helpers::preInit();
require_once dirname(__FILE__) . '/../../../../init.php';
include dirname(__FILE__) . '/bankwire.php';
// create an instance of the payment module
$bankwire = new CartAPI_Module_BankWire();
// get some extra params
$cartOrder = getCartOrder();
if ($cartOrder === FALSE) {
die("ERROR: Cannot get cart order");
}
$orderTotal = $cartOrder->total_paid;
$cartCurrency = new Currency((int) $cartOrder->id_currency);
// set some smarty params
$smarty->assign(array('total_to_pay' => Tools::displayPrice($orderTotal, $cartCurrency, false), 'bankwireDetails' => nl2br2($bankwire->details), 'bankwireAddress' => nl2br2($bankwire->address), 'bankwireOwner' => $bankwire->owner, 'id_order' => (int) $cartOrder->id));
// output
$smarty->force_compile = true;
// remove after tpl debug
$smarty->display(dirname(__FILE__) . '/success.tpl');
//////////////////////////////////////////////////////////////////////////
function getCartOrder()
{
global $cart;
$id_order = Order::getOrderByCartId((int) $cart->id);
if (!$id_order) {
return false;
}
$cartOrder = new Order((int) $id_order);
if (!Validate::isLoadedObject($cartOrder)) {
return false;
示例7: getContent
public function getContent()
{
if (Tools::isSubmit('addNewSlide')) {
$this->_createNewSlide();
}
foreach ($this->kinkyslider_output_images as $slideToUpdate) {
if (Tools::isSubmit($this->name . '_deleteslide_' . $slideToUpdate['kinky_id'])) {
$this->_deleteSlide($slideToUpdate['kinky_id']);
}
}
if (Tools::isSubmit('updateSlides')) {
foreach ($this->kinkyslider_output_images as $slideToUpdate) {
$_thisID = $slideToUpdate['kinky_id'];
$_thisLink = $slideToUpdate['kinky_link'];
$_thisImageDir = $slideToUpdate['kinky_imagedir'];
$_thisHeader = $slideToUpdate['kinky_header'];
$_thisPrice = $slideToUpdate['kinky_price'];
$_thisOrder = $slideToUpdate['kinky_order'];
$_thisActive = $slideToUpdate['kinky_active'];
$_thisSlideIsChanged = false;
/* Let's see if the user wanted to upload an image for this slide ID
* If so, we'll create a new directory on the server, move the uploaded image there,
* Scale the image to the width & height given in the configuration and
* Then save it as JPEG image.
*/
if (isset($_FILES[$this->name . '_image' . $_thisID]) and isset($_FILES[$this->name . '_image' . $_thisID]['tmp_name']) and !empty($_FILES[$this->name . '_image' . $_thisID]['tmp_name'])) {
if ($error = @checkImage($_FILES[$this->name . '_image' . $_thisID], 4000000)) {
$this->_postErrors[] = $error;
} else {
$_last_picture_dir = $this->bazinga_last_dir('images');
$_numeric_last_picture_dir = (int) $_last_picture_dir;
$_new_picture_dir = $_numeric_last_picture_dir + 1;
$_target_path = dirname(__FILE__) . '/uploads/images/' . $_new_picture_dir . '/';
mkdir(str_replace('//', '/', $_target_path), 0755, true);
if (move_uploaded_file($_FILES[$this->name . '_image' . $_thisID]['tmp_name'], $_target_path . KINKYSLIDER_DEFAULT_FILE_NAME . '.png')) {
// $this->bazinga_load($_target_path.$_FILES[$this->name.'_image'.$_thisID]['name']);
// $this->bazinga_resizeZoomCrop($this->kinkyslider_calculated_image_width,$this->kinkyslider_calculated_image_height);
//$this->bazinga_save($_target_path.KINKYSLIDER_DEFAULT_FILE_NAME.'.png');
$_thisImageDir = $_new_picture_dir;
$_thisSlideIsChanged = true;
}
}
}
if ($_checkUpdate = Tools::getValue($this->name . '_link' . $_thisID)) {
$this->_linkValidation($_checkUpdate);
if (!sizeof($this->_postErrors)) {
$_thisLink = $_checkUpdate;
$_thisSlideIsChanged = true;
}
}
if ($_checkUpdate = Tools::getValue($this->name . '_order' . $_thisID)) {
$this->_numericValidation($_checkUpdate, 'order');
if (!sizeof($this->_postErrors)) {
$_thisOrder = $_checkUpdate;
$_thisSlideIsChanged = true;
}
}
if ($_checkUpdate = Tools::getValue($this->name . '_header' . $_thisID)) {
$_thisHeader = strip_tags(nl2br2($_checkUpdate));
$_thisSlideIsChanged = true;
}
if ($_checkUpdate = Tools::getValue($this->name . '_price' . $_thisID)) {
$_thisPrice = strip_tags(nl2br2($_checkUpdate));
$_thisSlideIsChanged = true;
}
if ($_checkUpdate = (int) Tools::getValue($this->name . '_active' . $_thisID)) {
if ($_checkUpdate == 1 && $_thisActive == 0) {
$_thisActive = 1;
$_thisSlideIsChanged = true;
}
} elseif ((int) Tools::getValue($this->name . '_active' . $_thisID) != 1 && $_thisActive == 1) {
$_thisActive = 0;
$_thisSlideIsChanged = true;
}
if ($_thisSlideIsChanged == true) {
$this->_updataSlide($_thisID, $_thisLink, $_thisImageDir, $_thisHeader, $_thisPrice, $_thisOrder, $_thisActive);
}
}
/* end foreach */
if (!sizeof($this->_postErrors)) {
$this->_html .= '<div class="conf confirm">' . $this->l('Ustawienia zostały zaktualizowane') . '</div>';
} else {
foreach ($this->_postErrors as $err) {
$this->_html .= '<div class="alert error">' . $err . '</div>';
}
}
}
/*end isSubmit('updateSlider'); */
if (Tools::isSubmit('updateSettings')) {
foreach ($this->kinkyslider_config as $configRowToUpdate) {
if ($_checkUpdate = Tools::getValue($this->name . '_config_' . $configRowToUpdate['kinky_key'])) {
switch ($configRowToUpdate['kinky_validation']) {
case KINKYSLIDER_VALIDATION_STANDARD:
break;
case KINKYSLIDER_VALIDATION_NUMERIC:
$this->_numericValidation($_checkUpdate, $configRowToUpdate['sml_key']);
break;
case KINKYSLIDER_VALIDATION_NUMERIC_OR_NONE:
$this->_numericOrNoneValidation($_checkUpdate, $configRowToUpdate['kinky_label']);
break;
//.........这里部分代码省略.........
示例8: _postProcessParameters
private function _postProcessParameters()
{
// Saving new configurations
if ($this->setConfiguration('EBAY_PAYPAL_EMAIL', pSQL(Tools::getValue('ebay_paypal_email'))) && $this->setConfiguration('EBAY_IDENTIFIER', pSQL(Tools::getValue('ebay_identifier'))) && $this->setConfiguration('EBAY_RETURNS_ACCEPTED_OPTION', pSQL(Tools::getValue('ebay_returns_accepted_option'))) && $this->setConfiguration('EBAY_RETURNS_DESCRIPTION', $this->isVersionOneDotFive() ? Tools::nl2br(Tools::getValue('ebay_returns_description')) : nl2br2(Tools::getValue('ebay_returns_description')), true) && $this->setConfiguration('EBAY_SHOP', pSQL(Tools::getValue('ebay_shop'))) && $this->setConfiguration('EBAY_SHOP_POSTALCODE', pSQL(Tools::getValue('ebay_shop_postalcode'))) && $this->setConfiguration('EBAY_LISTING_DURATION', Tools::getValue('listingdurations')) && $this->setConfiguration('EBAY_AUTOMATICALLY_RELIST', Tools::getValue('automaticallyrelist')) && $this->setConfiguration('EBAY_CONDITION_NEW', Tools::getValue('newConditionID')) && $this->setConfiguration('EBAY_CONDITION_USED', Tools::getValue('usedConditionID')) && $this->setConfiguration('EBAY_CONDITION_REFURBISHED', Tools::getValue('refurbishedConditionID'))) {
$this->_html .= $this->displayConfirmation($this->l('Settings updated'));
} else {
$this->_html .= $this->displayError($this->l('Settings failed'));
}
}
示例9: process_answer
}
function process_answer($str)
{
$str = trim($str);
$f_str = preg_replace("/\\([A-Da-d]\\)/", "", substr($str, 0, 3)) . substr($str, 3);
return html_entity_decode(trim($f_str));
}
function process_answer_option($str)
{
$ansArray = array("1" => "A", "2" => "B", "3" => "C", "4" => "D");
$str = trim($str);
return array_search(substr($str, -1), $ansArray);
}
// Retrieve the DOM from a given URL
//$html = file_get_html('file:///var/www/html/quizmaster/upload/uk.html');
$html = nl2br2(file_get_contents('/var/www/html/quizmaster/upload/GKindiagktime.html'));
//echo $html;
$htmlArray = explode("<br />", $html);
$out = fopen('/var/www/html/quizmaster/upload/new.csv', 'w');
fputcsv($out, array('question', 'option_1', 'option_2', 'option_3', 'option_4', 'correct_answer', 'category', 'explanation', 'multi_answer'));
// Find all "span" tags and print their HREFs
$cnt = count($htmlArray);
$i = 0;
while ($i < $cnt) {
$i = $i + 2;
$data = array();
$data['question'] = $htmlArray[$i++];
$data['option_1'] = process_answer($htmlArray[$i++]);
$data['option_2'] = process_answer($htmlArray[$i++]);
$data['option_3'] = process_answer($htmlArray[$i++]);
$data['option_4'] = process_answer($htmlArray[$i++]);
示例10: intval
/* Scenes (could be externalised to another controler if you need them */
$smarty->assign('scenes', Scene::getScenes(intval($category->id), intval($cookie->id_lang), true, false));
/* Scenes images formats */
if ($sceneImageTypes = ImageType::getImagesTypes('scenes')) {
foreach ($sceneImageTypes as $sceneImageType) {
if ($sceneImageType['name'] == 'thumb_scene') {
$thumbSceneImageType = $sceneImageType;
} elseif ($sceneImageType['name'] == 'large_scene') {
$largeSceneImageType = $sceneImageType;
}
}
$smarty->assign('thumbSceneImageType', isset($thumbSceneImageType) ? $thumbSceneImageType : NULL);
$smarty->assign('largeSceneImageType', isset($largeSceneImageType) ? $largeSceneImageType : NULL);
}
$category->name = Category::hideCategoryPosition($category->name);
$category->description = nl2br2($category->description);
$subCategories = $category->getSubCategories(intval($cookie->id_lang));
$smarty->assign('category', $category);
if (Db::getInstance()->numRows()) {
$smarty->assign('subcategories', $subCategories);
}
if ($category->id != 1) {
$nbProducts = $category->getProducts(NULL, NULL, NULL, $orderBy, $orderWay, true);
include dirname(__FILE__) . '/pagination.php';
$smarty->assign('nb_products', $nbProducts);
$cat_products = $category->getProducts(intval($cookie->id_lang), intval($p), intval($n), $orderBy, $orderWay);
}
$smarty->assign(array('products' => (isset($cat_products) and $cat_products) ? $cat_products : NULL, 'id_category' => intval($category->id), 'id_category_parent' => intval($category->id_parent), 'return_category_name' => Tools::safeOutput(Category::hideCategoryPosition($category->name)), 'path' => Tools::getPath(intval($category->id), $category->name)));
}
}
$smarty->assign(array('allow_oosp' => intval(Configuration::get('PS_ORDER_OUT_OF_STOCK')), 'suppliers' => Supplier::getSuppliers(), 'errors' => $errors));
示例11: _postProcessParameters
private function _postProcessParameters()
{
// Saving new configurations
if ($this->setConfiguration('EBAY_PAYPAL_EMAIL', pSQL(Tools::getValue('ebay_paypal_email'))) && $this->setConfiguration('EBAY_IDENTIFIER', pSQL(Tools::getValue('ebay_identifier'))) && $this->setConfiguration('EBAY_RETURNS_ACCEPTED_OPTION', pSQL(Tools::getValue('ebay_returns_accepted_option'))) && $this->setConfiguration('EBAY_RETURNS_DESCRIPTION', version_compare(_PS_VERSION_, '1.5', '>') ? Tools::nl2br(Tools::getValue('ebay_returns_description')) : nl2br2(Tools::getValue('ebay_returns_description')), true) && $this->setConfiguration('EBAY_SHOP', pSQL(Tools::getValue('ebay_shop'))) && $this->setConfiguration('EBAY_SHOP_POSTALCODE', pSQL(Tools::getValue('ebay_shop_postalcode'))) && $this->setConfiguration('EBAY_LISTING_DURATION', Tools::getValue('listingdurations')) && $this->setConfiguration('EBAY_PICTURE_SIZE_DEFAULT', (int) Tools::getValue('sizedefault')) && $this->setConfiguration('EBAY_PICTURE_SIZE_SMALL', (int) Tools::getValue('sizesmall')) && $this->setConfiguration('EBAY_PICTURE_SIZE_BIG', (int) Tools::getValue('sizebig')) && $this->setConfiguration('EBAY_AUTOMATICALLY_RELIST', Tools::getValue('automaticallyrelist')) && $this->setConfiguration('EBAY_RETURNS_WITHIN', pSQL(Tools::getValue('returnswithin'))) && $this->setConfiguration('EBAY_RETURNS_WHO_PAYS', pSQL(Tools::getValue('returnswhopays')))) {
$this->html .= $this->displayConfirmation($this->l('Settings updated'));
} else {
$this->html .= $this->displayError($this->l('Settings failed'));
}
}
示例12: postProcess
public function postProcess()
{
global $currentIndex, $cookie, $link;
if ($id_customer_thread = (int) Tools::getValue('id_customer_thread')) {
if ($id_contact = (int) Tools::getValue('id_contact')) {
Db::getInstance()->Execute('UPDATE ' . _DB_PREFIX_ . 'customer_thread SET id_contact = ' . (int) $id_contact . ' WHERE id_customer_thread = ' . (int) $id_customer_thread);
}
if ($id_status = (int) Tools::getValue('setstatus')) {
$statusArray = array(1 => 'open', 2 => 'closed', 3 => 'pending1', 4 => 'pending2');
Db::getInstance()->Execute('UPDATE ' . _DB_PREFIX_ . 'customer_thread SET status = "' . $statusArray[$id_status] . '" WHERE id_customer_thread = ' . (int) $id_customer_thread . ' LIMIT 1');
}
if (isset($_POST['id_employee_forward'])) {
// Todo: need to avoid doubles
$messages = Db::getInstance()->ExecuteS('
SELECT ct.*, cm.*, cl.name subject, CONCAT(e.firstname, \' \', e.lastname) employee_name, CONCAT(c.firstname, \' \', c.lastname) customer_name, c.firstname
FROM ' . _DB_PREFIX_ . 'customer_thread ct
LEFT JOIN ' . _DB_PREFIX_ . 'customer_message cm ON (ct.id_customer_thread = cm.id_customer_thread)
LEFT JOIN ' . _DB_PREFIX_ . 'contact_lang cl ON (cl.id_contact = ct.id_contact AND cl.id_lang = ' . (int) $cookie->id_lang . ')
LEFT OUTER JOIN ' . _DB_PREFIX_ . 'employee e ON e.id_employee = cm.id_employee
LEFT OUTER JOIN ' . _DB_PREFIX_ . 'customer c ON (c.email = ct.email)
WHERE ct.id_customer_thread = ' . (int) Tools::getValue('id_customer_thread') . '
ORDER BY cm.date_add DESC');
$output = '';
foreach ($messages as $message) {
$output .= $this->displayMsg($message, true, (int) Tools::getValue('id_employee_forward'));
}
$cm = new CustomerMessage();
$cm->id_employee = (int) $cookie->id_employee;
$cm->id_customer_thread = (int) Tools::getValue('id_customer_thread');
$cm->ip_address = ip2long($_SERVER['REMOTE_ADDR']);
$currentEmployee = new Employee($cookie->id_employee);
if ($id_employee = (int) Tools::getValue('id_employee_forward') and $employee = new Employee($id_employee) and Validate::isLoadedObject($employee)) {
$params = array('{messages}' => $output, '{employee}' => $currentEmployee->firstname . ' ' . $currentEmployee->lastname, '{comment}' => stripslashes($_POST['message_forward']));
if (Mail::Send((int) $cookie->id_lang, 'forward_msg', Mail::l('Fwd: Customer message', (int) $cookie->id_lang), $params, $employee->email, $employee->firstname . ' ' . $employee->lastname, $currentEmployee->email, $currentEmployee->firstname . ' ' . $currentEmployee->lastname, NULL, NULL, _PS_MAIL_DIR_, true)) {
$cm->message = $this->l('Message forwarded to') . ' ' . $employee->firstname . ' ' . $employee->lastname . "\n" . $this->l('Comment:') . ' ' . $_POST['message_forward'];
$cm->add();
}
} elseif ($email = Tools::getValue('email') and Validate::isEmail($email)) {
$params = array('{messages}' => $output, '{employee}' => $currentEmployee->firstname . ' ' . $currentEmployee->lastname, '{comment}' => stripslashes($_POST['message_forward']));
if (Mail::Send((int) $cookie->id_lang, 'forward_msg', Mail::l('Fwd: Customer message', (int) $cookie->id_lang), $params, $email, NULL, $currentEmployee->email, $currentEmployee->firstname . ' ' . $currentEmployee->lastname, NULL, NULL, _PS_MAIL_DIR_, true)) {
$cm->message = $this->l('Message forwarded to') . ' ' . $email . "\n" . $this->l('Comment:') . ' ' . $_POST['message_forward'];
$cm->add();
}
} else {
echo '<div class="alert error">' . Tools::displayError('Email invalid.') . '</div>';
}
}
if (Tools::isSubmit('submitReply')) {
$ct = new CustomerThread($id_customer_thread);
$cm = new CustomerMessage();
$cm->id_employee = (int) $cookie->id_employee;
$cm->id_customer_thread = $ct->id;
$cm->message = Tools::htmlentitiesutf8(nl2br2(Tools::getValue('reply_message')));
$cm->ip_address = ip2long($_SERVER['REMOTE_ADDR']);
if (isset($_FILES) and !empty($_FILES['joinFile']['name']) and $_FILES['joinFile']['error'] != 0) {
$this->_errors[] = Tools::displayError('An error occurred with the file upload.');
} elseif ($cm->add()) {
$fileAttachment = NULL;
if (!empty($_FILES['joinFile']['name'])) {
$fileAttachment['content'] = file_get_contents($_FILES['joinFile']['tmp_name']);
$fileAttachment['name'] = $_FILES['joinFile']['name'];
$fileAttachment['mime'] = $_FILES['joinFile']['type'];
}
$params = array('{reply}' => nl2br2(Tools::getValue('reply_message')), '{link}' => $link->getPageLink('contact-form.php', true) . '?id_customer_thread=' . (int) $ct->id . '&token=' . $ct->token);
if (Mail::Send((int) $ct->id_lang, 'reply_msg', Mail::l('An answer to your message is available', (int) $ct->id_lang), $params, Tools::getValue('msg_email'), NULL, NULL, NULL, $fileAttachment, NULL, _PS_MAIL_DIR_, true)) {
$ct->status = 'closed';
$ct->update();
}
Tools::redirectAdmin($currentIndex . '&id_customer_thread=' . (int) $id_customer_thread . '&viewcustomer_thread&token=' . Tools::getValue('token'));
} else {
$this->_errors[] = Tools::displayError('An error occurred, your message was not sent. Please contact your system administrator.');
}
}
}
return parent::postProcess();
}
示例13: hookPaymentReturn
public function hookPaymentReturn($params)
{
if (!$this->active) {
return;
}
global $smarty;
$state = $params['objOrder']->getCurrentState();
if ($state == _PS_OS_BANKWIRE_ or $state == _PS_OS_OUTOFSTOCK_) {
$smarty->assign(array('total_to_pay' => Tools::displayPrice($params['total_to_pay'], $params['currencyObj'], false, false), 'bankwireDetails' => nl2br2($this->details), 'bankwireAddress' => nl2br2($this->address), 'bankwireOwner' => $this->owner, 'status' => 'ok', 'id_order' => $params['objOrder']->id));
} else {
$smarty->assign('status', 'failed');
}
return $this->display(__FILE__, 'payment_return.tpl');
}
示例14: displayForm
public function displayForm($isMainTab = true)
{
global $currentIndex, $cookie;
parent::displayForm();
if (!($obj = $this->loadObject(true))) {
return;
}
echo '
<form action="' . $currentIndex . '&submitAdd' . $this->table . '=1&token=' . $this->token . '" method="post">
' . ($obj->id ? '<input type="hidden" name="id_' . $this->table . '" value="' . $obj->id . '" />' : '') . '
<input type="hidden" name="id_order" value="' . $obj->id_order . '" />
<input type="hidden" name="id_customer" value="' . $obj->id_customer . '" />
<fieldset><legend><img src="../img/admin/return.gif" />' . $this->l('Return Merchandise Authorization (RMA)') . '</legend>
<label>' . $this->l('Customer:') . ' </label>';
$customer = new Customer((int) $obj->id_customer);
echo '
<div class="margin-form">' . $customer->firstname . ' ' . $customer->lastname . '
<p style="clear: both"><a href="index.php?tab=AdminCustomers&id_customer=' . $customer->id . '&viewcustomer&token=' . Tools::getAdminToken('AdminCustomers' . (int) Tab::getIdFromClassName('AdminCustomers') . (int) $cookie->id_employee) . '">' . $this->l('View details on customer page') . '</a></p>
</div>
<label>' . $this->l('Order:') . ' </label>';
$order = new Order((int) $obj->id_order);
echo ' <div class="margin-form">' . $this->l('Order #') . sprintf('%06d', $order->id) . ' ' . $this->l('from') . ' ' . Tools::displayDate($order->date_upd, $order->id_lang) . '
<p style="clear: both"><a href="index.php?tab=AdminOrders&id_order=' . $order->id . '&vieworder&token=' . Tools::getAdminToken('AdminOrders' . (int) Tab::getIdFromClassName('AdminOrders') . (int) $cookie->id_employee) . '">' . $this->l('View details on order page') . '</a></p>
</div>
<label>' . $this->l('Customer explanation:') . ' </label>
<div class="margin-form">' . nl2br2($obj->question) . '</div>
<label>' . $this->l('Status:') . ' </label>
<div class="margin-form">
<select name=\'state\'>';
$states = OrderReturnState::getOrderReturnStates($cookie->id_lang);
foreach ($states as $state) {
echo '<option value="' . $state['id_order_return_state'] . '"' . ($obj->state == $state['id_order_return_state'] ? ' selected="selected"' : '') . '>' . $state['name'] . '</option>';
}
echo ' </select>
<p style="clear: both">' . $this->l('Merchandise return (RMA) status') . '</p>
</div>';
if ($obj->state >= 3) {
echo ' <label>' . $this->l('Slip:') . ' </label>
<div class="margin-form">' . $this->l('Generate a new slip from the customer order') . '
<p style="clear: both"><a href="index.php?tab=AdminOrders&id_order=' . $order->id . '&vieworder&token=' . Tools::getAdminToken('AdminOrders' . (int) Tab::getIdFromClassName('AdminOrders') . (int) $cookie->id_employee) . '#products">' . $this->l('More information on order page') . '</a></p>
</div>';
}
echo ' <label>' . $this->l('Products:') . ' </label>
<div class="margin-form">';
echo '<table cellpadding="0" cellspacing="0">
<tr>
<td class="col-left"> </td>
<td>
<table cellspacing="0" cellpadding="0" class="table">
<tr>
<th style="width: 100px;">' . $this->l('Reference') . '</th>
<th>' . $this->l('Product name') . '</th>
<th>' . $this->l('Quantity') . '</th>
<th>' . $this->l('Action') . '</th>
</tr>';
$order = new Order((int) $obj->id_order);
$quantityDisplayed = array();
/* Customized products */
if ($returnedCustomizations = OrderReturn::getReturnedCustomizedProducts((int) $obj->id_order)) {
$allCustomizedDatas = Product::getAllCustomizedDatas((int) $order->id_cart);
foreach ($returnedCustomizations as $returnedCustomization) {
echo '
<tr>
<td>' . $returnedCustomization['reference'] . '</td>
<td class="center">' . $returnedCustomization['name'] . '</td>
<td class="center">' . (int) $returnedCustomization['product_quantity'] . '</td>
<td class="center"><a href="' . $currentIndex . '&deleteorder_return_detail&id_order_detail=' . $returnedCustomization['id_order_detail'] . '&id_customization=' . $returnedCustomization['id_customization'] . '&id_order_return=' . $obj->id . '&token=' . $this->token . '"><img src="../img/admin/delete.gif"></a></td>
</tr>';
$customizationDatas =& $allCustomizedDatas[(int) $returnedCustomization['product_id']][(int) $returnedCustomization['product_attribute_id']][(int) $returnedCustomization['id_customization']]['datas'];
foreach ($customizationDatas as $type => $datas) {
echo '<tr>
<td colspan="4">';
if ($type == _CUSTOMIZE_FILE_) {
$i = 0;
echo '<ul style="margin: 4px 0px 4px 0px; padding: 0px; list-style-type: none;">';
foreach ($datas as $data) {
echo '<li style="display: inline; margin: 2px;">
<a href="displayImage.php?img=' . $data['value'] . '&name=' . (int) $order->id . '-file' . ++$i . '" target="_blank"><img src="' . _THEME_PROD_PIC_DIR_ . $data['value'] . '_small" alt="" /></a>
</li>';
}
echo '</ul>';
} elseif ($type == _CUSTOMIZE_TEXTFIELD_) {
$i = 0;
echo '<ul style="margin: 0px 0px 4px 0px; padding: 0px 0px 0px 6px; list-style-type: none;">';
foreach ($datas as $data) {
echo '<li>' . ($data['name'] ? $data['name'] : $this->l('Text #') . ++$i) . $this->l(':') . ' ' . $data['value'] . '</li>';
}
echo '</ul>';
}
echo '</td>
</tr>';
}
$quantityDisplayed[(int) $returnedCustomization['id_order_detail']] = isset($quantityDisplayed[(int) $returnedCustomization['id_order_detail']]) ? $quantityDisplayed[(int) $returnedCustomization['id_order_detail']] + (int) $returnedCustomization['product_quantity'] : (int) $returnedCustomization['product_quantity'];
}
}
/* Classic products */
$products = OrderReturn::getOrdersReturnProducts($obj->id, $order);
foreach ($products as $k => $product) {
if (!isset($quantityDisplayed[(int) $product['id_order_detail']]) or (int) $product['product_quantity'] > (int) $quantityDisplayed[(int) $product['id_order_detail']]) {
//.........这里部分代码省略.........
示例15: amr_format_value
//.........这里部分代码省略.........
/* amr need to add code to reformat the timezone as per admin entry. Also only show if timezone different ? */
$htmlcontent = amr_format_tz(timezone_name_get($content));
break;
case 'TZID':
/* amr need to add code to reformat the timezone as per admin entry. Also only show if timezone different ? */
$htmlcontent = amr_format_tz(timezone_name_get($content));
break;
case 'timezone':
/* amr need to add code to reformat the timezone as per admin entry. Also only show if timezone different ? */
$htmlcontent = amr_format_timezone($content);
break;
default:
/* should not be any */
$htmlcontent = amr_format_date($amr_formats['DateTime'], $content);
}
} elseif (is_array($content)) {
if ($k === 'DURATION') {
$htmlcontent = amr_format_duration($content);
} elseif ($k === 'RRULE' or $k === 'EXRULE') {
$htmlcontent = amr_format_rrule($content);
} elseif ($k === 'RDATE' or $k === 'EXDATE') {
$htmlcontent = amr_prettyprint_r_ex_date($content);
} elseif ($k === 'CATEGORIES') {
// umm - what if ics category
$htmlcontent = amr_format_taxonomies('category', $content);
} elseif ($k === 'post_tag') {
$htmlcontent = amr_format_taxonomies('post_tag', $content);
} elseif ($k == 'ATTACH') {
if (isset($content[0]['type'])) {
// then we are at the top level of the array, so can ask to handled repetaed values
return amr_format_repeatable_property($content, $k, $event, $before, $after);
} else {
$htmlcontent = amr_format_attach($content, $event);
}
} else {
/* simple array don't think we need to list the items separately eg: multiple comments or descriptions - just line */
if (!empty($eventtaxonomies) and in_array($k, $eventtaxonomies)) {
$htmlcontent = amr_format_taxonomies($k, $content);
} else {
return amr_format_repeatable_property($content, $k, $event, $before, $after);
}
}
} elseif (is_null($content) or $content === '') {
$htmlcontent = '';
} else {
if (function_exists('amr_format_' . $k)) {
$htmlcontent = call_user_func('amr_format_' . $k, $content);
} else {
switch ($k) {
case 'COMMENT':
case 'DESCRIPTION':
//var_dump($content);
$htmlcontent = html_entity_decode(amr_click_and_trim(nl2br2(amr_amp($content))));
break;
case 'SUMMARY':
case 'icsurl':
case 'addtogoogle':
case 'addevent':
case 'subscribeevent':
case 'subscribeseries':
case 'map':
case 'refresh':
case 'attending_event':
$htmlcontent = $content;
/* avoid hyperlink as we may have added url already */
break;
case 'URL':
/* assume valid URL, should not need to validate here, then format it as such */
$htmlcontent = amr_format_url($content);
break;
case 'LOCATION':
$htmlcontent = amr_click_and_trim(nl2br2(amr_amp($content)));
break;
case 'X-WR-TIMEZONE':
/* not parsed as object - since it is cal attribute, not property attribue */
$htmlcontent = amr_format_tz($content);
break;
case 'allday':
$htmlcontent = amr_format_allday($content);
break;
default:
/* Convert any newlines to html breaks */
if (!empty($eventtaxonomies) and in_array($k, $eventtaxonomies)) {
$htmlcontent = amr_format_taxonomies($k, $content);
} else {
$func = 'amr_format_' . str_replace('-', '_', $k);
if (function_exists($func)) {
$htmlcontent = call_user_func($func, $content);
}
$htmlcontent = str_replace("\n", "<br />", $content);
}
}
}
}
}
if (empty($htmlcontent)) {
return;
}
return $before . $htmlcontent . $after;
}