本文整理汇总了PHP中Shopp::object_r方法的典型用法代码示例。如果您正苦于以下问题:PHP Shopp::object_r方法的具体用法?PHP Shopp::object_r怎么用?PHP Shopp::object_r使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Shopp
的用法示例。
在下文中一共展示了Shopp::object_r方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _object_r
/**
* @deprecated Use Shopp::_object_r()
**/
function _object_r($object)
{
return Shopp::object_r($object);
}
示例2: ipn
/**
* Updates purchase records from an IPN message
*
* @author Jonathan Davis, John Dillick
* @since 1.0
* @version 1.2
*
* @return void
**/
public function ipn()
{
if (!$this->ipnvalid()) {
return;
}
$Message = $this->Message;
shopp_debug('PayPal IPN response protocol: ' . Shopp::object_r($Message));
$id = $Message->order();
$event = $Message->event();
$Purchase = new ShoppPurchase($id);
if (empty($Purchase->id)) {
$error = 'The IPN failed because the given order does not exist.';
shopp_debug($error);
status_header('404');
die($error);
}
$this->process($event, $Purchase);
status_header('200');
die('OK');
}
示例3: shopp_add_product
/**
* Comprehensive product creation through Product Developer API.
*
* This function will do everything needed for creating a product except
* attach product images and products. That is done in the Asset API. :)
* You should be able to build an importer from another system using this function.
*
* It is also possible to update an existing product (by passing the
* existing id as part of the $data array) or else you can alternatively
* use shopp_update_product() for that.
*
* @todo possibly remove the capability of passing in an id to update a product
*
* @api
* @since 1.2
*
* @param array $data (required) associative array structure containing a single product definition, see _validate_product_data for how this array is structured/validated.
* @return Product the created product object, or boolean false on a failure.
**/
function shopp_add_product($data = array())
{
if (empty($data)) {
shopp_debug(__FUNCTION__ . " failed: Empty data parameter.");
return false;
}
$problems = _validate_product_data($data);
if (!empty($problems)) {
shopp_debug("Problems detected: " . Shopp::object_r($problems));
return false;
}
$Product = new ShoppProduct();
// Set Product publish status
if (isset($data['publish'])) {
$Product->publish = _shopp_product_publish_date($data['publish']);
if ($Product->publish > 0) {
$Product->status = 'future';
}
}
// Set Product name
if (empty($data['name'])) {
shopp_debug(__FUNCTION__ . " failed: Missing product name.");
}
$Product->name = $data['name'];
// Set Product slug
if (!empty($data['slug'])) {
$Product->slug = $data['slug'];
}
if (empty($Product->slug)) {
$Product->slug = sanitize_title($Product->name);
}
$Product->slug = wp_unique_post_slug($Product->slug, $Product->id, $Product->status, ShoppProduct::posttype(), 0);
$Product->updates($data, array('meta', 'categories', 'prices', 'tags', 'publish'));
$Product->save();
ShoppProduct::publishset(array($Product->id), $data['publish']['flag'] ? 'publish' : 'draft');
if (empty($Product->id)) {
shopp_debug(__FUNCTION__ . " failed: Failure to create new Product object.");
return false;
}
// Product-wide settings
$Product->featured = isset($data['featured']) && true === $data['featured'] ? "on" : "off";
$Product->variants = isset($data['variants']) ? "on" : "off";
$Product->addons = isset($data['addons']) ? "on" : "off";
if (isset($data['packaging'])) {
$packaging_set = shopp_product_set_packaging($Product->id, $data['packaging']);
if (!$packaging_set) {
shopp_debug(__FUNCTION__ . " failed: Failure to set packaging setting.");
return false;
}
}
// Save Taxonomies
// Categories
if (isset($data['categories']) && isset($data['categories']['terms'])) {
$cats_set = shopp_product_add_categories($Product->id, $data['categories']['terms']);
if (!$cats_set) {
shopp_debug(__FUNCTION__ . " failed: Failure to add product categories to product.");
return false;
}
}
// Tags
if (isset($data['tags']) && isset($data['tags']['terms'])) {
$tags_set = shopp_product_add_tags($Product->id, $data['tags']['terms']);
if (!$tags_set) {
shopp_debug(__FUNCTION__ . " failed: Failure to add product tags to product.");
return false;
}
}
// Terms
if (isset($data['terms']) && isset($data['terms']['terms']) && isset($data['terms']['taxonomy'])) {
$terms_set = shopp_product_add_terms($Product->id, $data['terms']['terms'], $data['terms']['taxonomy']);
if (!$terms_set) {
shopp_debug(__FUNCTION__ . " failed: Failure to add product taxonomy terms to product.");
return false;
}
}
// Create Specs
if (isset($data['specs'])) {
$specs_set = shopp_product_set_specs($Product->id, $data['specs']);
if (!$specs_set) {
shopp_debug(__FUNCTION__ . " failed: Failure to add product specs to product.");
return false;
//.........这里部分代码省略.........