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


PHP edd_get_purchase_link函数代码示例

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


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

示例1: edd_download_shortcode

/**
 * Purchase Link Shortcode
 *
 * Retrieves a download and displays the purchase form.
 *
 * @since 1.0
 * @param array $atts Shortcode attributes
 * @param string $content
 * @return string Fully formatted purchase link
 */
function edd_download_shortcode($atts, $content = null)
{
    global $post;
    $post_id = is_object($post) ? $post->ID : 0;
    $atts = shortcode_atts(array('id' => $post_id, 'price_id' => isset($atts['price_id']) ? $atts['price_id'] : false, 'sku' => '', 'price' => '1', 'direct' => '0', 'text' => '', 'style' => edd_get_option('button_style', 'button'), 'color' => edd_get_option('checkout_color', 'blue'), 'class' => 'edd-submit', 'form_id' => ''), $atts, 'purchase_link');
    // Override text only if not provided / empty
    if (!$atts['text']) {
        if ($atts['direct'] == '1' || $atts['direct'] == 'true') {
            $atts['text'] = edd_get_option('buy_now_text', __('Buy Now', 'easy-digital-downloads'));
        } else {
            $atts['text'] = edd_get_option('add_to_cart_text', __('Purchase', 'easy-digital-downloads'));
        }
    }
    // Override color if color == inherit
    if (isset($atts['color'])) {
        $atts['color'] = $atts['color'] == 'inherit' ? '' : $atts['color'];
    }
    if (!empty($atts['sku'])) {
        $download = edd_get_download_by('sku', $atts['sku']);
        $atts['download_id'] = $download->ID;
    } elseif (isset($atts['id'])) {
        // Edd_get_purchase_link() expects the ID to be download_id since v1.3
        $atts['download_id'] = $atts['id'];
        $download = edd_get_download($atts['download_id']);
    }
    if ($download) {
        return edd_get_purchase_link($atts);
    }
}
开发者ID:Balamir,项目名称:Easy-Digital-Downloads,代码行数:39,代码来源:shortcodes.php

示例2: edd_download_shortcode

/**
 * Purchase Link Shortcode
 *
 * Retrieves a download and displays the purchase form.
 *
 * @access      private
 * @since       1.0 
 * @return      string
*/
function edd_download_shortcode($atts, $content = null)
{
    extract(shortcode_atts(array('id' => '', 'text' => __('Purchase', 'edd'), 'style' => 'button', 'color' => 'blue', 'class' => ''), $atts));
    $download = edd_get_download($id);
    if ($download) {
        return edd_get_purchase_link($download->ID, $text, $style, $color, $class);
    }
}
开发者ID:ryannmicua,项目名称:Easy-Digital-Downloads,代码行数:17,代码来源:shortcodes.php

示例3: edd_download_shortcode

/**
 * Purchase Link Shortcode
 *
 * Retrieves a download and displays the purchase form.
 *
 * @since 1.0
 * @param array $atts Shortcode attributes
 * @param string $content
 * @return string Fully formatted purchase link
 */
function edd_download_shortcode($atts, $content = null)
{
    global $post, $edd_options;
    extract(shortcode_atts(array('id' => $post->ID, 'price' => '1', 'text' => isset($edd_options['add_to_cart_text']) && $edd_options['add_to_cart_text'] != '' ? $edd_options['add_to_cart_text'] : __('Purchase', 'edd'), 'style' => isset($edd_options['button_style']) ? $edd_options['button_style'] : 'button', 'color' => isset($edd_options['checkout_color']) ? $edd_options['checkout_color'] : 'blue', 'class' => 'edd-submit'), $atts));
    // Edd_get_purchase_link() expects the ID to be download_id since v1.3
    $atts['download_id'] = $atts['id'];
    $download = edd_get_download($atts['download_id']);
    if ($download) {
        return edd_get_purchase_link($atts);
    }
}
开发者ID:bangtienmanh,项目名称:Easy-Digital-Downloads,代码行数:21,代码来源:shortcodes.php

示例4: edd_download_shortcode

