• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP shopp_debug函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中shopp_debug函数的典型用法代码示例。如果您正苦于以下问题:PHP shopp_debug函数的具体用法?PHP shopp_debug怎么用?PHP shopp_debug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: login

 public static function login($result)
 {
     $Customer = ShoppOrder()->Customer;
     if ($Customer->loggedin()) {
         return $result;
     }
     $accounts = shopp_setting('account_system');
     $pleaselogin = ' ' . Shopp::__('If you have an account with us, please login now.');
     // This specific !isset condition checks if the loginname is not provided
     // If no loginname is provided, but an account system is used, we need to
     // generate a new login name for the customer
     if ('wordpress' == $accounts && !isset($_POST['loginname'])) {
         ShoppLoginGenerator::object();
         $_POST['loginname'] = ShoppLoginGenerator::name();
         if (apply_filters('shopp_login_required', empty($_POST['loginname']))) {
             return shopp_add_error(Shopp::__('A login could not be created with the information you provided. Enter a different name or email address.') . $pleaselogin);
         }
         shopp_debug('Login set to ' . $_POST['loginname'] . ' for WordPress account creation.');
     }
     // Validate unique email address for new account
     if (in_array($accounts, array('wordpress', 'shopp')) && !$Customer->session(ShoppCustomer::GUEST)) {
         $ShoppCustomer = new ShoppCustomer($_POST['email'], 'email');
         if (apply_filters('shopp_email_exists', 'wordpress' == $accounts ? email_exists($_POST['email']) : $ShoppCustomer->exists())) {
             return shopp_add_error(Shopp::__('The email address you entered is already in use. Enter a different email address to create a new account.') . $pleaselogin);
         }
     }
     // Validate WP login
     if (isset($_POST['loginname'])) {
         if (apply_filters('shopp_login_required', empty($_POST['loginname']))) {
             return shopp_add_error(Shopp::__('You must enter a login name for your account.'));
         }
         if (apply_filters('shopp_login_valid', !validate_username($_POST['loginname']))) {
             $sanitized = sanitize_user($_POST['loginname'], true);
             $illegal = array_diff(str_split($_POST['loginname']), str_split($sanitized));
             return shopp_add_error(Shopp::__('The login name provided includes invalid characters: %s', esc_html(join(' ', $illegal))));
         }
         if (apply_filters('shopp_login_exists', username_exists($_POST['loginname']))) {
             return shopp_add_error(Shopp::__('"%s" is already in use. Enter a different login name to create a new account.', esc_html($_POST['loginname'])) . $pleaselogin);
         }
     }
     return $result;
 }
开发者ID:forthrobot,项目名称:inuvik,代码行数:42,代码来源:Validation.php


示例2: shopp_admin_add_submenu

/**
 * Add a sub-menu to a Shopp menu
 *
 * @api
 * @since 1.3
 *
 * @param string $label	The translated label to use for the menu
 * @param string $page The Shopp-internal menu page name (plugin prefix will be automatically added)
 * @param string $menu The Shopp-internal menu page name to append the submenu to
 * @param mixed $handler The callback handler to use to handle the page
 * @param string $access The access capability required to see the menu
 * @return integer The position the menu was added
 **/
function shopp_admin_add_submenu($label, $page, $menu = null, $handler = false, $access = null)
{
    $Admin = ShoppAdmin();
    if (is_null($menu)) {
        $Admin->mainmenu();
    }
    if (is_null($access)) {
        $access = 'none';
    }
    // Restrict access by default
    if (false === $handler) {
        $handler = array(Shopp::object()->Flow, 'admin');
    }
    if (!is_callable($handler)) {
        shopp_debug(__FUNCTION__ . " failed: The specified callback handler is not valid.");
        return false;
    }
    $menupage = add_submenu_page($menu, $label, $label, $access, $page, $handler);
    $Admin->menu($page, $menupage);
    $Admin->addtab($page, $menu);
    do_action("shopp_add_menu_{$page}");
    return $menupage;
}
开发者ID:BlessySoftwares,项目名称:anvelocom,代码行数:36,代码来源:admin.php


