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


PHP WebserviceRequest::getInstance方法代码示例

本文整理汇总了PHP中WebserviceRequest::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP WebserviceRequest::getInstance方法的具体用法?PHP WebserviceRequest::getInstance怎么用?PHP WebserviceRequest::getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WebserviceRequest的用法示例。


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

示例1: updateWs

 /**
  * For a given {id_product, id_product_attribute and id_shop}, gets the stock available id associated
  *
  * @param int $id_product
  * @param int $id_product_attribute Optional
  * @param int $id_shop Optional
  * @return int
  */
 public function updateWs()
 {
     if ($this->depends_on_stock) {
         return WebserviceRequest::getInstance()->setError(500, Tools::displayError('You can\'t update stock available when it\'s depend on stock'));
     }
     return $this->update();
 }
开发者ID:rongandat,项目名称:vatfairfoot,代码行数:15,代码来源:StockAvailable.php

示例2: updateWs

 /**
  * For a given {id_product, id_product_attribute and id_shop}, gets the stock available id associated
  *
  * @param int $id_product
  * @param int $id_product_attribute Optional
  * @param int $id_shop Optional
  * @return int
  */
 public function updateWs()
 {
     if ($this->depends_on_stock) {
         return WebserviceRequest::getInstance()->setError(500, Tools::displayError('You cannot update the available stock when it depends on stock.'), 133);
     }
     return $this->update();
 }
开发者ID:Eximagen,项目名称:3m,代码行数:15,代码来源:StockAvailable.php

示例3: displayError

 /**
  * Display last SQL error
  *
  * @param bool $sql
  */
 public function displayError($sql = false)
 {
     global $webservice_call;
     $errno = $this->getNumberError();
     if ($webservice_call && $errno) {
         WebserviceRequest::getInstance()->setError(500, '[SQL Error] ' . $this->getMsgError() . '. Query was : ' . $sql, 97);
     } else {
         if (_PS_DEBUG_SQL_ && $errno && !defined('PS_INSTALLATION_IN_PROGRESS')) {
             if ($sql) {
                 throw new PrestaShopDatabaseException($this->getMsgError() . '<br /><br /><pre>' . $sql . '</pre>');
             }
             throw new PrestaShopDatabaseException($this->getMsgError());
         }
     }
 }
开发者ID:nicolasjeol,项目名称:hec-ecommerce,代码行数:20,代码来源:Db.php

示例4: displayMySQLError

 public function displayMySQLError($query = false)
 {
     global $webservice_call;
     if ($webservice_call && mysql_errno($this->_link)) {
         WebserviceRequest::getInstance()->setError(500, '[SQL Error] ' . mysql_error($this->_link) . '. Query was : ' . $query, 97);
     } elseif (_PS_DEBUG_SQL_ and mysql_errno($this->_link) and !defined('PS_INSTALLATION_IN_PROGRESS')) {
         if ($query) {
             die(Tools::displayError(mysql_error($this->_link) . '<br /><br /><pre>' . $query . '</pre>'));
         }
         die(Tools::displayError(mysql_error($this->_link)));
     }
 }
开发者ID:7s4r,项目名称:eBidix,代码行数:12,代码来源:MySQL.php

示例5: displayError

 /**
  * Display last SQL error
  *
  * @param bool $sql
  */
 public function displayError($sql = false)
 {
     global $webservice_call;
     $errno = $this->getNumberError();
     if ($webservice_call && $errno) {
         $dbg = debug_backtrace();
         WebserviceRequest::getInstance()->setError(500, '[SQL Error] ' . $this->getMsgError() . '. From ' . (isset($dbg[3]['class']) ? $dbg[3]['class'] : '') . '->' . $dbg[3]['function'] . '() Query was : ' . $sql, 97);
     } else {
         if (_PS_DEBUG_SQL_ && $errno && !defined('PS_INSTALLATION_IN_PROGRESS')) {
             if ($sql) {
                 throw new PrestaShopDatabaseException($this->getMsgError() . '<br /><br /><pre>' . $sql . '</pre>');
             }
             throw new PrestaShopDatabaseException($this->getMsgError());
         }
     }
 }
开发者ID:carloslastresDev,项目名称:HealthyTaiwan_UsingPrestaShop,代码行数:21,代码来源:Db.php

