當前位置: 首頁>>代碼示例>>PHP>>正文


PHP isc_strlen函數代碼示例

本文整理匯總了PHP中isc_strlen函數的典型用法代碼示例。如果您正苦於以下問題:PHP isc_strlen函數的具體用法?PHP isc_strlen怎麽用?PHP isc_strlen使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了isc_strlen函數的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;
	}
開發者ID:hungnv0789,項目名稱:vhtm,代碼行數:36,代碼來源:class.exportfiletype.factory.php

示例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;
 }
開發者ID:nirvana-info,項目名稱:old_bak,代碼行數:30,代碼來源:class.importmethod.factory.php

示例3: DownloadContent

/**
* Forces content to be downloaded
*
* @param mixed $filename The name of the file to use when downloading the content
* @param string $data The content to download
* @param string $mimetype The mime type to use. Defaults to detecting the type based on file extension.
*/
function DownloadContent($filename, $data, $mimetype = "")
{
    SetDownloadHeaders($filename, isc_strlen($data), $mimetype);
    // output data
    echo $data;
    exit;
}
開發者ID:nirvana-info,項目名稱:old_bak,代碼行數:14,代碼來源:download.php

示例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;
	}
開發者ID:hungnv0789,項目名稱:vhtm,代碼行數:23,代碼來源:String.php

示例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;
         }
     }
 }
開發者ID:nirvana-info,項目名稱:old_bak,代碼行數:48,代碼來源:HomeSaleProducts.php