/**
 * Purchase Link Shortcode
 *
 * Retrieves a download and displays the purchase form.
 *
 * @since 1.0
 * @param array $atts Shortcode attributes
 * @param string $content
 * @return string Fully formatted purchase link
 */
function edd_download_shortcode($atts, $content = null)
{
    global $post, $edd_options;
    $post_id = is_object($post) ? $post->ID : 0;
    $atts = shortcode_atts(array('id' => $post_id, 'sku' => '', 'price' => '1', 'direct' => '0', 'text' => isset($edd_options['add_to_cart_text']) && $edd_options['add_to_cart_text'] != '' ? $edd_options['add_to_cart_text'] : __('Purchase', 'edd'), 'style' => isset($edd_options['button_style']) ? $edd_options['button_style'] : 'button', 'color' => isset($edd_options['checkout_color']) ? $edd_options['checkout_color'] : 'blue', 'class' => 'edd-submit', 'form_id' => ''), $atts, 'purchase_link');
    // Override color if color == inherit
    if (isset($atts['color'])) {
        $atts['color'] = $atts['color'] == 'inherit' ? '' : $atts['color'];
    }
    if (isset($atts['id'])) {
        // Edd_get_purchase_link() expects the ID to be download_id since v1.3
        $atts['download_id'] = $atts['id'];
        $download = edd_get_download($atts['download_id']);
    } elseif (isset($atts['sku'])) {
        $download = edd_get_download_by('sku', $atts['sku']);
        $atts['download_id'] = $download->ID;
    }
    if ($download) {
        return edd_get_purchase_link($atts);
    }
}
开发者ID:Bragi26,项目名称:Easy-Digital-Downloads,代码行数:31,代码来源:shortcodes.php

示例5: sf_campaign_sidebar

    function sf_campaign_sidebar()
    {
        global $post;
        $campaign = new ATCF_Campaign($post->ID);
        $download_id = $post->ID;
        $prices = edd_get_variable_prices($download_id);
        $type = edd_single_price_option_mode($download_id) ? 'checkbox' : 'radio';
        $extra_class = "";
        if ($campaign->is_donations_only()) {
            $extra_class = 'project-donate-only';
        }
        ?>
            <div id="back-this-project" class="campaign-sidebar <?php 
        echo esc_attr($extra_class);
        ?>
 col-sm-4">
                <?php 
        if ($campaign->is_active()) {
            if ($campaign->is_donations_only()) {
                echo '<p class="donate-only">' . __('This project is donation only, and you can donate using the button below.', 'swiftframework') . '</p>';
                echo edd_get_purchase_link(array('download_id' => $post->ID, 'class' => 'accent sf-button contribute-now', 'price' => false, 'text' => __('Donate Now', 'swiftframework')));
            } else {
                echo edd_get_purchase_link(array('download_id' => $post->ID, 'class' => 'accent sf-button contribute-now', 'price' => false, 'text' => __('Contribute Now', 'swiftframework')));
            }
        } else {
            // Inactive, just show options with no button
            if ($campaign->is_donations_only()) {
                echo '<p class="project-ended">' . __('This project has ended.', 'swiftframework') . '</p>';
            } else {
                atcf_campaign_contribute_options($prices, $type, $download_id);
            }
        }
        ?>
            </div>
        <?php 
    }
开发者ID:shimion,项目名称:wishlistshimion,代码行数:36,代码来源:sf-campaign-detail.php

示例6: edd_get_payment_meta_cart_details

        $cart = edd_get_payment_meta_cart_details($post->ID, true);
        //print_r($cart); exit;
        $cart_total_products = array();
        $cart_total_amount = 0;
        if (is_array($cart) && !empty($cart)) {
            foreach ($cart as $cart_product) {
                $cart_total_products[] = $cart_product['name'];
                $cart_total_amount += $cart_product['price'];
            }
        }
        $css_expired = '';
        $expired_content = '';
        if ('expired' == edd_software_licensing()->get_license_status($licenses[0]->ID)) {
            $css_expired = '_expired';
            $post_meta = get_post_meta($licenses[0]->ID, '_edd_sl_download_id', true);
            $expired_content = __(' - Expired', 'edd_downloads') . " " . edd_get_purchase_link(array('download_id' => $post_meta));
        }
        ?>

			<tr class="edd_purchase_row">

				<?php 
        do_action('edd_purchase_history_row_start', $post->ID, $purchase_data);
        ?>

				<td class="edd_purchase_id">#<?php 
        echo edd_get_payment_number($post->ID);
        ?>
