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


PHP shopp_setting函数代码示例

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


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

示例1: __construct

 function __construct()
 {
     if ('none' == shopp_setting('account_system')) {
         return parent::__construct('shopp-order-lookup', __('Shopp Order Lookup', 'Shopp'), array('description' => __('Lookup orders by order number and email', 'Shopp')));
     }
     parent::__construct('shopp-account', __('Shopp Account', 'Shopp'), array('description' => __('Customer account management dashboard', 'Shopp')));
 }
开发者ID:forthrobot,项目名称:inuvik,代码行数:7,代码来源:account.php

示例2: options

 /**
  * Builds a list of payment method options
  *
  * @author Jonathan Davis
  * @since 1.1.5
  *
  * @return void
  **/
 public function options()
 {
     $options = array();
     $accepted = array();
     $processors = array();
     $gateways = explode(',', shopp_setting('active_gateways'));
     foreach ($gateways as $gateway) {
         $id = false;
         if (false !== strpos($gateway, '-')) {
             list($module, $id) = explode('-', $gateway);
         } else {
             $module = $gateway;
         }
         $GatewayModule = $this->modules($module);
         if (!$GatewayModule) {
             continue;
         }
         if ($GatewayModule->secure) {
             $this->secure = true;
         }
         $settings = $GatewayModule->settings;
         if (false !== $id && isset($settings[$id])) {
             $settings = $settings[$id];
         }
         $slug = sanitize_title_with_dashes($settings['label']);
         $PaymentOption = new ShoppPaymentOption($slug, $settings['label'], $GatewayModule->module, $gateway, array_keys($GatewayModule->cards()));
         $options[$slug] = $PaymentOption;
         $processors[$PaymentOption->processor] = $slug;
         $accepted = array_merge($accepted, $GatewayModule->cards());
     }
     $this->populate($options);
     $this->cards = $accepted;
     $this->processors = $processors;
 }
开发者ID:forthrobot,项目名称:inuvik,代码行数:42,代码来源:Payments.php