示例3: shopp_cart_item_addons_count

/**
 * Returns the number of addons added to the cartitem.
 *
 * @api
 * 
 * @param $itemkey
 * @return bool|int
 */
function shopp_cart_item_addons_count($itemkey)
{
    if (false === $itemkey) {
        shopp_debug(__FUNCTION__ . " failed: itemkey parameter required.");
        return false;
    }
    if (!($item = shopp_cart_item($itemkey))) {
        shopp_debug(__FUNCTION__ . " failed: no such item {$itemkey}");
        return false;
    }
    if (false === ($addons = shopp_cart_item_addons($itemkey))) {
        return false;
        // Debug message will already have been generated in shopp_cart_item_addons()
    }
    return (int) count($addons);
}
开发者ID:forthrobot,项目名称:inuvik,代码行数:24,代码来源:cart.php


示例4: preload

 /**
  * Loads session data from another session into this one
  *
  * Used to access third-party session data. This only happens when
  * a payment system uses server-to-server communication that needs
  * session-specific information about the customer or transaction.
  *
  * @since 1.3.6
  *
  * @param string $session The session ID to load
  * @return bool True if successful, false otherwise
  */
 public function preload($session)
 {
     if (!$this->exists($session)) {
         trigger_error('Could not reload the specified session.');
         return false;
     }
     $this->destroy();
     $this->open();
     $this->load($session);
     $this->cook();
     shopp_debug('Session started ' . str_repeat('-', 64));
     return true;
 }
开发者ID:forthrobot,项目名称:inuvik,代码行数:25,代码来源:Shopping.php


示例5: shopp_rmv_product_download

/**
 * shopp_rmv_product_download
 *
 * Remove a product download asset
 *
 * @api
 * @since 1.2
 *
 * @param int $download the product asset id
 * @return bool true on success, false on failure
 **/
function shopp_rmv_product_download($download)
{
    if (empty($download)) {
        shopp_debug(__FUNCTION__ . ' failed: download parameter required.');
        return false;
    }
    $File = new ProductDownload($download);
    if (empty($File->id)) {
        shopp_debug(__FUNCTION__ . " failed: No such product download with id {$download}.");
        return false;
    }
    return $File->delete();
}
开发者ID:forthrobot,项目名称:inuvik,代码行数:24,代码来源:asset.php


示例6: is_shopp_page

/**
 * Determines if the requested page is a Shopp page or if it matches a given Shopp page
 *
 * Also checks to see if the current loaded query is a Shopp product or product taxonomy.
 *
 * @api
 * @since 1.0
 *
 * @param string $page (optional) System page name ID for the correct ShoppStorefront page {@see ShoppPages class}
 * @param WP_Query $wp_query (optional) will use the global wp_query by default if false, or the provided WP_Query object
 * @return boolean
 **/
function is_shopp_page($page = false, $wp_query = false)
{
    if (false === $wp_query) {
        global $wp_the_query;
        $wp_query = $wp_the_query;
    }
    if (empty($wp_query->query_vars)) {
        shopp_debug('Conditional is_shopp_page functions do not work before the WordPress query is run. Before then, they always return false.');
    }
    $is_shopp_page = false;
    $Page = ShoppPages()->requested();
    if (false === $page) {
        // Check if the current request is a shopp page request
        // Product and collection pages are considered a Shopp page request
        if (is_shopp_product($wp_query) || $wp_query->get('post_type') == ShoppProduct::$posttype) {
            $is_shopp_page = true;
        }
        if (is_shopp_collection($wp_query)) {
            $is_shopp_page = true;
        }
        if (false !== $Page) {
            $is_shopp_page = true;
        }
    } elseif (false !== $Page) {
        // Check if the given shopp page name is the current request
        if ($Page->name() == $page) {
            $is_shopp_page = true;
        }
    }
    return $is_shopp_page;
}
开发者ID:BlessySoftwares,项目名称:anvelocom,代码行数:43,代码来源:core.php