示例6: BuildWhereFromVars

		public function BuildWhereFromVars($array)
		{
			$queryWhere = "";
			$queryJoin = "";
			$queryHaving = "";

			// Is this a custom search?
			if(!empty($array['searchId'])) {
				$this->_customSearch = $GLOBALS['ISC_CLASS_ADMIN_CUSTOMSEARCH']->LoadSearch($array['searchId']);
				$array = array_merge($array, (array)$this->_customSearch['searchvars']);
			}

			if (isset($array['searchQuery']) && $array['searchQuery'] != "") {
				// PostgreSQL is case sensitive for likes, so all matches are done in lower case
				$search_query = $GLOBALS['ISC_CLASS_DB']->Quote(trim($array['searchQuery']));
				$queryWhere .= "
					AND (
						customerid = '" . $search_query . "' OR
						custconfirstname LIKE '%" . $search_query . "%' OR
						custconlastname LIKE '%" . $search_query . "%' OR
						custconemail LIKE '%" . $search_query . "%' OR
						CONCAT(custconfirstname, ' ', custconlastname) LIKE '%" . $search_query . "%' OR
						custconcompany LIKE '%" . $search_query . "%'
					)";
			}

			if (isset($array['letter']) && $array['letter'] != '') {
				$letter = chr(ord($array['letter']));
				if ($array['letter'] == '0-9') {
					$queryWhere .= " AND custconlastname NOT REGEXP('^[a-zA-Z]')";
				}
				else if (isc_strlen($letter) == 1) {
					$queryWhere .= " AND custconlastname LIKE '".$GLOBALS['ISC_CLASS_DB']->Quote($letter)."%'";
				}
			}

			if (isset($array['phone']) && $array['phone'] != "") {
				$phone = $GLOBALS['ISC_CLASS_DB']->Quote(trim($array['phone']));
				$queryWhere .= sprintf(" AND custconphone LIKE '%%%s%%'", $phone);
			}

			if (isset($array['idFrom']) && $array['idFrom'] != "") {
				$id_from = $GLOBALS['ISC_CLASS_DB']->Quote((int)$array['idFrom']);
				$queryWhere .= sprintf(" AND customerid >= '%d'", $id_from);
			}
			if (isset($array['idTo']) && $array['idTo']) {
				$id_to = $GLOBALS['ISC_CLASS_DB']->Quote((int)$array['idTo']);
				$queryWhere .= sprintf(" AND customerid <= '%d'", $id_to);
			}

			// limit by number of orders
			if (!empty($array['ordersFrom'])) {
				$orders_from = $GLOBALS['ISC_CLASS_DB']->Quote((int)$array['ordersFrom']);
				$queryHaving .= sprintf(" AND numorders >= '%d'", $orders_from);
			}

			if (!empty($array['ordersTo'])) {
				$orders_to = $GLOBALS['ISC_CLASS_DB']->Quote((int)$array['ordersTo']);
				$queryHaving .= sprintf(" AND numorders <= '%d'", $orders_to);
			}

			if (isset($array['storeCreditFrom']) && $array['storeCreditFrom'] != "") {
				$credit_from = $GLOBALS['ISC_CLASS_DB']->Quote((int)$array['storeCreditFrom']);
				$queryWhere .= sprintf(" AND custstorecredit >= '%d'", $credit_from);
			}

			if (isset($array['storeCreditTo']) && $array['storeCreditTo'] != "") {
				$credit_to = $GLOBALS['ISC_CLASS_DB']->Quote((int)$array['storeCreditTo']);
				$queryWhere .= sprintf(" AND custstorecredit <= '%d'", $credit_to);
			}

			// Limit results to a particular join date range
			if (isset($array['dateRange']) && $array['dateRange'] != "") {
				$range = $array['dateRange'];
				switch($range) {
					// Registrations within the last day
					case "today":
						$from_stamp = mktime(0, 0, 0, isc_date("m"), isc_date("d"), isc_date("Y"));
						break;
					// Registrations received in the last 2 days
					case "yesterday":
						$from_stamp = mktime(0, 0, 0, isc_date("m"), date("d")-1, isc_date("Y"));
						$to_stamp = mktime(0, 0, 0, isc_date("m"), isc_date("d")-1, isc_date("Y"));
						break;
					// Registrations received in the last 24 hours
					case "day":
						$from_stamp = time()-60*60*24;
						break;
					// Registrations received in the last 7 days
					case "week":
						$from_stamp = time()-60*60*24*7;
						break;
					// Registrations received in the last 30 days
					case "month":
						$from_stamp = time()-60*60*24*30;
						break;
					// Registrations received this month
					case "this_month":
						$from_stamp = mktime(0, 0, 0, isc_date("m"), 1, isc_date("Y"));
						break;
//.........這裏部分代碼省略.........
開發者ID:hungnv0789,項目名稱:vhtm,代碼行數:101,代碼來源:class.customers.php

示例7: BuildWhereFromVars

 public function BuildWhereFromVars($array)
 {
     $queryWhere = "";
     if (isset($array['searchQuery']) && $array['searchQuery'] != "") {
         // PostgreSQL is case sensitive for likes, so all matches are done in lower case
         $search_query = $GLOBALS['ISC_CLASS_DB']->Quote(trim(isc_strtolower($array['searchQuery'])));
         $queryWhere .= "\n\t\t\t\t\tAND (\n\t\t\t\t\t\tcustomerid = '" . $search_query . "' OR\n\t\t\t\t\t\tLOWER(custconfirstname) LIKE '%" . $search_query . "%' OR\n\t\t\t\t\t\tLOWER(custconlastname) LIKE '%" . $search_query . "%' OR\n\t\t\t\t\t\tLOWER(custconemail) LIKE '%" . $search_query . "%' OR\n\t\t\t\t\t\tLOWER(CONCAT(custconfirstname, ' ', custconlastname)) LIKE '%" . $search_query . "%' OR\n\t\t\t\t\t\tLOWER(custconcompany) LIKE '%" . $search_query . "%'\n\t\t\t\t\t)";
     }
     if (isset($array['letter']) && $array['letter'] != '') {
         $letter = chr(ord($array['letter']));
         if ($array['letter'] == '0-9') {
             $queryWhere .= " AND custconlastname NOT REGEXP('^[a-zA-Z]')";
         } else {
             if (isc_strlen($letter) == 1) {
                 $queryWhere .= " AND custconlastname LIKE '" . $GLOBALS['ISC_CLASS_DB']->Quote($letter) . "%'";
             }
         }
     }
     if (isset($array['phone']) && $array['phone'] != "") {
         $phone = $GLOBALS['ISC_CLASS_DB']->Quote(trim($array['phone']));
         $queryWhere .= sprintf(" AND custconphone LIKE '%%%s%%'", $phone);
     }
     if (isset($array['idFrom']) && $array['idFrom'] != "") {
         $id_from = $GLOBALS['ISC_CLASS_DB']->Quote((int) $array['idFrom']);
         $queryWhere .= sprintf(" AND customerid >= '%d'", $id_from);
     }
     if (isset($array['idTo']) && $array['idTo']) {
         $id_to = $GLOBALS['ISC_CLASS_DB']->Quote((int) $array['idTo']);
         $queryWhere .= sprintf(" AND customerid <= '%d'", $id_to);
     }
     if (isset($array['storeCreditFrom']) && $array['storeCreditFrom'] != "") {
         $credit_from = $GLOBALS['ISC_CLASS_DB']->Quote((int) $array['storeCreditFrom']);
         $queryWhere .= sprintf(" AND custstorecredit >= '%d'", $credit_from);
     }
     if (isset($array['storeCreditTo']) && $array['storeCreditTo'] != "") {
         $credit_to = $GLOBALS['ISC_CLASS_DB']->Quote((int) $array['storeCreditTo']);
         $queryWhere .= sprintf(" AND custstorecredit <= '%d'", $credit_to);
     }
     // Limit results to a particular join date range
     if (isset($array['dateRange']) && $array['dateRange'] != "") {
         $range = $array['dateRange'];
         switch ($range) {
             // Registrations within the last day
             case "today":
                 $from_stamp = mktime(0, 0, 0, isc_date("m"), isc_date("d"), isc_date("Y"));
                 break;
                 // Registrations received in the last 2 days
             // Registrations received in the last 2 days
             case "yesterday":
                 $from_stamp = mktime(0, 0, 0, isc_date("m"), date("d") - 1, isc_date("Y"));
                 $to_stamp = mktime(0, 0, 0, isc_date("m"), isc_date("d") - 1, isc_date("Y"));
                 break;
                 // Registrations received in the last 24 hours
             // Registrations received in the last 24 hours
             case "day":
                 $from_stamp = time() - 60 * 60 * 24;
                 break;
                 // Registrations received in the last 7 days
             // Registrations received in the last 7 days
             case "week":
                 $from_stamp = time() - 60 * 60 * 24 * 7;
                 break;
                 // Registrations received in the last 30 days
             // Registrations received in the last 30 days
             case "month":
                 $from_stamp = time() - 60 * 60 * 24 * 30;
                 break;
                 // Registrations received this month
             // Registrations received this month
             case "this_month":
                 $from_stamp = mktime(0, 0, 0, isc_date("m"), 1, isc_date("Y"));
                 break;
                 // Orders received this year
             // Orders received this year
             case "this_year":
                 $from_stamp = mktime(0, 0, 0, 1, 1, isc_date("Y"));
                 break;
                 // Custom date
             // Custom date
             default:
                 if (isset($array['fromDate']) && $array['fromDate'] != "") {
                     $from_date = $array['fromDate'];
                     $from_data = explode("/", $from_date);
                     $from_stamp = mktime(0, 0, 0, $from_data[0], $from_data[1], $from_data[2]);
                 }
                 if (isset($array['toDate']) && $array['toDate'] != "") {
                     $to_date = $array['toDate'];
                     $to_data = explode("/", $to_date);
                     $to_stamp = mktime(0, 0, 0, $to_data[0], $to_data[1], $to_data[2]);
                 }
         }
         if (isset($from_stamp)) {
             $queryWhere .= sprintf(" AND custdatejoined >= '%d'", $from_stamp);
         }
         if (isset($to_stamp)) {
             $queryWhere .= sprintf(" AND custdatejoined <= '%d'", $to_stamp);
         }
     }
     if (isset($array['custGroupId']) && is_numeric($array['custGroupId'])) {
         $custGroupId = (int) $array['custGroupId'];
//.........這裏部分代碼省略.........
開發者ID:nirvana-info,項目名稱:old_bak,代碼行數:101,代碼來源:class.customers_jul23.php

示例8: _ImportRecord

 /**
  * Imports an tracking numbers in to the database.
  *
  * @param array Array of record data
  */
 protected function _ImportRecord($record)
 {
     if (trim($record['ordernumber']) == "") {
         $this->ImportSession['Results']['Failures'][] = implode(",", $record['original_record']) . " " . GetLang('ImportMissingOrderNumber');
         return;
     }
     $record['ordertrackingnumber'] = trim($record['ordertrackingnumber']);
     if ($record['ordertrackingnumber'] == "") {
         $this->ImportSession['Results']['Failures'][] = implode(",", $record['original_record']) . " " . GetLang('ImportMissingTrackingNumber');
         return;
     }
     if (isc_strlen($record['ordertrackingnumber']) > 100) {
         $this->ImportSession['Results']['Failures'][] = implode(",", $record['original_record']) . " " . GetLang('ImportTrackingNumberTooLong');
         return;
     }
     // Does the order number exist in the database?
     $query = "SELECT orderid, ordtrackingno, ordvendorid FROM [|PREFIX|]orders WHERE orderid='" . (int) $record['ordernumber'] . "'";
     $result = $GLOBALS['ISC_CLASS_DB']->Query($query);
     $order = $GLOBALS['ISC_CLASS_DB']->Fetch($result);
     if (!$order['orderid']) {
         $this->ImportSession['Results']['Failures'][] = implode(",", $record['original_record']) . " " . GetLang('ImportInvalidOrderNumber');
         return;
     }
     if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId() && $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId() != $order['ordvendorid']) {
         $this->ImportSession['Results']['Failures'][] = implode(",", $record['original_record']) . " " . GetLang('ImportInvalidOrderNumber');
         return;
     }
     // Does this order already have a tracking number?
     if ($order['ordtrackingno']) {
         // Overriding existing tracking number
         if (isset($this->ImportSession['OverrideDuplicates']) && $this->ImportSession['OverrideDuplicates'] == 1) {
             $this->ImportSession['Results']['Updates'][] = $record['ordernumber'] . " " . $record['ordertrackingnumber'];
         } else {
             $this->ImportSession['Results']['Duplicates'][] = $record['ordernumber'] . " " . $record['ordertrackingnumber'];
             return;
         }
     }
     $orderData = array("ordtrackingno" => $record['ordertrackingnumber']);
     if (isset($this->ImportSession['updateOrderStatus']) && $this->ImportSession['updateOrderStatus'] != 0) {
         $orderData['ordstatus'] = (int) $this->ImportSession['updateOrderStatus'];
     }
     if ($record['ordernumber'] > 0) {
         $GLOBALS['ISC_CLASS_DB']->UpdateQuery("orders", $orderData, "orderid='" . $order['orderid'] . "'");
         ++$this->ImportSession['Results']['SuccessCount'];
     } else {
         $this->ImportSession['Results']['Failures'][] = implode(",", $record['original_record']) . " " . GetLang('ImportInvalidOrderNumber');
         return;
     }
 }
開發者ID:nirvana-info,項目名稱:old_bak,代碼行數:54,代碼來源:class.batch.importer_29_3.php

示例9: GetProductFieldDetails

 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['fieldType']) {
                 //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['fileOriginName']) . '</a>';
                     break;
                     //field is a checkbox
                 //field is a checkbox
                 case 'checkbox':
                     $fieldValue = GetLang('Checked');
                     break;
                     //if field is a text area or short text display first
                 //if field is a text area or short text display first
                 default:
                     if (isc_strlen($field['fieldValue']) > 50) {
                         $fieldValue = isc_substr(isc_html_escape($field['fieldValue']), 0, 50) . " ..";
                     } else {
                         $fieldValue = isc_html_escape($field['fieldValue']);
                     }
             }
             if (trim($fieldValue) != '') {
                 $GLOBALS['CartProductFields'] .= '<dt> <img style="vertical-align: middle;" src="' . $GLOBALS['TPL_PATH'] . '/images/NodeJoin.gif" /> ' . isc_html_escape($field['fieldName']) . ':</dt>';
                 $GLOBALS['CartProductFields'] .= '<dd>' . $fieldValue . '</dd>';
             }
         }
     }
 }
開發者ID:nirvana-info,項目名稱:old_bak,代碼行數:35,代碼來源:CartContent_8_2.php

示例10: _BuildProductFeed

 private function _BuildProductFeed($feedTitle, $feedDescription, $feedId, $sortField, $sortOrder, $searchTerms = array())
 {
     $this->_SetFeedDetails();
     $feed = new ISC_FEED_GENERATOR($feedId, $this->_type, (int) GetConfig('RSSCacheTime') * 60);
     $channel = array("title" => $feedTitle, "description" => $feedDescription, "link" => $GLOBALS['ShopPath']);
     $feed->SetChannel($channel);
     // The magical Interspire Shopping Cart RSS feeds are actually just custom searches so pipe it off to our search function
     $searchterms = BuildProductSearchTerms($searchTerms);
     $searchQueries = BuildProductSearchQuery($searchterms, '', $sortField, $sortOrder);
     // Run the query
     $searchQueries['query'] .= $GLOBALS['ISC_CLASS_DB']->AddLimit(0, (int) GetConfig('RSSItemsLimit'));
     $result = $GLOBALS['ISC_CLASS_DB']->Query($searchQueries['query']);
     while ($product = $GLOBALS['ISC_CLASS_DB']->Fetch($result)) {
         if (isc_strlen($product['proddesc']) > 300) {
             $product['proddesc'] = isc_substr($product['proddesc'], 0, 298) . "..";
         }
         if ($product['imagefile']) {
             $product['proddesc'] = sprintf("<div style='float: right; padding: 10px;'>%s</div>%s", ImageThumb($product['imagefile'], ProdLink($product['prodname'])), $product['proddesc']);
         }
         // Determine the price of this product
         $price = CalculateProductPrice($product);
         $price = GetLang('Price') . ": " . $price;
         if (GetConfig('ShowProductRating')) {
             $ratingImage = $GLOBALS['TPL_PATH'] . '/images/IcoRating' . (int) $product['prodavgrating'] . '.gif';
             $ratingImage = '<img src="' . $ratingImage . '" alt="" />';
         } else {
             $ratingImage = '';
         }
         $product['proddesc'] .= '<p><strong>' . $price . '</strong> ' . $ratingImage . '</p>';
         // Add the item to the feed
         $item = array("title" => $product['prodname'], "description" => $product['proddesc'], "link" => ProdLink($product['prodname']), "date" => $product['proddateadded']);
         $feed->AddItem($item);
     }
     // Send the feed to the browser
     $feed->OutputFeed();
 }