示例6: webserviceErrorHandler

 /**
  * Used to replace the default PHP error handler, in order to display PHP errors in a XML format
  *
  * @param string $errno contains the level of the error raised, as an integer
  * @param array $errstr contains the error message, as a string
  * @param array $errfile errfile, which contains the filename that the error was raised in, as a string
  * @param array $errline errline, which contains the line number the error was raised at, as an integer
  * @return boolean Always return true to avoid the default PHP error handler
  */
 public function webserviceErrorHandler($errno, $errstr, $errfile, $errline)
 {
     $display_errors = strtolower(ini_get('display_errors')) != 'off';
     if (!(error_reporting() & $errno) || $display_errors) {
         return;
     }
     $errortype = array(E_ERROR => 'Error', E_WARNING => 'Warning', E_PARSE => 'Parse', E_NOTICE => 'Notice', E_CORE_ERROR => 'Core Error', E_CORE_WARNING => 'Core Warning', E_COMPILE_ERROR => 'Compile Error', E_COMPILE_WARNING => 'Compile Warning', E_USER_ERROR => 'Error', E_USER_WARNING => 'User warning', E_USER_NOTICE => 'User notice', E_STRICT => 'Runtime Notice', E_RECOVERABLE_ERROR => 'Recoverable error');
     $type = isset($errortype[$errno]) ? $errortype[$errno] : 'Unknown error';
     error_log('[PHP ' . $type . ' #' . $errno . '] ' . $errstr . ' (' . $errfile . ', line ' . $errline . ')');
     switch ($errno) {
         case E_ERROR:
             WebserviceRequest::getInstance()->setError(500, '[PHP Error #' . $errno . '] ' . $errstr . ' (' . $errfile . ', line ' . $errline . ')', 2);
             break;
         case E_WARNING:
             WebserviceRequest::getInstance()->setError(500, '[PHP Warning #' . $errno . '] ' . $errstr . ' (' . $errfile . ', line ' . $errline . ')', 3);
             break;
         case E_PARSE:
             WebserviceRequest::getInstance()->setError(500, '[PHP Parse #' . $errno . '] ' . $errstr . ' (' . $errfile . ', line ' . $errline . ')', 4);
             break;
         case E_NOTICE:
             WebserviceRequest::getInstance()->setError(500, '[PHP Notice #' . $errno . '] ' . $errstr . ' (' . $errfile . ', line ' . $errline . ')', 5);
             break;
         case E_CORE_ERROR:
             WebserviceRequest::getInstance()->setError(500, '[PHP Core #' . $errno . '] ' . $errstr . ' (' . $errfile . ', line ' . $errline . ')', 6);
             break;
         case E_CORE_WARNING:
             WebserviceRequest::getInstance()->setError(500, '[PHP Core warning #' . $errno . '] ' . $errstr . ' (' . $errfile . ', line ' . $errline . ')', 7);
             break;
         case E_COMPILE_ERROR:
             WebserviceRequest::getInstance()->setError(500, '[PHP Compile #' . $errno . '] ' . $errstr . ' (' . $errfile . ', line ' . $errline . ')', 8);
             break;
         case E_COMPILE_WARNING:
             WebserviceRequest::getInstance()->setError(500, '[PHP Compile warning #' . $errno . '] ' . $errstr . ' (' . $errfile . ', line ' . $errline . ')', 9);
             break;
         case E_USER_ERROR:
             WebserviceRequest::getInstance()->setError(500, '[PHP Error #' . $errno . '] ' . $errstr . ' (' . $errfile . ', line ' . $errline . ')', 10);
             break;
         case E_USER_WARNING:
             WebserviceRequest::getInstance()->setError(500, '[PHP User warning #' . $errno . '] ' . $errstr . ' (' . $errfile . ', line ' . $errline . ')', 11);
             break;
         case E_USER_NOTICE:
             WebserviceRequest::getInstance()->setError(500, '[PHP User notice #' . $errno . '] ' . $errstr . ' (' . $errfile . ', line ' . $errline . ')', 12);
             break;
         case E_STRICT:
             WebserviceRequest::getInstance()->setError(500, '[PHP Strict #' . $errno . '] ' . $errstr . ' (' . $errfile . ', line ' . $errline . ')', 13);
             break;
         case E_RECOVERABLE_ERROR:
             WebserviceRequest::getInstance()->setError(500, '[PHP Recoverable error #' . $errno . '] ' . $errstr . ' (' . $errfile . ', line ' . $errline . ')', 14);
             break;
         default:
             WebserviceRequest::getInstance()->setError(500, '[PHP Unknown error #' . $errno . '] ' . $errstr . ' (' . $errfile . ', line ' . $errline . ')', 15);
     }
     return true;
 }