</td>

                <td class="edd_purchase_product<?php 
开发者ID:jomsocial,项目名称:eddDownloads,代码行数:31,代码来源:history-purchase.php

示例7: marketify_purchase_link

 /**
  * Download Purchase Link
  *
  * @since Marketify 1.0
  *
  * @return void
  */
 function marketify_purchase_link($download_id = null)
 {
     global $post, $edd_options;
     if (!$download_id) {
         $download_id = $post->ID;
     }
     $variable = edd_has_variable_prices($download_id);
     if (!$variable) {
         echo edd_get_purchase_link(array('download_id' => $download_id, 'price' => false));
     } else {
         $button = !empty($edd_options['add_to_cart_text']) ? $edd_options['add_to_cart_text'] : __('Purchase', 'marketify');
         printf('<a href="#buy-now-%s" class="button buy-now popup-trigger">%s</a>', $post->ID, $button);
     }
 }
开发者ID:evinw,项目名称:project_3dBP,代码行数:21,代码来源:edd-template-tags.php

示例8: edd_append_purchase_link

/**
 * Append Purchase Link
 *
 * Automatically appends the purchase link to download content, if enabled.
 *
 * @since 1.0
 * @param int $download_id Download ID
 * @return void
 */
function edd_append_purchase_link($download_id)
{
    if (!get_post_meta($download_id, '_edd_hide_purchase_link', true)) {
        echo edd_get_purchase_link(array('download_id' => $download_id));
    }
}
开发者ID:jplhomer,项目名称:Easy-Digital-Downloads,代码行数:15,代码来源:template-functions.php

示例9: widget

 /** @see WP_Widget::widget */
 public function widget($args, $instance)
 {
     $args['id'] = isset($args['id']) ? $args['id'] : 'edd_download_details_widget';
     if (!empty($instance['download_id'])) {
         if ('current' === $instance['download_id']) {
             $instance['display_type'] = 'current';
             unset($instance['download_id']);
         } elseif (is_numeric($instance['download_id'])) {
             $instance['display_type'] = 'specific';
         }
     }
     if (!isset($instance['display_type']) || 'specific' === $instance['display_type'] && !isset($instance['download_id']) || 'current' == $instance['display_type'] && !is_singular('download')) {
         return;
     }
     // set correct download ID.
     if ('current' == $instance['display_type'] && is_singular('download')) {
         $download_id = get_the_ID();
     } else {
         $download_id = absint($instance['download_id']);
     }
     // Since we can take a typed in value, make sure it's a download we're looking for
     $download = get_post($download_id);
     if (!is_object($download) || 'download' !== $download->post_type) {
         return;
     }
     // Variables from widget settings.
     $title = apply_filters('widget_title', $instance['title'], $instance, $args['id']);
     $download_title = $instance['download_title'] ? apply_filters('edd_product_details_widget_download_title', '<h3>' . get_the_title($download_id) . '</h3>', $download_id) : '';
     $purchase_button = $instance['purchase_button'] ? apply_filters('edd_product_details_widget_purchase_button', edd_get_purchase_link(array('download_id' => $download_id)), $download_id) : '';
     $categories = $instance['categories'] ? $instance['categories'] : '';
     $tags = $instance['tags'] ? $instance['tags'] : '';
     // Used by themes. Opens the widget.
     echo $args['before_widget'];
     // Display the widget title.
     if ($title) {
         echo $args['before_title'] . $title . $args['after_title'];
     }
     do_action('edd_product_details_widget_before_title', $instance, $download_id);
     // download title.
     echo $download_title;
     do_action('edd_product_details_widget_before_purchase_button', $instance, $download_id);
     // purchase button.
     echo $purchase_button;
     // categories and tags.
     $category_list = $categories ? get_the_term_list($download_id, 'download_category', '', ', ') : '';
     $category_count = count(get_the_terms($download_id, 'download_category'));
     $category_labels = edd_get_taxonomy_labels('download_category');
     $category_label = $category_count > 1 ? $category_labels['name'] : $category_labels['singular_name'];
     $tag_list = $tags ? get_the_term_list($download_id, 'download_tag', '', ', ') : '';
     $tag_count = count(get_the_terms($download_id, 'download_tag'));
     $tag_taxonomy = edd_get_taxonomy_labels('download_tag');
     $tag_label = $tag_count > 1 ? $tag_taxonomy['name'] : $tag_taxonomy['singular_name'];
     $text = '';
     if ($category_list || $tag_list) {
         $text .= '<p class="edd-meta">';
         if ($category_list) {
             $text .= '<span class="categories">%1$s: %2$s</span><br/>';
         }
         if ($tag_list) {
             $text .= '<span class="tags">%3$s: %4$s</span>';
         }
         $text .= '</p>';
     }
     do_action('edd_product_details_widget_before_categories_and_tags', $instance, $download_id);
     printf($text, $category_label, $category_list, $tag_label, $tag_list);
     do_action('edd_product_details_widget_before_end', $instance, $download_id);
     // Used by themes. Closes the widget.
     echo $args['after_widget'];
 }
