本文整理汇总了PHP中Shopp::url方法的典型用法代码示例。如果您正苦于以下问题:PHP Shopp::url方法的具体用法?PHP Shopp::url怎么用?PHP Shopp::url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Shopp
的用法示例。
在下文中一共展示了Shopp::url方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bloginfo
?>
,
uidir = '<?php
echo SHOPP_ADMIN_URI;
?>
',
siteurl = '<?php
bloginfo('url');
?>
',
adminurl = '<?php
echo admin_url();
?>
',
canonurl = '<?php
echo trailingslashit(Shopp::url('' != get_option('permalink_structure') ? get_class_property('ProductCategory', 'namespace') : $Category->taxonomy . '='));
?>
',
ajaxurl = adminurl+'admin-ajax.php',
addcategory_url = '<?php
echo wp_nonce_url(admin_url() . "admin-ajax.php", "shopp-ajax_add_category");
?>
',
editslug_url = '<?php
echo wp_nonce_url(admin_url() . "admin-ajax.php", "wp_ajax_shopp_edit_slug");
?>
',
fileverify_url = '<?php
echo wp_nonce_url(admin_url() . "admin-ajax.php", "shopp-ajax_verify_file");
?>
',
示例2: cart
/**
* Handles shopping cart requests
*
* @author Jonathan Davis
* @since 1.1
*
* @return void
**/
public function cart()
{
if (isset($_REQUEST['shopping']) && 'reset' == strtolower($_REQUEST['shopping'])) {
ShoppShopping()->reset();
Shopp::redirect(Shopp::url());
}
if (empty($_REQUEST['cart'])) {
return true;
}
do_action('shopp_cart_request');
if (isset($_REQUEST['checkout'])) {
Shopp::redirect(Shopp::url(false, 'checkout', $this->security()));
}
if (isset($_REQUEST['ajax'])) {
$Cart = ShoppOrder()->Cart;
$Cart->totals();
$Cart->ajax();
}
$redirect = false;
if (isset($_REQUEST['redirect'])) {
$redirect = $_REQUEST['redirect'];
}
switch ($redirect) {
case 'checkout':
Shopp::redirect(Shopp::url(false, $redirect, ShoppOrder()->security()));
break;
default:
if (!empty($_REQUEST['redirect'])) {
Shopp::safe_redirect($_REQUEST['redirect']);
} else {
Shopp::redirect(Shopp::url(false, 'cart'));
}
}
exit;
}
示例3: bloginfo
?>
,
uidir = '<?php
echo SHOPP_ADMIN_URI;
?>
',
siteurl = '<?php
bloginfo('url');
?>
',
screenid = '<?php
echo get_current_screen()->id;
?>
',
canonurl = '<?php
echo trailingslashit(Shopp::url());
?>
',
adminurl = '<?php
echo admin_url();
?>
',
sugg_url = '<?php
echo wp_nonce_url(admin_url('admin-ajax.php'), "wp_ajax_shopp_storage_suggestions");
?>
',
tagsugg_url = '<?php
echo wp_nonce_url(admin_url('admin-ajax.php'), "wp_ajax_shopp_suggestions");
?>
',
spectemp_url = '<?php
示例4: url
/**
* Returns a URL for a resized image.
*
* If direct mode is enabled (which it is by
* default) and the image is already cached to the file system then a URL for that
* file will be returned.
*
* In all other cases a Shopp Image Server URL will be returned.
*
* @param $width
* @param $height
* @param $scale
* @param $sharpen
* @param $quality
* @param $fill
* @return string
*/
public function url($width = null, $height = null, $scale = null, $sharpen = null, $quality = null, $fill = null)
{
$request = array();
$url = Shopp::url('' != get_option('permalink_structure') ? trailingslashit($this->id) . $this->filename : $this->id, 'images');
// Get the current URI
$uri = $this->uri;
// Handle resize requests
$params = func_get_args();
if (count($params) > 0) {
list($width, $height, $scale, $sharpen, $quality, $fill) = $params;
$request = $this->resizing($width, $height, $scale, $sharpen, $quality, $fill);
// Build the path to the cached copy of the file (if it exists)
$size = $this->cachefile($request);
$uri = "cache_{$size}_{$this->filename}";
// Override the URI for the request
}
// Ask the engine if we have a direct URL
$direct_url = $this->engine()->direct($uri);
if (false !== $direct_url) {
return $direct_url;
}
if (empty($request)) {
return $url;
} else {
return Shopp::add_query_string($request, $url);
}
}
示例5: url
/**
* Provides the checkout page URL
*
* @api `shopp('checkout.url')`
* @since 1.0
*
* @param string $result The output
* @param array $options The options
* @param ShoppOrder $O The working object
* @return string The checkout page URL
**/
public static function url($result, $options, $O)
{
$link = Shopp::url(false, 'checkout', $O->security());
$Storefront = ShoppStorefront();
// Pass any arguments along
$args = $_GET;
unset($args['shopp_page'], $args['acct']);
$link = esc_url(add_query_arg($args, $link));
if (isset($Storefront->_confirm_page_content)) {
$link = apply_filters('shopp_confirm_url', $link);
} else {
$link = apply_filters('shopp_checkout_url', $link);
}
return $link;
}
示例6: feed
/**
* Iterates loaded products in buffered batches and generates a feed-friendly item record
*
* NOTE: To modify the output of the RSS generator, use
* the filter hooks provided in a separate plugin or
* in the theme functions.php file.
*
* @author Jonathan Davis
* @since 1.0
* @version 1.1
*
* @return string A feed item record
**/
public function feed()
{
$paged = 100;
// Buffer 100 products at a time.
$loop = false;
$product = ShoppProduct();
if ($product) {
$loop = shopp($this, 'products');
if (!$loop) {
$product = false;
} else {
$product = ShoppProduct();
}
}
if (!($product || $loop)) {
if (!$this->products) {
$page = 1;
} else {
$page = $this->page + 1;
}
if ($this->pages > 0 && $page > $this->pages) {
return false;
}
$this->load(array('load' => array('prices', 'specs', 'categories', 'coverimages'), 'paged' => $paged, 'page' => $page));
$loop = shopp($this, 'products');
if (!$loop) {
return false;
}
// Loop ended, bail out
$product = ShoppProduct();
if (!$product) {
return false;
}
// No products, bail
}
$item = array();
$item['guid'] = shopp($product, 'get-id');
$item['title'] = $product->name;
$item['link'] = shopp($product, 'get-url');
$item['pubDate'] = date('D, d M Y H:i O', $product->publish);
// Item Description
$item['description'] = '';
$item['description'] .= '<table><tr>';
$Image = current($product->images);
if (!empty($Image)) {
$item['description'] .= '<td><a href="' . $item['link'] . '" title="' . $product->name . '">';
$item['description'] .= '<img src="' . esc_attr(add_query_string($Image->resizing(75, 75, 0), Shopp::url($Image->id, 'images'))) . '" alt="' . $product->name . '" width="75" height="75" />';
$item['description'] .= '</a></td>';
}
$pricing = "";
$priceindex = 'price';
if (Shopp::str_true($product->sale)) {
$priceindex = 'saleprice';
}
if ($product->min[$priceindex] != $product->max[$priceindex]) {
$pricing .= Shopp::__('from') . ' ';
}
$pricing .= money($product->min[$priceindex]);
$item['description'] .= "<td><p><big>{$pricing}</big></p>";
$item['description'] .= apply_filters('shopp_rss_description', $product->summary, $product) . '</td></tr></table>';
$item['description'] = '<![CDATA[' . $item['description'] . ']]>';
// Google Base Namespace
// http://www.google.com/support/merchants/bin/answer.py?hl=en&answer=188494
// Below are Google Base specific attributes
// You can use the shopp_rss_item filter hook to add new item attributes or change the existing attributes
if ($Image) {
$item['g:image_link'] = add_query_string($Image->resizing(400, 400, 0), Shopp::url($Image->id, 'images'));
}
$item['g:condition'] = 'new';
$item['g:availability'] = shopp_setting_enabled('inventory') && $product->outofstock ? 'out of stock' : 'in stock';
$price = Shopp::floatval(Shopp::str_true($product->sale) ? $product->min['saleprice'] : $product->min['price']);
if (!empty($price)) {
$item['g:price'] = $price;
$item['g:price_type'] = "starting";
}
// Include product_type using Shopp category taxonomies
foreach ($product->categories as $category) {
$ancestry = array($category->name);
$ancestors = get_ancestors($category->term_id, $category->taxonomy);
foreach ((array) $ancestors as $ancestor) {
$term = get_term($ancestor, $category->taxonomy);
if ($term) {
array_unshift($ancestry, $term->name);
}
}
$item['g:product_type[' . $category->term_id . ']'] = join(' > ', $ancestry);
}
//.........这里部分代码省略.........
示例7: editor
/**
* Interface processor for the product editor
*
* @author Jonathan Davis
* @return void
**/
public function editor()
{
$Shopp = Shopp::object();
if (!current_user_can('shopp_products')) {
wp_die(__('You do not have sufficient permissions to access this page.'));
}
if (empty($Shopp->Product)) {
$Product = new ShoppProduct();
$Product->status = "publish";
} else {
$Product = $Shopp->Product;
}
$Product->slug = apply_filters('editable_slug', $Product->slug);
$permalink = trailingslashit(Shopp::url());
$Price = new ShoppPrice();
$priceTypes = ShoppPrice::types();
$billPeriods = ShoppPrice::periods();
$workflows = array('continue' => Shopp::__('Continue Editing'), 'close' => Shopp::__('Products Manager'), 'new' => Shopp::__('New Product'), 'next' => Shopp::__('Edit Next'), 'previous' => Shopp::__('Edit Previous'));
$taglist = array();
foreach ($Product->tags as $tag) {
$taglist[] = $tag->name;
}
if ($Product->id && !empty($Product->images)) {
$ids = join(',', array_keys($Product->images));
$CoverImage = reset($Product->images);
$image_table = $CoverImage->_table;
$Product->cropped = sDB::query("SELECT * FROM {$image_table} WHERE context='image' AND type='image' AND '2'=SUBSTRING_INDEX(SUBSTRING_INDEX(name,'_',4),'_',-1) AND parent IN ({$ids})", 'array', 'index', 'parent');
}
$shiprates = shopp_setting('shipping_rates');
if (!empty($shiprates)) {
ksort($shiprates);
}
$uploader = shopp_setting('uploader_pref');
if (!$uploader) {
$uploader = 'flash';
}
$process = empty($Product->id) ? 'new' : $Product->id;
$_POST['action'] = add_query_arg(array_merge($_GET, array('page' => $this->Admin->pagename('products'))), admin_url('admin.php'));
$post_type = ShoppProduct::posttype();
// Re-index menu options to maintain order in JS #2930
if (isset($Product->options['v']) || isset($Product->options['a'])) {
$options = array_keys($Product->options);
foreach ($options as $type) {
foreach ($Product->options[$type] as $id => $menu) {
$Product->options[$type][$type . $id] = $menu;
$Product->options[$type][$type . $id]['options'] = array_values($menu['options']);
unset($Product->options[$type][$id]);
}
}
} else {
foreach ($Product->options as &$menu) {
$menu['options'] = array_values($menu['options']);
}
}
do_action('add_meta_boxes', ShoppProduct::$posttype, $Product);
do_action('add_meta_boxes_' . ShoppProduct::$posttype, $Product);
do_action('do_meta_boxes', ShoppProduct::$posttype, 'normal', $Product);
do_action('do_meta_boxes', ShoppProduct::$posttype, 'advanced', $Product);
do_action('do_meta_boxes', ShoppProduct::$posttype, 'side', $Product);
include $this->ui('editor.php');
}
示例8: 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()));
}
示例9: url
/**
* Provides the context appropriate URL for selecting shipping options
*
* @api `shopp('context.property')`
* @since 1.0
*
* @param string $result The output
* @param array $options The options
* @param ShoppShiprates $O The working object
* @return void
**/
public static function url($result, $options, $O)
{
return is_shopp_page('checkout') ? Shopp::url(false, 'confirm-order') : Shopp::url(false, 'cart');
}
示例10: process
public function process()
{
$action = $this->form('checkout');
if ('process' != $action) {
return;
}
$Payments = ShoppOrder()->Payments;
$Cart = ShoppOrder()->Cart;
$forcedconfirm = 'always' == shopp_setting('order_confirmation');
$wasfree = $Cart->orderisfree();
// Get current free status
$estimated = $Cart->total();
// Get current total
$Cart->totals();
// Retotal after checkout to capture order total changes
// We have to avoid truthiness, hence the strange logic expression
if (true !== apply_filters('shopp_validate_checkout', true)) {
return;
} else {
$this->customer();
}
// Catch changes from validation
// Catch originally free orders that get extra (shipping) costs added to them
if ($wasfree && $Payments->count() > 1 && !$Cart->orderisfree() && empty($Payments->selected()->cards)) {
shopp_add_error(Shopp::__('The order amount changed and requires that you select a payment method.'));
Shopp::redirect(Shopp::url(false, 'checkout', ShoppOrder()->security()));
}
// Do not use shopp_checkout_processed for payment gateway redirect actions
// Free order processing doesn't take over until the order is submitted for processing in `shopp_process_order`
do_action('shopp_checkout_processed');
// If the cart's total changes at all, confirm the order
if (apply_filters('shopp_order_confirm_needed', $estimated != $Cart->total() || $forcedconfirm)) {
Shopp::redirect(Shopp::url(false, 'confirm', ShoppOrder()->security()));
return;
}
do_action('shopp_process_order');
}
示例11: screen
/**
* Interface processor for the category editor
*
* @author Jonathan Davis
* @since 1.0
* @return void
**/
public function screen()
{
global $CategoryImages;
$Shopp = Shopp::object();
if (!current_user_can('shopp_categories')) {
wp_die(__('You do not have sufficient permissions to access this page.'));
}
$Category = $this->Model;
$Price = new ShoppPrice();
$priceTypes = ShoppPrice::types();
$billPeriods = ShoppPrice::periods();
// Build permalink for slug editor
$permalink = trailingslashit(Shopp::url()) . "category/";
$Category->slug = apply_filters('editable_slug', $Category->slug);
$pricerange_menu = array("disabled" => __('Price ranges disabled', 'Shopp'), "auto" => __('Build price ranges automatically', 'Shopp'), "custom" => __('Use custom price ranges', 'Shopp'));
$uploader = shopp_setting('uploader_pref');
if (!$uploader) {
$uploader = 'flash';
}
$workflows = array("continue" => __('Continue Editing', 'Shopp'), "close" => __('Categories Manager', 'Shopp'), "new" => __('New Category', 'Shopp'), "next" => __('Edit Next', 'Shopp'), "previous" => __('Edit Previous', 'Shopp'));
do_action('add_meta_boxes', ProductCategory::$taxon, $Category);
do_action('add_meta_boxes_' . ProductCategory::$taxon, $Category);
do_action('do_meta_boxes', ProductCategory::$taxon, 'normal', $Category);
do_action('do_meta_boxes', ProductCategory::$taxon, 'advanced', $Category);
do_action('do_meta_boxes', ProductCategory::$taxon, 'side', $Category);
include $this->ui('category.php');
}
示例12: redirect
/**
* Handle login redirects
*
* @author Jonathan Davis
* @since 1.2
*
* @return void
**/
public function redirect()
{
$redirect = false;
$secure = ShoppOrder()->security();
if (isset($_REQUEST['redirect']) && !empty($_REQUEST['redirect'])) {
if (ShoppPages()->exists($_REQUEST['redirect'])) {
$redirect = Shopp::url(false, $_REQUEST['redirect'], $secure);
} else {
$redirect = $_REQUEST['redirect'];
}
}
if (!$redirect) {
$redirect = apply_filters('shopp_login_redirect', Shopp::url(false, 'account', $secure));
}
Shopp::safe_redirect($redirect);
}
示例13: returnurl
protected function returnurl()
{
return add_query_arg('rmtpay', $this->id(), Shopp::url(false, 'thanks'));
}
示例14: url
/**
* Provides the URL of for the order
*
* @api `shopp('context.property')`
* @since 1.0
*
* @param string $result The output
* @param array $options The options
* @param ShoppPurchase $O The working object
* @return void
**/
public static function url($result, $options, $O)
{
return Shopp::url(array('order' => $Purchase->id), 'account');
}
示例15: pdt
/**
* Handle the synchronous return from PPS (PDT and default return)
*
* @author Jonathan Davis
* @since 1.2
**/
public function pdt()
{
$Order = ShoppOrder();
if (!$this->pdtvalid()) {
return;
}
$Message = $this->Message;
$id = $Message->order();
$event = $Message->event();
$Purchase = new ShoppPurchase($id);
if (empty($Purchase->id)) {
shopp_debug('PDT processing could not load the in progress order from the database.');
return Shopp::redirect(Shopp::url(false, 'thanks', false));
}
$Order->inprogress = $Purchase->id;
$this->process($event, $Purchase);
Shopp::redirect(Shopp::url(false, 'thanks', false));
}