本文整理汇总了PHP中shopp_set_setting函数的典型用法代码示例。如果您正苦于以下问题:PHP shopp_set_setting函数的具体用法?PHP shopp_set_setting怎么用?PHP shopp_set_setting使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了shopp_set_setting函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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 = '';
if (!empty($basestates)) {
$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');
}
示例2: updates
public function updates()
{
$form = $this->form();
if (empty($form)) {
return;
}
do_action('shopp_save_payment_settings');
$Gateways = Shopp::object()->Gateways;
$gateways = array_keys($Gateways->activated());
$gateway = key($form);
// Handle Multi-instance payment systems
$indexed = false;
if (preg_match('/\\[(\\d+)\\]/', $gateway, $matched)) {
$indexed = '-' . $matched[1];
$gateway = str_replace($matched[0], '', $gateway);
}
// Merge the existing gateway settings with the newly updated settings
if (isset($Gateways->active[$gateway])) {
$Gateway = $Gateways->active[$gateway];
// Cannot use array_merge() because it adds numeric index values instead of overwriting them
$this->form[$gateway] = (array) $this->form[$gateway] + (array) $Gateway->settings;
}
// Add newly activated gateways
if (!in_array($gateway . $indexed, $gateways)) {
$gateways[] = $gateway . $indexed;
shopp_set_setting('active_gateways', join(',', $gateways));
}
// Save the gateway settings
shopp_set_formsettings();
$this->notice(Shopp::__('Shopp payments settings saved.'));
Shopp::redirect(add_query_arg());
}
示例3: welcome
public function welcome()
{
$Shopp = Shopp::object();
include $this->ui('welcome.php');
// Displayed the welcome, turn display_welcome flag off
shopp_set_setting('display_welcome', 'off');
return true;
}
示例4: __construct
public function __construct()
{
$this->purchase_cols = ShoppPurchase::exportcolumns();
$this->purchased_cols = ShoppPurchased::exportcolumns();
$this->defined = array_merge($this->purchase_cols, $this->purchased_cols);
$this->sitename = get_bloginfo('name');
$this->headings = shopp_setting('purchaselog_headers') == "on";
$this->selected = shopp_setting('purchaselog_columns');
$this->date_format = get_option('date_format');
$this->time_format = get_option('time_format');
shopp_set_setting('purchaselog_lastexport', current_time('timestamp'));
}
示例5: setup
/**
* Displays the General Settings screen and processes updates
*
* @author Jonathan Davis
* @since 1.0
*
* @return void
**/
public function setup()
{
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'])) {
$_POST['settings']['display_welcome'] = 'off';
shopp_set_formsettings();
}
$country = isset($_POST['settings']) && isset($_POST['settings']['base_operations']) ? $_POST['settings']['base_operations']['country'] : '';
$countries = array();
$countrydata = Lookup::countries();
$country_zones = Lookup::country_zones();
foreach ($countrydata as $iso => $c) {
if ($country == $iso) {
$base_region = $c['region'];
}
$countries[$iso] = $c['name'];
}
// Save settings
if (!empty($_POST['save']) && isset($_POST['settings'])) {
check_admin_referer('shopp-setup');
if (isset($_POST['settings']['base_operations'])) {
$baseop =& $_POST['settings']['base_operations'];
$zone = isset($baseop['zone']) && isset($country_zones[$country]) && isset($country_zones[$country][$baseop['zone']]) ? $baseop['zone'] : false;
if (isset($countrydata[$country])) {
$baseop = $countrydata[$country];
}
$baseop['country'] = $country;
$baseop['zone'] = $zone;
$baseop['currency']['format'] = scan_money_format($baseop['currency']['format']);
if (is_array($baseop['currency']['format'])) {
$fields = array_keys($baseop['currency']['format']);
foreach ($fields as $field) {
if (isset($baseop['currency'][$field])) {
$baseop['currency']['format'][$field] = $baseop['currency'][$field];
}
}
}
shopp_set_setting('tax_inclusive', in_array($country, Lookup::country_inclusive_taxes()) ? 'on' : 'off');
}
if (!isset($_POST['settings']['target_markets'])) {
asort($_POST['settings']['target_markets']);
}
shopp_set_formsettings();
$updated = __('Shopp settings saved.', 'Shopp');
}
$operations = shopp_setting('base_operations');
if (isset($country_zones[$operations['country']])) {
$zones = $country_zones[$operations['country']];
}
$targets = shopp_setting('target_markets');
if (is_array($targets)) {
$targets = array_map('stripslashes', $targets);
}
if (!$targets) {
$targets = array();
}
include $this->ui('setup.php');
}
示例6: __construct
/**
* Setup the module for runtime
*
* Auto-loads settings for the module and setups defaults
*
* @author Jonathan Davis
* @since 1.1
*
* @return void
**/
public function __construct()
{
$this->module = get_class($this);
$this->session = ShoppShopping()->session;
$this->Order = ShoppOrder();
if ('ShoppFreeOrder' != $this->module) {
// There are no settings for ShoppFreeOrder
$this->settings = shopp_setting($this->module);
// @todo Remove legacy gateway settings migrations
// Attempt to copy old settings if this is a new prefixed gateway class
if (empty($this->settings) && false !== strpos($this->module, 'Shopp')) {
$legacy = substr($this->module, 5);
$this->settings = shopp_setting($legacy);
if (!empty($this->settings)) {
shopp_set_setting($this->module, $this->settings);
}
}
}
if (!isset($this->settings['label']) && $this->cards) {
$this->settings['label'] = __('Credit Card', 'Shopp');
}
$this->baseop = ShoppBaseLocale()->settings();
$this->currency = ShoppBaseCurrency()->code();
$this->precision = ShoppBaseCurrency()->precision();
$this->_loadcards();
$gateway = GatewayModules::hookname($this->module);
add_action('shopp_init', array($this, 'myactions'), 30);
add_action('shopp_' . $gateway . '_refunded', array($this, 'cancelorder'));
if ($this->authonly) {
add_filter('shopp_purchase_order_' . $gateway . '_processing', create_function('', 'return "auth";'));
} elseif ($this->saleonly) {
add_filter('shopp_purchase_order_' . $gateway . '_processing', create_function('', 'return "sale";'));
}
}
示例7: uninstalled
protected function uninstalled($module)
{
if (($detected = shopp_setting(self::MODULES_SETTING)) === false) {
return;
}
if (isset($detected[$module])) {
unset($detected[$module]);
shopp_set_setting(self::MODULES_SETTING, $detected);
}
}
示例8: advanced
public function advanced()
{
if (!current_user_can('shopp_settings_system')) {
wp_die(__('You do not have sufficient permissions to access this page.'));
}
if (!empty($_POST['save'])) {
check_admin_referer('shopp-system-advanced');
if (!isset($_POST['settings']['error_notifications'])) {
$_POST['settings']['error_notifications'] = array();
}
shopp_set_formsettings();
// Reinitialize Error System
ShoppErrors()->reporting((int) shopp_setting('error_logging'));
ShoppErrorLogging()->loglevel((int) shopp_setting('error_logging'));
ShoppErrorNotification()->setup();
if (isset($_POST['shopp_services_plugins']) && $this->helper_installed()) {
add_option('shopp_services_plugins');
// Add if it doesn't exist
update_option('shopp_services_plugins', $_POST['shopp_services_plugins']);
}
$this->notice(Shopp::__('Advanced settings saved.'));
} elseif (!empty($_POST['rebuild'])) {
check_admin_referer('shopp-system-advanced');
$assets = ShoppDatabaseObject::tablename(ProductImage::$table);
$query = "DELETE FROM {$assets} WHERE context='image' AND type='image'";
if (sDB::query($query)) {
$this->notice(Shopp::__('All cached images have been cleared.'));
}
} elseif (!empty($_POST['resum'])) {
check_admin_referer('shopp-system-advanced');
$summaries = ShoppDatabaseObject::tablename(ProductSummary::$table);
$query = "UPDATE {$summaries} SET modified='" . ProductSummary::RECALCULATE . "'";
if (sDB::query($query)) {
$this->notice(Shopp::__('Product summaries are set to recalculate.'));
}
} elseif (isset($_POST['shopp_services_helper'])) {
check_admin_referer('shopp-system-advanced');
$plugin = 'ShoppServices.php';
$source = SHOPP_PATH . "/core/library/{$plugin}";
$install = WPMU_PLUGIN_DIR . '/' . $plugin;
if (false === ($creds = request_filesystem_credentials($this->url, '', false, false, null))) {
return true;
}
// stop the normal page form from displaying
if (!WP_Filesystem($creds)) {
// credentials were no good, ask for them again
request_filesystem_credentials($this->url, '', false, false, null);
return true;
}
global $wp_filesystem;
if ('install' == $_POST['shopp_services_helper']) {
if (!$wp_filesystem->exists($install)) {
if ($wp_filesystem->exists(WPMU_PLUGIN_DIR) || $wp_filesystem->mkdir(WPMU_PLUGIN_DIR, FS_CHMOD_DIR)) {
// Install the mu-plugin helper
$wp_filesystem->copy($source, $install, true, FS_CHMOD_FILE);
} else {
$this->notice(Shopp::_mi('The services helper could not be installed because the `mu-plugins` directory could not be created. Check the file permissions of the `%s` directory on the web aserver.', WP_CONTENT_DIR), 'error');
}
}
if ($wp_filesystem->exists($install)) {
shopp_set_setting('shopp_services_helper', 'on');
$this->notice(Shopp::__('Services helper installed.'));
} else {
$this->notice(Shopp::__('The services helper failed to install.'), 'error');
}
} elseif ('remove' == $_POST['shopp_services_helper']) {
global $wp_filesystem;
if ($wp_filesystem->exists($install)) {
$wp_filesystem->delete($install);
}
if (!$wp_filesystem->exists($install)) {
shopp_set_setting('shopp_services_helper', 'off');
$this->notice(Shopp::__('Services helper uninstalled.'));
} else {
$this->notice(Shopp::__('Services helper could not be uninstalled.'), 'error');
}
}
}
$notifications = shopp_setting('error_notifications');
if (empty($notifications)) {
$notifications = array();
}
$notification_errors = array(SHOPP_TRXN_ERR => Shopp::__('Transaction Errors'), SHOPP_AUTH_ERR => Shopp::__('Login Errors'), SHOPP_ADDON_ERR => Shopp::__('Add-on Errors'), SHOPP_COMM_ERR => Shopp::__('Communication Errors'), SHOPP_STOCK_ERR => Shopp::__('Inventory Warnings'));
$errorlog_levels = array(0 => Shopp::__('Disabled'), SHOPP_ERR => Shopp::__('General Shopp Errors'), SHOPP_TRXN_ERR => Shopp::__('Transaction Errors'), SHOPP_AUTH_ERR => Shopp::__('Login Errors'), SHOPP_ADDON_ERR => Shopp::__('Add-on Errors'), SHOPP_COMM_ERR => Shopp::__('Communication Errors'), SHOPP_STOCK_ERR => Shopp::__('Inventory Warnings'), SHOPP_ADMIN_ERR => Shopp::__('Admin Errors'), SHOPP_DB_ERR => Shopp::__('Database Errors'), SHOPP_PHP_ERR => Shopp::__('PHP Errors'), SHOPP_ALL_ERR => Shopp::__('All Errors'), SHOPP_DEBUG_ERR => Shopp::__('Debugging Messages'));
$plugins = get_plugins();
$service_plugins = get_option('shopp_services_plugins');
include $this->ui('advanced.php');
}
示例9: __construct
public function __construct()
{
$this->customer_cols = ShoppCustomer::exportcolumns();
$this->billing_cols = BillingAddress::exportcolumns();
$this->shipping_cols = ShippingAddress::exportcolumns();
$this->defined = array_merge($this->customer_cols, $this->billing_cols, $this->shipping_cols);
$this->sitename = get_bloginfo('name');
$this->headings = shopp_setting('customerexport_headers') == "on";
$this->selected = shopp_setting('customerexport_columns');
shopp_set_setting('customerexport_lastexport', current_time('timestamp'));
}
示例10: maintenance
/**
* Handles maintenance mode messages
**/
private function maintenance()
{
if (ShoppLoader::is_activating() || Shopp::upgradedb()) {
return;
}
if (isset($_POST['settings']) && wp_verify_nonce($_REQUEST['_wpnonce'], 'shopp-setup')) {
if (isset($_POST['settings']['maintenance'])) {
shopp_set_setting('maintenance', $_POST['settings']['maintenance']);
}
}
if (Shopp::maintenance()) {
if (isset($_GET['_wpnonce']) && wp_verify_nonce($_GET['_wpnonce'], 'shopp_disable_maintenance')) {
shopp_set_setting('maintenance', 'off');
} else {
$url = wp_nonce_url(add_query_arg('page', $this->Admin->pagename('setup'), admin_url('admin.php')), 'shopp_disable_maintenance');
$this->notice(Shopp::__('Shopp is currently in maintenance mode. %sDisable Maintenance Mode%s', '<a href="' . $url . '" class="button">', '</a>'), 'error', 1);
}
}
}
示例11: save
public function save($country, $state = '')
{
$this->country = $country;
$this->state = $state;
shopp_set_setting('base_locale', array($country, $state));
shopp_set_setting('tax_inclusive', in_array($country, ShoppLookup::country_inclusive_taxes()) ? 'on' : 'off');
$this->lookup($country);
}
示例12: __construct
/**
* Initializes a shipping module
*
* Grabs settings that most shipping modules will needs and establishes
* the event listeners to trigger module functionality.
*
* @author Jonathan Davis
* @since 1.1
*
* @return void
**/
public function __construct()
{
$Order = ShoppOrder();
$this->module = get_class($this);
if ($this->singular) {
// @todo Remove legacy gateway settings migrations
// Attempt to copy old settings if this is a new prefixed gateway class
$this->settings = shopp_setting($this->module);
if (empty($this->settings) && false !== strpos($this->module, 'Shopp')) {
$legacy = substr($this->module, 5);
$this->settings = shopp_setting($legacy);
if (!empty($this->settings)) {
shopp_set_setting($this->module, $this->settings);
shopp_rmv_setting($legacy);
// Clean up legacy setting
}
}
} else {
$active = shopp_setting('active_shipping');
if (isset($active[$this->module]) && is_array($active[$this->module])) {
$this->methods = array();
$this->fallbacks = array();
foreach ($active[$this->module] as $index => $set) {
$setting = shopp_setting("{$this->module}-{$index}");
if (isset($setting['fallback']) && 'on' == $setting['fallback']) {
$this->fallbacks["{$this->module}-{$index}"] = $setting;
} else {
$this->methods["{$this->module}-{$index}"] = $setting;
}
}
}
}
$this->base = shopp_setting('base_operations');
$this->units = shopp_setting('weight_unit');
// Setup default packaging for shipping module
$this->settings['shipping_packaging'] = shopp_setting('shipping_packaging');
// Shipping module can override the default behavior and the global setting by specifying the local packaging property
if (isset($this->packaging) && $this->packaging != $this->settings['shipping_packaging']) {
$this->settings['shipping_packaging'] = $this->packaging;
}
$this->packager = apply_filters('shopp_' . strtolower($this->module) . '_packager', new ShippingPackager(array('type' => $this->settings['shipping_packaging']), $this->module));
$this->destinations = __('Service provider markets', 'Shopp');
add_action('shopp_calculate_shipping_init', array(&$this, 'init'));
add_action('shopp_calculate_item_shipping', array(&$this, 'calcitem'), 10, 2);
add_action('shopp_calculate_shipping', array(&$this, 'calculate'), 10, 2);
if (isset($this->fallbacks) && !empty($this->fallbacks)) {
add_action('shopp_calculate_fallback_shipping_init', array(&$this, 'fallbacks'));
add_action('shopp_calculate_fallback_shipping', array(&$this, 'calculate'));
add_action('shopp_calculate_fallback_shipping', array(&$this, 'reset'), 20);
}
}
示例13: maintenance
/**
* Adds a maintenance mode notice to every admin screen
*
* @since 1.3
*
* @return void
**/
public function maintenance()
{
if (ShoppLoader::is_activating() || Shopp::upgradedb()) {
return;
}
$setting = isset($_POST['settings']['maintenance']) ? $_POST['settings']['maintenance'] : false;
$nonce = isset($_POST['_wpnonce']) ? $_POST['_wpnonce'] : false;
if (false !== $setting && wp_verify_nonce($nonce, 'shopp-setup')) {
shopp_set_setting('maintenance', $setting);
}
if (!Shopp::maintenance()) {
return;
}
if (wp_verify_nonce($this->request('_wpnonce'), 'shopp_disable_maintenance')) {
shopp_set_setting('maintenance', 'off');
} else {
$url = wp_nonce_url(add_query_arg('page', ShoppAdmin::pagename('settings'), admin_url('admin.php')), 'shopp_disable_maintenance');
$this->Screen->notice(Shopp::__('Shopp is currently in maintenance mode. %sDisable Maintenance Mode%s', '<a href="' . $url . '" class="button">', '</a>'), 'error', 1);
}
}
示例14: themepath
/**
* Update the stored path to the activated theme
*
* Automatically updates the Shopp theme path setting when the
* a new theme is activated.
*
* @author Jonathan Davis
* @since 1.1
*
* @return void
**/
public function themepath()
{
shopp_set_setting('theme_templates', addslashes(sanitize_path(STYLESHEETPATH . '/' . "shopp")));
}
示例15: upgrade_130
public function upgrade_130()
{
global $wpdb;
$db_version = ShoppSettings::dbversion();
if ($db_version < 1201) {
// 1.3 schema changes
$this->upschema();
// All existing sessions must be cleared and restarted, 1.3 & 1.3.6 sessions are not compatible with any prior version of Shopp
ShoppShopping()->reset();
$sessions_table = ShoppDatabaseObject::tablename('shopping');
sDB::query("DELETE FROM {$sessions_table}");
// Remove all the temporary PHP native session data from the options table
sDB::query("DELETE FROM from {$wpdb->options} WHERE option_name LIKE '__php_session_*'");
}
if ($db_version < 1200) {
$meta_table = ShoppDatabaseObject::tablename('meta');
sDB::query("UPDATE {$meta_table} SET value='on' WHERE name='theme_templates' AND (value != '' AND value != 'off')");
sDB::query("DELETE FROM {$meta_table} WHERE type='image' AND value LIKE '%O:10:\"ShoppError\"%'");
// clean up garbage from legacy bug
sDB::query("DELETE FROM {$meta_table} WHERE CONCAT('', name *1) = name AND context = 'category' AND type = 'meta'");
// clean up bad category meta
// Update purchase gateway values to match new prefixed class names
$gateways = array('PayPalStandard' => 'ShoppPayPalStandard', '_2Checkout' => 'Shopp2Checkout', 'OfflinePayment' => 'ShoppOfflinePayment', 'TestMode' => 'ShoppTestMode', 'FreeOrder' => 'ShoppFreeOrder');
foreach ($gateways as $name => $classname) {
sDB::query("UPDATE {$purchase_table} SET gateway='{$classname}' WHERE gateway='{$name}'");
}
$activegateways = explode(',', shopp_setting('active_gateways'));
foreach ($activegateways as &$setting) {
if (false === strpos($setting, 'Shopp')) {
$setting = str_replace(array_keys($gateways), $gateways, $setting);
}
}
shopp_set_setting('active_gateways', join(',', $activegateways));
}
if ($db_version < 1200 && shopp_setting_enabled('tax_inclusive')) {
$price_table = ShoppDatabaseObject::tablename('price');
$taxrates = shopp_setting('taxrates');
$baseop = shopp_setting('base_operations');
$taxtaxes = array();
// Capture taxonomy condition tax rates
$basetaxes = array();
// Capture base of operations rate(s)
foreach ($taxrates as $rate) {
if (!($baseop['country'] == $rate['country'] || ShoppTax::ALL == $rate['country'])) {
continue;
}
if (!empty($rate['zone']) && $baseop['zone'] != $rate['zone']) {
continue;
}
if (!empty($rate['rules']) && $rate['logic'] == 'any') {
// Capture taxonomy conditional rates
foreach ($rate['rules'] as $raterule) {
if ('product-category' == $raterule['p']) {
$taxname = ProductCategory::$taxon . '::' . $raterule['v'];
} elseif ('product-tags' == $raterule['p']) {
$taxname = ProductTag::$taxon . '::' . $raterule['v'];
}
$taxtaxes[$taxname] = Shopp::floatval($rate['rate']) / 100;
}
} else {
$basetaxes[] = Shopp::floatval($rate['rate']) / 100;
}
}
// Find products by in each taxonomy termno
$done = array();
// Capture each set into the "done" list
foreach ($taxtaxes as $taxterm => $taxrate) {
list($taxonomy, $name) = explode('::', $taxterm);
$Collection = new ProductCollection();
$Collection->load(array('ids' => true, 'taxquery' => array(array('taxonomy' => $taxonomy, 'field' => 'name', 'terms' => $name))));
$query = "UPDATE {$price_table} SET price=price+(price*{$taxrate}) WHERE tax='on' AND product IN (" . join(',', $Collection->products) . ")";
sDB::query($query);
$done = array_merge($done, $Collection->products);
}
// Update the rest of the prices (skipping those we've already done) with the tax rate that matches the base of operations
$taxrate = array_sum($basetaxes);
// Merge all the base taxes into a single rate
$done = empty($done) ? '' : " AND product NOT IN (" . join(',', $done) . ")";
$query = "UPDATE {$price_table} SET price=price+(price*{$taxrate}) WHERE tax='on'{$done}";
sDB::query($query);
}
}