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

PHP wpsc_get_option函数代码示例

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

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



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

示例1: is_store_front_page

 /**
  * Shortcut method, return true if this is the main store, and it is being
  * displayed as the front page.
  *
  * @since  0.1
  * @access private
  *
  * @return boolean
  */
 private function is_store_front_page()
 {
     $controller = get_query_var('wpsc_controller');
     $id = get_queried_object_id();
     // is_home() is always true if this is the front page and store is set
     // to be displayed here. This is because 'page_on_front' is set to an
     // empty value whenever wpsc_store_as_front_page is set to true
     return !$controller && is_home() && !$id && wpsc_get_option('store_as_front_page');
 }
开发者ID:osuarcher,项目名称:WP-e-Commerce,代码行数:18,代码来源:router.php


示例2: _wpsc_filter_default_styles_setting

function _wpsc_filter_default_styles_setting($settings)
{
    // prevent infinite loop
    remove_filter('wpsc_default_settings', '_wpsc_filter_default_styles_setting');
    if (!wpsc_get_option('default_style')) {
        $settings['default_styles'] = array();
    }
    return $settings;
}
开发者ID:ashik968,项目名称:digiplot,代码行数:9,代码来源:settings.php


示例3: widget

 public function widget($args, $instance)
 {
     $query = new WP_Query(array('posts_per_page' => $instance['post_count'], 'post_type' => 'wpsc-product', 'post_status' => 'publish'));
     if (!$query->have_posts()) {
         return;
     }
     $instance = wp_parse_args($instance, $this->defaults);
     extract($args);
     add_image_size('wpsc_product_widget_thumbnail', $instance['width'], $instance['height'], wpsc_get_option('crop_thumbnails'));
     $title = apply_filters('widget_title', $instance['title']);
     include WPSC_TE_V2_SNIPPETS_PATH . '/widgets/latest-products/widget.php';
 }
开发者ID:osuarcher,项目名称:WP-e-Commerce,代码行数:12,代码来源:latest-products.php


示例4: _wpsc_get_filtered_categories

function _wpsc_get_filtered_categories()
{
    $filtered = wpsc_get_option('categories_to_filter');
    $args = array('hide_empty' => 0);
    if ($filtered == 'first_level') {
        $args['parent'] = 0;
    } elseif ($filtered == 'custom') {
        $ids = array_map('absint', wpsc_get_option('categories_to_filter_custom'));
        $args['include'] = $ids;
    }
    return get_terms('wpsc_product_category', $args);
}
开发者ID:ashik968,项目名称:digiplot,代码行数:12,代码来源:product.php


示例5: wpsc_default_customizer_settings