開發者ID:nirvana-info,項目名稱:old_bak,代碼行數:36,代碼來源:class.rss.php

示例11: _CreateDBBackup

	public function _CreateDBBackup($file, &$error)
	{
		$time = isc_date('dS F Y \a\t H:i', time());
		$contents = sprintf("-- Database Backup\n-- Generated: %s\n-- -------------------------------------\n\n", $time);

		if(!function_exists('gzopen')) {
			$error = 'PHP is not compiled with ZLIB support';
			return false;
		}

		$progress = 0;

		$tables = $this->_FetchTables();

		foreach($tables as $table => $rowCount) {
			$this->_UpdateProgress(sprintf(GetLang('BackupStatusTable'), $table));

			$fields = $this->_FetchTableFields($table);
			$fields = implode("`,`", $fields);

			$contents .= "\n\n".$this->_ShowCreateTable($table).";\n\n";

			// Now fetch out all of the data
			$query = sprintf("SELECT * FROM %s", $table);
			$Result = $GLOBALS['ISC_CLASS_DB']->Query($query);
			while($row = $GLOBALS['ISC_CLASS_DB']->Fetch($Result)) {
				$values = '';
				foreach($row as $k => $v) {
					if(is_null($v)) {
						$values .= 'NULL,';
					}
					else {
						$values .= "'".$GLOBALS['ISC_CLASS_DB']->Quote($v)."',";
					}
				}
				$values = rtrim($values,",");
				$insert = sprintf("INSERT INTO %s (`%s`) VALUES (%s);\n", $table, $fields, $values);

				$contents .= $insert;

				if(isc_strlen($contents) > BACKUP_BUFFER_SIZE) {
					$this->_handler->WriteCompressedFile($file, $contents);
					$contents = '';
				}
			}
			if($this->Verbose) {
				$this->_DBProgress += $rowCount;
			}
		}

		// Write any remaining data
		$this->_handler->WriteCompressedFile($file, $contents);
		if($this->_handler->type == "remote") {
			$this->_UpdateProgress(GetLang('BackupStatusUploading'));
		}
		$this->_handler->CloseFile($file);
	}
開發者ID:hungnv0789,項目名稱:vhtm,代碼行數:57,代碼來源:class.backup.php

示例12: OrderApplyCouponCode

 /**
  * Apply a coupon code or gift certificate code to the order that's being created/edited.
  */
 private function OrderApplyCouponCode()
 {
     if (!isset($_REQUEST['couponCode']) || !isset($_REQUEST['orderSession'])) {
         exit;
     }
     $orderClass = GetClass('ISC_ADMIN_ORDERS');
     $api = $orderClass->GetCartApi($_REQUEST['orderSession']);
     $response = array();
     $code = trim($_REQUEST['couponCode']);
     // If we were passed a gift certificate code, attempt to apply it first
     if (isc_strlen($code) == GIFT_CERTIFICATE_LENGTH && gzte11(ISC_LARGEPRINT)) {
         if (!$api->ApplyGiftCertificate($code)) {
             $errors = implode("\n", $api->GetErrors());
         }
     } else {
         if (!$api->ApplyCoupon($code)) {
             $errors = implode("\n", $api->GetErrors());
         } else {
             // If we've applied a coupon code, we need to refresh the entire grid of order items
             // as prices may have also changed.
             $response['orderTable'] = $orderClass->GenerateOrderItemsGrid();
         }
     }
     if (isset($errors)) {
         $response['error'] = $errors;
     }
     // Generate the order summary again
     $response['orderSummary'] = $orderClass->GenerateOrderSummaryTable();
     echo isc_json_encode($response);
     exit;
 }