示例3: screen

 public function screen()
 {
     $Shopp = Shopp::object();
     if (!current_user_can('shopp_settings_checkout')) {
         wp_die(__('You do not have sufficient permissions to access this page.'));
     }
     $purchasetable = ShoppDatabaseObject::tablename(ShoppPurchase::$table);
     $next = sDB::query("SELECT IF ((MAX(id)) > 0,(MAX(id)+1),1) AS id FROM {$purchasetable} LIMIT 1");
     $next_setting = shopp_setting('next_order_id');
     if ($next->id > $next_setting) {
         $next_setting = $next->id;
     }
     $term_recount = false;
     if (!empty($_POST['save'])) {
         check_admin_referer('shopp-setup-management');
         $next_order_id = $_POST['settings']['next_order_id'] = intval($_POST['settings']['next_order_id']);
         if ($next_order_id >= $next->id) {
             if (sDB::query("ALTER TABLE {$purchasetable} AUTO_INCREMENT=" . sDB::escape($next_order_id))) {
                 $next_setting = $next_order_id;
             }
         }
         $_POST['settings']['order_shipfee'] = Shopp::floatval($_POST['settings']['order_shipfee']);
         // Recount terms when this setting changes
         if (isset($_POST['settings']['inventory']) && $_POST['settings']['inventory'] != shopp_setting('inventory')) {
             $term_recount = true;
         }
         shopp_set_formsettings();
         $this->notice(Shopp::__('Management settings saved.'), 'notice', 20);
     }
     if ($term_recount) {
         $taxonomy = ProductCategory::$taxon;
         $terms = get_terms($taxonomy, array('hide_empty' => 0, 'fields' => 'ids'));
         if (!empty($terms)) {
             wp_update_term_count_now($terms, $taxonomy);
         }
     }
     $states = array(__('Map the label to an order state:', 'Shopp') => array_merge(array('' => ''), Lookup::txnstatus_labels()));
     $statusLabels = shopp_setting('order_status');
     $statesLabels = shopp_setting('order_states');
     $reasonLabels = shopp_setting('cancel_reasons');
     if (empty($reasonLabels)) {
         $reasonLabels = array(__('Not as described or expected', 'Shopp'), __('Wrong size', 'Shopp'), __('Found better prices elsewhere', 'Shopp'), __('Product is missing parts', 'Shopp'), __('Product is defective or damaaged', 'Shopp'), __('Took too long to deliver', 'Shopp'), __('Item out of stock', 'Shopp'), __('Customer request to cancel', 'Shopp'), __('Item discontinued', 'Shopp'), __('Other reason', 'Shopp'));
     }
     $promolimit = array('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '15', '20', '25');
     $lowstock = shopp_setting('lowstock_level');
     if (empty($lowstock)) {
         $lowstock = 0;
     }
     include $this->ui('management.php');
 }
开发者ID:forthrobot,项目名称:inuvik,代码行数:50,代码来源:OrdersSettings.php

示例4: chartseries

 function chartseries($label, array $options = array())
 {
     if (!$this->Chart) {
         $this->initchart();
     }
     extract($options);
     if ($record->stocked == 0) {
         return;
     }
     $threshold = shopp_setting('lowstock_level');
     $warning = $record->inventory / $record->stocked * 100 < $threshold;
     $this->Chart->series($record->product, array('color' => $warning ? '#A90007' : '#CB4B16', 'data' => array(array($index, $record->stocked))));
     $backordered = 0 > $record->inventory;
     $this->Chart->series($record->product, array('color' => $backordered ? '#dc322f' : '#1C63A8', 'data' => array(array($index, $record->inventory))));
 }
开发者ID:forthrobot,项目名称:inuvik,代码行数:15,代码来源:inventory.php

示例5: getCountryID

 function getCountryID()
 {
     return 209;
     $country = strtoupper(shopp_setting('base_operations'));
     switch ($country) {
         case 'SE':
             return 209;
         case 'FI':
             return 73;
         case 'DK':
             return 59;
         case 'NO':
             return 164;
         default:
             return 209;
     }
 }
开发者ID:ben72,项目名称:billmate-shopp,代码行数:17,代码来源:commonfunctions.php

示例6: 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::__('&quot;%s&quot; 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

示例7: settings

 /**
  * Filters the tax settings based on
  *
  * @author Jonathan Davis
  * @since 1.3
  *
  * @return array A list of tax rate settings
  **/
 public function settings()
 {
     if (!shopp_setting_enabled('taxes')) {
         return false;
     }
     $taxrates = shopp_setting('taxrates');
     $fallbacks = array();
     $settings = array();
     foreach ((array) $taxrates as $setting) {
         $defaults = array('rate' => 0, 'country' => '', 'zone' => '', 'haslocals' => false, 'logic' => 'any', 'rules' => array(), 'localrate' => 0, 'compound' => false, 'label' => Shopp::__('Tax'));
         $setting = array_merge($defaults, $setting);
         extract($setting);
         if (!$this->taxcountry($country)) {
             continue;
         }
         if (!$this->taxzone($zone)) {
             continue;
         }
         if (!$this->taxrules($rules, $logic)) {
             continue;
         }
         // Capture fall back tax rates
         if (empty($zone) && self::ALL == $country) {
             $fallbacks[] = $setting;
             continue;
         }
         $key = hash('crc32b', serialize($setting));
         // Key settings before local rates
         $setting['localrate'] = 0;
         if (isset($setting['locals']) && is_array($setting['locals']) && isset($setting['locals'][$this->address['locale']])) {
             $setting['localrate'] = $setting['locals'][$this->address['locale']];
         }
         $settings[$key] = $setting;
     }
     if (empty($settings) && !empty($fallbacks)) {
         $settings = $fallbacks;
     }
     $settings = apply_filters('shopp_cart_taxrate_settings', $settings);
     // @deprecated Use shopp_tax_rate_settings instead
     return apply_filters('shopp_tax_rate_settings', $settings);
 }
开发者ID:forthrobot,项目名称:inuvik,代码行数:49,代码来源:Tax.php

示例8: updates

 public function updates()
 {
     $builtin_path = SHOPP_PATH . '/templates';
     $theme_path = sanitize_path(STYLESHEETPATH . '/shopp');
     if (Shopp::str_true($this->form('theme_templates')) && !is_dir($theme_path)) {
         $this->form['theme_templates'] = 'off';
         $this->notice(Shopp::__("Shopp theme templates can't be used because they don't exist."), 'error');
     }
     if (empty($this->form('catalog_pagination'))) {
         $this->form['catalog_pagination'] = 0;
     }
     // Recount terms when this setting changes
     if ($this->form('outofstock_catalog') != shopp_setting('outofstock_catalog')) {
         $taxonomy = ProductCategory::$taxon;
         $terms = get_terms($taxonomy, array('hide_empty' => 0, 'fields' => 'ids'));
         if (!empty($terms)) {
             wp_update_term_count_now($terms, $taxonomy);
         }
     }
     shopp_set_formsettings();
     $this->notice(Shopp::__('Presentation settings saved.'), 'notice', 20);
 }
开发者ID:forthrobot,项目名称:inuvik,代码行数:22,代码来源:Presentation.php

示例9: save_meta_box

function save_meta_box($Category)
{
    $Shopp = Shopp::object();
    $workflows = array("continue" => __('Continue Editing', 'Shopp'), "close" => __('Category Manager', 'Shopp'), "new" => __('New Category', 'Shopp'), "next" => __('Edit Next', 'Shopp'), "previous" => __('Edit Previous', 'Shopp'));
    ?>
	<div id="major-publishing-actions">
		<input type="hidden" name="id" value="<?php 
    echo $Category->id;
    ?>
" />
		<select name="settings[workflow]" id="workflow">
		<?php 
    echo Shopp::menuoptions($workflows, shopp_setting('workflow'), true);
    ?>
		</select>
		<input type="submit" class="button-primary" name="save" value="<?php 
    _e('Update', 'Shopp');
    ?>
" />
	</div>
<?php 
}
开发者ID:forthrobot,项目名称:inuvik,代码行数:22,代码来源:ui.php

示例10: screen

 public function screen()
 {
     if (!current_user_can('shopp_settings')) {
         wp_die(__('You do not have sufficient permissions to access this page.'));
     }
     // Welcome screen handling
     if (!empty($_POST['setup'])) {
         shopp_set_setting('display_welcome', 'off');
     }
     $countries = ShoppLookup::countries();
     $basecountry = ShoppBaseLocale()->country();
     $countrymenu = Shopp::menuoptions($countries, $basecountry, true);
     $basestates = ShoppLookup::country_zones(array($basecountry));
     $statesmenu = Shopp::menuoptions($basestates[$basecountry], ShoppBaseLocale()->state(), true);
     $targets = shopp_setting('target_markets');
     if (is_array($targets)) {
         $targets = array_map('stripslashes', $targets);
     }
     if (!$targets) {
         $targets = array();
     }
     $zones_ajaxurl = wp_nonce_url(admin_url('admin-ajax.php'), 'wp_ajax_shopp_country_zones');
     include $this->ui('setup.php');
 }
开发者ID:forthrobot,项目名称:inuvik,代码行数:24,代码来源:Setup.php

示例11: save

 public function save(ShoppCustomer $Customer)
 {
     if ($this->request('new')) {
         if (!isset($this->valid_email)) {
             return $this->notice(Shopp::__('Could not create new customer. You must enter a valid email address.'));
         }
         if (!isset($this->valid_password)) {
             $this->password = wp_hash_password(wp_generate_password(12, true));
         }
         if ('wordpress' !== shopp_setting('account_system')) {
             $wpuser = $Customer->create_wpuser();
             $login = '<strong>' . sanitize_user($this->form('userlogin')) . '</strong>';
             if ($wpuser) {
                 $this->notice(Shopp::__('A new customer has been created with the WordPress login &quot;%s&quot;.', $login), 'error');
             } else {
                 $this->notice(Shopp::__('Could not create the WordPress login &quot;%s&quot; for the new customer.', $login), 'error');
             }
         }
         $this->notice(Shopp::__('New customer created.'));
     }
     $Customer->save();
 }
开发者ID:forthrobot,项目名称:inuvik,代码行数:22,代码来源:Customers.php

示例12: process

 public static function process()
 {
     // We have to avoid truthiness, hence the strange logic expression
     if (true !== apply_filters('shopp_validate_registration', true)) {
         return;
     }
     $Customer = ShoppOrder()->Customer;
     do_action('shopp_customer_registration', $Customer);
     if ($Customer->session(ShoppCustomer::GUEST)) {
         $Customer->type = __('Guest', 'Shopp');
         // No cuts
         $Customer->wpuser = 0;
         // No buts
         unset($Customer->password);
         // No coconuts
     } else {
         // WordPress account integration used, customer has no wp user
         if ('wordpress' == shopp_setting('account_system') && empty($Customer->wpuser)) {
             if ($wpuser = get_current_user_id()) {
                 $Customer->wpuser = $wpuser;
             } else {
                 $Customer->create_wpuser();
             }
             // not logged in, create new account
         }
         if (!$Customer->exists(true)) {
             $Customer->id = false;
             shopp_debug('Creating new Shopp customer record');
             if (empty($Customer->password)) {
                 $Customer->password = wp_generate_password(12, true);
             }
             if ('shopp' == shopp_setting('account_system')) {
                 $Customer->notification();
             }
             $Customer->password = wp_hash_password($Customer->password);
             if (isset($Customer->passhash)) {
                 $Customer->password = $Customer->passhash;
             }
         } else {
             unset($Customer->password);
         }
         // Existing customer, do not overwrite password field!
     }
     // New customer, save hashed password
     $Customer->save();
     $Customer->password = '';
     // Update billing and shipping addresses
     $addresses = array('Billing', 'Shipping');
     foreach ($addresses as $Address) {
         if (empty(ShoppOrder()->{$Address}->address)) {
             continue;
         }
         $Address = ShoppOrder()->{$Address};
         $Address->customer = $Customer->id;
         $Address->save();
     }
     do_action('shopp_customer_registered', $Customer);
     // Auto-login
     $Customer->login();
     // Login the customer
     if (!empty($Customer->wpuser)) {
         // Log the WordPress user in
         ShoppLogin::wpuser(get_user_by('id', $Customer->wpuser));
     }
     if (apply_filters('shopp_registration_redirect', false)) {
         Shopp::redirect(Shopp::url(false, 'account'));
     }
 }
开发者ID:msigley,项目名称:shopp,代码行数:68,代码来源:Registration.php

示例13: state

 /**
  * Helper method to render markup for state/province input fields
  *
  * @internal
  * @since 1.3
  *
  * @param string        $result  The output
  * @param array         $options The options
  * - **mode**: `input` (input, value) Displays the field `input` or the current value of the property
  * - **type**: `menu` (menu, text) Changes the input type to a drop-down menu or text input field
  * - **options**: A comma-separated list of options for the drop-down menu when the **type** is set to `menu`
  * - **required**: `auto` (auto,on,off) Sets the field to be required automatically, always `on` or disabled `off`
  * - **class**: The class attribute specifies one or more class-names for the input
  * - **label**: The label shown as the default option of the drop-down menu when the **type** is set to `menu`
  * - **address**: `billing` (billing,shipping) Used to specify which address the field takes input for
  * @param ShoppCustomer $O       The working object
  * @return string The state input markup
  **/
 private static function state($result, $options, $O)
 {
     $defaults = array('mode' => 'input', 'type' => 'menu', 'options' => '', 'required' => 'auto', 'class' => '', 'label' => '', 'address' => 'billing');
     $options = array_merge($defaults, $options);
     $options['address'] = self::valid_address($options['address']);
     $Address = self::AddressObject($options['address']);
     if (!isset($options['value'])) {
         $options['value'] = $Address->state;
     }
     $options['selected'] = $options['value'];
     $options['id'] = "{$options['address']}-state";
     extract($options, EXTR_SKIP);
     if ('value' == $mode) {
         return $value;
     }
     $countries = (array) shopp_setting('target_markets');
     $select_attrs = array('title', 'required', 'class', 'disabled', 'required', 'size', 'tabindex', 'accesskey');
     $country = ShoppBaseLocale()->country();
     if (!empty($Address->country)) {
         $country = $Address->country;
     }
     if (!array_key_exists($country, $countries)) {
         $country = key($countries);
     }
     $regions = Lookup::country_zones();
     $states = isset($regions[$country]) ? $regions[$country] : array();
     if (!empty($options['options']) && empty($states)) {
         $states = explode(',', $options['options']);
     }
     $classes = false === strpos($class, ' ') ? explode(' ', $class) : array();
     $classes[] = $id;
     if ('auto' == $required) {
         unset($options['required']);
         // prevent inputattrs from handling required=auto
         $classes[] = 'auto-required';
     }
     $options['class'] = join(' ', $classes);
     if ('text' == $type) {
         return '<input type="text" name="' . $address . '[state]" id="' . $id . '" ' . inputattrs($options) . '/>';
     }
     $options['disabled'] = 'disabled';
     $options['class'] = join(' ', array_merge($classes, array('disabled', 'hidden')));
     $result = '<select name="' . $address . '[state]" id="' . $id . '-menu" ' . inputattrs($options, $select_attrs) . '>' . '<option value="">' . $label . '</option>' . (!empty($states) ? menuoptions($states, $selected, true) : '') . '</select>';
     unset($options['disabled']);
     $options['class'] = join(' ', $classes);
     $result .= '<input type="text" name="' . $address . '[state]" id="' . $id . '" ' . inputattrs($options) . '/>';
     return $result;
 }
开发者ID:forthrobot,项目名称:inuvik,代码行数:66,代码来源:customer.php

示例14: __construct

 public function __construct(ShoppReportFramework $Report)
 {
     $this->ReportClass = get_class($Report);
     $this->options = $Report->options;
     $Report->load();
     $this->columns = $Report->columns();
     $this->data = $Report->data;
     $this->records = $Report->total;
     $report = $this->options['report'];
     $settings = shopp_setting("{$report}_report_export");
     $this->headings = Shopp::str_true($settings['headers']);
     $this->selected = $settings['columns'];
 }
开发者ID:msigley,项目名称:shopp,代码行数:13,代码来源:Reports.php

示例15: functions

 /**
  * Loads the theme templates `shopp/functions.php` if present
  *
  * If theme content templates are enabled, checks for and includes a functions.php file (if present).
  * This allows developers to add Shopp-specific presentation logic with the added convenience of knowing
  * that shopp_init has run.
  *
  * @author Barry Hughes
  * @since 1.3
  *
  * @return void
  **/
 public static function functions()
 {
     if (!Shopp::str_true(shopp_setting('theme_templates'))) {
         return;
     }
     Shopp::locate_template(array('functions.php'), true);
 }
开发者ID:forthrobot,项目名称:inuvik,代码行数:19,代码来源:API.php


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