function wpsc_default_customizer_settings($settings)
{
    $settings['wpsc_product_width_thumbnails'] = array('control' => array('class' => 'WPSC_Customizer_Thumbnail_Control', 'settings' => array('single_view_image_width', 'single_view_image_height'), 'priority' => 15, 'type' => 'wpsc-thumbnail', 'section' => 'wpsc_thumbnails', 'label' => __('Single Product Thumbnails'), 'default' => '', 'description' => __('Sets thumbnail size for single product view.', 'wp-e-commerce')), 'setting' => array('type' => 'option', 'capability' => 'manage_options', 'sanitize_callback' => 'absint'));
    $settings['wpsc_product_width_archive_thumbnails'] = array('control' => array('class' => 'WPSC_Customizer_Thumbnail_Control', 'settings' => array('product_image_width', 'product_image_height'), 'priority' => 20, 'type' => 'wpsc-thumbnail', 'section' => 'wpsc_thumbnails', 'label' => __('Archive Product Thumbnails'), 'default' => '', 'description' => __('Sets thumbnail size for archive product view.', 'wp-e-commerce')), 'setting' => array('type' => 'option', 'capability' => 'manage_options', 'sanitize_callback' => 'absint'));
    $settings['wpsc_product_width_taxonomy_thumbnails'] = array('control' => array('class' => 'WPSC_Customizer_Thumbnail_Control', 'settings' => array('category_image_width', 'category_image_height'), 'priority' => 30, 'type' => 'wpsc-thumbnail', 'section' => 'wpsc_thumbnails', 'label' => __('Product Category Thumbnails'), 'default' => '', 'description' => __('Sets thumbnail size for category images.', 'wp-e-commerce')), 'setting' => array('type' => 'option', 'capability' => 'manage_options', 'sanitize_callback' => 'absint'));
    $settings['wpsc_crop_thumbnails'] = array('control' => array('type' => 'checkbox', 'priority' => 10, 'section' => 'wpsc_thumbnails', 'label' => __('Crop Thumbnails'), 'default' => false, 'description' => __('Crop images to the specified dimensions using center positions.')), 'setting' => array('type' => 'option', 'capability' => 'manage_options', 'default' => false, 'sanitize_callback' => 'esc_attr'));
    $settings['wpsc_products_per_page'] = array('control' => array('type' => 'number', 'priority' => 20, 'section' => 'wpsc_general', 'label' => __('Products Per Page'), 'default' => wpsc_get_option('products_per_page'), 'description' => __('Set the maximum number of products per page.', 'wp-e-commerce')), 'setting' => array('type' => 'option', 'capability' => 'manage_options', 'sanitize_callback' => 'absint'), 'partial' => array('selector' => '#wpsc-products', 'render_callback' => 'wpsc_customizer_render_products'));
    $settings['wpsc_fancy_notifications'] = array('control' => array('type' => 'checkbox', 'priority' => 10, 'section' => 'wpsc_general', 'label' => __('Add to Cart Notifications'), 'default' => false, 'description' => __('Enable Add to Cart notifications. When adding an item to your cart, this will create a popup notification for users.', 'wp-e-commerce')), 'setting' => array('type' => 'option', 'capability' => 'manage_options', 'default' => false, 'sanitize_callback' => 'esc_attr'), 'partial' => array('selector' => '#wpsc-products', 'render_callback' => 'wpsc_customizer_render_products'));
    $settings['wpsc_layout'] = array('control' => array('type' => 'select', 'priority' => 10, 'section' => 'wpsc_layout', 'label' => __('Layout'), 'default' => 'grid', 'description' => __('Change the layout of your store.'), 'choices' => apply_filters('wpsc_layouts', array('grid' => __('Grid', 'wp-e-commerce'), 'list' => __('List', 'wp-e-commerce')))), 'setting' => array('type' => 'option', 'capability' => 'manage_options', 'default' => 'grid', 'sanitize_callback' => 'sanitize_text_field'));
    $settings['wpsc_products_per_row'] = array('control' => array('type' => 'select', 'priority' => 12, 'section' => 'wpsc_layout', 'label' => __('Products Per Row'), 'default' => 'auto', 'description' => __('Set the maximum number of products per row. Defaults to showing 4 per row, up to six products per row', 'wp-e-commerce'), 'choices' => apply_filters('wpsc_products_per_row_options', array('2' => __('2', 'wp-e-commerce'), '3' => __('3', 'wp-e-commerce'), '4' => __('4', 'wp-e-commerce'), '5' => __('5', 'wp-e-commerce'), '6' => __('6', 'wp-e-commerce')))), 'setting' => array('type' => 'option', 'capability' => 'manage_options', 'default' => 'auto', 'sanitize_callback' => 'wpsc_customizer_products_per_row'), 'partial' => array('selector' => '#wpsc-products', 'render_callback' => 'wpsc_customizer_render_products'));
    return $settings;
}
开发者ID:benhuson,项目名称:WP-e-Commerce,代码行数:12,代码来源:wpsc-customizer.php


示例6: _wpsc_te2_enqueue_reading_settings_fix

/**
 * Use JavaScript to dynamically inject "Main store as front page" option in
 * Settings->Reading.
 *
 * This is not a very elegant hack, but it helps make it easier for user to
 * select the main store as the front page, rather than having to dive into
 * Settings->Store->Pages.
 *
 * @since  0.1
 * @access private
 */
function _wpsc_te2_enqueue_reading_settings_fix()
{
    $store_as_front_page = wpsc_get_option('store_as_front_page');
    // generate the HTML for the Main store as front page option in Settings->Reading
    // the radio's value is 'wpsc_main_store', but this will be reset back to
    // either 'posts' or 'page' in {@link _wpsc_te2_action_sanitize_show_on_front() }
    $dropdown = '<label>' . sprintf(__('Posts page: %s', 'wp-e-commerce'), wp_dropdown_pages(array('id' => 'wpsc_page_for_posts', 'name' => 'page_for_posts', 'echo' => 0, 'show_option_none' => __('&mdash; Select &mdash;', 'wp-e-commerce'), 'option_none_value' => '0', 'selected' => get_option('page_for_posts')))) . '</label>';
    $html = '<div class="wpsc-main-store-on-front"><p><label><input class="tog" %1$s type="radio" name="show_on_front" value="wpsc_main_store" />%2$s</label></p>';
    $html .= '<ul><li>%3$s</li></ul></div>';
    // the radio box will be checked if 'wpsc_store_as_front_page' option is true
    $html = sprintf($html, checked($store_as_front_page, true, false), __('Main store page', 'wp-e-commerce'), $dropdown);
    // enqueue the script that will dynamically inject this HTML
    wp_enqueue_script('wpsc-fix-reading-settings');
    wp_localize_script('wpsc-fix-reading-settings', 'WPSC_Fix_Reading', array('html' => $html, 'store_as_front_page' => $store_as_front_page));
}
开发者ID:benhuson,项目名称:WP-e-Commerce,代码行数:26,代码来源:admin.php


示例7: validate_field

 public function validate_field($value, $field_name)
 {
     $internal_name = substr($field_name, 5);
     // remove the wpsc_ part, WP core passes the whole option name
     $rules = explode('|', $this->form_array[$internal_name]['validation']);
     $field_title = $this->form_array[$internal_name]['title'];
     $field_id = $this->form_array[$internal_name]['id'];
     $valid = true;
     foreach ($rules as $rule) {
         if (is_callable($rule)) {
             $valid = $valid && call_user_func($rule, $value);
         } else {
             $valid = apply_filters('wpsc_settings_validation_rule_' . $rule, $valid, $value, $field_name, $field_title, $field_id);
         }
     }
     if (!$valid) {
         $value = wpsc_get_option($internal_name);
     }
     return $value;
 }
开发者ID:ashik968,项目名称:digiplot,代码行数:20,代码来源:settings-form.php


示例8: widget

 public function widget($args, $instance)
 {
     global $post;
     $instance = wp_parse_args($instance, $this->defaults);
     $title = apply_filters('widget_title', $instance['title']);
     extract($args);
     add_image_size('wpsc_product_widget_thumbnail', $instance['width'], $instance['height'], wpsc_get_option('crop_thumbnails'));
     $on_sale_products = get_posts(array('post_type' => 'wpsc-product', 'nopaging' => true, 'post_status' => array('publish', 'inherit'), 'meta_query' => array(array('key' => '_wpsc_special_price', 'value' => 0, 'compare' => '>', 'type' => 'NUMERIC'))));
     // extract products with no parents
     $products = wp_list_filter($on_sale_products, array('post_parent' => 0));
     // get parent of variations
     $parent_ids = array_unique(wp_list_pluck($on_sale_products, 'post_parent'));
     $parents = array();
     if (!empty($parent_ids)) {
         $parents = get_posts(array('post_type' => 'wpsc-product', 'nopaging' => true, 'post_status' => 'publish', 'post__in' => $parent_ids, 'post__not_in' => wp_list_pluck($products, 'ID')));
     }
     $products = array_merge($products, $parents);
     if (!empty($instance['post_count'])) {
         $products = array_slice($products, 0, $instance['post_count']);
     }
     include WPSC_TE_V2_SNIPPETS_PATH . '/widgets/on-sale/widget.php';
 }
开发者ID:osuarcher,项目名称:WP-e-Commerce,代码行数:22,代码来源:on-sale.php


示例9: _filter_field_category_filter

 public function _filter_field_category_filter($output, $field_array)
 {
     extract($field_array);
     $description_html = apply_filters('wpsc_settings_' . $name . '_description', $description, $field_array);
     if (!isset($class)) {
         $class = 'wpsc-settings-category-filter';
     }
     $output = '';
     $selected = wpsc_get_option('categories_to_filter');
     $output .= wpsc_form_radios($name, $selected, array('all' => _x('All categories', 'category filter settings', 'wpsc'), 'first_level' => _x('First level categories only', 'category filter settings', 'wpsc'), 'custom' => _x('Custom', 'category filter settings', 'wpsc')), array('id' => $id), false);
     $terms = get_terms('wpsc_product_category', array('hide_empty' => false));
     $options = array();
     foreach ($terms as $term) {
         $options[$term->term_id] = $term->name;
     }
     $selected = wpsc_get_option("categories_to_filter_custom");
     $output .= '<div class="wpsc-settings-category-filter-custom">';
     $output .= '<div class="wpsc-settings-category-filter-custom-all wpsc-settings-all-none">';
     $output .= sprintf(_x('Select: %1$s %2$s', 'select all / none', 'wpsc'), '<a href="#" data-for="' . $id . '-custom-select" class="wpsc-multi-select-all">' . _x('All', 'select all', 'wpsc') . '</a>', '<a href="#" data-for="' . $id . '-custom-select" class="wpsc-multi-select-none">' . _x('None', 'select none', 'wpsc') . '</a>');
     $output .= '</div>';
     $output .= wpsc_form_select("{$name}_custom[]", $selected, $options, array('id' => "{$id}-custom-select", 'class' => 'wpsc-multi-select', 'multiple' => 'multiple', 'size' => 5, 'data-placeholder' => __('Select categories', 'wpsc')), false);
     $output .= '</div>';
     return $output;
 }
开发者ID:osuarcher,项目名称:WP-e-Commerce,代码行数:24,代码来源:settings-presentation.php


示例10: wpsc_get_category_filter