開發者ID:nirvana-info,項目名稱:old_bak,代碼行數:34,代碼來源:class.remote.orders_23_Jult_mj.php

示例13: GetExpressOfferShippers


//.........這裏部分代碼省略.........
         }
         $textItemList = '';
         foreach ($shippingDestinations as $addressId => $shippingInfo) {
             if (isset($vendors[$i + 1]) || isset($shippingDestinations[$addressId + 1])) {
                 $GLOBALS['HideHorizontalRule'] = '';
             } else {
                 $GLOBALS['HideHorizontalRule'] = 'display: none';
             }
             $GLOBALS['AddressId'] = $addressId;
             // If no methods are available, this order can't progress so show an error
             if (empty($shippingInfo['quotes'])) {
                 $GLOBALS['HideNoShippingProviders'] = '';
                 $GLOBALS['HideShippingProviderList'] = 'none';
                 $hideItemList = false;
             }
             $GLOBALS['ItemList'] = '';
             if (!$hideItemList) {
                 foreach ($shippingInfo['items'] as $product) {
                     // Only show physical items
                     if ($product['data']['prodtype'] != PT_PHYSICAL) {
                         continue;
                     }
                     $textItemList .= $product['quantity'] . ' x ' . $product['product_name'] . "\n";
                     $GLOBALS['ProductQuantity'] = $product['quantity'];
                     $GLOBALS['ProductName'] = isc_html_escape($product['product_name']);
                     $GLOBALS['HideGiftWrapping'] = 'display: none';
                     $GLOBALS['HideGiftMessagePreview'] = 'display: none';
                     $GLOBALS['GiftWrappingName'] = '';
                     $GLOBALS['GiftMessagePreview'] = '';
                     if (isset($product['wrapping']['wrapname'])) {
                         $GLOBALS['HideGiftWrapping'] = '';
                         $GLOBALS['GiftWrappingName'] = isc_html_escape($product['wrapping']['wrapname']);
                         if (isset($product['wrapping']['wrapmessage'])) {
                             if (isc_strlen($product['wrapping']['wrapmessage']) > 30) {
                                 $product['wrapping']['wrapmessage'] = substr($product['wrapping']['wrapmessage'], 0, 27) . '...';
                             }
                             $GLOBALS['GiftMessagePreview'] = isc_html_escape($product['wrapping']['wrapmessage']);
                             if ($product['wrapping']['wrapmessage']) {
                                 $GLOBALS['HideGiftMessagePreview'] = '';
                             }
                         }
                     }
                     $GLOBALS['ItemList'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->GetSnippet('ShippingQuoteProduct');
                 }
             }
             // If no methods are available, this order can't progress so show an error
             if (empty($shippingInfo['quotes'])) {
                 $tags[] = $this->MakeXMLTag('status', 0);
                 $tags[] = $this->MakeXMLTag('step', 'ShippingAddress');
                 $textItemList = rtrim($textItemList, "\n");
                 $tags[] = $this->MakeXMLTag('message', GetLang('AjaxUnableToShipToAddress') . "\n\n" . $textItemList, true);
                 $this->SendXMLHeader();
                 $this->SendXMLResponse($tags);
                 exit;
             }
             if (!$GLOBALS['HideAddressLine']) {
                 $address = $orderShippingAddresses[$addressId];
                 $addressLine = array($address['shipfirstname'] . ' ' . $address['shiplastname'], $address['shipcompany'], $address['shipaddress1'], $address['shipaddress2'], $address['shipcity'], $address['shipstate'], $address['shipzip'], $address['shipcountry']);
                 // Please see self::GenerateShippingSelect below.
                 $addressLine = array_filter($addressLine, array($checkout, 'FilterAddressFields'));
                 $GLOBALS['AddressLine'] = isc_html_escape(implode(', ', $addressLine));
             } else {
                 $GLOBALS['AddressLine'] = '';
             }
             // Now build a list of the actual available quotes
             $GLOBALS['ShippingProviders'] = '';
開發者ID:nirvana-info,項目名稱:old_bak,代碼行數:67,代碼來源:class.remote.php

示例14: normalizeNewURLForDatabase

	/**
	* The 'New' for this refers to the fact that this is for normalising redirect target urls (as opposed to 'old', source urls) and has nothing to do with the age of the method.
	*
	* @param string $url
	* @param string $error
	*/
	public static function normalizeNewURLForDatabase($url, &$error = '')
	{
		// only allow valid urls
		$url = parse_url($url);
		if (!$url) {
			$error = GetLang('NewURLInvalid');
			return false;
		}

		// build a list of urls this store is known by
		$storeUrls = array();

		$primary = parse_url(GetConfig('ShopPath'));
		$storeUrls[] = $primary;

		if (GetConfig('ShopPathSSL') && GetConfig('ShopPathSSL') != GetConfig('ShopPath')) {
			$storeUrls[] = parse_url(GetConfig('ShopPathSSL'));
		}

		if (isset($url['scheme'])) {
			// if a scheme is specified, only allow http
			if ($url['scheme'] != 'http' && $url['scheme'] != 'https') {
				$error = GetLang('NewURLInvalid');
				return false;
			}
		} else {
			if (!isset($url['path']) || isc_substr($url['path'], 0, 1) != '/') {
				// hostless paths must begin with a /
				$error = GetLang('NewURLInvalid');
				return false;
			}

			$path = $url['path'];
			unset($url['path']);

			$url = array_merge($url, $primary);
			if (isset($url['path'])) {
				$url['path'] .= $path;
			} else {
				$url['path'] = $path;
			}

		}

		GetLib('class.urls');
		$url = ISC_URLS::unparseUrl($url);

		// see if the redirect url matches any url this store is known by
		foreach ($storeUrls as $storeUrl) {
			// yeah, this ends up parsing and unparsing the stored urls but it means we get a reliable, well-formatted check
			$storeUrl = ISC_URLS::unparseUrl($storeUrl);

			if (isc_substr($url, 0, isc_strlen($storeUrl)) === $storeUrl) {
				$url = isc_substr($url, isc_strlen($storeUrl));
				break;
			}
		}

		return $url;
	}
開發者ID:hungnv0789,項目名稱:vhtm,代碼行數:66,代碼來源:class.redirects.php

示例15: ManageReviewsGrid


//.........這裏部分代碼省略.........
         $sortOrder = "desc";
     }
     $sortLinks = array("OrderId" => "r.orderid", "Review" => "r.revtitle", "Name" => "p.prodname", "By" => "r.revfromname", "Rating" => "r.revrating", "Date" => "r.revdate", "Status" => "r.revstatus", "RatingQuality" => "r.qualityrating", "RatingInstall" => "r.installrating", "RatingValue" => "r.valuerating", "RatingSupport" => "r.supportrating", "RatingDelivery" => "r.deliveryrating");
     if (isset($_GET['sortField']) && in_array($_GET['sortField'], $sortLinks)) {
         $sortField = $_GET['sortField'];
         SaveDefaultSortField("ManageReviews", $_REQUEST['sortField'], $sortOrder);
     } else {
         list($sortField, $sortOrder) = GetDefaultSortField("ManageReviews", "r.reviewid", $sortOrder);
     }
     if (isset($_GET['page'])) {
         $page = (int) $_GET['page'];
     } else {
         $page = 1;
     }
     $GLOBALS['Page'] = $page;
     $sortURL = sprintf("&sortField=%s&sortOrder=%s", $sortField, $sortOrder);
     $GLOBALS['SortURL'] = $sortURL;
     // Limit the number of questions returned
     if ($page == 1) {
         $start = 1;
     } else {
         $start = $page * ISC_REVIEWS_PER_PAGE - (ISC_REVIEWS_PER_PAGE - 1);
     }
     $start = $start - 1;
     // Get the results for the query
     $reviewResult = $this->_GetReviewList($query, $start, $sortField, $sortOrder, $numReviews);
     $numPages = ceil($numReviews / ISC_REVIEWS_PER_PAGE);
     // Add the "(Page x of n)" label
     if ($numReviews > ISC_REVIEWS_PER_PAGE) {
         $GLOBALS['Nav'] = sprintf("(%s %d of %d) &nbsp;&nbsp;&nbsp;", GetLang('Page'), $page, $numPages);
         $GLOBALS['Nav'] .= BuildPagination($numReviews, ISC_REVIEWS_PER_PAGE, $page, sprintf("index.php?ToDo=viewReviews%s%s%s", $sortURL, $filterURL, $searchURL));
     } else {
         $GLOBALS['Nav'] = "";
     }
     $GLOBALS['Nav'] = rtrim($GLOBALS['Nav'], ' |');
     $GLOBALS['SearchQuery'] = $query;
     $GLOBALS['SortField'] = $sortField;
     $GLOBALS['SortOrder'] = $sortOrder;
     BuildAdminSortingLinks($sortLinks, "index.php?ToDo=viewReviews&amp;" . $searchURL . "&amp;page=" . $page . $filterURL, $sortField, $sortOrder);
     // Workout the maximum size of the array
     $max = $start + ISC_REVIEWS_PER_PAGE;
     if ($max > $numReviews) {
         $max = $numReviews;
     }
     if ($numReviews > 0) {
         // Display the reviews
         while ($row = $GLOBALS['ISC_CLASS_DB']->Fetch($reviewResult)) {
             $GLOBALS['ReviewId'] = $row['reviewid'];
             $GLOBALS['ProdName'] = isc_html_escape($row['prodname']);
             $GLOBALS['ProdLink'] = ProdLink($row['prodname']);
             if (isc_strlen($row['revtext']) > 100) {
                 $GLOBALS['ReviewTitle'] = isc_html_escape(sprintf("%s...", isc_substr($row['revtitle'], 0, 100)));
             } else {
                 $GLOBALS['ReviewTitle'] = isc_html_escape($row['revtitle']);
             }
             //lguan_20100612: Show extra rating options
             $GLOBALS['Rating'] = $this->wrapRatingImages($row['revrating']);
             $GLOBALS['RatingQuality'] = $this->wrapRatingImages($row['qualityrating']);
             $GLOBALS['RatingInstall'] = $this->wrapRatingImages($row['installrating']);
             $GLOBALS['RatingValue'] = $this->wrapRatingImages($row['valuerating']);
             $GLOBALS['RatingSupport'] = $this->wrapRatingImages($row['supportrating']);
             $GLOBALS['RatingDelivery'] = $this->wrapRatingImages($row['deliveryrating']);
             if ($row['revfromname'] != "") {
                 $GLOBALS['PostedBy'] = isc_html_escape($row['revfromname']);
             } else {
                 $GLOBALS['PostedBy'] = GetLang('NA');
             }
             $GLOBALS['Date'] = CDate($row['revdate']);
             $GLOBALS['PreviewLink'] = sprintf("<a title='%s' href='javascript:PreviewReview(%d)'>%s</a>", GetLang('PreviewReview'), $row['reviewid'], GetLang('Preview'));
             if ($GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Edit_Reviews)) {
                 $GLOBALS['EditLink'] = sprintf("<a title='%s' href='index.php?ToDo=editReview&amp;reviewId=%d'>%s</a>", GetLang('EditReview'), $row['reviewid'], GetLang('Edit'));
             } else {
                 $GLOBALS['EditLink'] = sprintf("<a class='Action' disabled>%s</a>", GetLang('Edit'));
             }
             switch ($row['revstatus']) {
                 case "0":
                     $GLOBALS['Status'] = GetLang('Pending');
                     break;
                 case "1":
                     $GLOBALS['Status'] = sprintf("<font color='green'>%s</font>", GetLang('Approved'));
                     break;
                 case "2":
                     $GLOBALS['Status'] = sprintf("<font color='red'>%s</font>", GetLang('Disapproved'));
                     break;
             }
             $revOrderid = $row['orderid'];
             //$orderInformations = $this->GetOrderInformationsByOrderId($revOrderid);
             if (is_numeric($revOrderid) && $revOrderid > 0 && isset($row["ordcustid"])) {
                 //viewOrders&orderId
                 $GLOBALS["OrderId"] = "<a href='index.php?ToDo=viewOrders&orderId=" . $row["orderid"] . "' >" . $row["orderid"] . "</a>";
             } else {
                 $GLOBALS["OrderId"] = "unknown";
             }
             $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("reviews.manage.row");
             $GLOBALS['ReviewGrid'] .= $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
         }
         $GLOBALS['ISC_CLASS_TEMPLATE']->SetTemplate("reviews.manage.grid");
         return $GLOBALS['ISC_CLASS_TEMPLATE']->ParseTemplate(true);
     }
 }
開發者ID:nirvana-info,項目名稱:old_bak,代碼行數:101,代碼來源:class.review.php


注:本文中的isc_strlen函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。