示例7: content

 public function content($content)
 {
     global $wp_query;
     // Test that this is the main query and it is a catalog page
     if (!$wp_query->is_main_query() || !is_catalog_frontpage()) {
         return $content;
     }
     shopp_debug('Displaying catalog page request: ' . $_SERVER['REQUEST_URI']);
     ob_start();
     locate_shopp_template(array('catalog.php'), true);
     $content = ob_get_clean();
     return apply_filters('shopp_catalog_template', $content);
 }
开发者ID:jonathandavis,项目名称:shopp,代码行数:13,代码来源:Pages.php


示例8: load

 public function load(array $options = array())
 {
     $thisclass = get_class($this);
     $slug = isset($this->slug) ? $this->slug : sanitize_key($thisclass);
     $Storefront = ShoppStorefront();
     $Shopping = ShoppShopping();
     $Processing = new ShoppProduct();
     $summary_table = ShoppDatabaseObject::tablename(ProductSummary::$table);
     $defaults = array('columns' => false, 'useindex' => false, 'joins' => array(), 'where' => array(), 'groupby' => false, 'orderby' => false, 'having' => array(), 'limit' => false, 'order' => false, 'page' => false, 'paged' => false, 'nostock' => null, 'pagination' => true, 'published' => true, 'ids' => false, 'adjacent' => false, 'product' => false, 'load' => array('coverimages'), 'inventory' => false, 'taxquery' => false, 'debug' => false);
     $loading = array_merge($defaults, $options);
     $loading = apply_filters("shopp_collection_load_options", $loading);
     $loading = apply_filters("shopp_{$slug}_collection_load_options", $loading);
     extract($loading);
     // Setup pagination
     $this->paged = false;
     $this->pagination = false === $paged ? shopp_setting('catalog_pagination') : $paged;
     $page = false === $page ? get_query_var('paged') : $page;
     $this->page = (int) $page > 0 || preg_match('/(0\\-9|[A-Z])/', $page) ? $page : 1;
     // Hard product limit per category to keep resources "reasonable"
     $hardlimit = apply_filters('shopp_category_products_hardlimit', 1000);
     // Enforce the where parameter as an array
     if (!is_array($where)) {
         return shopp_debug('The "where" parameter for ' . __METHOD__ . ' must be formatted as an array.');
     }
     // Inventory filtering
     if (shopp_setting_enabled('inventory') && (is_null($nostock) && !shopp_setting_enabled('outofstock_catalog') || !is_null($nostock) && !Shopp::str_true($nostock))) {
         $where[] = "( s.inventory='off' OR (s.inventory='on' AND s.stock > 0) )";
     }
     if (Shopp::str_true($published)) {
         $where[] = "p.post_status='publish'";
     }
     // Multiple taxonomy queries
     if (is_array($taxquery)) {
         $tqdefaults = array('relation' => 'AND', 'include_children' => true);
         $taxquery = array_merge($tqdefaults, $taxquery);
         $TQ = new WP_Tax_Query($taxquery);
         $sql = $TQ->get_sql($Processing->_table, 'ID');
         unset($TQ);
         $joins['taxquery'] = self::taxquery($sql['join']);
         $where[] = self::taxquery($sql['where']);
     }
     // Sort Order
     if (!$orderby) {
         $titlesort = "p.post_title ASC";
         $defaultsort = empty($order) ? $titlesort : $order;
         // Define filterable built-in sort methods (you're welcome)
         $sortmethods = apply_filters('shopp_collection_sort_methods', array('bestselling' => "s.sold DESC,{$titlesort}", 'highprice' => "maxprice DESC,{$titlesort}", 'lowprice' => "minprice ASC,{$titlesort}", 'newest' => "p.post_date DESC,{$titlesort}", 'oldest' => "p.post_date ASC,{$titlesort}", 'random' => "RAND(" . crc32($Shopping->session) . ")", 'chaos' => "RAND(" . time() . ")", 'reverse' => "p.post_title DESC", 'title' => $titlesort, 'custom' => is_subclass_of($this, 'ProductTaxonomy') ? "tr.term_order ASC,{$titlesort}" : $defaultsort, 'recommended' => is_subclass_of($this, 'ProductTaxonomy') ? "tr.term_order ASC,{$titlesort}" : $defaultsort, 'default' => $defaultsort));
         // Handle valid user browsing sort change requests
         if (isset($_REQUEST['sort']) && !empty($_REQUEST['sort']) && array_key_exists(strtolower($_REQUEST['sort']), $sortmethods)) {
             $Storefront->browsing['sortorder'] = strtolower($_REQUEST['sort']);
         }
         // Collect sort setting sources (Shopp admin setting, User browsing setting, programmer specified setting)
         $sortsettings = array(shopp_setting('default_product_order'), isset($Storefront->browsing['sortorder']) ? $Storefront->browsing['sortorder'] : false, !empty($order) ? $order : false);
         // Go through setting sources to determine most applicable setting
         $sorting = 'title';
         foreach ($sortsettings as $setting) {
             if (!empty($setting) && isset($sortmethods[strtolower($setting)])) {
                 $sorting = strtolower($setting);
             }
         }
         $orderby = $sortmethods[$sorting];
     }
     if (empty($orderby)) {
         $orderby = 'p.post_title ASC';
     }
     // Pagination
     if (empty($limit)) {
         if ($this->pagination > 0 && is_numeric($this->page) && Shopp::str_true($pagination)) {
             if (!$this->pagination || $this->pagination < 0) {
                 $this->pagination = $hardlimit;
             }
             $start = $this->pagination * ($this->page - 1);
             $limit = "{$start},{$this->pagination}";
         } else {
             $limit = $hardlimit;
         }
         $limited = false;
         // Flag that the result set does not have forced limits
     } else {
         $limited = true;
     }
     // The result set has forced limits
     // Core query components
     // Load core product data and product summary columns
     $cols = array('p.ID', 'p.post_title', 'p.post_name', 'p.post_excerpt', 'p.post_status', 'p.post_date', 'p.post_modified', 's.modified AS summed', 's.sold', 's.grossed', 's.maxprice', 's.minprice', 's.ranges', 's.taxed', 's.stock', 's.lowstock', 's.inventory', 's.featured', 's.variants', 's.addons', 's.sale');
     if ($ids) {
         $cols = array('p.ID');
     }
     $columns = "SQL_CALC_FOUND_ROWS " . join(',', $cols) . ($columns !== false ? ',' . $columns : '');
     $table = "{$Processing->_table} AS p";
     $where[] = "p.post_type='" . ShoppProduct::posttype() . "'";
     $joins[$summary_table] = "LEFT OUTER JOIN {$summary_table} AS s ON s.product=p.ID";
     $options = compact('columns', 'useindex', 'table', 'joins', 'where', 'groupby', 'having', 'limit', 'orderby');
     // Alphabetic pagination
     if ('alpha' === $pagination || preg_match('/(0\\-9|[A-Z])/', $page)) {
         // Setup Roman alphabet navigation
         $alphanav = array_merge(array('0-9'), range('A', 'Z'));
         $this->alpha = array_combine($alphanav, array_fill(0, count($alphanav), 0));
         // Setup alphabetized index query
         $a = $options;
//.........这里部分代码省略.........
开发者ID:forthrobot,项目名称:inuvik,代码行数:101,代码来源:Collection.php


示例9: valid

 public function valid()
 {
     if (!$this->order()) {
         // boolean false and 0 are both invalid
         shopp_debug('PayPal messsage invalid. Missing or invalid "invoice" field.');
         return false;
     }
     if (false === $this->txnid() && false === $this->txnorigin()) {
         shopp_debug('PayPal messsage invalid. Missing txn_id or parent_txn_id.');
         return false;
     }
     return true;
 }
开发者ID:forthrobot,项目名称:inuvik,代码行数:13,代码来源:PayPalStandard.php


示例10: check_admin_referer

        ?>
			<?php 
        check_admin_referer('shopp_upgrade_notice');
        $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
        $homeurl = wp_specialchars_decode(get_option('home'), ENT_QUOTES);
        $admin = get_bloginfo('admin_email');
        $site = parse_url($homeurl);
        $_ = array();
        $_[] = 'From: "' . $blogname . '" <' . shopp_setting('merchant_email') . '>';
        $_[] = 'To: ' . $admin;
        $_[] = sprintf('Subject: Shopp Upgraded on %s', $site['host']);
        $_[] = '';
        $_[] = sprintf(__('The Shopp installation on %1$s has been upgraded to %2$s and requires a database upgrade. Please login to %1$s and perform the upgrade by deactivating and reactivating the Shopp plugin.', 'Shopp'), $homeurl, ShoppVersion::release());
        $message = apply_filters('shopp_upgrade_notice_message', join("\n", $_));
        if (Shopp::email($message)) {
            shopp_debug('A Shopp upgrade notification was sent.');
        }
        Shopp::_em('### Upgrade Notice Sent

An upgrade notice has been sent to the site administrator.');
        ?>
		<?php 
    } else {
        ?>

			<div class="error"><?php 
        Shopp::_em('### Contact Your Site Administrator

You will need to notify a site administrator to perform the upgrade.');
        ?>
			</div>
开发者ID:forthrobot,项目名称:inuvik,代码行数:31,代码来源:update.php


示例11: shopp_rmv_customer_address

/**
 * Remove an address
 *
 * @api
 * @since 1.2
 *
 * @param int $address the address id to remove
 * @return bool true on success, false on failure
 **/
function shopp_rmv_customer_address($address = false)
{
    if (!$address) {
        shopp_debug(__FUNCTION__ . " failed: Missing address id parameter.");
        return false;
    }
    $Address = new ShoppAddress($address);
    if (empty($Address->id)) {
        shopp_debug(__FUNCTION__ . " failed: No such address with id {$address}.");
        return false;
    }
    return $Address->delete();
}
开发者ID:forthrobot,项目名称:inuvik,代码行数:22,代码来源:customer.php


示例12: calculate

 /**
  * @deprecated Do not use
  **/
 public function calculate()
 {
     shopp_debug(__CLASS__ . ' is a deprecated class. Use the Theme API instead.');
     return false;
 }
开发者ID:forthrobot,项目名称:inuvik,代码行数:8,代码来源:Deprecated.php


示例13: encrypt

 /**
  * Encrypts the session data.
  *
  * The session data is passed by reference and will be encrypted
  * if the stars are aligned (the secured flag is set over an SSL
  * connection with a valid encryption key).
  *
  * The security key is kept on the client-side as a secure cookie
  * so that the server only ever touches it for a short time.
  *
  * @param array $data The session data to encrypt
  * @return void
  **/
 private function encrypt(&$data)
 {
     if (!$this->secured()) {
         return;
     }
     if (!is_ssl()) {
         return;
     }
     if (!($key = $this->securekey())) {
         return;
     }
     shopp_debug('Cart saving in secure mode!');
     $secure = self::ENCRYPTION . sDB::query("SELECT AES_ENCRYPT('{$data}','{$key}') AS data", 'auto', 'col', 'data');
     $db = sDB::object();
     $data = $db->api->escape($secure);
 }
开发者ID:BlessySoftwares,项目名称:anvelocom,代码行数:29,代码来源:Session.php


示例14: __construct

 /**
  * Builds a shipping option from a configured/calculated
  * shipping rate array
  *
  * Example:
  * new ShippingOption(array(
  * 		'name' => 'Name of Shipping Rate Method',
  * 		'slug' => 'rate-method-slug',
  * 		'amount' => 0.99,
  * 		'delivery' => '1d-2d',
  * 		'items' => array(
  * 			0 => 0.99,
  * 			1 => 0.50
  * 		)
  * ));
  *
  * @author Jonathan Davis
  * @since 1.1
  *
  * @param array $rate The calculated shipping rate
  * @param boolean $estimate Flag to be included/excluded from estimates
  * @return void
  **/
 public function __construct(array $rate, $estimate = true)
 {
     if (!isset($rate['slug'])) {
         // Fire off an error if the slug is not provided
         return !shopp_debug('A slug (string) value is required in the $rate array parameter when constructing a new ShoppShiprateService');
     }
     $this->name = $rate['name'];
     $this->slug = $rate['slug'];
     $this->amount = $rate['amount'];
     $this->estimate = $estimate;
     if (!empty($rate['delivery'])) {
         $this->delivery = $rate['delivery'];
     }
     if (!empty($rate['items'])) {
         $this->items = $rate['items'];
     }
 }
开发者ID:forthrobot,项目名称:inuvik,代码行数:40,代码来源:Shiprates.php


示例15: create_wpuser

 /**
  * Create a new WordPress user associated with this customer
  *
  * @author Jonathan Davis
  * @since 1.3
  *
  * @return boolean True if successful, false otherwise
  **/
 public function create_wpuser()
 {
     if (empty($this->loginname)) {
         return false;
     }
     if (!validate_username($this->loginname)) {
         shopp_add_error(Shopp::__('This login name is invalid because it uses illegal characters. Valid login names include: letters, numbers, spaces, . - @ _'));
         return false;
     }
     if (username_exists($this->loginname)) {
         shopp_add_error(Shopp::__('The login name is already registered. Please choose another login name.'));
         return false;
     }
     if (empty($this->password)) {
         $this->password = wp_generate_password(12, true);
     }
     // Create the WordPress account
     $wpuser = wp_insert_user(array('user_login' => $this->loginname, 'user_pass' => $this->password, 'user_email' => $this->email, 'display_name' => $this->firstname . ' ' . $this->lastname, 'nickname' => $this->firstname, 'first_name' => $this->firstname, 'last_name' => $this->lastname));
     if (!$wpuser) {
         return false;
     }
     // Link the WP user ID to this customer record
     $this->wpuser = $wpuser;
     if (isset($this->passhash)) {
         global $wpdb;
         $wpdb->update($wpdb->users, array('user_pass' => $this->passhash), array('ID' => $wpuser));
     }
     if (apply_filters('shopp_notify_new_wpuser', true)) {
         // Send email notification of the new account
         $password = isset($this->passhash) ? '*******' : $this->password;
         // Only include generated passwords
         wp_new_user_notification($wpuser, $password);
     }
     shopp_debug(sprintf('Successfully created the WordPress user "%s" for the Shopp account.', $this->loginname));
     // Set the WP user created flag
     $this->session(self::WPUSER, true);
     return true;
 }
开发者ID:BlessySoftwares,项目名称:anvelocom,代码行数:46,代码来源:Customer.php


示例16: isvalid

 /**
  * Validate order data before transaction processing
  *
  * @author Jonathan Davis
  * @since 1.1
  *
  * @return boolean Validity of the order
  **/
 public function isvalid($report = true)
 {
     $Customer = $this->Customer;
     $Shipping = $this->Shipping;
     $Shiprates = $this->Shiprates;
     $Payments = $this->Payments;
     $Cart = $this->Cart;
     $valid = true;
     $errlevel = $report ? SHOPP_TRXN_ERR : SHOPP_DEBUG_ERR;
     shopp_debug('Validating order data for processing');
     if (0 == $Cart->count()) {
         $valid = apply_filters('shopp_ordering_empty_cart', false);
         shopp_add_error(__('There are no items in the cart.', 'Shopp'), $errlevel);
     }
     $stock = true;
     foreach ($Cart as $item) {
         if (!$item->instock()) {
             $valid = apply_filters('shopp_ordering_items_outofstock', false);
             shopp_add_error(sprintf(__('%s does not have sufficient stock to process order.', 'Shopp'), $item->name . (empty($item->option->label) ? '' : '(' . $item->option->label . ')')), $errlevel);
             $stock = false;
         }
     }
     $valid_customer = true;
     if (!$Customer) {
         $valid_customer = apply_filters('shopp_ordering_empty_customer', false);
     }
     // No Customer
     // Always require name and email
     if (empty($Customer->firstname)) {
         $valid_customer = apply_filters('shopp_ordering_empty_firstname', false);
     }
     if (empty($Customer->lastname)) {
         $valid_customer = apply_filters('shopp_ordering_empty_lastname', false);
     }
     if (empty($Customer->email)) {
         $valid_customer = apply_filters('shopp_ordering_empty_email', false);
     }
     if (!$valid_customer) {
         $valid = false;
         shopp_add_error(__('There is not enough customer information to process the order.', 'Shopp'), $errlevel);
     }
     // Check for shipped items but no Shipping information
     $valid_shipping = true;
     if ($Cart->shipped() && shopp_setting_enabled('shipping')) {
         if (empty($Shipping->address)) {
             $valid_shipping = apply_filters('shopp_ordering_empty_shipping_address', false);
         }
         if (empty($Shipping->country)) {
             $valid_shipping = apply_filters('shopp_ordering_empty_shipping_country', false);
         }
         if (empty($Shipping->postcode)) {
             $valid_shipping = apply_filters('shopp_ordering_empty_shipping_postcode', false);
         }
         if ($Shiprates->count() == 0 && !$Shiprates->free()) {
             $valid = apply_filters('shopp_ordering_no_shipping_costs', false);
             $message = __('The order cannot be processed. No shipping is available to the address you provided. Please return to %scheckout%s and try again.', 'Shopp');
             if ($Shiprates->realtime()) {
                 $message = __('The order cannot be processed. The shipping rate service did not provide rates because of a problem and no other shipping is available to the address you provided. Please return to %scheckout%s and try again or contact the store administrator.', 'Shopp');
             }
             if (!$valid) {
                 shopp_add_error(sprintf($message, '<a href="' . Shopp::url(false, 'checkout', $this->security()) . '">', '</a>'), $errlevel);
             }
         }
     }
     if (!$valid_shipping) {
         $valid = false;
         shopp_add_error(__('The shipping address information is incomplete. The order cannot be processed.', 'Shopp'), $errlevel);
     }
     // Alert when no gateway is configured (and the order is not free)
     if ($Payments->count() == 0 && $Cart->total() > 0) {
         $valid = false;
         shopp_add_error(Lookup::errors('gateway', 'nogateways'), $errlevel);
     }
     return $valid;
 }
开发者ID:forthrobot,项目名称:inuvik,代码行数:83,代码来源:Order.php


示例17: lock

 /**
  * Create a lock for transaction processing
  *
  * @author Jonathan Davis
  * @since 1.2.1
  *
  * @return boolean
  **/
 public function lock($data)
 {
     if (!isset($data['order'])) {
         return false;
     }
     $order = $data['order'];
     $locked = 0;
     for ($attempts = 0; $attempts < 3 && $locked == 0; $attempts++) {
         $locked = sDB::query("SELECT GET_LOCK('{$order}'," . SHOPP_TXNLOCK_TIMEOUT . ") AS locked", 'auto', 'col', 'locked');
         if (0 == $locked) {
             sleep(1);
         }
         // Wait a sec before trying again
     }
     if (1 == $locked) {
         return true;
     }
     shopp_debug("Purchase authed lock for order #{$order} failed. Could not achieve a lock.");
     Shopp::redirect(Shopp::url(false, 'thanks', ShoppOrder()->security()));
 }
开发者ID:forthrobot,项目名称:inuvik,代码行数:28,代码来源:Events.php


示例18: shopp_add_order_event

/**
 * shopp_add_order_event - log an order event
 *
 * @api
 * @since 1.2
 *
 * @param int $order (conditionally required default:false) Will be false for purchase events, but needs the order id otherwise.
 * @param string $type (required) the order event type
 * @param array $message (optional default:array()) the event message protocol
 * @return bool true on success, false on error
 **/
function shopp_add_order_event($order = false, $type = false, $message = array())
{
    if (false !== $order && !shopp_order_exists($order)) {
        shopp_debug(__FUNCTION__ . " '{$type}' failed: Invalid order id.");
        return false;
    }
    if (!$type || !OrderEvent::handler($type)) {
        shopp_debug(__FUNCTION__ . " failed: Missing or invalid order event type");
        return false;
    }
    return OrderEvent::add($order, $type, $message);
}
开发者ID:forthrobot,项目名称:inuvik,代码行数:23,代码来源:order.php


示例19: shopp_product_weights

/**
 * Returns an array containing one or more values representing possible product weight (this might be one or multiple
 * weights if for instance the product has variants). The returned array is indexed on the variant ID where appropriate.
 * If there are no variants the actual product weight will have a zero index.
 *
 * @param $product ID or existing product object
 * @return array
 */
function shopp_product_weights($product)
{
    if (!is_a($product, 'ShoppProduct')) {
        $product = shopp_product($product);
    }
    if (false === $product) {
        shopp_debug(__FUNCTION__ . ' failed:  a valid product object or product ID must be specified.');
        return false;
    }
    $weights = array();
    foreach ($product->prices as $price) {
        $weight = isset($price->dimensions['weight']) ? $price->dimensions['weight'] : 0;
        if ('product' === $price->context) {
            $weights[0] = $weight;
        }
        if ('variation' === $price->context) {
            $weights[$price->id] = $weight;
        }
    }
    if (count($weights) > 1) {
        unset($weights[0]);
    }
    // Do not return the 'base' weight if there are variants
    return $weights;
}
开发者ID:forthrobot,项目名称:inuvik,代码行数:33,代码来源:product.php


示例20: valid

 /**
  * Determines if the module is a valid and compatible Shopp module
  *
  * @author Jonathan Davis
  * @since 1.1
  *
  * @return boolean True if the addon validates, false otherwise
  **/
 public function valid()
 {
     $error = false;
     if (false === strpos(strtolower($this->package), 'shopp') || empty($this->classname) || empty($this->interface)) {
         $error = true;
     } elseif (empty($this->version)) {
         $error = shopp_debug(sprintf('%s could not be loaded because no @version property was set in the addon header comments.', $this->filename));
     } elseif (empty($this->since)) {
         $error = shopp_debug(sprintf('%s could not be loaded because no @since property was set in the addon header comments.', $this->filename));
     } elseif (class_exists('ShoppVersion')) {
         if (version_compare(self::baseversion(ShoppVersion::release()), self::baseversion($this->since)) == -1) {
             $error = shopp_debug(sprintf('%s could not be loaded because it requires version %s (or higher) of Shopp.', $this->name, $this->since));
         }
     }
     if ($error) {
         return false;
     }
     return true;
 }
开发者ID:borkweb,项目名称:shopp,代码行数:27,代码来源:Modules.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP shopp_enqueue_script函数代码示例发布时间:2022-05-24
下一篇:
PHP shopp_custom_script函数代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap