本文整理汇总了PHP中isc_substr函数的典型用法代码示例。如果您正苦于以下问题:PHP isc_substr函数的具体用法?PHP isc_substr怎么用?PHP isc_substr使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isc_substr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetExportFileTypeList
/**
* Gets a list of available export file types
*
* @return array An array of available file types in the format: filetype => type_details_array[]
*/
public static function GetExportFileTypeList()
{
$files = scandir(TYPE_ROOT);
$types = array();
foreach($files as $file) {
if(!is_file(TYPE_ROOT . $file) || isc_substr($file, -3) != "php") {
continue;
}
require_once TYPE_ROOT . $file;
$file = isc_substr($file, 0, isc_strlen($file) - 4);
/*
$pos = isc_strrpos($file, ".");
$typeName = isc_strtoupper(isc_substr($file, $pos + 1));
*/
$className = "ISC_ADMIN_EXPORTFILETYPE_" . strtoupper($file); //$typeName;
if(!class_exists($className)) {
continue;
}
$obj = new $className;
if (!$obj->ignore) {
$types[$file] = $obj->GetTypeDetails();
}
}
return $types;
}
示例2: GetExportMethodList
/**
* Gets a list of available export methods
*
* @return array An array of details about available export methods. methodname => details[]
*/
public static function GetExportMethodList()
{
$files = scandir(METHOD_ROOT);
$methods = array();
foreach ($files as $file) {
if (!is_file(METHOD_ROOT . $file) || isc_substr($file, -3) != "php") {
continue;
}
require_once METHOD_ROOT . $file;
$file = isc_substr($file, 0, isc_strlen($file) - 4);
$file = strtoupper($file);
/*
$pos = isc_strrpos($file, ".");
$methodName = isc_strtoupper(isc_substr($file, $pos + 1));
*/
$className = "ISC_ADMIN_EXPORTMETHOD_" . $file;
//$methodName;
if (!class_exists($className)) {
continue;
}
$obj = new $className();
$methods[$file] = $obj->GetMethodDetails();
}
return $methods;
}
示例3: _ConstructPostData
protected function _ConstructPostData($postData)
{
$billingDetails = $this->GetBillingDetails();
$qbXML = new SimpleXMLElement('<?qbmsxml version="2.0"?><QBMSXML />');
$signOnDesktop = $qbXML->addChild('SignonMsgsRq')->addChild('SignonDesktopRq');
$signOnDesktop->addChild('ClientDateTime', date('Y-m-d\TH:i:s'));
$signOnDesktop->addChild('ApplicationLogin', $this->GetValue('ApplicationLogin'));
$signOnDesktop->addChild('ConnectionTicket', $this->GetValue('ConnectionTicket'));
$signOnDesktop->addChild('Language', 'English');
$signOnDesktop->addChild('AppID', $this->GetValue('AppID'));
$signOnDesktop->addChild('AppVer', '1.0');
$cardChargeRequest = $qbXML->addChild('QBMSXMLMsgsRq')->addChild('CustomerCreditCardChargeRq');
$cardChargeRequest->addChild('TransRequestID', $this->GetCombinedOrderId());
$cardChargeRequest->addChild('CreditCardNumber', $postData['ccno']);
$cardChargeRequest->addChild('ExpirationMonth', $postData['ccexpm']);
$cardChargeRequest->addChild('ExpirationYear', $postData['ccexpy']);
$cardChargeRequest->addChild('IsECommerce', 'true');
$cardChargeRequest->addChild('Amount', $this->GetGatewayAmount());
$cardChargeRequest->addChild('NameOnCard', isc_substr($postData['name'], 0, 30));
$cardChargeRequest->addChild('CreditCardAddress', isc_substr($billingDetails['ordbillstreet1'], 0, 30));
$cardChargeRequest->addChild('CreditCardPostalCode', isc_substr($billingDetails['ordbillzip'], 0, 9));
$cardChargeRequest->addChild('SalesTaxAmount', $this->GetTaxCost());
$cardChargeRequest->addChild('CardSecurityCode', $postData['cccvd']);
return $qbXML->asXML();
}
示例4: rightTruncate
/**
* Cuts the provided string to the specified length, applying a suffix if necessary, using the store's current character set.
*
* Usage:
* $str = 'alpha beta gamma';
* $str = Store_String::rightTruncate($str, 10);
* // $str === 'alpha b...';
*
* @param string $str
* @param int $length
* @param string $suffix
* @return string
*/
public static function rightTruncate($str, $length, $suffix = '...')
{
$strLength = isc_strlen($str);
if ($strLength <= $length) {
return $str;
}
$suffixLength = isc_strlen($suffix);
return isc_substr($str, 0, $length - $suffixLength) . $suffix;
}
示例5: SetPanelSettings
public function SetPanelSettings()
{
$count = 0;
$GLOBALS['SNIPPETS']['HomeSaleProducts'] = '';
if (GetConfig('HomeNewProducts') == 0) {
$this->DontDisplay = true;
return;
}
if (GetConfig('EnableProductReviews') == 0) {
$GLOBALS['HideProductRating'] = "display: none";
}
$query = "\n\t\t\t\tSELECT p.*, FLOOR(prodratingtotal/prodnumratings) AS prodavgrating, imageisthumb, imagefile, " . GetProdCustomerGroupPriceSQL() . "\n\t\t\t\tFROM [|PREFIX|]products p\n\t\t\t\tLEFT JOIN [|PREFIX|]product_images pi ON (p.productid=pi.imageprodid)\n\t\t\t\tWHERE p.prodsaleprice != 0 AND p.prodsaleprice < p.prodprice AND p.prodvisible='1' AND (imageisthumb=1 OR ISNULL(imageisthumb))\n\t\t\t\t" . GetProdCustomerGroupPermissionsSQL() . "\n\t\t\t\tORDER BY RAND()\n\t\t\t";
$query .= $GLOBALS['ISC_CLASS_DB']->AddLimit(0, GetConfig('HomeNewProducts'));
$result = $GLOBALS['ISC_CLASS_DB']->Query($query);
$GLOBALS['AlternateClass'] = '';
while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
if ($GLOBALS['AlternateClass'] == 'Odd') {
$GLOBALS['AlternateClass'] = 'Even';
} else {
$GLOBALS['AlternateClass'] = 'Odd';
}
$GLOBALS['ProductCartQuantity'] = '';
if (isset($GLOBALS['CartQuantity' . $row['productid']])) {
$GLOBALS['ProductCartQuantity'] = (int) $GLOBALS['CartQuantity' . $row['productid']];
}
$GLOBALS['ProductId'] = $row['productid'];
$GLOBALS['ProductName'] = isc_html_escape($row['prodname']);
$GLOBALS['ProductLink'] = ProdLink($row['prodname']);
// Determine the price of this product
$originalPrice = CalcRealPrice(CalcProdCustomerGroupPrice($row, $row['prodprice']), 0, 0, $row['prodistaxable']);
$GLOBALS['OriginalProductPrice'] = CurrencyConvertFormatPrice($originalPrice);
$GLOBALS['ProductPrice'] = CalculateProductPrice($row);
$GLOBALS['ProductRating'] = (int) $row['prodavgrating'];
// Workout the product description
$desc = strip_tags($row['proddesc']);
if (isc_strlen($desc) < 120) {
$GLOBALS['ProductSummary'] = $desc;
} else {
$GLOBALS['ProductSummary'] = isc_substr($desc, 0, 120) . "...";
}
$GLOBALS['ProductThumb'] = ImageThumb($row['imagefile'], ProdLink($row['prodname']));
$GLOBALS['SNIPPETS']['HomeSaleProducts'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("HomeSaleProductsItem");
if (!$GLOBALS['SNIPPETS']['HomeSaleProducts']) {
$this->DontDisplay = true;
return;
}
}
}
示例6: SetPanelSettings
public function SetPanelSettings()
{
$GLOBALS['ISC_CLASS_CATEGORY'] = GetClass('ISC_CATEGORY');
// Should we hide the comparison button?
if(GetConfig('EnableProductComparisons') == 0 || $GLOBALS['ISC_CLASS_CATEGORY']->GetNumProducts() < 2) {
$GLOBALS['HideCompareItems'] = "none";
}
// Load the products into the reference array
$GLOBALS['ISC_CLASS_CATEGORY']->GetProducts($products);
$GLOBALS['CategoryProductListing'] = "";
if(GetConfig('ShowProductRating') == 0) {
$GLOBALS['HideProductRating'] = "display: none";
}
$display_mode = ucfirst(GetConfig("CategoryDisplayMode"));
if ($display_mode == "Grid") {
$display_mode = "";
}
$GLOBALS['DisplayMode'] = $display_mode;
if ($display_mode == "List") {
if (GetConfig('ShowAddToCartLink') && $GLOBALS['ISC_CLASS_CATEGORY']->GetNumProducts() > 0) {
$GLOBALS['HideAddButton'] = '';
} else {
$GLOBALS['HideAddButton'] = 'none';
}
$GLOBALS['ListJS'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("ListCheckForm");
}
$GLOBALS['CompareButton'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CompareButton" . $display_mode);
if ($display_mode == "List" && $GLOBALS['ISC_CLASS_CATEGORY']->GetNumPages() > 1) {
$GLOBALS['CompareButtonTop'] = $GLOBALS['CompareButton'];
}
$GLOBALS['AlternateClass'] = '';
foreach($products as $row) {
$this->setProductGlobals($row);
// for list style
if ($display_mode == "List") {
// get a small chunk of the product description
$desc = isc_substr(strip_tags($row['proddesc']), 0, 225);
if (isc_strlen($row['proddesc']) > 225) {
// trim the description back to the last period or space so words aren't cut off
$period_pos = isc_strrpos($desc, ".");
$space_pos = isc_strrpos($desc, " ");
// find the character that we should trim back to. -1 on space pos for a space that follows a period, so we dont end up with 4 periods
if ($space_pos - 1 > $period_pos) {
$pos = $space_pos;
}
else {
$pos = $period_pos;
}
$desc = isc_substr($desc, 0, $pos);
$desc .= "...";
}
$GLOBALS['ProductDescription'] = $desc;
$GLOBALS['AddToCartQty'] = "";
if (CanAddToCart($row) && GetConfig('ShowAddToCartLink')) {
if (isId($row['prodvariationid']) || trim($row['prodconfigfields'])!='' || $row['prodeventdaterequired']) {
$GLOBALS['AddToCartQty'] = '<a href="' . $GLOBALS["ProductURL"] . '">' . $GLOBALS['ProductAddText'] . "</a>";
}
else {
$GLOBALS['CartItemId'] = $GLOBALS['ProductId'];
// If we're using a cart quantity drop down, load that
if (GetConfig('TagCartQuantityBoxes') == 'dropdown') {
$GLOBALS['Quantity0'] = "selected=\"selected\"";
$GLOBALS['QtyOptionZero'] = '<option %%GLOBAL_Quantity0%% value="0">Quantity</option>';
$GLOBALS['QtySelectStyle'] = 'width: auto;';
$GLOBALS['AddToCartQty'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CartItemQtySelect");
// Otherwise, load the textbox
} else {
$GLOBALS['ProductQuantity'] = 0;
$GLOBALS['AddToCartQty'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CartItemQtyText");
}
}
}
} // for grid style
else {
$GLOBALS["CompareOnSubmit"] = "onsubmit=\"return compareProducts(config.CompareLink)\"";
}
$GLOBALS['CategoryProductListing'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CategoryProductsItem" . $display_mode);
}
if($GLOBALS['ISC_CLASS_CATEGORY']->GetNumProducts() == 0) {
// There are no products in this category
$GLOBALS['CategoryProductListing'] = $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CategoryNoProductsMessage");
$GLOBALS['HideOtherProductsIn'] = 'none';
$GLOBALS['ExtraCategoryClass'] = "Wide WideWithLeft";
if($GLOBALS['SNIPPETS']['SubCategories'] != '') {
//.........这里部分代码省略.........
示例7: _StoreInsArtFileAndReturnId
public function _StoreInsArtFileAndReturnId($FileName, $fname)
{
$dir = $fname;
if (is_array($_FILES[$FileName]) && $_FILES[$FileName]['name'] != "") {
// If it's an image, make sure it's a valid image type
if (isc_strtolower(isc_substr($_FILES[$FileName]['name'], -3)) != "pdf") {
return "";
}
if (!is_dir(sprintf("../%s", $dir))) {
@mkdir("../" . $dir, 0777);
}
// Clean up the incoming file name a bit
$_FILES[$FileName]['name'] = preg_replace("#[^\\w.]#i", "_", $_FILES[$FileName]['name']);
$_FILES[$FileName]['name'] = preg_replace("#_{1,}#i", "_", $_FILES[$FileName]['name']);
$randomFileName = GenRandFileName($_FILES[$FileName]['name']);
$dest = realpath(ISC_BASE_PATH . "/" . $dir);
$dest .= "/" . $randomFileName;
if (move_uploaded_file($_FILES[$FileName]["tmp_name"], $dest)) {
isc_chmod($dest, ISC_WRITEABLE_FILE_PERM);
// The file was moved successfully
return $randomFileName;
} else {
// Couldn't move the file, maybe the directory isn't writable?
return "";
}
} else {
// The file doesn't exist in the $_FILES array
return "";
}
}
示例8: _GetMaxUploadSize
protected function _GetMaxUploadSize()
{
$sizes = array(
"upload_max_filesize" => ini_get("upload_max_filesize"),
"post_max_size" => ini_get("post_max_size")
);
$max_size = -1;
foreach($sizes as $size) {
if (!$size) {
continue;
}
$unit = isc_substr($size, -1);
$size = isc_substr($size, 0, -1);
switch(isc_strtolower($unit)) {
case "g":
$size *= 1024;
case "m":
$size *= 1024;
case "k":
$size *= 1024;
}
if($max_size == -1 || $size > $max_size) {
$max_size = $size;
}
}
if($max_size >= 1048576) {
$max_size = floor($max_size/1048576)."MB";
} else {
$max_size = floor($max_size/1024)."KB";
}
return $max_size;
}
示例9: GetProductFieldDetails
/**
* Generate a list of product fields for configurable products to be shown
* for a particular item in the cart based on the customer's configuration.
*
* @param array $productFields Array containing list of product fields for this product.
* @param int $cartItemId The ID of the item in the shopping cart.
*/
public function GetProductFieldDetails($productFields, $cartItemId)
{
// custom product fields on cart page
$GLOBALS['HideCartProductFields'] = 'display:none;';
$GLOBALS['CartProductFields'] = '';
if(isset($productFields) && !empty($productFields) && is_array($productFields)) {
$GLOBALS['HideCartProductFields'] = '';
foreach($productFields as $filedId => $field) {
switch ($field['type']) {
//field is a file
case 'file': {
//file is an image, display the image
$fieldValue = '<a target="_Blank" href="'.$GLOBALS['ShopPath'].'/viewfile.php?cartitem='.$cartItemId.'&prodfield='.$filedId.'">'.isc_html_escape($field['fileOriginalName']).'</a>';
break;
}
//field is a checkbox
case 'checkbox': {
$fieldValue = GetLang('Checked');
break;
}
//if field is a text area or short text display first
default: {
if(isc_strlen($field['value'])>50) {
$fieldValue = isc_substr(isc_html_escape($field['value']), 0, 50)." ..";
} else {
$fieldValue = isc_html_escape($field['value']);
}
}
}
if(trim($fieldValue) != '') {
$GLOBALS['CustomFieldName'] = isc_html_escape($field['name']);
$GLOBALS['CustomFieldValue'] = $fieldValue;
$GLOBALS['CartProductFields'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet("CartProductFields");
}
}
}
}
示例10: EditDiscountStep1
private function EditDiscountStep1()
{
$GLOBALS['Title'] = GetLang('EditDiscount');
$GLOBALS['Intro'] = GetLang('EditDiscountIntro');
$GLOBALS['Enabled'] = 'checked="checked"';
$GLOBALS['FormAction'] = "editDiscount2";
$GLOBALS['DiscountTypes'] = '';
$GLOBALS['Edit'] = 'display : none;';
$GLOBALS['DiscountJavascriptValidation'] = '';
$GLOBALS['DiscountEnabledCheck'] = 'checked="checked"';
$rules = GetAvailableModules('rule', false, false, false);
$GLOBALS['RuleList'] = '';
$GLOBALS['MaxUses'] = '';
$GLOBALS['DiscountExpiryFields'] = 'display : none';
$GLOBALS['DiscountMaxUsesDisabled'] = 'readonly="readonly"';
$GLOBALS['DiscountExpiryDateDisabled'] = 'readonly="readonly"';
require_once(ISC_BASE_PATH.'/lib/api/discount.api.php');
$discountAPI = new API_DISCOUNT();
$discountId = (int) $_GET['discountId'];
if ($discountAPI->DiscountExists($discountId)) {
$discount = $this->GetDiscountData($discountId);
$freeShippingMessageLocations = unserialize($discount['free_shipping_message_location']);
$GLOBALS['DiscountId'] = $discountId;
$GLOBALS['DiscountName'] = isc_html_escape($discount['discountname']);
$module = explode('_',$discount['discountruletype']);
if (isset($module[1])) {
GetModuleById('rule', $ruleModule, $module[1]);
if(!is_object($ruleModule)) {
// Something really bad went wrong >_<
exit;
}
}
else {
die('Can\'t find the module');
}
$cd = unserialize($discount['configdata']);
if (!empty($cd)) {
foreach ($cd as $var => $data) {
if (isc_substr($var,0,5) == "varn_") {
$data = FormatPrice($data, false, false);
}
$GLOBALS[$var] = $data;
}
}
$ruleModule->initialize($discount);
$ruleModule->initializeAdmin();
$GLOBALS['RuleList'] = '';
$GLOBALS['Vendor'] = '0';
if(gzte11(ISC_HUGEPRINT)) {
$GLOBALS['Vendor'] = 1;
}
foreach ($rules as $rule) {
$rulesSorted[$rule['object']->getRuleType()][] = $rule;
}
$first = true;
$GLOBALS['CurrentRule'] = 'null';
foreach ($rulesSorted as $type => $ruleType) {
if ($first) {
$GLOBALS['RuleList'] .= '<h4 style="margin-top:5px; margin-bottom:5px;">'.$type.' '.GetLang('BasedRule').'</h4>';
} else {
$GLOBALS['RuleList'] .= '<h4 style="margin-bottom:5px;">'.$type.' '.GetLang('BasedRule').'</h4>';
}
$first = false;
foreach ($ruleType as $rule) {
$GLOBALS['RuleList'] .= '<label><input type="radio" class="discountRadio" onClick="UpdateModule(this.id,'.(int)$rule['object']->vendorSupport().')" name="RuleType" value="'.$rule['id'].'" ';
if ($rule['id'] == $discount['discountruletype']) {
$GLOBALS['RuleList'] .= ' checked="checked" ';
$GLOBALS['CurrentRule'] = "'".$rule['id']."'";
}
$GLOBALS['RuleList'] .= 'id="'.$rule['id'].'"> ';
if (!(int)$rule['object']->vendorSupport() && $GLOBALS['Vendor'] == 1) {
$GLOBALS['RuleList'] .= '<span class="aside">'.$rule['object']->getDisplayName().'</span>';
} else {
$GLOBALS['RuleList'] .= '<span>'.$rule['object']->getDisplayName().'</span>';
}
//.........这里部分代码省略.........
示例11: _GetBackupList
public function _GetBackupList()
{
$backups = array();
if(!is_dir(ISC_BACKUP_DIRECTORY)) {
isc_mkdir(ISC_BACKUP_DIRECTORY);
}
if(is_dir(ISC_BACKUP_DIRECTORY)) {
$dh = opendir(ISC_BACKUP_DIRECTORY);
if($dh) {
while(($file = readdir($dh)) !== false) {
if(isc_substr($file, 0, 6) == "backup") {
$backups[$file] = array(
"size" => filesize(ISC_BACKUP_DIRECTORY . $file),
"mtime" => filemtime(ISC_BACKUP_DIRECTORY . $file)
);
if(!is_file(ISC_BACKUP_DIRECTORY . $file)) {
$backups[$file]['directory'] = 1;
}
}
}
}
}
return $backups;
}
示例12: buildXML
public function buildXML()
{
if (isc_strtolower($this->spool["service"]) !== "add" && is_array($this->spoolReferenceData)) {
$this->writeEscapedElement("ListID", $this->spoolReferenceData["ListID"]);
$this->writeEscapedElement("EditSequence", $this->spoolReferenceData["EditSequence"]);
}elseif(isc_strtolower($this->spool["service"]) !== "add"){
$fullName = $this->spoolNodeData["FirstName"] . ' ' . $this->spoolNodeData["LastName"];
$query = "SELECT * FROM [|PREFIX|]accountingref WHERE accountingreftype='customerguest' AND accountingrefvalue LIKE '%" . $GLOBALS["ISC_CLASS_DB"]->Quote($fullName) . "%' ORDER BY accoutingrefid DESC LIMIT 1";
$result = $GLOBALS["ISC_CLASS_DB"]->Query($query);
if ($row = $GLOBALS["ISC_CLASS_DB"]->Fetch($result)) {
$this->writeEscapedElement("ListID", @unserialize($row["ListID"]));
$this->writeEscapedElement("EditSequence", @unserialize($row['EditSequence']));
}
}
$this->buildCustomerGuestNameNode($name, $this->spoolNodeData["OrderID"]);
$this->writeEscapedElement("Name", isc_substr($this->spoolNodeData["FirstName"] . ' ' . $this->spoolNodeData["LastName"], 0, 50));
$this->writeEscapedElement("IsActive", "true");
$customerTypeListId = $this->accounting->getCustomerParentTypeListId(true);
if (!$customerTypeListId || trim($customerTypeListId) == '') {
throw new QBException("Unable to find customer parent type reference for guest checkout in customerguest", $this->spool);
}
$this->xmlWriter->startElement("ParentRef");
if (isc_strtolower($this->spool["service"]) == "add") {
$this->writeEscapedElement("FullName", 'Cart Guest Checkout Customers');
}else{
$this->writeEscapedElement("ListID", $customerTypeListId);
}
$this->xmlWriter->endElement();
/**
* Cannot be set if it is empty
*/
if ($this->spoolNodeData["FirstName"] !== '') {
$this->writeEscapedElement("FirstName", isc_substr($this->spoolNodeData["FirstName"], 0, 25));
}
/**
* Same with this one
*/
if ($this->spoolNodeData["LastName"] !== '') {
$this->writeEscapedElement("LastName", isc_substr($this->spoolNodeData["LastName"], 0, 25));
}
if (isset($this->spoolNodeData["ordbillphone"]) && $this->spoolNodeData["ordbillphone"] !== '') {
$this->writeEscapedElement("Phone", $this->spoolNodeData["ordbillphone"]);
} elseif (isset($this->spoolNodeData["Phone"]) && $this->spoolNodeData["Phone"] !== '') {
$this->writeEscapedElement("Phone", $this->spoolNodeData["Phone"]);
} else {
$this->writeEscapedElement("Phone", '555-555-6666');
}
if (isset($this->spoolNodeData["ordbillemail"]) && $this->spoolNodeData["ordbillemail"] !== '') {
$this->writeEscapedElement("Email", $this->spoolNodeData["ordbillemail"]);
} elseif (isset($this->spoolNodeData["Email"]) && $this->spoolNodeData["Email"] !== '') {
$this->writeEscapedElement("Email", $this->spoolNodeData["Email"]);
} else {
$this->writeEscapedElement("Email", 'guest@mystore.com');
}
return $this->buildOutput();
}
示例13: _ReplaceTokens
/**
* _ReplaceTokens
* Replace the placeholder tokens with values from the database
*
* @param String $row The row from the CSV file
* @param Array $Data A reference to the database row for the product
* @return String
*/
private function _ReplaceTokens($Row, &$Data)
{
$tokens = $this->_GetTokens();
foreach($this->_GetTokens() as $token => $val) {
if(isset($Data[$val]) || $token == "{PRODLINK}" || $token == "{STORENAME}") {
switch($token) {
case "{PRODSUMMARY}": {
$Data[$val] = $this->_Strip(strip_tags($Data[$val]));
if(strlen($Data[$val]) > 32) {
$Data[$val] = isc_substr($Data[$val], 0, 32) . "...";
}
$Data[$val] = trim($Data[$val]);
$Data[$val] = str_replace("\n", "", $Data[$val]);
$Data[$val] = str_replace("\r", "", $Data[$val]);
$Data[$val] = str_replace("\t", " ", $Data[$val]);
break;
}
case "{PRODPRICE}": {
$price = getClass('ISC_TAX')->getPrice($Data[$val], $Data['tax_class_id'], getConfig('taxDefaultTaxDisplayProducts'));
$Data[$val] = FormatPrice($price, false, true);
break;
}
case "{PRODLINK}": {
$Data[$val] = ProdLink($Data['prodname']);
break;
}
case "{STORENAME}": {
$Data[$val] = GetConfig("StoreName");
break;
}
}
// Replace the value from the row
$Row = str_replace($token, $Data[$val], $Row);
}
else {
// Replace the value with nothing
$Row = str_replace($token, "", $Row);
}
}
$Row = str_replace("{Campaign Name}", GetConfig('StoreName'), $Row);
$Row = str_replace("{Ad Group Name}", $this->_Strip($Data['prodname']), $Row);
$Row = str_replace("{Component Type}", "Ad", $Row);
$Row = str_replace("{Component Status}", "On", $Row);
$Row = str_replace("{Keyword}", "", $Row);
$Row = str_replace("{Keyword Alt Text}", "", $Row);
$Row = str_replace("{Keyword Custom URL}", "", $Row);
$Row = str_replace("{Sponsored Search Bid (USD)}", "", $Row);
$Row = str_replace("{Sponsored Search Bid Limit (USD)}", "", $Row);
$Row = str_replace("{Sponsored Search Status}", "", $Row);
$Row = str_replace("{Match Type}", "", $Row);
$Row = str_replace("{Content Match Bid (USD)}", "", $Row);
$Row = str_replace("{Content Match Bid Limit (USD)}", "", $Row);
$Row = str_replace("{Content Match Status}", "", $Row);
$Row = str_replace("{Ad Name}", $this->_BuildAdName($Data['prodname']), $Row);
$Row = str_replace("{Watch List}", "", $Row);
$Row = str_replace("{Campaign ID}", "", $Row);
$Row = str_replace("{Campaign Description}", "", $Row);
$Row = str_replace("{Campaign Start Date}", "", $Row);
$Row = str_replace("{Campaign End Date}", "", $Row);
$Row = str_replace("{Ad Group ID}", "", $Row);
$Row = str_replace("{Ad Group: Optimize Ad Display}", "", $Row);
$Row = str_replace("{Ad ID}", "", $Row);
$Row = str_replace("{Keyword ID}", "", $Row);
$Row = str_replace("{Checksum}", "", $Row);
$Row = str_replace("{Error Message}", "", $Row);
// Run one final trim
$Row = trim($Row);
// Return the row
return $Row;
}
示例14: writeRawElement
/**
* Write an XML node element with raw value
*
* Method will write an XML node element WITHOUT encoding the value. PLEASE BE CAREFULL!!!
*
* @access protected
* @param string $name The XML node name
* @param string $value The XML node value
* @param int $maxLength The optional maximum length of the value. Default is 0 (unlimited)
* @return bool TRUE if the node was created, FALSE on error
*/
protected function writeRawElement($name, $value, $maxLength=0)
{
if (trim($name) == "") {
return false;
}
if ($maxLength > 0) {
$value = isc_substr($value, 0, $maxLength);
}
$this->xmlWriter->startElement($name);
$this->xmlWriter->writeRaw($value);
$this->xmlWriter->endElement();
return true;
}
示例15: buildXML
public function buildXML()
{
if (isc_strtolower($this->spool["service"]) == "edit" && is_array($this->spoolReferenceData)) {
$this->writeEscapedElement("ListID", $this->spoolReferenceData["ListID"]);
$this->writeEscapedElement("EditSequence", $this->spoolReferenceData["EditSequence"]);
}
$this->buildProductVariationNameNode($this->spoolNodeData["prodname"], $this->spoolNodeData["combinationid"]);
$this->writeEscapedElement("IsActive", "true");
/**
* Set the product variation parent. Only do this for adding (want to edit the least amount as possible)
*/
if (isc_strtolower($this->spool["service"]) == "add") {
$productTypeListId = $this->accounting->getProductParentTypeListId(true);
if (!$productTypeListId || trim($productTypeListId) == '') {
throw new QBException("Unable to find product parent type reference for product variation in productvariation", $this->spool);
}
$this->xmlWriter->startElement("ParentRef");
$this->writeEscapedElement("ListID", $productTypeListId);
$this->xmlWriter->endElement();
}
if ($this->compareClientVersion("7.0") && isset($this->spoolNodeData["vcsku"]) && $this->spoolNodeData["vcsku"] !== "") {
$this->writeEscapedElement("ManufacturerPartNumber", $this->spoolNodeData["vcsku"]);
}
/**
* OK, different tag names for different versions for different countries. Good times, good times
*/
if ($this->compareClientCountry("uk") || $this->compareClientCountry("ca")) {
if ($this->compareClientVersion("3.0")) {
$this->xmlWriter->startElement("TaxCodeForSaleRef");
} else {
$this->xmlWriter->startElement("TaxCodeRef");
}
} else {
$this->xmlWriter->startElement("SalesTaxCodeRef");
}
$this->writeEscapedElement("FullName", "NON");
$this->xmlWriter->endElement();
$this->writeEscapedElement("SalesDesc", isc_substr($this->spoolNodeData["prodvariationname"], 0, 4095));
$prodPrice = CalcProductVariationPrice($this->spoolNodeData["prodprice"], $this->spoolNodeData["vcpricediff"], $this->spoolNodeData["vcprice"]);
$this->writeEscapedElement("SalesPrice", number_format($prodPrice, 2, ".", ""));
/**
* We can only set this for the add process as the mod process is only available in versions 7.0 and above
*/
if (isc_strtolower($this->spool["service"]) == "add" || $this->compareClientVersion("7.0")) {
$incomeAccountListId = $this->accounting->getAccountListId("income");
if (trim($incomeAccountListId) == '') {
throw new QBException("Cannot find the income account ListID for product variation ID: " . $this->spoolNodeData["combinationid"], $this->spool);
}
$this->xmlWriter->startElement("IncomeAccountRef");
$this->writeEscapedElement("ListID", $incomeAccountListId);
$this->xmlWriter->endElement();
}
if (isset($this->spoolNodeData["prodcostprice"]) && $this->spoolNodeData["prodcostprice"] > 0) {
$this->writeEscapedElement("PurchaseDesc", isc_substr($this->spoolNodeData["prodvariationname"], 0, 4095));
$this->writeEscapedElement("PurchaseCost", number_format($this->spoolNodeData["prodcostprice"], 2, ".", ""));
}
$cogsAccountListId = $this->accounting->getAccountListId("costofgoodssold");
if (trim($cogsAccountListId) == '') {
throw new QBException("Cannot find the cogs account ListID for product variation ID: " . $this->spoolNodeData["combinationid"], $this->spool);
}
$this->xmlWriter->startElement("COGSAccountRef");
$this->writeEscapedElement("ListID", $cogsAccountListId);
$this->xmlWriter->endElement();
$fixedAccountListId = $this->accounting->getAccountListId("fixedasset");
if (trim($fixedAccountListId) == '') {
throw new QBException("Cannot find the fixed account ListID for product ID: " . $this->spoolNodeData["combinationid"], $this->spool);
}
$this->xmlWriter->startElement("AssetAccountRef");
$this->writeEscapedElement("ListID", $fixedAccountListId);
$this->xmlWriter->endElement();
/**
* Only do this is we are a new product OR if we are handling the inventory levels
*/
if (isc_strtolower($this->spool["service"]) == "add" || $this->accounting->getValue("invlevels") == ACCOUNTING_QUICKBOOKS_TYPE_SHOPPINGCART) {
$this->writeEscapedElement("ReorderPoint", (int)$this->spoolNodeData["vclowstock"]);
}
if ($this->compareClientCountry("uk") && $this->compareClientVersion("2.0")) {
if (GetConfig("PricesIncludeTax")) {
$this->writeEscapedElement("AmountIncludesVAT", "1");
//.........这里部分代码省略.........