public function screen() { $status = 'available'; if (!is_dir($this->theme_path)) { $status = 'directory'; } else { if (!is_writable($this->theme_path)) { $status = 'permissions'; } else { $builtin = array_filter(scandir($this->template_path), 'filter_dotfiles'); $theme = array_filter(scandir($this->theme_path), 'filter_dotfiles'); if (empty($theme)) { $status = 'ready'; } elseif (array_diff($builtin, $theme)) { $status = 'incomplete'; } } } $category_views = array('grid' => Shopp::__('Grid'), 'list' => Shopp::__('List')); $row_products = array(2, 3, 4, 5, 6, 7); $productOrderOptions = ProductCategory::sortoptions(); $productOrderOptions['custom'] = Shopp::__('Custom'); $orderOptions = array('ASC' => Shopp::__('Order'), 'DESC' => Shopp::__('Reverse Order'), 'RAND' => Shopp::__('Shuffle')); $orderBy = array('sortorder' => Shopp::__('Custom arrangement'), 'created' => Shopp::__('Upload date')); include $this->ui('presentation.php'); }
public function updates() { if (!isset($_POST['resetlog'])) { return; } ShoppErrorLogging()->reset(); $this->notice(Shopp::__('The log file has been reset.')); }
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'); }
/** * 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); }
public function updates() { if (!isset($_POST['settings']['target_markets'])) { asort($_POST['settings']['target_markets']); } // Save all other settings shopp_set_formsettings(); $update = false; // Update country changes $country = ShoppBaseLocale()->country(); if ($country != $this->form('country')) { $country = strtoupper($this->form('country')); $countries = ShoppLookup::countries(); // Validate the country if (!isset($countries[$country])) { return $this->notice(Shopp::__('The country provided is not valid.'), 'error'); } $update = true; } // Update state changes $state = ShoppBaseLocale()->state(); if (ShoppBaseLocale()->state() != $this->form('state')) { $state = strtoupper($this->form('state')); $states = ShoppLookup::country_zones(array($country)); // Validate the state if (!empty($states) && !isset($states[$country][$state])) { return $this->notice(Shopp::__('The %s provided is not valid.', ShoppBaseLocale()->division()), 'error'); } $update = true; } // Save base locale changes if ($update) { ShoppBaseLocale()->save($country, $state); } $this->notice(Shopp::__('Shopp settings saved.')); }
public function column_name($Item) { echo '<a class="row-title edit" href="' . $editurl . '" title="' . Shopp::__('Edit') . ' "' . esc_attr($Item->name) . '"">' . esc_html($Item->name) . '</a>'; $edit_link = wp_nonce_url(add_query_arg('id', $Item->id), 'shopp-settings-images'); $delete_link = wp_nonce_url(add_query_arg('delete', $Item->id), 'shopp-settings-images'); echo $this->row_actions(array('edit' => '<a class="edit" href="' . $edit_link . '">' . __('Edit') . '</a>', 'delete' => '<a class="delete" href="' . $delete_link . '">' . __('Delete') . '</a>')); }
?> <br /> <?php if (!empty($operations['country'])) { ?> <strong><?php Shopp::_e('Currency'); ?> : </strong><?php echo Shopp::money(1000.0); ?> <?php if (shopp_setting_enabled('tax_inclusive')) { ?> <strong>(+<?php echo strtolower(Shopp::__('Tax')); ?> )</strong><?php } ?> <?php } ?> </td> </tr> <tr> <th scope="row" valign="top"><label for="target_markets"><?php Shopp::_e('Target Markets'); ?> </label></th> <td>
All of these advanced searches can be used: ', 'Customers Manager help tab') . $table; $Exporting = Shopp::_mx('### Exporting Customers can be exported in a variety of formats with any number of customer data columns needed. **Shopp supported order export formats:** * Tab-separated.txt * Comma-separated.csv * Microsoft© Excel.xls For Tab-separated, comma-separated and Microsoft® Excel file formats select the columns to include for each record in the export. Enable the Include column headings option to include column names in the first line of the export file. ### Continuous Periodic Exports Using filtering and searching you can isolate specific orders to export. Additionally, using date range filtering you can set up periodic exporting. Shopp stores the end date of each export that has date range filters enabled. This allows selecting the Last Export option from the date range drop-down menu which will automatically set the start field to the end date of the last completed export, and the end date field will be set to today’s current date.', 'Customers Manager help tab'); $sidebar = Shopp::_mx('**For more information:** [Shopp User Guide](%s) [Community Forums](%s) [Shopp Support Help Desk](%s)', 'Customers Manager help tab (sidebar)', ShoppSupport::DOCS . 'orders-customers/customer-manager/', ShoppSupport::FORUMS, ShoppSupport::SUPPORT); get_current_screen()->add_help_tab(array('id' => 'overview', 'title' => Shopp::__('Overview'), 'content' => $Overview)); get_current_screen()->add_help_tab(array('id' => 'filtering', 'title' => Shopp::__('Filtering'), 'content' => $Filtering)); get_current_screen()->add_help_tab(array('id' => 'exporting', 'title' => Shopp::__('Exporting'), 'content' => $Exporting)); get_current_screen()->add_help_tab(array('id' => 'search', 'title' => Shopp::__('Search'), 'content' => $Search)); get_current_screen()->set_help_sidebar($sidebar);
<tr> <td scope="row" valign="top" class="rate"><input type="text" name="settings[taxrates][${id}][rate]" id="tax-rate" value="${rate}" size="7" class="selectall" tabindex="1" /><br /><label for="tax-rate"><?php _e('Tax Rate', 'Shopp'); ?> </label><br /> <input type="hidden" name="settings[taxrates][${id}][compound]" value="off" /><label><input type="checkbox" id="tax-compound" name="settings[taxrates][${id}][compound]" value="on" ${compounded} tabindex="4" /> <?php Shopp::_e('Compound'); ?> </label></td> <td scope="row" class="conditions"> <select name="settings[taxrates][${id}][country]" class="country" tabindex="2">${countries}</select><select name="settings[taxrates][${id}][zone]" class="zone no-zones" tabindex="3">${zones}</select> <?php echo ShoppUI::button('add', 'addrule'); ?> <?php $options = array('any' => Shopp::__('any'), 'all' => strtolower(Shopp::__('All'))); $menu = '<select name="settings[taxrates][${id}][logic]" class="logic">' . menuoptions($options, false, true) . '</select>'; ?> <div class="conditionals no-conditions"> <p><label><?php printf(__('Apply tax rate when %s of the following conditions match', 'Shopp'), $menu); ?> :</label></p> <ul> ${conditions} </ul> </div> </td> <td> <div class="local-rates panel subpanel no-local-rates"> <div class="label"><label><?php
public function label() { return Shopp::__('Shipping'); }
/** * Renders the recent orders dashboard widget * * @author Jonathan Davis * @since 1.0 * * @return void **/ public static function orders_widget($args = false) { $defaults = array('before_widget' => '', 'before_title' => '', 'widget_name' => '', 'after_title' => '', 'after_widget' => ''); $args = array_merge($defaults, (array) $args); extract($args, EXTR_SKIP); $statusLabels = shopp_setting('order_status'); echo $before_widget; echo $before_title; echo $widget_name; echo $after_title; $purchasetable = ShoppDatabaseObject::tablename(ShoppPurchase::$table); $purchasedtable = ShoppDatabaseObject::tablename(Purchased::$table); $txnlabels = Lookup::txnstatus_labels(); if (!($Orders = get_transient('shopp_dashboard_orders'))) { $Orders = sDB::query("SELECT p.*,count(*) as items FROM (SELECT * FROM {$purchasetable} WHERE txnstatus != 'purchased' AND txnstatus != 'invoiced' ORDER BY created DESC LIMIT 6) AS p LEFT JOIN {$purchasedtable} AS i ON i.purchase=p.id GROUP BY p.id ORDER BY p.id DESC", 'array'); set_transient('shopp_dashboard_orders', $Orders, 90); // Keep for the next 1 minute } if (!empty($Orders)) { echo '<table class="widefat">' . '<thead>' . ' <tr>' . ' <th scope="col">' . __('Name', 'Shopp') . '</th>' . ' <th scope="col">' . __('Date', 'Shopp') . '</th>' . ' <th scope="col" class="num">' . Shopp::__('Items') . '</th>' . ' <th scope="col" class="num">' . Shopp::__('Total') . '</th>' . ' <th scope="col" class="num">' . Shopp::__('Status') . '</th>' . ' </tr>' . '</thead>' . ' <tbody id="orders" class="list orders">'; $even = false; foreach ($Orders as $Order) { $classes = array(); if ($even = !$even) { $classes[] = 'alternate'; } $txnstatus = isset($txnlabels[$Order->txnstatus]) ? $txnlabels[$Order->txnstatus] : $Order->txnstatus; $status = isset($statusLabels[$Order->status]) ? $statusLabels[$Order->status] : $Order->status; $contact = '' == $Order->firstname . $Order->lastname ? '(no contact name)' : $Order->firstname . ' ' . $Order->lastname; $url = add_query_arg(array('page' => ShoppAdmin()->pagename('orders'), 'id' => $Order->id), admin_url('admin.php')); $classes[] = strtolower(preg_replace('/[^\\w]/', '_', $Order->txnstatus)); echo '<tr class="' . join(' ', $classes) . '">' . ' <td><a class="row-title" href="' . $url . '" title="View "Order ' . $Order->id . '"">' . (empty($Order->firstname) && empty($Order->lastname) ? '(no contact name)' : $Order->firstname . ' ' . $Order->lastname) . '</a></td>' . ' <td>' . date("Y/m/d", mktimestamp($Order->created)) . '</td>' . ' <td class="num items">' . $Order->items . '</td>' . ' <td class="num total">' . money($Order->total) . '</td>' . ' <td class="num status">' . $statusLabels[$Order->status] . '</td>' . '</tr>'; } echo '</tbody></table>'; } else { echo '<p>' . Shopp::__('No orders, yet.') . '</p>'; } echo $after_widget; }
public static function rules() { $rules = apply_filters('shopp_discount_rules', array('Name' => Shopp::__('Name'), 'Category' => Shopp::__('Category'), 'Variation' => Shopp::__('Variation'), 'Price' => Shopp::__('Price'), 'Sale price' => Shopp::__('Sale price'), 'Type' => Shopp::__('Type'), 'In stock' => Shopp::__('In stock'), 'Tag name' => Shopp::__('Tag name'), 'Unit price' => Shopp::__('Unit price'), 'Total price' => Shopp::__('Total price'), 'Input name' => Shopp::__('Input name'), 'Input value' => Shopp::__('Input value'), 'Quantity' => Shopp::__('Quantity'), 'Any item name' => Shopp::__('Any item name'), 'Any item amount' => Shopp::__('Any item amount'), 'Any item quantity' => Shopp::__('Any item quantity'), 'Total quantity' => Shopp::__('Total quantity'), 'Shipping amount' => Shopp::__('Shipping amount'), 'Subtotal amount' => Shopp::__('Subtotal amount'), 'Discount amount' => Shopp::__('Discount amount'), 'Customer type' => Shopp::__('Customer type'), 'Ship-to country' => Shopp::__('Ship-to country'), 'Promo code' => Shopp::__('Discount code'), 'Promo use count' => Shopp::__('Discount use count'), 'Discounts applied' => Shopp::__('Discounts applied'), 'Is equal to' => Shopp::__('Is equal to'), 'Is not equal to' => Shopp::__('Is not equal to'), 'Contains' => Shopp::__('Contains'), 'Does not contain' => Shopp::__('Does not contain'), 'Begins with' => Shopp::__('Begins with'), 'Ends with' => Shopp::__('Ends with'), 'Is greater than' => Shopp::__('Is greater than'), 'Is greater than or equal to' => Shopp::__('Is greater than or equal to'), 'Is less than' => Shopp::__('Is less than'), 'Is less than or equal to' => Shopp::__('Is less than or equal to'))); echo json_encode($rules); }
<tr class="<?php echo $classes; ?> " rel="<?php echo $Category->slug; ?> "> <td><button type="button" name="top" alt="<?php $title = Shopp::__('Move to the top…'); echo $title; ?> " class="shoppui-step-top"><span class="hidden"><?php echo $title; ?> </span></button><button type="button" name="bottom" alt="<?php $title = Shopp::__('Move to the bottom…'); echo $title; ?> " class="shoppui-step-bottom"><span class="hidden"><?php echo $title; ?> </span></button><a class='row-title' href='<?php echo $editurl; ?> ' title='<?php _e('Edit', 'Shopp'); ?> "<?php echo $CategoryName; ?> "'><?php
public function downloads() { if (!current_user_can('shopp_settings_checkout')) { wp_die(__('You do not have sufficient permissions to access this page.')); } $downloads = array('1', '2', '3', '5', '10', '15', '25', '100'); $time = array('1800' => Shopp::__('%d minutes', 30), '3600' => Shopp::__('%d hour', 1), '7200' => Shopp::__('%d hours', 2), '10800' => Shopp::__('%d hours', 3), '21600' => Shopp::__('%d hours', 6), '43200' => Shopp::__('%d hours', 12), '86400' => Shopp::__('%d day', 1), '172800' => Shopp::__('%d days', 2), '259200' => Shopp::__('%d days', 3), '604800' => Shopp::__('%d week', 1), '2678400' => Shopp::__('%d month', 1), '7952400' => Shopp::__('%d months', 3), '15901200' => Shopp::__('%d months', 6), '31536000' => Shopp::__('%d year', 1)); if (!empty($_POST['save'])) { check_admin_referer('shopp-settings-downloads'); shopp_set_formsettings(); $this->notice(Shopp::__('Downloads settings saved.'), 'notice', 20); } include $this->ui('downloads.php'); }
echo $enabled ? ' checked' : ''; ?> " title="<?php echo $title; ?> "><span class="hidden"><?php echo $title; ?> </div> </td> <?php break; case 'menus': $classes[] = 'num'; $enabled = isset($Category->facetedmenus) && Shopp::str_true($Category->facetedmenus); $title = $enabled ? Shopp::__('Faceted search menus enabled') : ''; ?> <td width="5%" class="<?php echo esc_attr(join(' ', $classes)); ?> "> <div class="checkbox<?php echo $enabled ? ' checked' : ''; ?> " title="<?php echo $title; ?> "><span class="hidden"><?php echo $title; ?> </div>
public function column_name($Item) { $edit = wp_nonce_url(add_query_arg('id', $Item->setting)); $delete = wp_nonce_url(add_query_arg('delete', $Item->setting)); return '<a href="' . esc_url($edit) . '" title="' . Shopp::__('Edit') . ' "' . esc_attr($Item->label) . '"" class="edit row-title">' . esc_html($Item->label) . '</a>' . "\n" . '<div class="row-actions">' . ' <span class="edit"><a href="' . esc_url($edit) . '" title="' . Shopp::__('Edit') . ' "' . esc_attr($Item->label) . '"" class="edit">' . Shopp::__('Edit') . '</a> | </span><span class="delete"><a href="' . esc_url($delete) . '" title="' . Shopp::__('Delete') . ' "' . esc_attr($Item->label) . '"" class="delete">' . Shopp::__('Delete') . '</a></span>' . '</div>'; }
function shopp_default_script_settings() { $base = array(); $settings = Shopp::currency_format(); if (!empty($settings)) { $currency = array('cp' => $settings['cpos'], 'c' => $settings['currency'], 'p' => (int) $settings['precision'], 't' => $settings['thousands'], 'd' => $settings['decimals']); if (isset($settings['grouping'])) { $currency['g'] = is_array($settings['grouping']) ? join(',', $settings['grouping']) : $settings['grouping']; } } if (!is_admin()) { $base = array('nocache' => is_shopp_page('account')); } // Validation alerts shopp_localize_script('catalog', '$cv', array('field' => __('Your %s is required.', 'Shopp'), 'email' => __('The e-mail address you provided does not appear to be a valid address.', 'Shopp'), 'minlen' => __('The %s you entered is too short. It must be at least %d characters long.', 'Shopp'), 'pwdmm' => __('The passwords you entered do not match. They must match in order to confirm you are correctly entering the password you want to use.', 'Shopp'), 'chkbox' => __('%s must be checked before you can proceed.', 'Shopp'))); // Checkout page settings & localization shopp_localize_script('checkout', '$co', array('ajaxurl' => admin_url('admin-ajax.php'), 'loginname' => Shopp::__('You did not enter a login.'), 'loginpwd' => Shopp::__('You did not enter a password to login with.'), 'badpan' => Shopp::__('Not a valid card number.'), 'submitting' => Shopp::__('Submitting…'), 'error' => Shopp::__('An error occurred while submitting your order. Please try submitting your order again.'), 'timeout' => (int) SHOPP_SUBMIT_TIMEOUT)); // Validation alerts shopp_localize_script('cart', '$ct', array('items' => __('Items', 'Shopp'), 'total' => __('Total', 'Shopp'))); // Calendar localization shopp_localize_script('calendar', '$cal', array('jan' => __('January', 'Shopp'), 'feb' => __('February', 'Shopp'), 'mar' => __('March', 'Shopp'), 'apr' => __('April', 'Shopp'), 'may' => __('May', 'Shopp'), 'jun' => __('June', 'Shopp'), 'jul' => __('July', 'Shopp'), 'aug' => __('August', 'Shopp'), 'sep' => __('September', 'Shopp'), 'oct' => __('October', 'Shopp'), 'nov' => __('November', 'Shopp'), 'dec' => __('December', 'Shopp'), 'sun' => __('Sun', 'Shopp'), 'mon' => __('Mon', 'Shopp'), 'tue' => __('Tue', 'Shopp'), 'wed' => __('Wed', 'Shopp'), 'thu' => __('Thu', 'Shopp'), 'fri' => __('Fri', 'Shopp'), 'sat' => __('Sat', 'Shopp'))); // Product editor: unsaved changes warning shopp_localize_script('product-editor', '$msg', array('confirm' => __('The changes you made will be lost if you navigate away from this page.', 'Shopp'))); $defaults = apply_filters('shopp_js_settings', array_merge($currency, $base)); shopp_localize_script('shopp', '$s', $defaults); }
public function email($addressee, $address, $subject, array $templates = array()) { global $is_IIS; shopp_debug("ShoppPurchase::email(): {$addressee},{$address},{$subject}," . _object_r($templates)); // Build the e-mail message data $email['from'] = Shopp::email_from(shopp_setting('merchant_email'), shopp_setting('business_name')); if ($is_IIS) { $email['to'] = Shopp::email_to($address); } else { $email['to'] = Shopp::email_to($address, $addressee); } $email['subject'] = $subject; $email['receipt'] = $this->receipt(); $email['url'] = get_bloginfo('url'); $email['sitename'] = get_bloginfo('name'); $email['orderid'] = $this->id; $email = apply_filters('shopp_email_receipt_data', $email); $email = apply_filters('shopp_purchase_email_message', $email); $this->message = array_merge($this->message, $email); // Load and process the template file $defaults = array('email.php', 'order.php', 'order.html'); $emails = array_merge((array) $templates, $defaults); $template = Shopp::locate_template($emails); if (!file_exists($template)) { shopp_add_error(Shopp::__('A purchase notification could not be sent because the template for it does not exist.'), SHOPP_ADMIN_ERR); return false; } // Send the email if (Shopp::email($template, $this->message)) { shopp_debug('A purchase notification was sent to: ' . $this->message['to']); return true; } shopp_debug('A purchase notification FAILED to be sent to: ' . $this->message['to']); return false; }
public function column_conditional($Item) { $conditionals = count($Item['rules']) > 0; $this->checkbox($conditionals, $conditionals ? Shopp::__('This tax setting has conditional rules defined.') : Shopp::__('No conditions are defined for this tax rate.')); }
function rules_meta_box($Promotion) { $targets = array('Catalog' => __('catalog product', 'Shopp'), 'Cart' => __('shopping cart', 'Shopp'), 'Cart Item' => __('cart item', 'Shopp')); $target = '<select name="target" id="promotion-target" class="small">'; $target .= menuoptions($targets, $Promotion->target, true); $target .= '</select>'; if (empty($Promotion->search)) { $Promotion->search = "all"; } $logic = '<select name="search" class="small">'; $logic .= menuoptions(array('any' => Shopp::__('any'), 'all' => strtolower(Shopp::__('All'))), $Promotion->search, true); $logic .= '</select>'; ?> <p><strong><?php printf(__('Apply discount to %s', 'Shopp'), $target, $logic); ?> <strong id="target-property"></strong></strong></p> <table class="form-table" id="cartitem"></table> <p><strong><?php printf(__('When %s of these conditions match the', 'Shopp'), $logic); ?> <strong id="rule-target">:</strong></strong></p> <table class="form-table" id="rules"></table> <?php }
/** * Handles report loading * * @author Jonathan Davis * @since 1.3 * * @return Report The loaded Report object **/ static function report() { $options = self::options(); extract($options, EXTR_SKIP); $reports = self::reports(); // Load the report $report = isset($_GET['report']) ? $_GET['report'] : 'sales'; if (empty($reports[$report]['class'])) { return wp_die(Shopp::__('The requested report does not exist.')); } $ReportClass = $reports[$report]['class']; $Report = new $ReportClass($options); $Report->load(); return $Report; }
/** * Display a cart update button * * When a shopper clicks the update button, the cart is submitted and all * cart totals are recalculated. * * @api `shopp('cart.update-button')` * @since 1.0 * * @param string $result The output * @param array $options The options * @param ShoppCart $O The working object * - **autocomplete**: (on, off) Specifies whether an `<input>` element should have autocomplete enabled * - **accesskey**: Specifies a shortcut key to activate/focus an element. Linux/Windows: `[Alt]`+`accesskey`, Mac: `[Ctrl]``[Opt]`+`accesskey` * - **class**: The class attribute specifies one or more class-names for an element * - **disabled**: Specifies that an `<input>` element should be disabled * - **placeholder**: Specifies a short hint that describes the expected value of an `<input>` element * - **required**: Adds a class that specified an input field must be filled out before submitting the form, enforced by JS * - **tabindex**: Specifies the tabbing order of an element * - **title**: Specifies extra information about an element * - **label**: Specifies the button label value * @return string The markup for the update button */ public static function update_button($result, $options, $O) { $submit_attrs = array('title', 'value', 'disabled', 'tabindex', 'accesskey', 'class', 'autocomplete', 'placeholder', 'required'); $defaults = array('label' => Shopp::__('Update Subtotal'), 'class' => 'update-button'); $options = array_merge($defaults, $options); if (false !== strpos($options['class'], 'update-button')) { $options['class'] .= ' update-button'; } return '<input type="submit" name="update"' . inputattrs($options, $submit_attrs) . ' />'; }
/** * Provides the submit login button markup * * @api `shopp('customer.submit-login')` * @since 1.0 * * @param string $result The output * @param array $options The options * - **autocomplete**: (on, off) Specifies whether an `<input>` element should have autocomplete enabled * - **accesskey**: Specifies a shortcut key to activate/focus an element. Linux/Windows: `[Alt]`+`accesskey`, Mac: `[Ctrl]``[Opt]`+`accesskey` * - **class**: The class attribute specifies one or more class-names for an element * - **disabled**: Specifies that an `<input>` element should be disabled * - **placeholder**: Specifies a short hint that describes the expected value of an `<input>` element * - **required**: Adds a class that specified an input field must be filled out before submitting the form, enforced by JS * - **tabindex**: Specifies the tabbing order of an element * - **title**: Specifies extra information about an element * - **label**: Specifies the value of the button element. Defaults to `Login` * - **redirect**: Specifies the URL the customer is redirected to after login. Defaults to `$_REQUEST['redirect']`. * @param ShoppCustomer $O The working object * @return string The button markup **/ public static function submit_login($result, $options, $O) { $request = $_GET; $defaults = array('label' => Shopp::__('Login'), 'redirect' => isset($_REQUEST['redirect']) ? $_REQUEST['redirect'] : Shopp::url($request, 'account', ShoppOrder()->security())); $options = array_merge($defaults, $options); extract($options, EXTR_SKIP); $string = ''; $id = 'submit-login'; $context = ShoppStorefront::intemplate(); if (isset($request['acct']) && 'logout' == $request['acct']) { unset($request['acct']); } if ('checkout.php' == $context) { $redirect = 'checkout'; $id .= '-' . $redirect; } return '<input type="hidden" name="redirect" value="' . esc_attr($redirect) . '" />' . '<input type="submit" name="submit-login" id="' . $id . '"' . inputattrs($options) . ' />'; }
/** * Interface processor for the order manager * * @author Jonathan Davis * @return void **/ public function manager() { global $Shopp, $Notes; global $is_IIS; if (!current_user_can('shopp_orders')) { wp_die(__('You do not have sufficient permissions to access this page.', 'Shopp')); } $Purchase = ShoppPurchase(); $Purchase->Customer = new ShoppCustomer($Purchase->customer); $Gateway = $Purchase->gateway(); if (!empty($_POST["send-note"])) { $user = wp_get_current_user(); shopp_add_order_event($Purchase->id, 'note', array('note' => stripslashes($_POST['note']), 'user' => $user->ID)); $Purchase->load_events(); } // Handle Order note processing if (!empty($_POST['note'])) { $this->addnote($Purchase->id, stripslashes($_POST['note']), !empty($_POST['send-note'])); } if (!empty($_POST['delete-note'])) { $noteid = key($_POST['delete-note']); $Note = new ShoppMetaObject(array('id' => $noteid, 'type' => 'order_note')); $Note->delete(); } if (!empty($_POST['edit-note'])) { $noteid = key($_POST['note-editor']); $Note = new ShoppMetaObject(array('id' => $noteid, 'type' => 'order_note')); $Note->value->message = stripslashes($_POST['note-editor'][$noteid]); $Note->save(); } $Notes = new ObjectMeta($Purchase->id, 'purchase', 'order_note'); if (isset($_POST['submit-shipments']) && isset($_POST['shipment']) && !empty($_POST['shipment'])) { $shipments = $_POST['shipment']; foreach ((array) $shipments as $shipment) { shopp_add_order_event($Purchase->id, 'shipped', array('tracking' => $shipment['tracking'], 'carrier' => $shipment['carrier'])); } $updated = __('Shipping notice sent.', 'Shopp'); // Save shipping carrier default preference for the user $userid = get_current_user_id(); $setting = 'shopp_shipping_carrier'; if (!get_user_meta($userid, $setting, true)) { add_user_meta($userid, $setting, $shipment['carrier']); } else { update_user_meta($userid, $setting, $shipment['carrier']); } unset($_POST['ship-notice']); $Purchase->load_events(); } if (isset($_POST['order-action']) && 'refund' == $_POST['order-action']) { if (!current_user_can('shopp_refund')) { wp_die(__('You do not have sufficient permissions to carry out this action.', 'Shopp')); } $user = wp_get_current_user(); $reason = (int) $_POST['reason']; $amount = Shopp::floatval($_POST['amount']); $Purchase->load_events(); if (!empty($_POST['message'])) { $message = $_POST['message']; $Purchase->message['note'] = $message; } if ($amount <= $Purchase->captured - $Purchase->refunded) { if (!Shopp::str_true($_POST['send'])) { // Force the order status shopp_add_order_event($Purchase->id, 'notice', array('user' => $user->ID, 'kind' => 'refunded', 'notice' => __('Marked Refunded', 'Shopp'))); shopp_add_order_event($Purchase->id, 'refunded', array('txnid' => $Purchase->txnid, 'gateway' => $Gateway->module, 'amount' => $amount)); shopp_add_order_event($Purchase->id, 'voided', array('txnorigin' => $Purchase->txnid, 'txnid' => time(), 'gateway' => $Gateway->module)); } else { shopp_add_order_event($Purchase->id, 'refund', array('txnid' => $Purchase->txnid, 'gateway' => $Gateway->module, 'amount' => $amount, 'reason' => $reason, 'user' => $user->ID)); } if (!empty($_POST['message'])) { $this->addnote($Purchase->id, $_POST['message']); } $Purchase->load_events(); } else { $this->notice(Shopp::__('Refund failed. Cannot refund more than the current balance.'), 'error'); } } if (isset($_POST['order-action']) && 'cancel' == $_POST['order-action']) { if (!current_user_can('shopp_void')) { wp_die(__('You do not have sufficient permissions to carry out this action.', 'Shopp')); } // unset($_POST['refund-order']); $user = wp_get_current_user(); $reason = (int) $_POST['reason']; $message = ''; if (!empty($_POST['message'])) { $message = $_POST['message']; $Purchase->message['note'] = $message; } else { $message = 0; } if (!Shopp::str_true($_POST['send'])) { // Force the order status shopp_add_order_event($Purchase->id, 'notice', array('user' => $user->ID, 'kind' => 'cancelled', 'notice' => __('Marked Cancelled', 'Shopp'))); shopp_add_order_event($Purchase->id, 'voided', array('txnorigin' => $Purchase->txnid, 'txnid' => time(), 'gateway' => $Gateway->module)); } else { shopp_add_order_event($Purchase->id, 'void', array('txnid' => $Purchase->txnid, 'gateway' => $Gateway->module, 'reason' => $reason, 'user' => $user->ID, 'note' => $message)); } if (!empty($_POST['message'])) { $this->addnote($Purchase->id, $_POST['message']); } $Purchase->load_events(); } if (isset($_POST['billing']) && is_array($_POST['billing'])) { $Purchase->updates($_POST['billing']); $Purchase->save(); } if (isset($_POST['shipping']) && is_array($_POST['shipping'])) { $shipping = array(); foreach ($_POST['shipping'] as $name => $value) { $shipping["ship{$name}"] = $value; } $Purchase->updates($shipping); $Purchase->shipname = $shipping['shipfirstname'] . ' ' . $shipping['shiplastname']; $Purchase->save(); } if (isset($_POST['order-action']) && 'update-customer' == $_POST['order-action'] && !empty($_POST['customer'])) { $Purchase->updates($_POST['customer']); $Purchase->save(); } if (isset($_POST['cancel-edit-customer'])) { unset($_POST['order-action'], $_POST['edit-customer'], $_POST['select-customer']); } if (isset($_POST['order-action']) && 'new-customer' == $_POST['order-action'] && !empty($_POST['customer']) && !isset($_POST['cancel-edit-customer'])) { $Customer = new ShoppCustomer(); $Customer->updates($_POST['customer']); $Customer->password = wp_generate_password(12, true); if ('wordpress' == shopp_setting('account_system')) { $Customer->create_wpuser(); } else { unset($_POST['loginname']); } $Customer->save(); if ((int) $Customer->id > 0) { $Purchase->copydata($Customer); $Purchase->save(); } else { $this->notice(__('An unknown error occured. The customer could not be created.', 'Shopp'), 'error'); } } if (isset($_GET['order-action']) && 'change-customer' == $_GET['order-action'] && !empty($_GET['customerid'])) { $Customer = new ShoppCustomer((int) $_GET['customerid']); if ((int) $Customer->id > 0) { $Purchase->copydata($Customer); $Purchase->customer = $Customer->id; $Purchase->save(); } else { $this->notice(__('The selected customer was not found.', 'Shopp'), 'error'); } } if (isset($_POST['save-item']) && !empty($_POST['lineid'])) { // Create a cart representation of the order to recalculate order totals $Cart = new ShoppCart(); foreach ($Purchase->purchased as $OrderItem) { $CartItem = new Item($OrderItem); $Cart->contents[$OrderItem->id] = $CartItem; } $purchasedid = (int) $_POST['lineid']; $Purchased = $Purchase->purchased[$purchasedid]; if ($Purchased->id) { $override_total = Shopp::floatval($_POST['total']) != $Purchased->total; // Override total $Item = $Cart->contents[$purchasedid]; $Item->quantity($_POST['quantity']); $Item->unitprice = Shopp::floatval($_POST['unitprice']); $Item->retotal(); $Purchased->quantity = $Item->quantity; $Purchased->unitprice = $Item->unitprice; $Purchased->unittax = $Item->unittax; $Purchased->total = $Item->total; if ($override_total) { $Purchased->total = Shopp::floatval($_POST['total']); } $Purchased->save(); } $Cart->retotal = true; $Cart->totals(); $Purchase->copydata($Cart->Totals); $Purchase->save(); } if (isset($_POST['charge']) && $Gateway && $Gateway->captures) { if (!current_user_can('shopp_capture')) { wp_die(__('You do not have sufficient permissions to carry out this action.', 'Shopp')); } $user = wp_get_current_user(); shopp_add_order_event($Purchase->id, 'capture', array('txnid' => $Purchase->txnid, 'gateway' => $Purchase->gateway, 'amount' => $Purchase->capturable(), 'user' => $user->ID)); $Purchase->load_events(); } $base = shopp_setting('base_operations'); $targets = shopp_setting('target_markets'); $countries = array('' => ' '); $countrydata = Lookup::countries(); foreach ($countrydata as $iso => $c) { if ($base['country'] == $iso) { $base_region = $c['region']; } $countries[$iso] = $c['name']; } $Purchase->_countries = $countries; $regions = Lookup::country_zones(); $Purchase->_billing_states = array_merge(array('' => ' '), (array) $regions[$Purchase->country]); $Purchase->_shipping_states = array_merge(array('' => ' '), (array) $regions[$Purchase->shipcountry]); // Setup shipping carriers menu and JS data $carriers_menu = $carriers_json = array(); $shipping_carriers = (array) shopp_setting('shipping_carriers'); // The store-preferred shipping carriers $shipcarriers = Lookup::shipcarriers(); // The full list of available shipping carriers $notrack = Shopp::__('No Tracking'); // No tracking label $default = get_user_meta(get_current_user_id(), 'shopp_shipping_carrier', true); if (isset($shipcarriers[$default])) { $carriers_menu[$default] = $shipcarriers[$default]->name; $carriers_json[$default] = array($shipcarriers[$default]->name, $shipcarriers[$default]->trackpattern); } else { $carriers_menu['NOTRACKING'] = $notrack; $carriers_json['NOTRACKING'] = array($notrack, false); } $serviceareas = array('*', $base['country']); foreach ($shipcarriers as $code => $carrier) { if ($code == $default) { continue; } if (!empty($shipping_carriers) && !in_array($code, $shipping_carriers)) { continue; } if (!in_array($carrier->areas, $serviceareas)) { continue; } $carriers_menu[$code] = $carrier->name; $carriers_json[$code] = array($carrier->name, $carrier->trackpattern); } if (isset($shipcarriers[$default])) { $carriers_menu['NOTRACKING'] = $notrack; $carriers_json['NOTRACKING'] = array($notrack, false); } if (empty($statusLabels)) { $statusLabels = array(''); } include $this->ui('order.php'); }
public function column_title($Item) { $title = empty($Item->title) ? '(' . Shopp::__('not set') . ')' : $Item->title; $edit_link = wp_nonce_url(add_query_arg('edit', $Item->id), 'shopp-settings-pages'); echo '<a class="row-title edit" href="' . $edit_link . '" title="' . Shopp::__('Edit') . ' "' . esc_attr($title) . '"">' . esc_html($title) . '</a>'; echo $this->row_actions(array('edit' => '<a class="edit" href="' . $edit_link . '">' . __('Edit') . '</a>')); }
protected function title() { return Shopp::__('Conditions'); }
protected function title() { return Shopp::__('Billing Address'); }
<?php get_current_screen()->add_help_tab(array('id' => 'overview', 'title' => Shopp::__('Overview'), 'content' => Shopp::_mx('### Downloads Restrictions can be set to limit the access of downloads that have been purchased. #### Download Limit The download limit allows you to restrict the number of downloads of a purchased product. By default, an unlimited number of downloads are allowed. #### Time Limit The time limit setting provides access to a purchased product download for a limited amount of time starting from when the payment was received. ### IP Restriction This can allow restricting access to the computer the download was bought from. However, as IP addresses are sometimes randomly assigned, and can easily be cloaked, this option has limited usefulness for most cases. #### Download Quantity This setting prevents a quantity selection of digital goods. It is a useful setting when you prefer to prevent the possibility of buying the same digital good more than once in an order. ', 'Downloads help tab'))); get_current_screen()->set_help_sidebar(Shopp::_mx('**For more information:** [Shopp User Guide](%s) [Community Forums](%s) [Shopp Support Help Desk](%s) ', 'Context help tab (sidebar)', ShoppSupport::DOCS, ShoppSupport::FORUMS, ShoppSupport::SUPPORT));
/** * Generates the Shopp admin menus * * @author Jonathan Davis * @since 1.1 * * @return void **/ public function menus() { global $menu, $plugin_page; $access = 'shopp_menu'; if (Shopp::maintenance()) { $access = 'manage_options'; } // Add main menus $position = shopp_admin_add_menu(Shopp::__('Shopp'), 'orders', 40, false, 'shopp_orders', Shopp::clearpng()); shopp_admin_add_menu(Shopp::__('Catalog'), 'products', $position, false, 'shopp_products', Shopp::clearpng()); // Add after the Shopp menus to avoid being purged by the duplicate separator check $menu[$position - 1] = array('', 'read', 'separator-shopp', '', 'wp-menu-separator'); // Add menus to WordPress admin foreach ($this->pages as $page) { $this->submenus($page); } $parent = get_admin_page_parent(); if (isset($this->menus[$parent]) && false === strpos($this->menus[$parent], 'toplevel')) { $current_page = $plugin_page; $plugin_page = $parent; add_action('adminmenu', create_function('', 'global $plugin_page; $plugin_page = "' . $current_page . '";')); } }
public function label() { if (empty($this->label)) { return Shopp::__('Shipping'); } return $this->label; }