本文整理汇总了PHP中modApiFunc函数的典型用法代码示例。如果您正苦于以下问题:PHP modApiFunc函数的具体用法?PHP modApiFunc怎么用?PHP modApiFunc使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了modApiFunc函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onAction
function onAction()
{
global $application;
if (modApiFunc('Session', 'is_Set', 'SessionPost')) {
_fatal(array("CODE" => "CORE_050"), __CLASS__, __FUNCTION__);
}
$SessionPost = $_POST;
$SessionPost["ViewState"]["ErrorsArray"] = array();
$fsr_id = $SessionPost["FsRule_id"] = intval($SessionPost["FsRule_id"]);
$SessionPost["FsRuleName"] = trim($SessionPost["FsRuleName"]);
$SessionPost["FsRuleMinSubtotal"] = floatval($SessionPost["FsRuleMinSubtotal"]);
$SessionPost["FsRuleStrictCart"] = intval($SessionPost["StrictCart"]);
if ($SessionPost["FsRuleName"] == "") {
$SessionPost["ViewState"]["ErrorsArray"][] = "ERROR_EMPTY_RULE_NAME";
}
$is_unique = modApiFunc("Shipping_Cost_Calculator", "checkIfFsRuleIsUnique", $SessionPost["FsRuleName"], $fsr_id);
if (!$is_unique) {
$SessionPost["ViewState"]["ErrorsArray"][] = "ERROR_NOT_UNIQUE_RULE_NAME";
}
if ($SessionPost["FormSubmitValue"] == "Save") {
if (count($SessionPost["ViewState"]["ErrorsArray"]) == 0) {
unset($SessionPost["ViewState"]["ErrorsArray"]);
$this->saveSettings($SessionPost);
$SessionPost["ViewState"]["hasCloseScript"] = "true";
}
}
modApiFunc('Session', 'set', 'SessionPost', $SessionPost);
$request = new Request();
$request->setView(CURRENT_REQUEST_URL);
$request->setKey('FsRule_id', $fsr_id);
$application->redirect($request);
}
示例2: onAction
function onAction()
{
global $application;
$request =& $application->getInstance('Request');
$sets = $request->getValueByKey('sets');
$errors = array();
$sets['CATS_PREFIX'] = preg_replace("/[^a-z0-9_\\-]/i", "", $sets['CATS_PREFIX']);
$sets['PRODS_PREFIX'] = preg_replace("/[^a-z0-9_\\-]/i", "", $sets['PRODS_PREFIX']);
$sets['CMS_PREFIX'] = preg_replace("/[^a-z0-9_\\-]/i", "", $sets['CMS_PREFIX']);
if ($sets['CATS_PREFIX'] == "") {
$errors[] = 'ERR_INVALID_CATS_PREFIX';
}
if ($sets['PRODS_PREFIX'] == "") {
$errors[] = 'ERR_INVALID_PRODS_PREFIX';
}
if ($sets['CMS_PREFIX'] == "") {
$errors[] = 'ERR_INVALID_CMS_PREFIX';
}
if (empty($errors) and ($sets['CATS_PREFIX'] == $sets['PRODS_PREFIX'] or $sets['CMS_PREFIX'] == $sets['PRODS_PREFIX'] or $sets['CATS_PREFIX'] == $sets['CMS_PREFIX'])) {
$errors[] = 'ERR_PREFIXES_ARE_SAME';
}
if (empty($errors)) {
modApiFunc('Mod_Rewrite', 'updateSettings', $sets);
modApiFunc('Session', 'set', 'ResultMessage', 'MSG_SETTINGS_UPDATED');
} else {
modApiFunc('Session', 'set', 'MR_sets', $sets);
modApiFunc('Session', 'set', 'Errors', $errors);
}
$r = new Request();
$r->setView(CURRENT_REQUEST_URL);
// $r->setKey('page_view','MR_Settings');
$application->redirect($r);
}
示例3: getTag
function getTag($tag)
{
global $application;
$obj =& $application->getInstance('MessageResources', "payment-module-gc-messages", "AdminZone");
global $application;
$value = null;
switch ($tag) {
// case $this->HTML_LOCAL_TAGS_PREFIX .'PaymentHTMLModuleDescription':
// $value = $obj->getMessage('MODULE_PAYMENT_PAYPAL_PAYPAL_IPN_HTML_DESCRIPTION_CZ');
// break;
case $this->HTML_LOCAL_TAGS_PREFIX . 'FormMethodIdFieldName':
$value = "paymentModule[method_code]";
break;
case $this->HTML_LOCAL_TAGS_PREFIX . 'PaymentMethodID':
$ModuleInfo = modApiFunc($this->ModuleAPIClassName, "getInfo");
$value = $ModuleInfo['GlobalUniquePaymentModuleID'];
break;
case $this->HTML_LOCAL_TAGS_PREFIX . 'PaymentMethodName':
$ModuleInfo = modApiFunc($this->ModuleAPIClassName, "getInfo");
$value = $ModuleInfo['Name'];
break;
default:
break;
}
return $value;
}
示例4: onAction
/**
* @ describe the function ReinstallModuleAction->.
*/
function onAction()
{
global $application;
$request = $application->getInstance('Request');
$this->extn_name = $request->getValueByKey('extn_name');
$extension_name = $this->extn_name;
if ($this->extn_name != 'Modules_Manager') {
$pathdir = $application->getAppIni('PATH_ADD_MODULES_DIR');
$this->extn_name = strtolower($this->extn_name);
if (is_dir($pathdir . $this->extn_name) && $this->extn_name != "") {
modApiFunc('Extension_Manager', 'updateExtensionStatus', $extension_name, true);
modApiFunc("Modules_Manager", "initModules");
$moduleInfo = modApiFunc('Modules_Manager', 'getModuleInfoFromFile', '/avactis-extensions/' . $this->extn_name);
$backup_created = modApiFunc('Extension_Manager', 'backup_extension', $moduleInfo);
if ($backup_created) {
modApiFunc('Modules_Manager', 'uninstallModule', $moduleInfo);
modApiFunc("Session", "set", "UninstallMessage", 1);
} else {
modApiFunc('Extension_Manager', 'updateExtensionStatus', $extension_name, false);
modApiFunc("Session", "set", "ErrorMessage", "ERR_EXTN_BACKUP_FAILED");
}
} else {
modApiFunc("Session", "set", "ErrorMessage", "ERR_UNINSTALL_FAILED");
}
}
}
示例5: onAction
function onAction()
{
global $application;
$request =& $application->getInstance('Request');
$layout_path = $request->getValueByKey('layout_path');
$mr_act = $request->getValueByKey('mr_act');
if ($mr_act == 'on') {
$hta_content = modApiFunc('Mod_Rewrite', 'genRewriteBlock', $layout_path);
$res = modApiFunc('Mod_Rewrite', 'saveHTAcontent', $hta_content, $layout_path);
if (empty($res)) {
modApiFunc('Session', 'set', 'ResultMessage', 'MSG_MR_ENABLED');
modApiFunc('Mod_Rewrite', 'enableMRforLayout', $layout_path);
} else {
modApiFunc('Session', 'set', 'Errors', $res);
}
}
if ($mr_act == 'off') {
modApiFunc('Mod_Rewrite', 'disableMRforLayout', $layout_path);
modApiFunc('Session', 'set', 'ResultMessage', 'MSG_MR_DISABLED');
}
$r = new Request();
$r->setView(CURRENT_REQUEST_URL);
$r->setKey('page_view', 'MR_Settings');
$application->redirect($r);
}
示例6: onAction
function onAction()
{
global $application;
$request = new Request();
$category_id = $request->getValueByKey('category_id');
$tree_id = $request->getValueByKey('tree_id');
$fp_ids = $request->getValueByKey('to_save');
modApiFunc('Featured_Products', 'deleteAllFPLinksFromCategory', $category_id);
$errors = array();
if ($fp_ids != null) {
if (!modApiFunc('Featured_Products', 'addFPLinksToCategory', $category_id, $fp_ids)) {
$errors[] = 'E_FP_NOT_SAVED';
}
}
if (empty($errors)) {
modApiFunc('Session', 'set', 'ResultMessage', 'MSG_FP_SAVED');
} else {
modApiFunc('Session', 'set', 'Errors', $errors);
}
$request->setView('PopupWindow');
$request->setKey('page_view', 'FP_LinksList');
$request->setKey('category_id', $category_id);
$request->setKey('tree_id', $tree_id);
$application->redirect($request);
}
示例7: onAction
/**
* Deletes tax rate by zip set.
*/
function onAction()
{
global $application;
$SessionPost = array();
$SessionPost = $_POST;
$Errors = array();
$Result = array();
$request = new Request();
$request->setView("PopupWindow");
$updateSid = $request->getValueByKey("updateSid", 0);
if ($updateSid) {
$request->setKey("updateSid", $updateSid);
}
$description = '';
if (isset($_POST['file_description'])) {
$description = prepareHTMLDisplay(trim($_POST['file_description']));
}
if ($description == '') {
$SessionPost['Errors'][] = getMsg("TAX_ZIP", "ADD_NEW_SET_EMPTY_FILE_DESCRIPTION_ERROR");
modApiFunc('Session', 'set', 'SessionPost', $SessionPost);
$request->setKey("page_view", "TaxRateByZip_AddNewSet");
$application->redirect($request);
return;
}
modApiFunc('Session', 'set', 'SessionPost', $SessionPost);
$sid = modApiFunc("TaxRateByZip", "addSetToDB", $description, $_POST["csv_file_name"]);
$request->setKey("page_view", "TaxRatesImportView");
$request->setKey("sid", $sid);
$application->redirect($request);
}
示例8: onAction
function onAction()
{
global $application;
$request = new Request();
$account_name = modApiFunc('Customer_Account', 'getCurrentSignedCustomer');
$errors = array();
if ($account_name != null) {
$current_password = $request->getValueByKey('current_password');
if (!modApiFunc('Customer_Account', 'isCorrectAccountAndPasswd', $account_name, $current_password)) {
$errors[] = 'E_INVALID_CURRENT_PASSWD';
} else {
$validator =& $application->getInstance('CAValidator');
$passwd = array('passwd' => $request->getValueByKey('new_password'), 're-type' => $request->getValueByKey('retype_password'));
if (!$validator->isValid('passwd', $passwd)) {
$errors[] = 'E_INVALID_PASSWD';
}
}
if (!empty($errors)) {
modApiFunc('Session', 'set', 'RegisterErrors', $errors);
} else {
modApiFunc('Session', 'set', 'ResultMessage', 'MSG_PASSWD_UPDATED');
$obj =& $application->getInstance('CCustomerInfo', $account_name);
$obj->changePassword($passwd['passwd']);
}
}
$request->setView('CustomerChangePassword');
$application->redirect($request);
}
示例9: onAction
/**
*
*/
function onAction()
{
global $application;
$SessionPost = $_POST;
$SessionPost["ViewState"]["ShowResults"] = "true";
$request = $application->getInstance('Request');
$products = array();
$prod_prices = $request->getValueByKey("price");
$prod_qtys = $request->getValueByKey("qty");
$prod_shipping_costs = $request->getValueByKey("shipping_cost");
$prod_tax_classes = $request->getValueByKey("tax_class");
for ($i = 1; $i <= sizeof($prod_prices); $i++) {
// _ _ .
$price_including_taxes = modApiFunc("Localization", "FormatStrToFloat", $prod_prices[$i], "currency");
$price_excluding_taxes = modApiFunc("Catalog", "computePriceExcludingTaxes", $price_including_taxes, $prod_tax_classes[$i], true);
//force to work in AZ
$price_excluding_taxes = number_format($price_excluding_taxes, 2, '.', ',');
$SessionPost["price"][$i] = $price_excluding_taxes;
$products[] = array("CartItemSalePrice" => $price_excluding_taxes, "CartItemSalePriceExcludingTaxes" => $price_excluding_taxes, "Quantity_In_Cart" => $prod_qtys[$i], "ShippingPrice" => modApiFunc("Localization", "FormatStrToFloat", $prod_shipping_costs[$i], "currency"), "TaxClass" => $prod_tax_classes[$i]);
}
$country_id = modApiFunc('Configuration', 'getValue', SYSCONFIG_STORE_OWNER_COUNTRY);
$state = modApiFunc('Configuration', 'getValue', SYSCONFIG_STORE_OWNER_STATE);
// , , , ProductInfo,
// .
// - .
// $price_including_taxes
if (!is_numeric($country_id) || $country_id < 1 || !is_numeric($state) || $state < 1) {
// :
_fatal(array("CODE" => "CORE_057"), __CLASS__, __FUNCTION__);
}
modApiFunc('Taxes', 'setTaxDebug', $products, modApiFunc("Localization", "FormatStrToFloat", $request->getValueByKey("ShippingCost"), "currency"), $request->getValueByKey("ShippingMethod"), PRICE_N_A, array("Default" => array("CountryId" => $country_id, "StateId" => $state), "Shipping" => array("CountryId" => $request->getValueByKey("ShippingCountryId"), "StateId" => $request->getValueByKey("ShippingStateId")), "Billing" => array("CountryId" => $request->getValueByKey("BillingCountryId"), "StateId" => $request->getValueByKey("BillingStateId"))));
modApiFunc('Session', 'set', 'SessionPost', $SessionPost);
}
示例10: onAction
function onAction()
{
$r = new Request();
$to_cc = $r->getValueByKey('to_currency_code');
$from_cc = $r->getValueByKey('from_currency_code');
$base = $r->getValueByKey('base_rate');
$rate = trim($base);
$errors = array();
if (modApiFunc('Currency_Converter', 'doesManRateExists', $from_cc, $to_cc)) {
$errors[] = 'E_MAN_RATE_EXISTS';
}
#
# base rate validation. should be integer or decimal value
#
if ($this->validateDecimal($rate) != true) {
$errors[] = 'E_MAN_INVALID_RATE';
}
if (empty($errors)) {
if (!modApiFunc('Currency_Converter', 'addManualRate', $from_cc, $to_cc, $rate)) {
$errors[] = 'E_MAN_RATE_NOT_ADDED';
}
}
if (empty($errors)) {
modApiFunc('Session', 'set', 'ResultMessage', 'MSG_MAN_RATE_ADDED');
} else {
modApiFunc('Session', 'set', 'Errors', $errors);
}
$r->setView('PopupWindow');
$r->setKey('page_view', 'CurrencyRateEditor');
global $application;
$application->redirect($r);
}
示例11: getPresentOrderTotalAndCurrency
function getPresentOrderTotalAndCurrency($order_id)
{
$currency_id = modApiFunc("Localization", "whichCurrencySendOrderToPaymentShippingGatewayIn", $order_id, $this->getUid());
$currency = modApiFunc("Localization", "getCurrencyCodeById", $currency_id);
$order = modApiFunc('Checkout', 'getOrderInfo', $order_id, $currency_id);
return array('total' => floatval($order['Total']), 'curr' => $currency, 'msg' => getMsg('CHCKT', 'PAYMENT_STATUS_SUSPICIOUS'));
}
示例12: out_MessagesList
function out_MessagesList()
{
if (modApiFunc('Session', 'is_set', 'ResultMessage')) {
$html_code = '';
$messages = modApiFunc('Session', 'get', 'ResultMessage');
modApiFunc('Session', 'un_set', 'ResultMessage');
if (!is_array($messages)) {
$messages = array($messages);
}
foreach ($messages as $k => $message) {
$this->current_message = $message;
$html_code .= $this->templateFiller->fill('Message');
}
return $html_code;
}
if (modApiFunc('Session', 'is_set', 'RegisterErrors')) {
$html_code = '';
$errors = modApiFunc('Session', 'get', 'RegisterErrors');
modApiFunc('Session', 'un_set', 'RegisterErrors');
foreach ($errors as $k => $error) {
$this->current_error_number = $k + 1;
$this->current_error_message = $error;
$html_code .= $this->templateFiller->fill('Error');
}
return $html_code;
}
return '';
}
示例13: output
/**
*
*
* @
* @param
* @return
*/
function output()
{
global $application;
$this->_Template_Contents = array('FieldName' => modApiFunc("Hint", "getFieldName"), 'FieldDescr' => modApiFunc("Hint", "getFieldDescription"));
$application->registerAttributes($this->_Template_Contents);
return modApiFunc('TmplFiller', 'fill', "hint/", "container.tpl.html", array());
}
示例14: onAction
function onAction()
{
global $application;
$request = $application->getInstance('Request');
$pcid = $request->getValueByKey('PromoCodeID');
$categories_affected = $request->getValueByKey('cat_to_save');
$products_affected = $request->getValueByKey('prod_to_save');
$data['pcid'] = $pcid;
if ($categories_affected) {
$data['cats'] = implode('|', $categories_affected);
} else {
$data['cats'] = '';
}
if ($products_affected) {
$data['prods'] = implode('|', $products_affected);
} else {
$data['prods'] = '';
}
if ($pcid) {
$this->saveDataToDB($data);
}
$SessionPost = array('ViewState' => array('hasCloseScript' => false));
modApiFunc('Session', 'set', 'SessionPost', $SessionPost);
$request->setView('EditPromoCodeArea');
$request->setKey('PromoCode_id', $pcid);
$application->redirect($request);
}
示例15: SubscribeFormProfile
function SubscribeFormProfile()
{
$this->ini_section = 'SubscribeFormProfile';
$account = modApiFunc('Customer_Account', 'getCurrentSignedCustomer');
$this->emails = modApiFunc('Subscriptions', 'getCustomerSubscriptionEmails', $account);
$this->SubscribeForm_Base();
}