function wpsc_get_category_filter($args = '')
{
    if (!wpsc_get_option('display_category_filter')) {
        return '';
    }
    if (!wpsc_is_store() && !wpsc_is_product_category()) {
        return '';
    }
    $defaults = array('before' => '<div class="%s">', 'after' => '</div>', 'before_cat_list' => '<ul class="%s">', 'after_cat_list' => '</ul>', 'before_drill_down' => '<ul class="%s">', 'after_drill_down' => '</ul>', 'before_item' => '<li class="%s">', 'after_item' => '</li>', 'before_divider' => '<span class="%s">', 'after_divider' => '</span>', 'before_drill_down_divider' => '<span class="%s">', 'after_drill_down_divider' => '<span class="%s">', 'divider' => '|', 'drill_down_divider' => '&raquo;', 'padding' => 1, 'all_text' => _x('All', 'category filter', 'wpsc'));
    $defaults = apply_filters('wpsc_get_category_filter_default_args', $defaults);
    $r = wp_parse_args($args, $defaults);
    extract($r);
    $before = sprintf($before, 'wpsc-category-filter');
    $before_cat_list = sprintf($before_cat_list, 'wpsc-category-filter-list');
    $before_drill_down = sprintf($before_drill_down, 'wpsc-category-filter-drill-down');
    $before_divider = sprintf($before_divider, 'wpsc-category-filter-divider');
    $before_drill_down_divider = sprintf($before_drill_down_divider, 'wpsc-category-filter-drill-down-divider');
    if ($padding) {
        $length = strlen($divider) + $padding * 2;
        $padding = str_repeat("&nbsp;", $padding);
        $divider = $padding . $divider . $padding;
        $drill_down_divider = $padding . $drill_down_divider . $padding;
    }
    $divider = $before_divider . $divider . $after_divider;
    $drill_down_divider = $before_drill_down_divider . $drill_down_divider . $after_drill_down_divider;
    $displayed_categories = _wpsc_get_filtered_categories();
    $ids = wp_list_pluck($displayed_categories, 'term_id');
    $filters = array();
    $drilldown = array();
    // When drill down is enabled and we're not on store page
    if (wpsc_get_option('category_filter_drill_down') && !wpsc_is_store()) {
        $term = get_queried_object();
        $current = $term;
        // we need to trace back this category ancestors, if none of its ancestors
        // is one of the categories selected in the settings, the filter is not
        // output
        $ancestor_is_displayed = in_array($term->term_id, $ids);
        $ancestors = array();
        while ($term->parent) {
            $term = get_term($term->parent, 'wpsc_product_category');
            $ancestors[] = $term;
            if (in_array($term->term_id, $ids)) {
                $ancestor_is_displayed = true;
                break;
            }
        }
        if (!$ancestor_is_displayed) {
            return '';
        }
        // First item is always "All"
        $before_all = sprintf($before_item, 'wpsc-category-filter-drill-down-item wpsc-category-filter-drill-down-item-all');
        $link = '<a href="' . esc_url(wpsc_get_store_url()) . '">' . esc_html_x('All', 'category filter', 'wpsc') . '</a>';
        $drilldown[] = $before_all . $link . $drill_down_divider . $after_item;
        $ancestors = array_reverse($ancestors);
        foreach ($ancestors as $ancestor) {
            $before_this_item = sprintf($before_item, 'wpsc-category-filter-drill-down-item');
            $url = add_query_arg('wpsc_category_filter', 1, wpsc_get_product_category_permalink($ancestor->term_id));
            $link = '<a href="' . esc_url($url) . '">' . esc_html($ancestor->name) . '</a>';
            $drilldown[] = $before_this_item . $link . $drill_down_divider . $after_item;
        }
        // current category
        $before_this_item = sprintf($before_item, 'wpsc-category-filter-drill-down-item wpsc-category-filter-drill-down-item-active');
        $url = add_query_arg('wpsc_category_filter', 1, wpsc_get_product_category_permalink($current->term_id));
        $link = '<a href="' . esc_url($url) . '">' . esc_html($current->name) . '</a>';
        $drilldown[] = $before_this_item . $link . $after_item;
        $displayed_categories = get_terms('wpsc_product_category', array('parent' => $current->term_id, 'hide_empty' => 0));
        // When drill down is disabled, or when it is enabled and we're on store page
    } else {
        // If we're in store page, just simply display all categories as selected in
        // Settings->Store->Presentation
        // if we're in the wrong category, don't display the filter
        $current = get_queried_object_id();
        if (!wpsc_is_store() && !in_array($current, $ids)) {
            return '';
        }
        // if we're not on store page, and the 'wpsc_category_filter' query arg
        // is not set to 1, don't display the filter
        if (!wpsc_is_store() && empty($_GET['wpsc_category_filter'])) {
            return '';
        }
        // First item is always "All"
        $before_all = sprintf($before_item, 'wpsc-category-filter-item wpsc-category-filter-item-all');
        $link = '<a href="' . esc_url(wpsc_get_store_url()) . '">' . esc_html_x('All', 'category filter', 'wpsc') . '</a>';
        $filters[] = $before_all . $link . $divider . $after_item;
    }
    $cats_count = count($displayed_categories);
    // Subsequent items are extracted from $displayed_categories
    for ($i = 0; $i < $cats_count; $i++) {
        $cat = $displayed_categories[$i];
        $classes = 'wpsc-category-filter-item';
        // mark current category
        if (!wpsc_is_store() && $cat->term_id == $current) {
            $classes .= ' wpsc-category-filter-item-active';
        }
        $before_this_item = sprintf($before_item, $classes);
        $url = add_query_arg('wpsc_category_filter', 1, wpsc_get_product_category_permalink($cat->term_id));
        $link = '<a href="' . esc_url($url) . '">' . esc_html($cat->name) . '</a>';
        $filter = $before_this_item . $link;
        if ($i < $cats_count - 1) {
            $filter .= $divider;
//.........这里部分代码省略.........
开发者ID:RJHanson292,项目名称:WP-e-Commerce,代码行数:101,代码来源:product.php


示例11: get_shipping_method_js_vars

 private function get_shipping_method_js_vars()
 {
     global $wpsc_cart;
     $js_var = array('subtotal' => (double) $wpsc_cart->calculate_subtotal(), 'shipping' => array(), 'tax' => wpsc_is_tax_enabled() && !wpsc_is_tax_included() ? (double) wpsc_cart_tax(false) : 0, 'discount' => wpsc_coupon_amount(false) > 0 ? wpsc_coupon_amount(false) : 0);
     foreach ($this->shipping_calculator->sorted_quotes as $module_name => $quotes) {
         foreach ($quotes as $option => $cost) {
             $id = $this->shipping_calculator->ids[$module_name][$option];
             $js_var['shipping'][$id] = $cost;
         }
     }
     $currency = new WPSC_Country(get_option('currency_type'));
     $currency_code = $currency->get_currency_code();
     $isocode = $currency->get_isocode();
     $without_fractions = in_array($currency_code, WPSC_Payment_Gateways::currencies_without_fractions());
     $decimals = $without_fractions ? 0 : 2;
     $decimals = apply_filters('wpsc_modify_decimals', $decimals, $isocode);
     $decimal_separator = apply_filters('wpsc_format_currency_decimal_separator', wpsc_get_option('decimal_separator'), $isocode);
     $thousands_separator = apply_filters('wpsc_format_currency_thousands_separator', wpsc_get_option('thousands_separator'), $isocode);
     $symbol = apply_filters('wpsc_format_currency_currency_symbol', $currency->get_currency_symbol());
     $sign_location = get_option('currency_sign_location');
     $js_var['formatter'] = array('currency_code' => $currency_code, 'without_fractions' => $without_fractions, 'decimals' => $decimals, 'decimal_separator' => $decimal_separator, 'thousands_separator' => $thousands_separator, 'symbol' => $symbol, 'sign_location' => $sign_location);
     return $js_var;
 }
开发者ID:androidprojectwork,项目名称:WP-e-Commerce,代码行数:23,代码来源:checkout.php


示例12: wpsc_add_products_per_row_class

function wpsc_add_products_per_row_class($classes)
{
    $layout = wpsc_get_option('layout');
    if ('grid' !== $layout) {
        return $classes;
    }
    $rows = wpsc_get_option('products_per_row');
    $classes[] = 'wpsc-column-' . $rows;
    return $classes;
}
开发者ID:benhuson,项目名称:WP-e-Commerce,代码行数:10,代码来源:template-engine.php


示例13: wpsc_get_breadcrumb


//.........这里部分代码省略.........
        if (!empty($product_categories)) {
            $parent = $product_categories[0];
            $context = get_query_var('wpsc_product_category');
            if ($context && in_array($context, wp_list_pluck($product_categories, 'slug'))) {
                $parent = get_term_by('slug', $context, 'wpsc_product_category');
            }
        }
    } elseif (wpsc_is_store()) {
        // if this is the main store, default the "current_text" argument to
        // the store title
        $pre_current_text = wpsc_get_store_title();
    } elseif (wpsc_is_product_category()) {
        // if this is a product category, find its parent category if it has
        // one
        $pre_current_text = wpsc_get_product_category_name();
        $term = get_queried_object();
        if ($term->parent) {
            $parent = get_term($term->parent, 'wpsc_product_category');
        }
    } elseif (wpsc_is_product_tag()) {
        // if this is a product tag, set "current_text" to the tag name by default
        $pre_current_text = wpsc_get_product_tag_name();
    } elseif (wpsc_is_customer_account()) {
        // if this is the customer account page
        $c = _wpsc_get_current_controller();
        // if we're displaying an order's details, set the parent to the
        // "Your Account" page
        if ($c->order_id) {
            $pre_current_text = $c->order_id;
            $parent = array(array('title' => __('Your Account', 'wp-e-commerce'), 'url' => wpsc_get_customer_account_url()));
        } else {
            // otherwise, set the "current_text" argument to "Your Account"
            $pre_current_text = __('Your Account', 'wp-e-commerce');
        }
    }
    $defaults = array('before' => '<ul class="%s">', 'after' => '</ul>', 'before_item' => '<li class="%s">', 'after_item' => '</li>', 'before_divider' => '<span class="%s">', 'after_divider' => '</span>', 'divider' => '&raquo;', 'padding' => 0, 'include_home' => true, 'home_text' => $pre_front_text, 'include_store' => true, 'store_text' => $pre_store_text, 'include_current' => true, 'current_text' => $pre_current_text);
    $defaults = apply_filters('wpsc_get_breadcrumb_default_args', $defaults);
    $r = array_merge($defaults, $args);
    extract($r);
    // replace placeholders in arguments
    $before = sprintf($before, 'wpsc-breadcrumb');
    $before_item = sprintf($before_item, 'wpsc-breadcrumb-item');
    $before_divider = sprintf($before_divider, 'wpsc-breadcrumb-divider');
    // if padding is set, prepare the length, padding string and divider
    if ($padding) {
        $length = strlen(html_entity_decode($divider, ENT_COMPAT, 'UTF-8')) + $padding * 2;
        $padding = str_repeat("&nbsp;", $length);
        $divider = $padding . $divider . $padding;
    }
    $divider = $before_divider . $divider . $after_divider;
    // generate the breadcrumb array in reverse
    $breadcrumbs = array();
    // include current page in breadcrumb
    if ($include_current && !empty($current_text)) {
        $before_current_item = sprintf($before_item, 'wpsc-breadcrumb-item wpsc-breadcrumb-current');
        $breadcrumbs[] = $before_current_item . $current_text . $after_item;
    }
    // include ancestors in breadcrumb
    $ancestors = array();
    // if the current page has a parent
    if ($parent) {
        if (is_array($parent)) {
            // if $parent is an array, then use the 'url' and 'title' elements
            foreach ($parent as $p) {
                $before_this_item = sprintf($before_item, 'wpsc-breadcrumb-item wpsc-breadcrumb-ancestor');
                $link = '<a href="' . esc_url($p['url']) . '">' . esc_html($p['title']) . '</a>';
                $breadcrumbs[] = $before_this_item . $link . $divider . $after_item;
            }
        } else {
            // if $parent is a term object, recursively find all ancestors and
            // include them in the breadcrumb array
            while (!is_wp_error($parent) && is_object($parent)) {
                if (in_array($parent->parent, $ancestors)) {
                    break;
                }
                $ancestors[] = $parent->parent;
                $before_this_item = sprintf($before_item, 'wpsc-breadcrumb-item wpsc-breadcrumb-ancestor');
                $link = '<a href="' . wpsc_get_product_category_permalink($parent) . '">' . esc_html($parent->name) . '</a>';
                $breadcrumbs[] = $before_this_item . $link . $divider . $after_item;
                $parent = get_term($parent->parent, 'wpsc_product_category');
            }
        }
    }
    // include the store link if this is not the main store itself
    if ($include_store && !empty($store_text) && !wpsc_is_store()) {
        $before_this_item = sprintf($before_item, 'wpsc-breadcrumb-item wpsc-breadcrumb-store');
        $link = '<a href="' . wpsc_get_store_url() . '">' . $store_text . '</a>';
        $breadcrumbs[] = $before_this_item . $link . $divider . $after_item;
    }
    // include the home link
    if ($include_home && !empty($home_text) && !is_home() && !wpsc_get_option('store_as_front_page')) {
        $before_this_item = sprintf($before_item, 'wpsc-breadcrumb-item wpsc-breadcrumb-home');
        $link = '<a href="' . trailingslashit(home_url()) . '">' . $home_text . '</a>';
        $breadcrumbs[] = $before_this_item . $link . $divider . $after_item;
    }
    // reverse the breadcrumb array
    $breadcrumbs = apply_filters('wpsc_breadcrumb_array', array_reverse($breadcrumbs), $r);
    $html = $before . implode('', $breadcrumbs) . $after;
    return apply_filters('wpsc_get_breadcrumb', $html, $breadcrumbs, $r);
}
开发者ID:benhuson,项目名称:WP-e-Commerce,代码行数:101,代码来源:general.php


示例14: _wpsc_filter_product_permalink

/**
 * Properly replace permalink tags with product's name and product category.
 *
 * This function also takes into account two settings if $canonical is false: whether to prefix
 * product permalink with product category, and whether hierarchical product category URL is enabled.
 *
 * @access private
 * @since 4.0
 * @uses   apply_filters()        Applies 'wpsc_product_permalink_canonical' filter if $canonical is true.
 * @uses   apply_filters()        Applies 'wpsc_product_permalink' filter if $canonical is false.
 * @uses   get_option()           Gets 'permalink_structure' option.
 * @uses   get_query_var()        Gets the current "wpsc_product_category" context of the product.
 * @uses   get_term()             Gets the ancestor terms.
 * @uses   get_term_by()          Gets parent term so that we can recursively get the ancestors.
 * @uses   is_wp_error()
 * @uses   user_trailingslashit()
 * @uses   wp_get_object_terms()  Gets the product categories associated with the product.
 * @uses   wp_list_pluck()        Plucks only the "slug" of the categories array.
 * @uses   wpsc_get_option()      Gets 'hierarchical_product_category_url' option.
 *
 * @param  string $permalink
 * @param  object $post
 * @param  bool   $leavename
 * @param  bool   $sample
 * @param  bool   $canonical Whether to return a canonical URL or not
 * @return string
 */
function _wpsc_filter_product_permalink($permalink, $post, $leavename, $sample, $canonical = false)
{
    // Define what to replace in the permalink
    $rewritecode = array('%wpsc_product_category%', $leavename ? '' : '%wpsc-product%');
    $category_slug = '';
    // only need to do this if a permalink structure is used
    $permalink_structure = get_option('permalink_structure');
    if (empty($permalink_structure) || $post->post_type != 'wpsc-product' || in_array($post->post_status, array('draft', 'pending'))) {
        return $permalink;
    }
    if (strpos($permalink, '%wpsc_product_category%') !== false) {
        $category_slug = 'uncategorized';
        $categories = wp_list_pluck(wp_get_object_terms($post->ID, 'wpsc_product_category'), 'slug');
        // if there are multiple product categories, choose an appropriate one based on the current
        // product category being viewed
        if (!empty($categories)) {
            $category_slug = $categories[0];
            $context = get_query_var('wpsc_product_category');
            if (!$canonical && $context && in_array($context, $categories)) {
                $category_slug = $context;
            }
        }
        // if hierarchical product category URL is enabled, we need to get the ancestors
        if (!$canonical && wpsc_get_option('hierarchical_product_category_url')) {
            $term = get_term_by('slug', $category_slug, 'wpsc_product_category');
            if (is_object($term)) {
                $ancestors = array($category_slug);
                while ($term->parent) {
                    $term = get_term($term->parent, 'wpsc_product_category');
                    if (in_array($term->slug, $ancestors) || is_wp_error($term)) {
                        break;
                    }
                    $ancestors[] = $term->slug;
                }
                $category_slug = implode('/', array_reverse($ancestors));
            }
        }
    }
    $rewritereplace = array($category_slug, $post->post_name);
    $permalink = str_replace($rewritecode, $rewritereplace, $permalink);
    $permalink = user_trailingslashit($permalink, 'single');
    if ($canonical) {
        return apply_filters('wpsc_product_permalink_canonical', $permalink, $post->ID);
    } else {
        return apply_filters('wpsc_product_permalink', $permalink, $post->ID);
    }
}
开发者ID:benhuson,项目名称:WP-e-Commerce,代码行数:74,代码来源:core.php


示例15: wpsc_get_customer_account_title

function wpsc_get_customer_account_title()
{
    return wpsc_get_option('customer_account_page_title');
}
开发者ID:ashik968,项目名称:digiplot,代码行数:4,代码来源:common.php


示例16: wpsc_is_style_enabled

function wpsc_is_style_enabled($style)
{
    return in_array($style, (array) wpsc_get_option('default_styles'));
}
开发者ID:ashik968,项目名称:digiplot,代码行数:4,代码来源:css.php


示例17: wpsc_action_set_product_per_page_query_var

/**
 * Override the per page parameter to use WPEC own "products per page" option.
 *
 * @since 4.0
 * @uses  WP_Query::is_main_query()
 * @uses  wpsc_get_option()            Gets WPEC 'products_per_page' option.
 * @uses  wpsc_is_pagination_enabled()
 * @uses  wpsc_is_store()
 * @uses  wpsc_is_product_category()
 * @uses  wpsc_is_product_tag()
 *
 * @param  object $query
 */
function wpsc_action_set_product_per_page_query_var($query)
{
    if (is_single()) {
        return;
    }
    if (wpsc_is_pagination_enabled() && $query->is_main_query() && (wpsc_is_store() || wpsc_is_product_category() || wpsc_is_product_tag())) {
        $query->set('posts_per_archive_page', wpsc_get_option('products_per_page'));
    }
}
开发者ID:ashik968,项目名称:digiplot,代码行数:22,代码来源:template-engine.php


示例18: _wpsc_action_check_thumbnail_support

function _wpsc_action_check_thumbnail_support()
{
    if (!current_theme_supports('post-thumbnails')) {
        add_theme_support('post-thumbnails');
        add_action('init', '_wpsc_action_remove_post_type_thumbnail_support');
    }
    $crop = wpsc_get_option('crop_thumbnails');
    add_image_size('wpsc_product_single_thumbnail', get_option('single_view_image_width'), get_option('single_view_image_height'), $crop);
    add_image_size('wpsc_product_archive_thumbnail', get_option('product_image_width'), get_option('product_image_height'), $crop);
    add_image_size('wpsc_product_taxonomy_thumbnail', get_option('category_image_width'), get_option('category_image_height'), $crop);
    add_image_size('wpsc_product_admin_thumbnail', 50, 50, $crop);
    add_image_size('wpsc_product_cart_thumbnail', 64, 64, $crop);
}
开发者ID:ashik968,项目名称:digiplot,代码行数:13,代码来源:settings.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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