开发者ID:pderksen,项目名称:Easy-Digital-Downloads,代码行数:70,代码来源:widgets.php

示例10: widget

 /** @see WP_Widget::widget */
 public function widget($args, $instance)
 {
     $args['id'] = isset($args['id']) ? $args['id'] : 'edd_download_details_widget';
     if (!isset($instance['download_id']) || 'current' == $instance['download_id'] && !is_singular('download')) {
         return;
     }
     // set correct download ID.
     if ('current' == $instance['download_id'] && is_singular('download')) {
         $download_id = get_the_ID();
     } else {
         $download_id = absint($instance['download_id']);
     }
     // Variables from widget settings.
     $title = apply_filters('widget_title', $instance['title'], $instance, $args['id']);
     $download_title = $instance['download_title'] ? apply_filters('edd_product_details_widget_download_title', '<h3>' . get_the_title($download_id) . '</h3>', $download_id) : '';
     $purchase_button = $instance['purchase_button'] ? apply_filters('edd_product_details_widget_purchase_button', edd_get_purchase_link(array('download_id' => $download_id)), $download_id) : '';
     $categories = $instance['categories'] ? $instance['categories'] : '';
     $tags = $instance['tags'] ? $instance['tags'] : '';
     $image = $instance['image'] ? $instance['image'] : '';
     // Used by themes. Opens the widget.
     echo $args['before_widget'];
     // Display the widget title.
     if ($title) {
         echo $args['before_title'] . $title . $args['after_title'];
     }
     do_action('edd_product_details_widget_before_title', $instance, $download_id);
     // download title.
     echo $download_title;
     $feat_image = wp_get_attachment_url(get_post_thumbnail_id($download_id));
     if ($image) {
         echo '<p><img src="' . $feat_image . '" alt="' . get_the_title($download_id) . '" /></p>';
     }
     do_action('edd_product_details_widget_before_purchase_button', $instance, $download_id);
     // purchase button.
     echo $purchase_button;
     // categories and tags.
     $category_list = $categories ? get_the_term_list($download_id, 'download_category', '', ', ') : '';
     $category_count = count(get_the_terms($download_id, 'download_category'));
     $category_labels = edd_get_taxonomy_labels('download_category');
     $category_label = $category_count > 1 ? $category_labels['name'] : $category_labels['singular_name'];
     $tag_list = $tags ? get_the_term_list($download_id, 'download_tag', '', ', ') : '';
     $tag_count = count(get_the_terms($download_id, 'download_tag'));
     $tag_taxonomy = edd_get_taxonomy_labels('download_tag');
     $tag_label = $tag_count > 1 ? $tag_taxonomy['name'] : $tag_taxonomy['singular_name'];
     $text = '';
     if ($category_list || $tag_list) {
         $text .= '<p class="edd-meta">';
         if ($category_list) {
             $text .= '<span class="categories">%1$s: %2$s</span><br/>';
         }
         if ($tag_list) {
             $text .= '<span class="tags">%3$s: %4$s</span>';
         }
         $text .= '</p>';
     }
     do_action('edd_product_details_widget_before_categories_and_tags', $instance, $download_id);
     printf($text, $category_label, $category_list, $tag_label, $tag_list);
     do_action('edd_product_details_widget_before_end', $instance, $download_id);
     // Used by themes. Closes the widget.
     echo $args['after_widget'];
 }
开发者ID:deviodigital,项目名称:Easy-Digital-Downloads,代码行数:62,代码来源:widgets.php

示例11: edd_rp_render_shortcode

function edd_rp_render_shortcode($attributes, $content = null)
{
    global $post;
    extract(shortcode_atts(array('ids' => $post->id, 'user' => 'false', 'count' => 3, 'title' => __('Recommended Products', EDD_RP_TEXT_DOMAIN)), $attributes, 'recommended_products'));
    $ids = str_replace(' ', '', $ids);
    $ids = explode(',', $ids);
    $count = absint($count);
    $user_id = $user == 'true' ? get_current_user_id() : false;
    $suggestions = edd_rp_get_multi_suggestions($ids, $user_id, $count);
    if (is_array($suggestions) && !empty($suggestions)) {
        $suggestions = array_keys($suggestions);
        $suggested_downloads = new WP_Query(array('post__in' => $suggestions, 'post_type' => 'download'));
        if ($suggested_downloads->have_posts()) {
            ?>
			<div id="edd-rp-single-wrapper">
				<h5 id="edd-rp-single-header"><?php 
            echo $title;
            ?>
</h5>
				<div id="edd-rp-items-wrapper" class="edd-rp-single">
					<?php 
            while ($suggested_downloads->have_posts()) {
                ?>
						<?php 
                $suggested_downloads->the_post();
                ?>
						<div class="edd-rp-item <?php 
                echo !current_theme_supports('post-thumbnails') ? 'edd-rp-nothumb' : '';
                ?>
">
							<a href="<?php 
                the_permalink();
                ?>
">
							<?php 
                the_title();
                ?>
							<?php 
                if (current_theme_supports('post-thumbnails') && has_post_thumbnail(get_the_ID())) {
                    ?>
								<div class="edd_cart_item_image">
									<?php 
                    echo get_the_post_thumbnail(get_the_ID(), apply_filters('edd_checkout_image_size', array(125, 125)));
                    ?>
								</div>
							<?php 
                } else {
                    ?>
								<br />
							<?php 
                }
                ?>
							</a>
							<?php 
                if (!edd_has_variable_prices(get_the_ID())) {
                    ?>
								<?php 
                    edd_price(get_the_ID());
                    ?>
							<?php 
                }
                ?>

							<?php 
                echo edd_get_purchase_link(array('download_id' => get_the_ID(), 'price' => false, 'direct' => false));
                ?>
						</div>
					<?php 
            }
            ?>
				</div>
			</div>
		<?php 
        }
        ?>

		<?php 
        wp_reset_postdata();
        ?>

	<?php 
    }
}
开发者ID:nguyenthai2010,项目名称:ngocshop,代码行数:83,代码来源:shortcodes.php

示例12: the_permalink

			</div>
		</div>
	<?php 
}
?>
	<div class="bd">
		<h2 class="tight">
			<a href="<?php 
the_permalink();
?>
"><?php 
the_title();
?>
 &raquo;</a>
		</h2>
		<?php 
the_excerpt();
?>

		<?php 
if (post_meta('download_id')) {
    ?>
			<?php 
    echo edd_get_purchase_link(array('download_id' => post_meta('download_id'), 'text' => __('Order this Course now', 'yoastcom') . ' &raquo;'));
    ?>
		<?php 
}
?>
	</div>
</div>
<?php 
开发者ID:apsolut,项目名称:Yoast-theme-public,代码行数:31,代码来源:course.php

示例13: the_permalink

    ?>
		</a>
	<?php 
}
?>
	<div class="bd">
		<h2 class="tight">
			<a href="<?php 
the_permalink();
?>
"><?php 
the_title();
?>
 &raquo;</a>
		</h2>
		<?php 
the_excerpt();
?>

		<?php 
if (post_meta('download_id')) {
    ?>
			<?php 
    echo edd_get_purchase_link(array('download_id' => post_meta('download_id'), 'text' => __('Buy this ebook now', 'yoastcom') . ' &raquo;'));
    ?>
		<?php 
}
?>
	</div>
</div>
<?php 
开发者ID:apsolut,项目名称:Yoast-theme-public,代码行数:31,代码来源:ebook.php

示例14: edd_get_purchase_link

<div class="edd_download_buy_button">
	<?php 
echo edd_get_purchase_link(get_the_ID());
?>
</div>
开发者ID:ryannmicua,项目名称:Easy-Digital-Downloads,代码行数:5,代码来源:shortcode-content-cart-button.php

示例15: edd_csau_html


//.........这里部分代码省略.........
			<h2><?php 
            echo esc_attr($heading);
            ?>
</h2>

				<?php 
            while ($downloads->have_posts()) {
                $downloads->the_post();
                ?>
					<div itemscope itemtype="http://schema.org/Product" class="<?php 
                echo apply_filters('edd_download_class', 'edd_download', '', '');
                ?>
" id="edd_download_<?php 
                echo get_the_ID();
                ?>
">
						<div class="edd_download_inner">
						
							<?php 
                do_action('edd_csau_download_before');
                $show_excerpt = apply_filters('edd_csau_show_excerpt', true);
                $show_price = apply_filters('edd_csau_show_price', true);
                $show_button = apply_filters('edd_csau_upsell_show_button', true);
                edd_get_template_part('shortcode', 'content-image');
                edd_get_template_part('shortcode', 'content-title');
                if ($show_price) {
                    edd_get_template_part('shortcode', 'content-price');
                }
                if ($show_excerpt) {
                    edd_get_template_part('shortcode', 'content-excerpt');
                }
                // if the download is not in the cart, show the add to cart button
                if (edd_is_checkout()) {
                    if (!edd_item_in_cart(get_the_ID())) {
                        $text = apply_filters('edd_csau_cross_sell_add_to_cart_text', __('Add to cart', 'edd-csau'));
                        $price = apply_filters('edd_csau_cross_sell_show_button_price', false);
                        if ($show_button) {
                            ?>
 
									
									<div class="edd_download_buy_button">
										<?php 
                            echo edd_get_purchase_link(array('download_id' => get_the_ID(), 'text' => $text, 'price' => $price));
                            ?>
									</div>
									<?php 
                        }
                        ?>

								<?php 
                    } else {
                        echo apply_filters('edd_csau_added_to_cart_text', '<span class="edd-cart-added-alert"><i class="edd-icon-ok"></i> ' . __('Added to cart', 'edd-csau') . '</span>');
                    }
                } else {
                    $text = apply_filters('edd_csau_upsell_add_to_cart_text', __('Add to cart', 'edd-csau'));
                    $price = apply_filters('edd_csau_upsell_show_button_price', false);
                    $show_button = apply_filters('edd_csau_upsell_show_button', true);
                    if ($show_button) {
                        ?>
								<div class="edd_download_buy_button">
									<?php 
                        echo edd_get_purchase_link(array('download_id' => get_the_ID(), 'text' => $text, 'price' => $price));
                        ?>
								</div>
								<?php 
                    }
                    ?>
							<?php 
                }
                do_action('edd_csau_download_after');
                ?>
						</div>
					</div>
					<?php 
                if ($columns && $i % $columns == 0) {
                    ?>
<div style="clear:both;"></div><?php 
                }
                ?>
				<?php 
                $i++;
            }
            ?>

				<?php 
            wp_reset_postdata();
            ?>
			</div>
			<?php 
            $html = ob_get_clean();
            return apply_filters('edd_csau_html', $html, $downloads, $heading, $columns, $class_list);
        }
        ?>

		<?php 
    }
    ?>

<?php 
}
开发者ID:nguyenthai2010,项目名称:ngocshop,代码行数:101,代码来源:template-functions.php


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