本文整理汇总了PHP中WC_Install类的典型用法代码示例。如果您正苦于以下问题:PHP WC_Install类的具体用法?PHP WC_Install怎么用?PHP WC_Install使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WC_Install类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: setup
public function setup()
{
update_option('woocommerce_taxjar-integration_settings', array('api_token' => $this->api_token, 'enabled' => 'yes', 'taxjar_download' => 'yes', 'store_zip' => '80111', 'store_city' => 'Greenwood Village', 'debug' => 'yes'));
update_option('woocommerce_default_country', 'US:CO');
update_option('woocommerce_calc_shipping', 'yes');
$wc_install = new WC_Install();
$wc_install->install();
do_action('plugins_loaded');
}
开发者ID:JustinSainton,项目名称:taxjar-woocommerce-plugin,代码行数:9,代码来源:bootstrap.php
示例2: _install_wc
function _install_wc()
{
WC_Install::install();
update_option('woocommerce_calc_shipping', 'yes');
// Needed for tests cart and shipping methods
// reload capabilities after install, see https://core.trac.wordpress.org/ticket/28374
$GLOBALS['wp_roles']->reinit();
}
开发者ID:helgatheviking,项目名称:woocommerce-multilingual,代码行数:8,代码来源:bootstrap.php
示例3: _setup_theme
function _setup_theme()
{
define('WP_UNINSTALL_PLUGIN', true);
update_option('woocommerce_status_options', array('uninstall_data' => 1));
include dirname(__FILE__) . '/../vendor/woocommerce/uninstall.php';
WC_Install::install();
$GLOBALS['wp_roles']->reinit();
echo "Installing WooCommerce..." . PHP_EOL;
}
开发者ID:10up,项目名称:elasticpress,代码行数:9,代码来源:bootstrap.php
示例4: install_wc
/**
* Install WooCommerce after the test environment and WC have been loaded
*
* @since 2.2
*/
public function install_wc()
{
// clean existing install first
define('WP_UNINSTALL_PLUGIN', true);
include $this->plugin_dir . '/uninstall.php';
WC_Install::install();
// reload capabilities after install, see https://core.trac.wordpress.org/ticket/28374
$GLOBALS['wp_roles']->reinit();
echo "Installing WooCommerce..." . PHP_EOL;
}
开发者ID:nathanielks,项目名称:woocommerce,代码行数:15,代码来源:bootstrap.php
示例5: test_get_checkout_url_ssl
/**
* Test get_checkout_url over HTTP.
*
* @since 2.5.0
*/
public function test_get_checkout_url_ssl()
{
// Make sure pages exist
WC_Install::create_pages();
// Get the original setting
$o_setting = get_option('woocommerce_force_ssl_checkout');
// Force SSL checkout
update_option('woocommerce_force_ssl_checkout', 'yes');
$this->assertEquals($this->get_checkout_url(), wc_get_checkout_url());
// Restore option
update_option('woocommerce_force_ssl_checkout', $o_setting);
}
开发者ID:pelmered,项目名称:woocommerce,代码行数:17,代码来源:functions.php
示例6: install_wc
/**
* Install WooCommerce after the test environment and WC have been loaded
*
* @since 2.2
*/
public function install_wc()
{
// clean existing install first
define('WP_UNINSTALL_PLUGIN', true);
include $this->plugin_dir . '/uninstall.php';
WC_Install::install();
update_option('woocommerce_calc_shipping', 'yes');
// Needed for tests cart and shipping methods
// reload capabilities after install, see https://core.trac.wordpress.org/ticket/28374
$GLOBALS['wp_roles']->reinit();
echo "Installing WooCommerce..." . PHP_EOL;
}
开发者ID:haltaction,项目名称:woocommerce,代码行数:17,代码来源:bootstrap.php
示例7: update
/**
* Runs all pending WooCommerce database updates.
*/
public static function update()
{
global $wpdb;
$wpdb->hide_errors();
include_once WC_ABSPATH . 'includes/class-wc-install.php';
include_once WC_ABSPATH . 'includes/wc-update-functions.php';
$current_db_version = get_option('woocommerce_db_version');
$update_count = 0;
foreach (WC_Install::get_db_update_callbacks() as $version => $update_callbacks) {
if (version_compare($current_db_version, $version, '<')) {
foreach ($update_callbacks as $update_callback) {
WP_CLI::log(sprintf(__('Calling update function: %s', 'woocommerce'), $update_callback));
call_user_func($update_callback);
$update_count++;
}
}
}
WC_Admin_Notices::remove_notice('update');
WP_CLI::success(sprintf(__('%1$d updates complete. Database version is %2$s', 'woocommerce'), absint($update_count), get_option('woocommerce_db_version')));
}
开发者ID:shivapoudel,项目名称:woocommerce,代码行数:23,代码来源:class-wc-cli-update-command.php
示例8: status_tools
/**
* Handles output of tools
*/
public static function status_tools()
{
global $wpdb;
$tools = self::get_tools();
if (!empty($_GET['action']) && !empty($_REQUEST['_wpnonce']) && wp_verify_nonce($_REQUEST['_wpnonce'], 'debug_action')) {
switch ($_GET['action']) {
case 'clear_transients':
wc_delete_product_transients();
wc_delete_shop_order_transients();
WC_Cache_Helper::get_transient_version('shipping', true);
echo '<div class="updated"><p>' . __('Product Transients Cleared', 'woocommerce') . '</p></div>';
break;
case 'clear_expired_transients':
/*
* Deletes all expired transients. The multi-table delete syntax is used
* to delete the transient record from table a, and the corresponding
* transient_timeout record from table b.
*
* Based on code inside core's upgrade_network() function.
*/
$sql = "DELETE a, b FROM {$wpdb->options} a, {$wpdb->options} b\r\n\t\t\t\t\t\tWHERE a.option_name LIKE %s\r\n\t\t\t\t\t\tAND a.option_name NOT LIKE %s\r\n\t\t\t\t\t\tAND b.option_name = CONCAT( '_transient_timeout_', SUBSTRING( a.option_name, 12 ) )\r\n\t\t\t\t\t\tAND b.option_value < %d";
$rows = $wpdb->query($wpdb->prepare($sql, $wpdb->esc_like('_transient_') . '%', $wpdb->esc_like('_transient_timeout_') . '%', time()));
$sql = "DELETE a, b FROM {$wpdb->options} a, {$wpdb->options} b\r\n\t\t\t\t\t\tWHERE a.option_name LIKE %s\r\n\t\t\t\t\t\tAND a.option_name NOT LIKE %s\r\n\t\t\t\t\t\tAND b.option_name = CONCAT( '_site_transient_timeout_', SUBSTRING( a.option_name, 17 ) )\r\n\t\t\t\t\t\tAND b.option_value < %d";
$rows2 = $wpdb->query($wpdb->prepare($sql, $wpdb->esc_like('_site_transient_') . '%', $wpdb->esc_like('_site_transient_timeout_') . '%', time()));
echo '<div class="updated"><p>' . sprintf(__('%d Transients Rows Cleared', 'woocommerce'), $rows + $rows2) . '</p></div>';
break;
case 'reset_roles':
// Remove then re-add caps and roles
WC_Install::remove_roles();
WC_Install::create_roles();
echo '<div class="updated"><p>' . __('Roles successfully reset', 'woocommerce') . '</p></div>';
break;
case 'recount_terms':
$product_cats = get_terms('product_cat', array('hide_empty' => false, 'fields' => 'id=>parent'));
_wc_term_recount($product_cats, get_taxonomy('product_cat'), true, false);
$product_tags = get_terms('product_tag', array('hide_empty' => false, 'fields' => 'id=>parent'));
_wc_term_recount($product_tags, get_taxonomy('product_tag'), true, false);
echo '<div class="updated"><p>' . __('Terms successfully recounted', 'woocommerce') . '</p></div>';
break;
case 'clear_sessions':
$wpdb->query("\r\n\t\t\t\t\t\tDELETE FROM {$wpdb->options}\r\n\t\t\t\t\t\tWHERE option_name LIKE '_wc_session_%' OR option_name LIKE '_wc_session_expires_%'\r\n\t\t\t\t\t");
wp_cache_flush();
echo '<div class="updated"><p>' . __('Sessions successfully cleared', 'woocommerce') . '</p></div>';
break;
case 'install_pages':
WC_Install::create_pages();
echo '<div class="updated"><p>' . __('All missing WooCommerce pages was installed successfully.', 'woocommerce') . '</p></div>';
break;
case 'delete_taxes':
$wpdb->query("TRUNCATE " . $wpdb->prefix . "woocommerce_tax_rates");
$wpdb->query("TRUNCATE " . $wpdb->prefix . "woocommerce_tax_rate_locations");
echo '<div class="updated"><p>' . __('Tax rates successfully deleted', 'woocommerce') . '</p></div>';
break;
case 'reset_tracking':
delete_option('woocommerce_allow_tracking');
WC_Admin_Notices::add_notice('tracking');
echo '<div class="updated"><p>' . __('Usage tracking settings successfully reset.', 'woocommerce') . '</p></div>';
break;
default:
$action = esc_attr($_GET['action']);
if (isset($tools[$action]['callback'])) {
$callback = $tools[$action]['callback'];
$return = call_user_func($callback);
if ($return === false) {
if (is_array($callback)) {
echo '<div class="error"><p>' . sprintf(__('There was an error calling %s::%s', 'woocommerce'), get_class($callback[0]), $callback[1]) . '</p></div>';
} else {
echo '<div class="error"><p>' . sprintf(__('There was an error calling %s', 'woocommerce'), $callback) . '</p></div>';
}
}
}
break;
}
}
// Manual translation update messages
if (isset($_GET['translation_updated'])) {
WC_Language_Pack_Upgrader::language_update_messages();
}
// Display message if settings settings have been saved
if (isset($_REQUEST['settings-updated'])) {
echo '<div class="updated"><p>' . __('Your changes have been saved.', 'woocommerce') . '</p></div>';
}
include_once 'views/html-admin-page-status-tools.php';
}
开发者ID:slavic18,项目名称:cats,代码行数:87,代码来源:class-wc-admin-status.php
示例9: status_tools
/**
* Handles output of tools
*/
public static function status_tools()
{
global $wpdb;
$tools = self::get_tools();
if (!empty($_GET['action']) && !empty($_REQUEST['_wpnonce']) && wp_verify_nonce($_REQUEST['_wpnonce'], 'debug_action')) {
switch ($_GET['action']) {
case 'clear_transients':
wc_delete_product_transients();
wc_delete_shop_order_transients();
WC_Cache_Helper::get_transient_version('shipping', true);
echo '<div class="updated"><p>' . __('Product Transients Cleared', 'woocommerce') . '</p></div>';
break;
case 'clear_expired_transients':
// http://w-shadow.com/blog/2012/04/17/delete-stale-transients/
$rows = $wpdb->query("\n\t\t\t\t\t\tDELETE\n\t\t\t\t\t\t\ta, b\n\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t{$wpdb->options} a, {$wpdb->options} b\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\ta.option_name LIKE '_transient_%' AND\n\t\t\t\t\t\t\ta.option_name NOT LIKE '_transient_timeout_%' AND\n\t\t\t\t\t\t\tb.option_name = CONCAT(\n\t\t\t\t\t\t\t\t'_transient_timeout_',\n\t\t\t\t\t\t\t\tSUBSTRING(\n\t\t\t\t\t\t\t\t\ta.option_name,\n\t\t\t\t\t\t\t\t\tCHAR_LENGTH('_transient_') + 1\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\tAND b.option_value < UNIX_TIMESTAMP()\n\t\t\t\t\t");
$rows2 = $wpdb->query("\n\t\t\t\t\t\tDELETE\n\t\t\t\t\t\t\ta, b\n\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t{$wpdb->options} a, {$wpdb->options} b\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\ta.option_name LIKE '_site_transient_%' AND\n\t\t\t\t\t\t\ta.option_name NOT LIKE '_site_transient_timeout_%' AND\n\t\t\t\t\t\t\tb.option_name = CONCAT(\n\t\t\t\t\t\t\t\t'_site_transient_timeout_',\n\t\t\t\t\t\t\t\tSUBSTRING(\n\t\t\t\t\t\t\t\t\ta.option_name,\n\t\t\t\t\t\t\t\t\tCHAR_LENGTH('_site_transient_') + 1\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\tAND b.option_value < UNIX_TIMESTAMP()\n\t\t\t\t\t");
echo '<div class="updated"><p>' . sprintf(__('%d Transients Rows Cleared', 'woocommerce'), $rows + $rows2) . '</p></div>';
break;
case 'reset_roles':
// Remove then re-add caps and roles
WC_Install::remove_roles();
WC_Install::create_roles();
echo '<div class="updated"><p>' . __('Roles successfully reset', 'woocommerce') . '</p></div>';
break;
case 'recount_terms':
$product_cats = get_terms('product_cat', array('hide_empty' => false, 'fields' => 'id=>parent'));
_wc_term_recount($product_cats, get_taxonomy('product_cat'), true, false);
$product_tags = get_terms('product_tag', array('hide_empty' => false, 'fields' => 'id=>parent'));
_wc_term_recount($product_tags, get_taxonomy('product_tag'), true, false);
echo '<div class="updated"><p>' . __('Terms successfully recounted', 'woocommerce') . '</p></div>';
break;
case 'clear_sessions':
$wpdb->query("\n\t\t\t\t\t\tDELETE FROM {$wpdb->options}\n\t\t\t\t\t\tWHERE option_name LIKE '_wc_session_%' OR option_name LIKE '_wc_session_expires_%'\n\t\t\t\t\t");
wp_cache_flush();
echo '<div class="updated"><p>' . __('Sessions successfully cleared', 'woocommerce') . '</p></div>';
break;
case 'install_pages':
WC_Install::create_pages();
echo '<div class="updated"><p>' . __('All missing WooCommerce pages was installed successfully.', 'woocommerce') . '</p></div>';
break;
case 'delete_taxes':
$wpdb->query("TRUNCATE " . $wpdb->prefix . "woocommerce_tax_rates");
$wpdb->query("TRUNCATE " . $wpdb->prefix . "woocommerce_tax_rate_locations");
echo '<div class="updated"><p>' . __('Tax rates successfully deleted', 'woocommerce') . '</p></div>';
break;
case 'reset_tracking':
delete_option('woocommerce_allow_tracking');
WC_Admin_Notices::add_notice('tracking');
echo '<div class="updated"><p>' . __('Usage tracking settings successfully reset.', 'woocommerce') . '</p></div>';
break;
default:
$action = esc_attr($_GET['action']);
if (isset($tools[$action]['callback'])) {
$callback = $tools[$action]['callback'];
$return = call_user_func($callback);
if ($return === false) {
if (is_array($callback)) {
echo '<div class="error"><p>' . sprintf(__('There was an error calling %s::%s', 'woocommerce'), get_class($callback[0]), $callback[1]) . '</p></div>';
} else {
echo '<div class="error"><p>' . sprintf(__('There was an error calling %s', 'woocommerce'), $callback) . '</p></div>';
}
}
}
break;
}
}
// Manual translation update messages
if (isset($_GET['translation_updated'])) {
switch ($_GET['translation_updated']) {
case 2:
echo '<div class="error"><p>' . __('Failed to install/update the translation:', 'woocommerce') . ' ' . __('Seems you don\'t have permission to do this!', 'woocommerce') . '</p></div>';
break;
case 3:
echo '<div class="error"><p>' . __('Failed to install/update the translation:', 'woocommerce') . ' ' . sprintf(__('An authentication error occurred while updating the translation. Please try again or configure your %sUpgrade Constants%s.', 'woocommerce'), '<a href="http://codex.wordpress.org/Editing_wp-config.php#WordPress_Upgrade_Constants">', '</a>') . '</p></div>';
break;
case 4:
echo '<div class="error"><p>' . __('Failed to install/update the translation:', 'woocommerce') . ' ' . __('Sorry but there is no translation available for your language =/', 'woocommerce') . '</p></div>';
break;
default:
// Force WordPress find for new updates and hide the WooCommerce translation update
set_site_transient('update_plugins', null);
echo '<div class="updated"><p>' . __('Translations installed/updated successfully!', 'woocommerce') . '</p></div>';
break;
}
}
// Display message if settings settings have been saved
if (isset($_REQUEST['settings-updated'])) {
echo '<div class="updated"><p>' . __('Your changes have been saved.', 'woocommerce') . '</p></div>';
}
include_once 'views/html-admin-page-status-tools.php';
}
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:94,代码来源:class-wc-admin-status.php
示例10: complete
/**
* Complete
*
* Override if applicable, but ensure that the below actions are
* performed, or, call parent::complete().
*/
protected function complete()
{
$logger = new WC_Logger();
$logger->add('wc_db_updates', 'Data update complete');
WC_Install::update_db_version();
parent::complete();
}
开发者ID:Biont,项目名称:woocommerce,代码行数:13,代码来源:class-wc-background-updater.php
示例11: status_tools
/**
* Handles output of tools
*/
public static function status_tools()
{
global $woocommerce, $wpdb;
$tools = self::get_tools();
if (!empty($_GET['action']) && !empty($_REQUEST['_wpnonce']) && wp_verify_nonce($_REQUEST['_wpnonce'], 'debug_action')) {
switch ($_GET['action']) {
case 'clear_transients':
wc_delete_product_transients();
echo '<div class="updated"><p>' . __('Product Transients Cleared', 'woocommerce') . '</p></div>';
break;
case 'clear_expired_transients':
// http://w-shadow.com/blog/2012/04/17/delete-stale-transients/
$rows = $wpdb->query("\n\t\t\t\t\t\tDELETE\n\t\t\t\t\t\t\ta, b\n\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t{$wpdb->options} a, {$wpdb->options} b\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\ta.option_name LIKE '_transient_%' AND\n\t\t\t\t\t\t\ta.option_name NOT LIKE '_transient_timeout_%' AND\n\t\t\t\t\t\t\tb.option_name = CONCAT(\n\t\t\t\t\t\t\t\t'_transient_timeout_',\n\t\t\t\t\t\t\t\tSUBSTRING(\n\t\t\t\t\t\t\t\t\ta.option_name,\n\t\t\t\t\t\t\t\t\tCHAR_LENGTH('_transient_') + 1\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\tAND b.option_value < UNIX_TIMESTAMP()\n\t\t\t\t\t");
$rows2 = $wpdb->query("\n\t\t\t\t\t\tDELETE\n\t\t\t\t\t\t\ta, b\n\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t{$wpdb->options} a, {$wpdb->options} b\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\ta.option_name LIKE '_site_transient_%' AND\n\t\t\t\t\t\t\ta.option_name NOT LIKE '_site_transient_timeout_%' AND\n\t\t\t\t\t\t\tb.option_name = CONCAT(\n\t\t\t\t\t\t\t\t'_site_transient_timeout_',\n\t\t\t\t\t\t\t\tSUBSTRING(\n\t\t\t\t\t\t\t\t\ta.option_name,\n\t\t\t\t\t\t\t\t\tCHAR_LENGTH('_site_transient_') + 1\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\tAND b.option_value < UNIX_TIMESTAMP()\n\t\t\t\t\t");
echo '<div class="updated"><p>' . sprintf(__('%d Transients Rows Cleared', 'woocommerce'), $rows + $rows2) . '</p></div>';
break;
case 'reset_roles':
// Remove then re-add caps and roles
$installer = (include WC()->plugin_path() . '/includes/class-wc-install.php');
$installer->remove_roles();
$installer->create_roles();
echo '<div class="updated"><p>' . __('Roles successfully reset', 'woocommerce') . '</p></div>';
break;
case 'recount_terms':
$product_cats = get_terms('product_cat', array('hide_empty' => false, 'fields' => 'id=>parent'));
_wc_term_recount($product_cats, get_taxonomy('product_cat'), true, false);
$product_tags = get_terms('product_tag', array('hide_empty' => false, 'fields' => 'id=>parent'));
_wc_term_recount($product_tags, get_taxonomy('product_tag'), true, false);
echo '<div class="updated"><p>' . __('Terms successfully recounted', 'woocommerce') . '</p></div>';
break;
case 'clear_sessions':
$wpdb->query("\n\t\t\t\t\t\tDELETE FROM {$wpdb->options}\n\t\t\t\t\t\tWHERE option_name LIKE '_wc_session_%' OR option_name LIKE '_wc_session_expires_%'\n\t\t\t\t\t");
wp_cache_flush();
echo '<div class="updated"><p>' . __('Sessions successfully cleared', 'woocommerce') . '</p></div>';
break;
case 'install_pages':
WC_Install::create_pages();
echo '<div class="updated"><p>' . __('All missing WooCommerce pages was installed successfully.', 'woocommerce') . '</p></div>';
break;
case 'delete_taxes':
$wpdb->query("TRUNCATE " . $wpdb->prefix . "woocommerce_tax_rates");
$wpdb->query("TRUNCATE " . $wpdb->prefix . "woocommerce_tax_rate_locations");
echo '<div class="updated"><p>' . __('Tax rates successfully deleted', 'woocommerce') . '</p></div>';
break;
case 'translation_upgrade':
// Delete language pack version
delete_option('woocommerce_language_pack_version');
// Force WordPress find for new updates
set_site_transient('update_plugins', null);
echo '<div class="updated"><p>' . sprintf(__('Forced the translations upgrade successfully, please check the <a href="%s">Updates page</a>', 'woocommerce'), add_query_arg(array('force-check' => '1'), admin_url('update-core.php'))) . '</p></div>';
break;
default:
$action = esc_attr($_GET['action']);
if (isset($tools[$action]['callback'])) {
$callback = $tools[$action]['callback'];
$return = call_user_func($callback);
if ($return === false) {
if (is_array($callback)) {
echo '<div class="error"><p>' . sprintf(__('There was an error calling %s::%s', 'woocommerce'), get_class($callback[0]), $callback[1]) . '</p></div>';
} else {
echo '<div class="error"><p>' . sprintf(__('There was an error calling %s', 'woocommerce'), $callback) . '</p></div>';
}
}
}
break;
}
}
// Display message if settings settings have been saved
if (isset($_REQUEST['settings-updated'])) {
echo '<div class="updated"><p>' . __('Your changes have been saved.', 'woocommerce') . '</p></div>';
}
include_once 'views/html-admin-page-status-tools.php';
}
开发者ID:joshquila,项目名称:demo2-youse,代码行数:76,代码来源:class-wc-admin-status.php
示例12: wc_update_260_db_version
function wc_update_260_db_version()
{
WC_Install::update_db_version('2.6.0');
}
开发者ID:Korkey128k,项目名称:woocommerce,代码行数:4,代码来源:wc-update-functions.php
示例13: wp_clear_scheduled_hook
}
global $wpdb, $wp_version;
wp_clear_scheduled_hook('woocommerce_scheduled_sales');
wp_clear_scheduled_hook('woocommerce_cancel_unpaid_orders');
wp_clear_scheduled_hook('woocommerce_cleanup_sessions');
wp_clear_scheduled_hook('woocommerce_geoip_updater');
wp_clear_scheduled_hook('woocommerce_tracker_send_event');
/*
* Only remove ALL product and page data if WC_REMOVE_ALL_DATA constant is set to true in user's
* wp-config.php. This is to prevent data loss when deleting the plugin from the backend
* and to ensure only the site owner can perform this action.
*/
if (defined('WC_REMOVE_ALL_DATA') && true === WC_REMOVE_ALL_DATA) {
// Roles + caps.
include_once dirname(__FILE__) . '/includes/class-wc-install.php';
WC_Install::remove_roles();
// Pages.
wp_trash_post(get_option('woocommerce_shop_page_id'));
wp_trash_post(get_option('woocommerce_cart_page_id'));
wp_trash_post(get_option('woocommerce_checkout_page_id'));
wp_trash_post(get_option('woocommerce_myaccount_page_id'));
wp_trash_post(get_option('woocommerce_edit_address_page_id'));
wp_trash_post(get_option('woocommerce_view_order_page_id'));
wp_trash_post(get_option('woocommerce_change_password_page_id'));
wp_trash_post(get_option('woocommerce_logout_page_id'));
if ($wpdb->get_var("SHOW TABLES LIKE '{$wpdb->prefix}woocommerce_attribute_taxonomies';")) {
$wc_attributes = array_filter((array) $wpdb->get_col("SELECT attribute_name FROM {$wpdb->prefix}woocommerce_attribute_taxonomies;"));
} else {
$wc_attributes = array();
}
// Tables.
开发者ID:tlovett1,项目名称:woocommerce,代码行数:31,代码来源:uninstall.php
示例14: plugin_row_meta
*/
public static function plugin_row_meta($links, $file)
{
if ($file == WC_PLUGIN_BASENAME) {
$row_meta = array('docs' => '<a href="' . esc_url(apply_filters('woocommerce_docs_url', 'http://docs.woothemes.com/documentation/plugins/woocommerce/')) . '" title="' . esc_attr(__('View WooCommerce Documentation', 'woocommerce')) . '">' . __('Docs', 'woocommerce') . '</a>', 'apidocs' => '<a href="' . esc_url(apply_filters('woocommerce_apidocs_url', 'http://docs.woothemes.com/wc-apidocs/')) . '" title="' . esc_attr(__('View WooCommerce API Docs', 'woocommerce')) . '">' . __('API Docs', 'woocommerce') . '</a>', 'support' => '<a href="' . esc_url(apply_filters('woocommerce_support_url', 'http://support.woothemes.com/')) . '" title="' . esc_attr(__('Visit Premium Customer Support Forum', 'woocommerce')) . '">' . __('Premium Support', 'woocommerce') . '</a>');
return array_merge($links, $row_meta);
}
return (array) $links;
}
/**
* Uninstall tables when MU blog is deleted.
* @param array $tables
* @return array
*/
public static function wpmu_drop_tables($tables)
{
global $wpdb;
$tables[] = $wpdb->prefix . 'woocommerce_sessions';
$tables[] = $wpdb->prefix . 'woocommerce_api_keys';
$tables[] = $wpdb->prefix . 'woocommerce_attribute_taxonomies';
$tables[] = $wpdb->prefix . 'woocommerce_downloadable_product_permissions';
$tables[] = $wpdb->prefix . 'woocommerce_termmeta';
$tables[] = $wpdb->prefix . 'woocommerce_tax_rates';
$tables[] = $wpdb->prefix . 'woocommerce_tax_rate_locations';
$tables[] = $wpdb->prefix . 'woocommerce_order_items';
$tables[] = $wpdb->prefix . 'woocommerce_order_itemmeta';
return $tables;
}
}
WC_Install::init();
开发者ID:AnnG56,项目名称:woocommerce,代码行数:30,代码来源:class-wc-install.php
示例15: test_remove_roles
/**
* Test - remove roles.
*/
public function test_remove_roles()
{
WC_Install::remove_roles();
$this->assertNull(get_role('customer'));
$this->assertNull(get_role('shop_manager'));
}
开发者ID:WPprodigy,项目名称:woocommerce,代码行数:9,代码来源:install.php
示例16: execute_tool
/**
* Actually executes a a tool.
*
* @param string $tool
* @return array
*/
public function execute_tool($tool)
{
global $wpdb;
$ran = true;
switch ($tool) {
case 'clear_transients':
wc_delete_product_transients();
wc_delete_shop_order_transients();
WC_Cache_Helper::get_transient_version('shipping', true);
$message = __('Product Transients Cleared', 'woocommerce');
break;
case 'clear_expired_transients':
/*
* Deletes all expired transients. The multi-table delete syntax is used.
* to delete the transient record from table a, and the corresponding.
* transient_timeout record from table b.
*
* Based on code inside core's upgrade_network() function.
*/
$sql = "DELETE a, b FROM {$wpdb->options} a, {$wpdb->options} b\n\t\t\t\t\tWHERE a.option_name LIKE %s\n\t\t\t\t\tAND a.option_name NOT LIKE %s\n\t\t\t\t\tAND b.option_name = CONCAT( '_transient_timeout_', SUBSTRING( a.option_name, 12 ) )\n\t\t\t\t\tAND b.option_value < %d";
$rows = $wpdb->query($wpdb->prepare($sql, $wpdb->esc_like('_transient_') . '%', $wpdb->esc_like('_transient_timeout_') . '%', time()));
$sql = "DELETE a, b FROM {$wpdb->options} a, {$wpdb->options} b\n\t\t\t\t\tWHERE a.option_name LIKE %s\n\t\t\t\t\tAND a.option_name NOT LIKE %s\n\t\t\t\t\tAND b.option_name = CONCAT( '_site_transient_timeout_', SUBSTRING( a.option_name, 17 ) )\n\t\t\t\t\tAND b.option_value < %d";
$rows2 = $wpdb->query($wpdb->prepare($sql, $wpdb->esc_like('_site_transient_') . '%', $wpdb->esc_like('_site_transient_timeout_') . '%', time()));
$message = sprintf(__('%d Transients Rows Cleared', 'woocommerce'), $rows + $rows2);
break;
case 'reset_roles':
// Remove then re-add caps and roles
WC_Install::remove_roles();
WC_Install::create_roles();
$message = __('Roles successfully reset', 'woocommerce');
break;
case 'recount_terms':
$product_cats = get_terms('product_cat', array('hide_empty' => false, 'fields' => 'id=>parent'));
_wc_term_recount($product_cats, get_taxonomy('product_cat'), true, false);
$product_tags = get_terms('product_tag', array('hide_empty' => false, 'fields' => 'id=>parent'));
_wc_term_recount($product_tags, get_taxonomy('product_tag'), true, false);
$message = __('Terms successfully recounted', 'woocommerce');
break;
case 'clear_sessions':
$wpdb->query("TRUNCATE {$wpdb->prefix}woocommerce_sessions");
wp_cache_flush();
$message = __('Sessions successfully cleared', 'woocommerce');
break;
case 'install_pages':
WC_Install::create_pages();
return __('All missing WooCommerce pages was installed successfully.', 'woocommerce');
break;
case 'delete_taxes':
$wpdb->query("TRUNCATE TABLE {$wpdb->prefix}woocommerce_tax_rates;");
$wpdb->query("TRUNCATE TABLE {$wpdb->prefix}woocommerce_tax_rate_locations;");
WC_Cache_Helper::incr_cache_prefix('taxes');
$message = __('Tax rates successfully deleted', 'woocommerce');
break;
case 'reset_tracking':
delete_option('woocommerce_allow_tracking');
WC_Admin_Notices::add_notice('tracking');
$message = __('Usage tracking settings successfully reset.', 'woocommerce');
break;
default:
$tools = $this->get_tools();
if (isset($tools[$tool]['callback'])) {
$callback = $tools[$tool]['callback'];
$return = call_user_func($callback);
if ($return === false) {
$callback_string = is_array($callback) ? get_class($callback[0]) . '::' . $callback[1] : $callback;
$ran = false;
$message = sprintf(__('There was an error calling %s', 'woocommerce'), $callback_string);
} else {
$message = __('Tool ran.', 'woocommerce');
}
} else {
$ran = false;
$message = __('There was an error calling this tool. There is no callback present.', 'woocommerce');
}
break;
}
return array('success' => $ran, 'message' => $message);
}
开发者ID:tlovett1,项目名称:woocommerce,代码行数:84,代码来源:class-wc-rest-system-status-tools-controller.php
示例17: wc_setup_pages_save
/**
* Save Page Settings
*/
public function wc_setup_pages_save()
{
check_admin_referer('wc-setup');
WC_Install::create_pages();
wp_redirect(esc_url_raw($this->get_next_step_link()));
exit;
}
开发者ID:zengskie,项目名称:Heroku-WordPress-PostgreSQL,代码行数:10,代码来源:class-wc-admin-setup-wizard.php
示例18: delete_woocommerce_data
/**
* Delete all woocommerce data
*
*/
public function delete_woocommerce_data()
{
global $wpdb;
global $wc_product_attributes;
$wpdb->show_errors();
$sql_queries = array();
$sql_queries[] = <<<SQL
-- Delete WooCommerce term metas
TRUNCATE {$wpdb->prefix}woocommerce_termmeta
SQL;
$sql_queries[] = <<<SQL
-- Delete WooCommerce attribute taxonomies
TRUNCATE {$wpdb->prefix}woocommerce_attribute_taxonomies
SQL;
$sql_queries[] = <<<SQL
-- Delete WooCommerce order items
TRUNCATE {$wpdb->prefix}woocommerce_order_items
SQL;
$sql_queries[] = <<<SQL
-- Delete WooCommerce order item metas
TRUNCATE {$wpdb->prefix}woocommerce_order_itemmeta
SQL;
// Execute SQL queries
if (count($sql_queries) > 0) {
foreach ($sql_queries as $sql) {
$wpdb->query($sql);
}
}
// Reset the WC pages flags
$wc_pages = array('shop', 'cart', 'checkout', 'myaccount');
foreach ($wc_pages as $wc_page) {
update_option('woocommerce_' . $wc_page . '_page_id', 0);
}
// Empty attribute taxonomies cache
delete_transient('wc_attribute_taxonomies');
$wc_product_attributes = array();
$wpdb->hide_errors();
$this->display_admin_notice(__('WooCommerce data deleted', 'fg-magento-to-woocommerce'));
// Recreate WooCommerce default data
if (class_exists('WC_Install')) {
WC_Install::create_pages();
$this->display_admin_notice(__('WooCommerce default data created', 'fg-magento-to-woocommerce'));
}
}
开发者ID:mike-a-b,项目名称:teeninstyle,代码行数:48,代码来源:class-fg-magento-to-woocommerce-admin.php
示例19: init
/**
* Hook in tabs.
*/
public static function init()
{
add_action('init', array(__CLASS__, 'check_version'), 5);
add_action('admin_init', array(__CLASS__, 'install_actions'));
add_action('in_plugin_update_message-woocommerce/woocommerce.php', array(__CLASS__, 'in_plugin_update_message'));
add_filter('plugin_action_links_' . WC_PLUGIN_BASENAME, array(__CLASS__, 'plugin_action_links'));
add_filter('plugin_row_meta', array(__CLASS__, 'plugin_row_meta'), 10, 2);
add_filter('wpmu_drop_tables', array(__CLASS__, 'wpmu_drop_tables'));
add_filter('cron_schedules', array(__CLASS__, 'cron_schedules'));
add_action('woocommerce_plugin_background_installer', array(__CLASS__, 'background_installer'), 10, 2);
// Init background updates
self::$background_updater = new WC_Background_Updater();
}
开发者ID:seriusokhatsky,项目名称:woocommerce,代码行数:16,代码来源:class-wc-install.php
示例20: init_background_updater
/**
* Init background updates
*/
public static function init_background_updater()
{
include_once 'class-wc-background-updater.php';
self::$background_updater = new WC_Background_Updater();
}
开发者ID:jesusmarket,项目名称:jesusmarket,代码行数:8,代码来源:class-wc-install.php
注:本文中的WC_Install类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论