当前位置: 首页>>代码示例>>PHP>>正文


PHP DefaultPriceFormat函数代码示例

本文整理汇总了PHP中DefaultPriceFormat函数的典型用法代码示例。如果您正苦于以下问题:PHP DefaultPriceFormat函数的具体用法?PHP DefaultPriceFormat怎么用?PHP DefaultPriceFormat使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了DefaultPriceFormat函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _ImportRecord

	protected function _ImportRecord($record)
	{
		// the field we have chosen to identify the product
		$prodIdentField = $this->ImportSession['IdentField'];
		$identFieldName = $this->_ImportFields[$prodIdentField];

		// chosen ident field is empty, can't continue
		if (empty($prodIdentField)) {
			$this->addImportResult('Failures', GetLang('NoIdentField', array('identField' => $identFieldName)));
			return;
		}

		// get the product for this row
		$query = "SELECT * FROM [|PREFIX|]products WHERE " . $prodIdentField . " = '" . $GLOBALS['ISC_CLASS_DB']->Quote(trim($record[$prodIdentField])) . "'";
		$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
		if (($prod = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) === false) {
			// no prod found? failrow
			$this->addImportResult('Failures', GetLang('AssociatedProductNotFound', array('identField' => $identFieldName, 'identValue' => $record[$prodIdentField])));
			return;
		}
		$productID = $prod['productid'];
		$variationID = $prod['prodvariationid'];

		//---- the fields we'll be updating the product with ----

		// variation code
		if (isset($record['prodvarsku'])) {
			$prodCode = $record['prodvarsku'];

			if (!empty($prodCode) || (empty($prodCode) && $this->ImportSession['DefaultForEmpty'])) {
				$updateFields['vcsku'] = $prodCode;
			}
		}
		elseif (isset($record['prodcode'])) {
			$prodCode = $record['prodcode'];

			if (!empty($prodCode) || (empty($prodCode) && $this->ImportSession['DefaultForEmpty'])) {
				$updateFields['vcsku'] = $prodCode;
			}
		}

		// variation price
		if (isset($record['prodvarprice'])) {
			$varPrice = $record['prodvarprice'];

			if (empty($varPrice) && $this->ImportSession['DefaultForEmpty']) {
				$updateFields['vcprice'] = 0;
				$updateFields['vcpricediff'] = '';
			}
			else {
				// prefixed by a + then it's a price addition
				if (isc_substr($varPrice, 0, 1) == "+") {
					$priceDiff = "add";
				} // price subtraction
				elseif ($varPrice < 0) {
					$priceDiff = "subtract";
				} // fixed price
				else {
					$priceDiff = "fixed";
				}

				$varPrice = abs((float)DefaultPriceFormat($varPrice));
				$updateFields['vcprice'] = $varPrice;
				$updateFields['vcpricediff'] = $priceDiff;
			}
		}

		// variation weight
		if (isset($record['prodvarweight'])) {
			$varWeight = $record['prodvarweight'];

			if (empty($varWeight) && $this->ImportSession['DefaultForEmpty']) {
				$updateFields['vcweight'] = 0;
				$updateFields['vcweightdiff'] = '';
			}
			elseif (!empty($record['prodvarweight'])) {
				// prefixed by a + then it's a weight addition
				if (isc_substr($varWeight, 0, 1) == "+") {
					$weightDiff = "add";
				} // weight subtraction
				elseif ($varWeight < 0) {
					$weightDiff = "subtract";
				} // fixed weight
				else {
					$weightDiff = "fixed";
				}

				$updateFields['vcweight'] = abs((float)$varWeight);
				$updateFields['vcweightdiff'] = $weightDiff;
			}
		}

		// stock level
		if (isset($record['prodvarstock'])) {
			if (empty($record['prodvarstock']) && $this->ImportSession['DefaultForEmpty']) {
				$updateFields['vcstock'] = 0;
			}
			else {
				$updateFields['vcstock'] = $record['prodvarstock'];
			}
//.........这里部分代码省略.........
开发者ID:hungnv0789,项目名称:vhtm,代码行数:101,代码来源:product_variations.php

示例2: _CreateGroupLevelDiscounts

 /**
  * _CreateGroupLevelDiscounts
  * Create the group-level discounts for a new/updated group
  *
  * @param Int $GroupId The group to which the discounts belong
  * @return Boolean True if they were created, false on DB error
  */
 private function _CreateGroupLevelDiscounts($GroupId)
 {
     // Now add any category specific discounts
     if (isset($_POST['catRules']['category']) && isset($_POST['catRules']['discount']) && isset($_POST['catRules']['discounttype']) && isset($_POST['catRules']['discountMethod'])) {
         for ($i = 0; $i < count($_POST['catRules']['category']); $i++) {
             $cat_id = $_POST['catRules']['category'][$i];
             $discount = DefaultPriceFormat($_POST['catRules']['discount'][$i]);
             $applies_to = $_POST['catRules']['discounttype'][$i];
             $discountmethod = $_POST['catRules']['discountMethod'][$i];
             $newCatDiscount = array("customergroupid" => $GroupId, "discounttype" => "CATEGORY", "catorprodid" => $cat_id, "discountpercent" => $discount, "appliesto" => $applies_to, "discountmethod" => $discountmethod);
             $newCatDiscountId = $GLOBALS['ISC_CLASS_DB']->InsertQuery("customer_group_discounts", $newCatDiscount);
         }
     }
     // Build the cache again
     $GLOBALS['ISC_CLASS_DATA_STORE']->UpdateCustomerGroupsCategoryDiscounts($GroupId);
     // Followed by any product specific discounts
     if (isset($_POST['prodRules']['product']) && isset($_POST['prodRules']['discount']) && isset($_POST['prodRules']['discountMethod'])) {
         for ($i = 0; $i < count($_POST['prodRules']['product']); $i++) {
             $prod_id = $_POST['prodRules']['product'][$i];
             $discount = DefaultPriceFormat($_POST['prodRules']['discount'][$i]);
             $discountmethod = $_POST['prodRules']['discountMethod'][$i];
             $newProdDiscount = array("customergroupid" => $GroupId, "discounttype" => "PRODUCT", "catorprodid" => $prod_id, "discountpercent" => $discount, "appliesto" => "NOT_APPLICABLE", "discountmethod" => $discountmethod);
             $newProdDiscountId = $GLOBALS['ISC_CLASS_DB']->InsertQuery("customer_group_discounts", $newProdDiscount);
         }
     }
     $err = $GLOBALS["ISC_CLASS_DB"]->GetErrorMsg();
     if ($err == "") {
         return true;
     } else {
         return false;
     }
 }
开发者ID:nirvana-info,项目名称:old_bak,代码行数:39,代码来源:class.customers_jul23.php

示例3: IsPrice

/**
 * Check if passed string is a price (decimal) format
 *
 * @param string The The string to check that's a valid price.
 * @return boolean True if valid, false if not
 */
function IsPrice($price)
{
    // Format the price as we'll be storing it internally
    $price = DefaultPriceFormat($price);
    // If the price contains anything other than [0-9.] then it's invalid
    if (preg_match('#[^0-9\\.]#i', $price)) {
        return false;
    }
    return true;
}
开发者ID:nirvana-info,项目名称:old_bak,代码行数:16,代码来源:general.php

示例4: SaveModuleSettings

 /**
  * Save the configuration variables for this module that come in from the POST
  * array.
  *
  * @param array An array of configuration variables.
  * @return boolean True if successful.
  */
 public function SaveModuleSettings($settings = array())
 {
     // Delete any current settings the module has
     $this->DeleteModuleSettings();
     // Insert the new settings
     if (empty($settings)) {
         return true;
     }
     $shippingMethod = GetShippingMethodById($this->methodId);
     // Mark the module as being configured
     $newVar = array('zoneid' => $shippingMethod['zoneid'], 'methodid' => $this->methodId, 'modulename' => $this->GetId(), 'variablename' => 'is_setup', 'variableval' => 1, 'varvendorid' => $shippingMethod['methodvendorid']);
     $GLOBALS['ISC_CLASS_DB']->InsertQuery("shipping_vars", $newVar);
     $moduleVariables = $this->GetCustomVars();
     // Loop through the options that this module has
     foreach ($settings as $name => $value) {
         $format = '';
         if (isset($moduleVariables[$name]['format'])) {
             $format = $moduleVariables[$name]['format'];
         }
         if (is_array($value)) {
             foreach ($value as $childValue) {
                 switch ($format) {
                     case 'price':
                         $value = DefaultPriceFormat($childValue);
                         break;
                     case 'weight':
                     case 'dimension':
                         $value = DefaultDimensionFormat($value);
                         break;
                 }
                 // Mark the module as being configured
                 $newVar = array('zoneid' => $shippingMethod['zoneid'], 'methodid' => $this->methodId, 'modulename' => $this->GetId(), 'variablename' => $name, 'variableval' => $childValue, 'varvendorid' => $shippingMethod['methodvendorid']);
                 $GLOBALS['ISC_CLASS_DB']->InsertQuery("shipping_vars", $newVar);
             }
         } else {
             switch ($format) {
                 case 'price':
                     $value = DefaultPriceFormat($value);
                     break;
                 case 'weight':
                 case 'dimension':
                     $value = DefaultDimensionFormat($value);
                     break;
             }
             // Mark the module as being configured
             $newVar = array('zoneid' => $shippingMethod['zoneid'], 'methodid' => $this->methodId, 'modulename' => $this->GetId(), 'variablename' => $name, 'variableval' => $value, 'varvendorid' => $shippingMethod['methodvendorid']);
             $GLOBALS['ISC_CLASS_DB']->InsertQuery("shipping_vars", $newVar);
         }
     }
     return true;
 }
开发者ID:nirvana-info,项目名称:old_bak,代码行数:58,代码来源:class.shipping.php

示例5: _ImportRecord

 /**
  * Imports an actual product record in to the database.
  *
  * @param array Array of record data
  */
 protected function _ImportRecord($record)
 {
     if (!$record['custconemail']) {
         $this->ImportSession['Results']['Failures'][] = implode(",", $record['original_record']) . " " . GetLang('ImportCustomersMissingEmail');
         return;
     }
     if (!is_email_address($record['custconemail'])) {
         $this->ImportSession['Results']['Failures'][] = implode(",", $record['original_record']) . " " . GetLang('ImportCustomersInvalidEmail');
         return;
     }
     $fillin = array('custconcompany', 'custconfirstname', 'custconlastname', 'custconphone');
     foreach ($fillin as $fillkey) {
         if (!isset($record[$fillkey])) {
             $record[$fillkey] = '';
         }
     }
     // Is there an existing customer with the same email?
     $customerId = 0;
     $existingFormSessionId = 0;
     $query = sprintf("select customerid from [|PREFIX|]customers where lower(custconemail)='%s'", $GLOBALS['ISC_CLASS_DB']->Quote(isc_strtolower($record['custconemail'])));
     $result = $GLOBALS["ISC_CLASS_DB"]->Query($query);
     if ($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($result)) {
         // Overriding existing products, set the product id
         if (isset($this->ImportSession['OverrideDuplicates']) && $this->ImportSession['OverrideDuplicates'] == 1) {
             $customerId = $row['customerid'];
             $this->ImportSession['Results']['Updates'][] = $record['custconfirstname'] . " " . $record['custconlastname'] . " (" . $record['custconemail'] . ")";
         } else {
             $this->ImportSession['Results']['Duplicates'][] = $record['custconfirstname'] . " " . $record['custconlastname'] . " (" . $record['custconemail'] . ")";
             return;
         }
         if (isId($row['custformsessionid'])) {
             $existingFormSessionId = $row['custformsessionid'];
         }
     }
     $customerData = array('company' => $record['custconcompany'], 'firstname' => $record['custconfirstname'], 'lastname' => $record['custconlastname'], 'email' => $record['custconemail'], 'phone' => $record['custconphone']);
     if (isset($record['custpassword']) && $record['custpassword'] !== '') {
         $customerData['password'] = $record['custpassword'];
     }
     if (isset($record['custstorecredit'])) {
         $customerData['storecredit'] = DefaultPriceFormat($record['custstorecredit']);
     }
     if (isId($customerId)) {
         $customerData['customerid'] = $customerId;
     }
     // Are we placing the customer in a customer group?
     $groupId = 0;
     if (!empty($record['custgroup'])) {
         static $customerGroups;
         $groupName = strtolower($record['custgroup']);
         if (isset($customerGroups[$groupName])) {
             $groupId = $customerGroups[$groupName];
         } else {
             $query = "\n\t\t\t\t\tSELECT customergroupid\n\t\t\t\t\tFROM [|PREFIX|]customer_groups\n\t\t\t\t\tWHERE LOWER(groupname)='" . $GLOBALS['ISC_CLASS_DB']->Quote($groupName) . "'\n\t\t\t\t";
             $groupId = $GLOBALS['ISC_CLASS_DB']->FetchOne($query, 'customergroupid');
             // Customer group doesn't exist, create it
             if (!$groupId) {
                 $newGroup = array('name' => $record['custgroup'], 'discount' => 0, 'isdefault' => 0, 'categoryaccesstype' => 'all');
                 $entity = new ISC_ENTITY_CUSTOMERGROUP();
                 $groupId = $entity->add($newGroup);
             }
             if ($groupId) {
                 $customerGroups[$groupName] = $groupId;
             }
         }
     }
     $customerData['customergroupid'] = $groupId;
     // Do we have a shipping address?
     $shippingData = array();
     if (isset($record['shipfullname']) || isset($record['shipfirstname']) || isset($record['shipaddress1']) || isset($record['shipaddress2']) || isset($record['shipcity']) || isset($record['shipstate']) || isset($record['shipzip']) || isset($record['shipcountry'])) {
         $fillin = array('shipaddress1', 'shipaddress2', 'shipcity', 'shipstate', 'shipzip', 'shipcountry');
         foreach ($fillin as $fillkey) {
             if (!isset($record[$fillkey])) {
                 $record[$fillkey] = '';
             }
         }
         $shippingData['shipfirstname'] = '';
         $shippingData['shiplastname'] = '';
         $shippingData['shipaddress1'] = $record['shipaddress1'];
         $shippingData['shipaddress2'] = $record['shipaddress2'];
         $shippingData['shipcity'] = $record['shipcity'];
         $shippingData['shipstate'] = $record['shipstate'];
         $shippingData['shipzip'] = $record['shipzip'];
         $shippingData['shipcountry'] = $record['shipcountry'];
         $shippingData['shipstateid'] = 0;
         $shippingData['shipcountryid'] = 0;
         $shippingData['shipdestination'] = '';
         // Find the country and state
         $shippingData['shipcountryid'] = (int) GetCountryByName($record['shipcountry']);
         if (!$shippingData['shipcountryid']) {
             $shippingData['shipcountryid'] = (int) GetCountryIdByISO2($record['shipcountry']);
         }
         // Still nothing? 0 for the shipping country ID
         if (!$shippingData['shipcountryid']) {
             $shippingData['shipcountryid'] = 0;
         }
//.........这里部分代码省略.........
开发者ID:nirvana-info,项目名称:old_bak,代码行数:101,代码来源:class.batch.importer_29_3.php

示例6: CommitWrap

	/**
	 * Commit a gift wrapping type to the database (either create a new one or update an existing one)
	 *
	 * @param array An array of data about the gift wrapping type.
	 * @param int If updating an existing wrap, the ID.
	 * @return boolean True if successful, false if not.
	 */
	private function CommitWrap($data, $wrapId=0)
	{
		if(!isset($data['wrapvisible'])) {
			$data['wrapvisible'] = 0;
		}

		if(!isset($data['wrapallowcomments'])) {
			$data['wrapallowcomments'] = '';
		}

		// image validation is performed in ValidateWrap
		$files = ISC_UPLOADHANDLER::getUploadedFiles();
		foreach ($files as /** @var UploadHandlerFile */$file) {
			if ($file->fieldName == 'wrapimage') {
				if ($file->getIsMoved()) {
					// only save if file was moved by ValidateWrap
					$data['wrappreview'] = str_replace(ISC_BASE_PATH . '/' . GetConfig('ImageDirectory') . '/', '', $file->getMovedDestination());
				}
				break;
			}
		}

		$wrapData = array(
			'wrapname' => $data['wrapname'],
			'wrapprice' => DefaultPriceFormat($data['wrapprice']),
			'wrapvisible' => (int)$data['wrapvisible'],
			'wrapallowcomments' => (int)$data['wrapallowcomments'],
		);

		if(isset($data['wrappreview'])) {
			$wrapData['wrappreview'] = $data['wrappreview'];
		}

		if($wrapId == 0) {
			$wrapId = $GLOBALS['ISC_CLASS_DB']->InsertQuery('gift_wrapping', $wrapData);
		}
		else {
			$GLOBALS['ISC_CLASS_DB']->UpdateQuery('gift_wrapping', $wrapData, "wrapid='".(int)$wrapId."'");
		}

		$GLOBALS['ISC_CLASS_DATA_STORE']->UpdateGiftWrapping();

		// Couldn't save? return an error message
		if($GLOBALS['ISC_CLASS_DB']->GetErrorMsg()) {
			return false;
		}

		return true;
	}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:56,代码来源:class.settings.giftwrapping.php

示例7: CommitOrder

 /**
  * Actually save a new order or an updated existing order in the database
  * after it's been validated.
  *
  * @param array An array of details about the order to save.
  * @param int The ID of the existing order if we're updating an order.
  * @return boolean True if successful, false if not.
  */
 private function CommitOrder($data, $orderId = 0)
 {
     $GLOBALS['ISC_CLASS_DB']->StartTransaction();
     /**
      * We need to find our billing/shipping details from the form fields first as it is
      * also used in creating the customer
      */
     $billingDetails = array();
     $shippingDetails = array();
     $billingFields = $GLOBALS['ISC_CLASS_FORM']->getFormFields(FORMFIELDS_FORM_BILLING, true);
     $shippingFields = $GLOBALS['ISC_CLASS_FORM']->getFormFields(FORMFIELDS_FORM_SHIPPING, true);
     $fields = $billingFields + $shippingFields;
     $addressMap = array('FirstName' => 'firstname', 'LastName' => 'lastname', 'CompanyName' => 'company', 'AddressLine1' => 'address1', 'AddressLine2' => 'address2', 'City' => 'city', 'State' => 'state', 'Zip' => 'zip', 'State' => 'state', 'Country' => 'country', 'Phone' => 'phone');
     foreach (array_keys($fields) as $fieldId) {
         $privateName = $fields[$fieldId]->record['formfieldprivateid'];
         if ($privateName == '' || !array_key_exists($privateName, $addressMap)) {
             continue;
         }
         if ($fields[$fieldId]->record['formfieldformid'] == FORMFIELDS_FORM_BILLING) {
             $detailsVar =& $billingDetails;
         } else {
             $detailsVar =& $shippingDetails;
         }
         /**
          * Find the country
          */
         if (isc_strtolower($privateName) == 'country') {
             $detailsVar['shipcountry'] = $fields[$fieldId]->getValue();
             $detailsVar['shipcountryid'] = GetCountryByName($fields[$fieldId]->getValue());
             if (!isId($detailsVar['shipcountryid'])) {
                 $detailsVar['shipcountryid'] = 0;
             }
             /**
              * Else find the state
              */
         } else {
             if (isc_strtolower($privateName) == 'state') {
                 $detailsVar['shipstate'] = $fields[$fieldId]->getValue();
                 $stateInfo = GetStateInfoByName($detailsVar['shipstate']);
                 if ($stateInfo && isId($stateInfo['stateid'])) {
                     $detailsVar['shipstateid'] = $stateInfo['stateid'];
                 } else {
                     $detailsVar['shipstateid'] = 0;
                 }
                 /**
                  * Else the rest
                  */
             } else {
                 $detailsVar['ship' . $addressMap[$privateName]] = $fields[$fieldId]->getValue();
             }
         }
     }
     // If we're creating an account for this customer, create it now
     if ($data['ordcustid'] == 0 && $data['customerType'] == 'new') {
         $customerData = array('email' => $data['custconemail'], 'password' => $data['custpassword'], 'firstname' => $billingDetails['shipfirstname'], 'lastname' => $billingDetails['shiplastname'], 'company' => $billingDetails['shipcompany'], 'phone' => $billingDetails['shipphone'], 'token' => GenerateCustomerToken(), 'customergroupid' => $data['custgroupid']);
         $GLOBALS['CusFirstname'] = $billingDetails['shipfirstname'];
         # Baskaran
         /* Added the store credit as seperate as it may be disabled while add/edit order - vikas  */
         if (isset($data['custstorecredit'])) {
             $customerData['storecredit'] = DefaultPriceFormat($data['custstorecredit']);
         }
         /**
          * Save the customer custom fields
          */
         if (gzte11(ISC_MEDIUMPRINT)) {
             $formSessionId = $GLOBALS['ISC_CLASS_FORM']->saveFormSession(FORMFIELDS_FORM_ACCOUNT);
             if (isId($formSessionId)) {
                 $customerData['custformsessionid'] = $formSessionId;
             }
         }
         $entity = new ISC_ENTITY_CUSTOMER();
         $data['ordcustid'] = $entity->add($customerData);
         if (!$data['ordcustid']) {
             $GLOBALS['ISC_CLASS_DB']->RollbackTransaction();
             return false;
         }
     }
     //2010-11-08 Ronnie add When calculating the ship infomation corresponding to no
     $GLOBALS['BCK_shipcountryid'] = $detailsVar['shipcountry'];
     $GLOBALS['BCK_shipstateid'] = $detailsVar['shipstate'];
     if ($GLOBALS['BCK_shipstateid'] == '') {
         $GLOBALS['BCK_shipcountryid'] = $billingDetails['shipcountry'];
         $GLOBALS['BCK_shipstateid'] = $billingDetails['shipstate'];
     }
     foreach ($this->GetCartApi()->GetProductsInCart() as $rowId => $product) {
         if (!isset($product['exists_order_coupon']) && isset($product['discount'])) {
             // Now workout the discount amount
             if ($product['coupontype'] == 0) {
                 // It's a dollar discount
                 $newPrice = $product['product_price'] - $product['discount'];
             } else {
                 // It's a percentage discount
//.........这里部分代码省略.........
开发者ID:nirvana-info,项目名称:old_bak,代码行数:101,代码来源:class.orders.php

示例8: _CommitCompanyGiftCertificate

 private function _CommitCompanyGiftCertificate($cgcId = 0)
 {
     $_POST['cgcappliesto'] = $_POST['usedfor'];
     if ($_POST['cgcappliesto'] == "categories") {
         // Applies to categories
         $_POST['cgcappliestovalues'] = implode(",", array_map('intval', $_POST['catids']));
     } else {
         // Applies to products
         $_POST['cgcappliestovalues'] = implode(',', array_map('intval', explode(',', $_POST['prodids'])));
     }
     if (!empty($_POST['cgcexpires'])) {
         //$_POST['cgcexpires'] = ConvertDateToTime($_POST['cgcexpires']); comment by NI_20100901_Jack  make it same with coupon
         $vals = explode("/", $_POST['cgcexpires']);
         $mktime = mktime(23, 59, 59, $vals[0], $vals[1], $vals[2]);
         $_POST['cgcexpires'] = $mktime;
     } else {
         $_POST['cgcexpires'] = 0;
     }
     if (!isset($_POST['cgccode']) || empty($_POST['cgccode'])) {
         $_POST['cgccode'] = GenerateCouponCode();
     }
     if (isset($_POST['cgcenabled'])) {
         $_POST['cgcenabled'] = 1;
     } else {
         $_POST['cgcenabled'] = 0;
     }
     $_POST['cgcminpurchase'] = DefaultPriceFormat($_POST['cgcminpurchase']);
     $_POST['cgcamount'] = DefaultPriceFormat($_POST['cgcamount']);
     $_POST['cgcbalance'] = DefaultPriceFormat($_POST['cgcbalance']);
     for ($i = 1; $i <= $_POST['recipientcount']; $i++) {
         if (empty($_POST['to_name_' . $i]) && empty($_POST['to_email_' . $i])) {
             continue;
         }
         if ($i == 1 or empty($_POST['to_name']) and empty($_POST['to_email'])) {
             $_POST['to_name'] .= $_POST['to_name_' . $i];
             $_POST['to_email'] .= $_POST['to_email_' . $i];
         } else {
             $_POST['to_name'] .= '$' . $_POST['to_name_' . $i];
             $_POST['to_email'] .= '$' . $_POST['to_email_' . $i];
         }
     }
     if ($cgcId == 0) {
         //check if code or name already exist
         $query = sprintf("select * from [|PREFIX|]company_gift_certificates where cgccode = '%s'", $_POST['cgccode']);
         $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
         if ($GLOBALS['ISC_CLASS_DB']->CountResult($result) > 0) {
             return GetLang('CompanyGiftCertificateCodeExists');
         }
         //new cgc
         $query = sprintf("insert into [|PREFIX|]company_gift_certificates (\n\t\t\t\t\tcgccode, cgcto, cgctoemail, \n\t\t\t\t\tcgccustid, cgcamount, cgcbalance, cgcenabled, cgcmessage, \n\t\t\t\t\tcgcname, cgcappliesto, cgcappliestovalues, cgcminpurchase, cgctemplate, \n\t\t\t\t\tcgcexpirydate, cgcpurchasedate, cgcstatus) VALUES\n\t\t\t\t\t('%s', '%s', '%s', \n\t\t\t\t\t%s, %s, %s, %s, '%s', \n\t\t\t\t\t'%s', '%s', '%s', %s, '%s', \n\t\t\t\t\t%s, %s, 2);", $_POST['cgccode'], $_POST['to_name'], $_POST['to_email'], 0, $_POST['cgcamount'], $_POST['cgcbalance'], $_POST['cgcenabled'], $_POST['message'], $_POST['cgcname'], $_POST['cgcappliesto'], $_POST['cgcappliestovalues'], (int) $_POST['cgcminpurchase'], $_POST['certificate_theme'], $_POST['cgcexpires'], time());
         $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
         if ($result == false) {
             return GetLang('CompanyGiftCertificateInsertError');
         } else {
             return;
         }
     } else {
         //check if code or name already exist
         $query = sprintf("select * from [|PREFIX|]company_gift_certificates where cgccode = '%s' and cgcid <> %s ", $_POST['cgccode'], $cgcId);
         $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
         if ($GLOBALS['ISC_CLASS_DB']->CountResult($result) > 0) {
             return GetLang('CompanyGiftCertificateCodeExists');
         }
         //check balance
         $query = sprintf("UPDATE [|PREFIX|]company_gift_certificates SET \n\t\t\t\t\tcgccode = '%s', cgcto = '%s',cgctoemail = '%s',cgcamount = %s,cgcbalance = %s,\n\t\t\t\t\tcgcenabled = %s,cgcmessage = '%s',cgcname = '%s',cgcappliesto = '%s',cgcappliestovalues = '%s',\n\t\t\t\t\tcgcminpurchase = %s,cgctemplate = '%s',cgcexpirydate = %s WHERE cgcid = %s;", $_POST['cgccode'], $_POST['to_name'], $_POST['to_email'], $_POST['cgcamount'], $_POST['cgcbalance'], $_POST['cgcenabled'], $_POST['message'], $_POST['cgcname'], $_POST['cgcappliesto'], $_POST['cgcappliestovalues'], $_POST['cgcminpurchase'], $_POST['certificate_theme'], $_POST['cgcexpires'], $cgcId);
         $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
         if ($result == false) {
             return GetLang('ErrCompanyGiftCertificateNotUpdated');
         } else {
             return;
         }
     }
 }
开发者ID:nirvana-info,项目名称:old_bak,代码行数:73,代码来源:class.company.giftcertificates.php

示例9: _GetVariationData

		/**
		* _GetVariationData
		* Load the variation data for a product either from the form or database
		*
		* @param Int $ProductId The ID of the product to load variations for. 0 if it's a new product
		* @param String $RefArray The array to store the variation details in
		* @return Void
		*/
		public function _GetVariationData($ProductId = 0, &$RefArray = array())
		{
			if($ProductId == 0) {
				// First, do we even have a variation selected?
				if(isset($_POST['variationId']) && is_numeric($_POST['variationId']) && isset($_POST['options'])) {
					foreach($_POST['options'] as $option_counter => $option) {
						$tmp = array();

						// The combination ID hasn't been assigned yet
						if(isset($option['id'])) {
							$tmp['combinationid'] = $option['id'];
						}
						else {
							$tmp['combinationid'] = 0;
						}

						// The product ID hasn't been assigned yet
						$tmp['vcproductid'] = 0;

						// The variation id
						$tmp['vcvariationid'] = (int)$_POST['variationId'];

						// Is the combination enabled?
						$tmp['vcenabled'] = 0;
						if(isset($option['enabled'])) {
							$tmp['vcenabled'] = 1;
						}

						// The variation option combination
						$ids = preg_replace("/^#/", "", $option['variationcombination']);
						$ids = str_replace("#", ",", $ids);
						$tmp['vcoptionids'] = $ids;

						// The product option's SKU
						$tmp['vcsku'] = $option['sku'];

						// The price difference type
						$tmp['vcpricediff'] = $option['pricediff'];

						// The price difference or fixed price
						$tmp['vcprice'] = DefaultPriceFormat($option['price']);

						// The weight difference type
						$tmp['vcweightdiff'] = $option['weightdiff'];

						// The weight difference or fixed weight
						$tmp['vcweight'] = DefaultDimensionFormat($option['weight']);

						$tmp['vcimage'] = '';
						$tmp['vcimagezoom'] = '';
						$tmp['vcimagestd'] = '';
						$tmp['vcimagethumb'] = '';


						if (isset($_FILES['options']['name'][$option_counter]['image']) && $_FILES['options']['name'][$option_counter]['image'] != '') {
							try {
								$image = ISC_PRODUCT_IMAGE::importImage(
									$_FILES['options']['tmp_name'][$option_counter]['image'],
									$_FILES['options']['name'][$option_counter]['image'],
									false,
									false,
									true,
									false
								);

								$tmp['vcimage'] = $image->getSourceFilePath();
								$tmp['vcimagezoom'] = $image->getResizedFilePath(ISC_PRODUCT_IMAGE_SIZE_ZOOM, true, false);
								$tmp['vcimagestd'] = $image->getResizedFilePath(ISC_PRODUCT_IMAGE_SIZE_STANDARD, true, false);
								$tmp['vcimagethumb'] = $image->getResizedFilePath(ISC_PRODUCT_IMAGE_SIZE_THUMBNAIL, true, false);
							}
							catch (Exception $ex) {
							}
						}
						elseif (isset($option['delimage'])) {
							$tmp['vcimage'] = "REMOVE";
						}

						// The current stock level
						if(isset($option['currentstock'])) {
							$tmp['vcstock'] = (int)$option['currentstock'];
						}
						else {
							$tmp['vcstock'] = 0;
						}

						// The low stock level
						if(isset($option['lowstock'])) {
							$tmp['vclowstock'] = (int)$option['lowstock'];
						}
						else {
							$tmp['vclowstock'] = 0;
						}
//.........这里部分代码省略.........
开发者ID:hungnv0789,项目名称:vhtm,代码行数:101,代码来源:class.product.php

示例10: SaveUpdatedTaxRate

 /**
  * Save an updated tax rate in the database.
  */
 private function SaveUpdatedTaxRate()
 {
     $data = $this->GetTaxRateDataFromPost();
     $updatedRate = array("taxratename" => $data['taxratename'], "taxratepercent" => DefaultPriceFormat($data['taxratepercent']), "taxratecountry" => $data['taxratecountry'], "taxratestates" => $data['taxratestates'], "taxratebasedon" => $data['taxratebasedon'], "taxratestatus" => (int) $data['taxratestatus'], 'taxaddress' => $data['taxaddress']);
     $GLOBALS['ISC_CLASS_DB']->UpdateQuery("tax_rates", $updatedRate, "taxrateid='" . $GLOBALS['ISC_CLASS_DB']->Quote((int) $data['taxrateid']) . "'");
     if ($GLOBALS['ISC_CLASS_DB']->Error() == "") {
         $this->ManageTaxSettings(array(GetLang('TaxRateUpdatedSuccessfully') => MSG_SUCCESS));
         // Log this action
         $GLOBALS['ISC_CLASS_LOG']->LogAdminAction($data['taxrateid'], $data['taxratename']);
     } else {
         $this->ManageTaxSettings(array(sprintf(GetLang('TaxRateNotUpdated'), $GLOBALS['ISC_CLASS_DB']->Error()) => MSG_ERROR));
     }
 }
开发者ID:nirvana-info,项目名称:old_bak,代码行数:16,代码来源:class.settings.tax.php

示例11: _ImportRecord

	/**
	 * Imports an actual product record in to the database.
	 *
	 * @param array Array of record data
	 */
	protected function _ImportRecord($record)
	{
		static $customerGroups=array();

		if(!$record['custconemail']) {
			$this->ImportSession['Results']['Failures'][] = implode(",", $record['original_record'])." ".GetLang('ImportCustomersMissingEmail');
			return;
		}

		if(!is_email_address($record['custconemail'])) {
			$this->ImportSession['Results']['Failures'][] = implode(",", $record['original_record'])." ".GetLang('ImportCustomersInvalidEmail');
			return;
		}

		// Is there an existing customer with the same email?
		$existingCustomer = null;
		$existingFormSessionId = 0;
		$searchFields = array(
			"custconemail" => array(
								"value" => isc_strtolower($record["custconemail"]),
								"func" => "LOWER"
							)
		);

		$customerId = $this->customerEntity->search($searchFields);
		if (isId($customerId)) {
			$existingCustomer = $this->customerEntity->get($customerId);
		} else {
			$customerId = 0;
		}

		if(is_array($existingCustomer)) {
			// Overriding existing customer, set the customer id
			if(isset($this->ImportSession['OverrideDuplicates']) && $this->ImportSession['OverrideDuplicates'] == 1) {
				$this->ImportSession['Results']['Updates'][] = $record['custconfirstname']." ".$record['custconlastname']." (".$record['custconemail'].")";
			}
			else {
				$this->ImportSession['Results']['Duplicates'][] = $record['custconfirstname']." ".$record['custconlastname']." (".$record['custconemail'].")";
				return;
			}

			if (isId($existingCustomer['custformsessionid'])) {
				$existingFormSessionId = $existingCustomer['custformsessionid'];
			}
		} else {

			/**
			 * Fill in the blanks only if we are adding in a customer
			 */
			$fillin = array('custconcompany', 'custconfirstname', 'custconlastname', 'custconphone');
			foreach ($fillin as $fillkey) {
				if (!isset($record[$fillkey])) {
					$record[$fillkey] = '';
				}
			}
		}

		$customerData = array();

		foreach (array_keys($this->_ImportFields) as $field) {
			if (substr($field, 0, 4) == "cust" && array_key_exists($field, $record)) {
				$customerData[$field] = $record[$field];
			}
		}

		if(isset($customerData["custstorecredit"])) {
			$customerData["custstorecredit"] = DefaultPriceFormat($customerData["custstorecredit"]);
		}

		if (array_key_exists("custgroup", $customerData)) {
			$customerData["custgroupid"] = $customerData["custgroup"];
		}

		if (isId($customerId)) {
			$customerData["customerid"] = $customerId;
		}

		// Are we placing the customer in a customer group?
		$groupId = 0;
		if (array_key_exists("custgroup", $record) && trim($record["custgroup"]) !== "") {
			$groupName = strtolower($record['custgroup']);
			if(isset($customerGroups[$groupName])) {
				$groupId = $customerGroups[$groupName];
			}
			else {
				$searchFields = array(
					"groupname" => array(
									"value" => isc_strtolower($groupName),
									"func" => "LOWER"
								)
				);

				$groupId = $this->groupEntity->search($searchFields);

				// Customer group doesn't exist, create it
//.........这里部分代码省略.........
开发者ID:hungnv0789,项目名称:vhtm,代码行数:101,代码来源:customers.php

示例12: SaveEbayTemplate

	/**
	 * To save the defined eBay listing template
	 *
	 * @param string $error Referenced variable to store an error message in if saving is unsuccessfull
	 * @param int $templateId The optional template to update instead. If 0 a new template is created.
	 * @return mixed Returns the template Id if saved successfully, FALSE otherwise
	 */
	public function SaveEbayTemplate(&$error, $templateId = 0)
	{
		// site we're listing on
		$siteId = (int)$_POST['siteId'];

		// set up basic template variables
		$templateName = $_POST['templateName'];
		$templateIsDefault = isset($_POST['templateAsDefault']);
		$privateListing = isset($_POST['privateListing']);

		// set up category variables
		$categoryOptions = $_POST['primaryCategoryOptions'];
		$secondaryCategoryOptions = array();
		$primaryCategoryId = $categoryOptions['category_id'];
		$secondaryCategoryId = 0;
		$secondaryCategoryName = '';
		$primaryStoreCategoryId = 0;
		$primaryStoreCategoryName = '';
		$secondaryStoreCategoryId = 0;
		$secondaryStoreCategoryName = '';

		if (!empty($_POST['secondaryCategoryOptions'])) {
			$secondaryCategoryId = $_POST['secondaryCategoryOptions']['category_id'];
			$secondaryCategoryName = $_POST['secondaryCategoryOptions']['name'];
			$secondaryCategoryOptions = $_POST['secondaryCategoryOptions'];
		}

		if (!empty($_POST['primaryStoreCategoryOptions'])) {
			$primaryStoreCategoryId = $_POST['primaryStoreCategoryOptions']['category_id'];
			$primaryStoreCategoryName = $_POST['primaryStoreCategoryOptions']['name'];
		}

		if (!empty($_POST['secondaryStoreCategoryOptions'])) {
			$secondaryStoreCategoryId = $_POST['secondaryStoreCategoryOptions']['category_id'];
			$secondaryStoreCategoryName = $_POST['secondaryStoreCategoryOptions']['name'];
		}

		// item details
		$quantityToSell = 1;
		if ($_POST['quantityType'] == 'more') {
			$quantityToSell = (int)$_POST['quantityMore'];
		}
		if ($quantityToSell < 1) {
			$quantityToSell = 1;
		}

		$useItemPhoto = isset($_POST['useItemPhoto']);

		$lotSize = 0;
		if (isset($_POST['lotSize'])) {
			$lotSize = (int)$_POST['lotSize'];
		}
		if ($lotSize < 0) {
			$lotSize = 0;
		}

		$useProductImage = isset($_POST['useItemPhoto']);

		// item location
		$locationCountry = (int)$_POST['locationCountry'];
		$locationCountryCode = GetCountryISO2ById($locationCountry);

		$locationZip = $_POST['locationZip'];
		$locationCityState = $_POST['locationCityState'];

		$prices = array();

		// selling method
		$sellingMethod = $_POST['sellingMethod'];

		// Online Auction
		if ($sellingMethod == 'Chinese') {
			// reserve price
			$useReservePrice = isset($_POST['useReservePrice']);
			if ($useReservePrice) {
				$reservePriceOption = $_POST['reservePriceOption'];

				$price = array(
					'price_type'	=> self::RESERVE_PRICE_TYPE,
					'selected_type' => $reservePriceOption
				);

				if ($reservePriceOption == 'PriceExtra') {
					$price['calculate_operator'] = $_POST['reservePricePlusOperator'];
					$price['calculate_option'] = $_POST['reservePricePlusType'];
					if ($price['calculate_option'] == 'amount') {
						$price['calculate_price'] = DefaultPriceFormat($_POST['reservePricePlusValue']);
					}
					else {
						$price['calculate_price'] = (double)$_POST['reservePricePlusValue'];
					}
				}
				elseif ($reservePriceOption == 'CustomPrice') {
//.........这里部分代码省略.........
开发者ID:hungnv0789,项目名称:vhtm,代码行数:101,代码来源:class.ebay.php

示例13: CommitShippingZone

	/**
	 * Commit the changes (or a new shipping zone) to the database.
	 *
	 * @param array Array of information to insert/update about the shipping zone.
	 * @param int The shipping zone ID if we're updating an existing zone.
	 * @return boolean True if successful, false if there was an error.
	 */
	public function CommitShippingZone($data, $zoneId=0)
	{
		// If the zone ID is 0, then we're creating a new zone
		if($zoneId > 0) {
			$existingZone = $this->GetShippingZoneData($zoneId);
		}
		else {
			if($GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId() > 0) {
				$data['zonevendorid'] = $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId();
			}
			else if(isset($_REQUEST['vendorId'])) {
				$data['zonevendorid'] = (int)$_REQUEST['vendorId'];
			}
		}

		if(!trim($data['zonename'])) {
			return false;
		}

		if(($data['zonetype'] != 'state' && $data['zonetype'] != 'zip') || $zoneId == 1) {
			$data['zonetype'] = 'country';
		}

		if(!isset($data['zonefreeshipping'])) {
			$data['zonefreeshipping'] = 0;
			$data['zonefreeshippingtotal'] = 0;
		}

		if(!isset($data['zoneenabled'])) {
			$data['zoneenabled'] = 0;
		}
		else {
			$data['zoneenabled'] = 1;
		}

		if(!isset($data['zonehandlingseparate'])) {
			$data['zonehandlingseparate'] = 0;
		}

		if(!isset($data['zonehandlingtype'])) {
			$data['zonehandlingtype'] = 'none';
		}

		if(!isset($data['zonehandlingfee'])) {
			$data['zonehandlingfee'] = 0;
		}

		$zoneData = array(
			'zonename' => $data['zonename'],
			'zonetype' => $data['zonetype'],
			'zonefreeshipping' => $data['zonefreeshipping'],
			'zonefreeshippingtotal' => DefaultPriceFormat($data['zonefreeshippingtotal']),
			'zonehandlingtype' => $data['zonehandlingtype'],
			'zonehandlingfee' => DefaultPriceFormat($data['zonehandlingfee']),
			'zonehandlingseparate' => $data['zonehandlingseparate'],
			'zoneenabled' => $data['zoneenabled']
		);

		if(isset($data['zonevendorid'])) {
			$zoneData['zonevendorid'] = $data['zonevendorid'];
		}
		else if(isset($existingZone)) {
			$zoneData['zonevendorid'] = $existingZone['zonevendorid'];
		} else {
			$zoneData['zonevendorid'] = 0;
		}

		if($zoneId == 0) {
			$zoneId = $GLOBALS['ISC_CLASS_DB']->InsertQuery("shipping_zones", $zoneData);
		}
		else {
			$GLOBALS['ISC_CLASS_DB']->UpdateQuery("shipping_zones", $zoneData, "zoneid='".(int)$zoneId."'");
		}

		$GLOBALS['ZoneId'] = $zoneId;

		// Couldn't save? return an error message
		if($GLOBALS['ISC_CLASS_DB']->GetErrorMsg()) {
			return false;
		}

		if(!isset($existingZone) || (isset($existingZone) && $existingZone['zonedefault'] != 1)) {
			// Delete the old locations first
			if(isset($existingZone)) {
				$GLOBALS['ISC_CLASS_DB']->DeleteQuery('shipping_zone_locations', "WHERE zoneid='".$zoneId."'");
			}

			// Now we insert the locations for this zone type.
			switch($data['zonetype']) {
				case 'country':
					$countryList = GetCountryListAsIdValuePairs();
					foreach($data['zonetype_country_list'] as $countryId) {
						if(!isset($countryList[$countryId])) {
//.........这里部分代码省略.........
开发者ID:hungnv0789,项目名称:vhtm,代码行数:101,代码来源:class.settings.shipping.php

示例14: _CommitCoupon

		protected function _CommitCoupon($CouponId = 0)
		{
			$name = trim($_POST['couponname']);
			$type = $_POST['coupontype']; // dollar or percent
			$amount = DefaultPriceFormat($_POST['couponamount']);

			$appliesTo = $_POST['usedfor'];

			if($appliesTo == "categories") {
				$appliesValues = $_POST['catids'];
				// nothing selected then default to all categories
				if (empty($appliesValues)) {
					$appliesValues = array('0');
				}
			}
			else {
				$appliesValues = explode(",", $_POST['prodids']);
			}

			if (!empty($_POST['couponexpires'])) {
				$expires = ConvertDateToTime($_POST['couponexpires']);
			} else {
				$expires = 0;
			}

			if (!isset($_POST['couponcode']) || empty($_POST['couponcode'])) {
				$code = GenerateCouponCode();
			}
			else {
				$code = trim($_POST['couponcode']);
			}

			if (isset($_POST['couponenabled'])) {
				$enabled = 1;
			} else {
				$enabled = 0;
			}

			$minPurchase = DefaultPriceFormat($_POST['couponminpurchase']);

			$maxUses = 0;
			$maxUsesPerCus = 0;
			if (isset($_POST['couponmaxuses'])) {
				$maxUses = (int)$_POST['couponmaxuses'];
			}
			if (isset($_POST['couponmaxusespercus'])) {
				$maxUsesPerCus = (int)$_POST['couponmaxusespercus'];
			}

			$locationRestricted = 0;
			if (!empty ($_POST['YesLimitByLocation'])) {
				$locationRestricted = 1;
			}

			$shippingMethodRestricted = 0;
			if (!empty ($_POST['YesLimitByShipping'])) {
				$shippingMethodRestricted = 1;
			}

			$coupon = array(
				'couponname' => $name,
				'coupontype' => $type,
				'couponamount' => $amount,
				'couponminpurchase' => $minPurchase,
				'couponexpires' => $expires,
				'couponenabled' => $enabled,
				'couponcode' => $code,
				'couponappliesto' => $appliesTo,
				'couponmaxuses' => $maxUses,
				'couponmaxusespercus' => $maxUsesPerCus,
				'location_restricted' => $locationRestricted,
				'shipping_method_restricted' => $shippingMethodRestricted,
			);

			// update existing coupon
			if ($CouponId) {
				$result = $GLOBALS['ISC_CLASS_DB']->UpdateQuery("coupons", $coupon, "couponid = '" . $GLOBALS['ISC_CLASS_DB']->Quote($CouponId) . "'");
				if (!$result) {
					return "Failed to update coupon";
				}

				//delete existing values
				$query = "DELETE FROM [|PREFIX|]coupon_values WHERE couponid = '" . $GLOBALS['ISC_CLASS_DB']->Quote($CouponId) . "'";
				$GLOBALS['ISC_CLASS_DB']->Query($query);
			}
			else {
				// create new coupon
				$CouponId = $GLOBALS['ISC_CLASS_DB']->InsertQuery("coupons", $coupon);

				if (!isId($CouponId)) {
					return "Failed to create coupon";
				}
			}

			// add applies to values
			if (!empty($appliesValues)) {
				foreach ($appliesValues as $value) {
					$couponvalue = array(
						'couponid' => $CouponId,
						'valueid' => $value
//.........这里部分代码省略.........
开发者ID:hungnv0789,项目名称:vhtm,代码行数:101,代码来源:class.coupons.php

示例15: UpdateStoreCredit

 /**
  * Update the store credit for a customer
  *
  * @return void
  **/
 private function UpdateStoreCredit()
 {
     if (!isset($_REQUEST['customerId'])) {
         exit;
     }
     $query = sprintf("SELECT customerid, custstorecredit FROM [|PREFIX|]customers WHERE customerid='%d'", $GLOBALS['ISC_CLASS_DB']->Quote($_REQUEST['customerId']));
     $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
     $customer = $GLOBALS['ISC_CLASS_DB']->Fetch($result);
     if ($customer['customerid'] == 0) {
         exit;
     }
     $updatedCustomer = array("custstorecredit" => DefaultPriceFormat($_REQUEST['credit']));
     $GLOBALS['ISC_CLASS_DB']->UpdateQuery("customers", $updatedCustomer, "customerid='" . $GLOBALS['ISC_CLASS_DB']->Quote($customer['customerid']) . "'");
     // Log the credit change
     $creditChange = CFloat($_REQUEST['credit'] - $customer['custstorecredit']);
     if ($creditChange != 0) {
         $creditLog = array("customerid" => (int) $customer['customerid'], "creditamount" => $creditChange, "credittype" => "adjustment", "creditdate" => time(), "creditrefid" => 0, "credituserid" => $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetUserId(), "creditreason" => "");
         $GLOBALS['ISC_CLASS_DB']->InsertQuery("customer_credits", $creditLog);
     }
     echo 1;
     exit;
 }
开发者ID:nirvana-info,项目名称:old_bak,代码行数:27,代码来源:class.remote_dec04.php


注:本文中的DefaultPriceFormat函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。