本文整理汇总了PHP中AO::log方法的典型用法代码示例。如果您正苦于以下问题:PHP AO::log方法的具体用法?PHP AO::log怎么用?PHP AO::log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AO
的用法示例。
在下文中一共展示了AO::log方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendHeaders
/**
* Fixes CGI only one Status header allowed bug
*
* @link http://bugs.php.net/bug.php?id=36705
*
*/
public function sendHeaders()
{
if (!$this->canSendHeaders()) {
AO::log('HEADERS ALREADY SENT: ' . mageDebugBacktrace(true, true, true));
return $this;
}
if (substr(php_sapi_name(), 0, 3) == 'cgi') {
$statusSent = false;
foreach ($this->_headersRaw as $i => $header) {
if (stripos($header, 'status:') === 0) {
if ($statusSent) {
unset($this->_headersRaw[$i]);
} else {
$statusSent = true;
}
}
}
foreach ($this->_headers as $i => $header) {
if (strcasecmp($header['name'], 'status') === 0) {
if ($statusSent) {
unset($this->_headers[$i]);
} else {
$statusSent = true;
}
}
}
}
parent::sendHeaders();
}
示例2: handlePhpError
public static function handlePhpError($errorCode, $errorMessage, $errorFile)
{
AO::log($errorMessage . $errorFile);
if (in_array($errorCode, array(E_ERROR, E_USER_ERROR, E_RECOVERABLE_ERROR))) {
$this->_fault('internal');
}
return true;
}
示例3: update
/**
* Update tier prices of product
*
* @param int|string $productId
* @param array $tierPrices
* @return boolean
*/
public function update($productId, $tierPrices)
{
AO::log($tierPrices);
$product = $this->_initProduct($productId);
if (!is_array($tierPrices)) {
$this->_fault('data_invalid', AO::helper('catalog')->__('Invalid Tier Prices'));
}
$updateValue = array();
foreach ($tierPrices as $tierPrice) {
if (!is_object($tierPrice) || !isset($tierPrice->qty) || !isset($tierPrice->price)) {
$this->_fault('data_invalid', AO::helper('catalog')->__('Invalid Tier Prices'));
}
if (!isset($tierPrice->website) || $tierPrice->website == 'all') {
$tierPrice->website = 0;
} else {
try {
$tierPrice->website = AO::app()->getWebsite($tierPrice->website)->getId();
} catch (Mage_Core_Exception $e) {
$tierPrice->website = 0;
}
}
if (!isset($tierPrice->customer_group_id)) {
$tierPrice->customer_group_id = 'all';
}
if ($tierPrice->customer_group_id == 'all') {
$tierPrice->customer_group_id = Mage_Customer_Model_Group::CUST_GROUP_ALL;
}
$updateValue[] = array('website_id' => $tierPrice->website, 'cust_group' => $tierPrice->customer_group_id, 'price_qty' => $tierPrice->qty, 'price' => $tierPrice->price);
}
try {
if (is_array($errors = $product->validate())) {
$this->_fault('data_invalid', implode("\n", $errors));
}
} catch (Mage_Core_Exception $e) {
$this->_fault('data_invalid', $e->getMessage());
}
try {
$product->setData(self::ATTRIBUTE_CODE, $updateValue);
$product->validate();
$product->save();
} catch (Mage_Core_Exception $e) {
$this->_fault('not_updated', $e->getMessage());
}
return true;
}
示例4: printLogQuery
/**
* Print and/or log query
*
* @param boolean $printQuery
* @param boolean $logQuery
* @return Mage_Sales_Model_Entity_Order_Attribute_Collection_Paid
*/
public function printLogQuery($printQuery = false, $logQuery = false, $sql = null)
{
if ($printQuery) {
echo is_null($sql) ? $this->getSelect()->__toString() : $sql;
}
if ($logQuery) {
AO::log(is_null($sql) ? $this->getSelect()->__toString() : $sql);
}
return $this;
}