开发者ID:dev-lav,项目名称:htdocs,代码行数:63,代码来源:WebserviceRequest.php

示例7: setWsPositionInCategory

    /**
     * Webservice setter : set virtual field position in category
     *
     * @return bool
     */
    public function setWsPositionInCategory($position)
    {
        if ($position < 0) {
            WebserviceRequest::getInstance()->setError(500, Tools::displayError('You cannot set a negative position, the minimum for a position is 0.'), 134);
        }
        $result = Db::getInstance()->executeS('
			SELECT `id_product`
			FROM `' . _DB_PREFIX_ . 'category_product`
			WHERE `id_category` = ' . (int) $this->id_category_default . '
			ORDER BY `position`
		');
        if ($position > 0 && $position + 1 > count($result)) {
            WebserviceRequest::getInstance()->setError(500, Tools::displayError('You cannot set a position greater than the total number of products in the category, minus 1 (position numbering starts at 0).'), 135);
        }
        foreach ($result as &$value) {
            $value = $value['id_product'];
        }
        $current_position = $this->getWsPositionInCategory();
        if ($current_position && isset($result[$current_position])) {
            $save = $result[$current_position];
            unset($result[$current_position]);
            array_splice($result, (int) $position, 0, $save);
        }
        foreach ($result as $position => $id_product) {
            Db::getInstance()->update('category_product', array('position' => $position), '`id_category` = ' . (int) $this->id_category_default . ' AND `id_product` = ' . (int) $id_product);
        }
        return true;
    }
开发者ID:yewed,项目名称:share,代码行数:33,代码来源:Product.php

示例8: webserviceErrorHandler

 /**
  * Used to replace the default PHP error handler, in order to display PHP errors in a XML format 
  *
  * @param string $errno contains the level of the error raised, as an integer
  * @param array $errstr contains the error message, as a string
  * @param array $errfile errfile, which contains the filename that the error was raised in, as a string
  * @param array $errline errline, which contains the line number the error was raised at, as an integer
  * @return boolean Always return true to avoid the default PHP error handler
  */
 public function webserviceErrorHandler($errno, $errstr, $errfile, $errline)
 {
     if (!(error_reporting() & $errno)) {
         return;
     }
     switch ($errno) {
         case E_ERROR:
             WebserviceRequest::getInstance()->setError(500, '[PHP Error #' . $errno . '] ' . $errstr . ' (' . $errfile . ', line ' . $errline . ')');
             break;
         case E_WARNING:
             WebserviceRequest::getInstance()->setError(500, '[PHP Warning #' . $errno . '] ' . $errstr . ' (' . $errfile . ', line ' . $errline . ')');
             break;
         case E_PARSE:
             WebserviceRequest::getInstance()->setError(500, '[PHP Parse #' . $errno . '] ' . $errstr . ' (' . $errfile . ', line ' . $errline . ')');
             break;
         case E_NOTICE:
             WebserviceRequest::getInstance()->setError(500, '[PHP Notice #' . $errno . '] ' . $errstr . ' (' . $errfile . ', line ' . $errline . ')');
             break;
         case E_CORE_ERROR:
             WebserviceRequest::getInstance()->setError(500, '[PHP Core #' . $errno . '] ' . $errstr . ' (' . $errfile . ', line ' . $errline . ')');
             break;
         case E_CORE_WARNING:
             WebserviceRequest::getInstance()->setError(500, '[PHP Core warning #' . $errno . '] ' . $errstr . ' (' . $errfile . ', line ' . $errline . ')');
             break;
         case E_COMPILE_ERROR:
             WebserviceRequest::getInstance()->setError(500, '[PHP Compile #' . $errno . '] ' . $errstr . ' (' . $errfile . ', line ' . $errline . ')');
             break;
         case E_COMPILE_WARNING:
             WebserviceRequest::getInstance()->setError(500, '[PHP Compile warning #' . $errno . '] ' . $errstr . ' (' . $errfile . ', line ' . $errline . ')');
             break;
         case E_USER_ERROR:
             WebserviceRequest::getInstance()->setError(500, '[PHP Error #' . $errno . '] ' . $errstr . ' (' . $errfile . ', line ' . $errline . ')');
             break;
         case E_USER_WARNING:
             WebserviceRequest::getInstance()->setError(500, '[PHP User warning #' . $errno . '] ' . $errstr . ' (' . $errfile . ', line ' . $errline . ')');
             break;
         case E_USER_NOTICE:
             WebserviceRequest::getInstance()->setError(500, '[PHP User notice #' . $errno . '] ' . $errstr . ' (' . $errfile . ', line ' . $errline . ')');
             break;
         case E_STRICT:
             WebserviceRequest::getInstance()->setError(500, '[PHP Strict #' . $errno . '] ' . $errstr . ' (' . $errfile . ', line ' . $errline . ')');
             break;
         case E_RECOVERABLE_ERROR:
             WebserviceRequest::getInstance()->setError(500, '[PHP Recoverable error #' . $errno . '] ' . $errstr . ' (' . $errfile . ', line ' . $errline . ')');
             break;
         default:
             WebserviceRequest::getInstance()->setError(500, '[PHP Unknown error #' . $errno . '] ' . $errstr . ' (' . $errfile . ', line ' . $errline . ')');
     }
     return true;
 }
开发者ID:hecbuma,项目名称:quali-fisioterapia,代码行数:59,代码来源:WebserviceRequest.php

示例9: setWsCustomizedDataTextFields

    /**
     * Set customized text fields
     * (for webservice)
     *
     * @param array $values
     *
     * @return bool
     */
    public function setWsCustomizedDataTextFields($values)
    {
        $cart = new Cart($this->id_cart);
        if (!Validate::isLoadedObject($cart)) {
            WebserviceRequest::getInstance()->setError(500, Tools::displayError('Could not load cart id=' . $this->id_cart), 137);
            return false;
        }
        Db::getInstance()->execute('
		DELETE FROM `' . _DB_PREFIX_ . 'customized_data`
		WHERE id_customization = ' . (int) $this->id . '
		AND type = 1');
        foreach ($values as $value) {
            $query = 'INSERT INTO `' . _DB_PREFIX_ . 'customized_data` (`id_customization`, `type`, `index`, `value`)
				VALUES (' . (int) $this->id . ', 1, ' . (int) $value['id_customization_field'] . ', \'' . pSQL($value['value']) . '\')';
            if (!Db::getInstance()->execute($query)) {
                return false;
            }
        }
        return true;
    }
开发者ID:M03G,项目名称:PrestaShop,代码行数:28,代码来源:Customization.php

示例10: call_user_func

    $class_name = 'WebserviceRequest';
    $bad_class_name = true;
}
// fetch the request
$request = call_user_func(array($class_name, 'getInstance'));
$result = $request->fetch($key, $method, $_GET['url'], $params, $bad_class_name, $input_xml);
// display result
if (ob_get_length() == 0) {
    header($result['content_type']);
} else {
    header('Content-Type: application/javascript');
}
// Useful for debug...
header($result['status']);
header($result['x_powered_by']);
header($result['execution_time']);
if (isset($result['ps_ws_version'])) {
    header($result['ps_ws_version']);
}
if ($result['type'] == 'xml') {
    header($result['content_sha1']);
    echo $result['content'];
} elseif ($result['type'] == 'image') {
    if ($result['content_type'] == 'Content-Type: image/jpeg') {
        imagejpeg(WebserviceRequest::getInstance()->_imageResource);
    } elseif ($result['content_type'] == 'Content-Type: image/gif') {
        imagegif(WebserviceRequest::getInstance()->_imageResource);
    }
    imagedestroy(WebserviceRequest::getInstance()->_imageResource);
}
ob_end_flush();
开发者ID:hecbuma,项目名称:quali-fisioterapia,代码行数:31,代码来源:dispatcher.php


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