PHP Class WC_Install

Exibir arquivo Open project: woocommerce/woocommerce Class Usage Examples

Public Methods

Method Description
background_installer ( string $plugin_to_install_id, array $plugin_to_install ) Install a plugin from .org in the background via a cron job (used by installer - opt in).
check_version ( ) Check WooCommerce version and run the updater is required.
create_pages ( ) Create pages that the plugin relies on, storing page id's in variables.
create_roles ( ) Create roles and capabilities.
cron_schedules ( array $schedules ) : array Add more cron schedules.
in_plugin_update_message ( $args ) Show plugin changes. Code adapted from W3 Total Cache.
init ( ) Hook in tabs.
init_background_updater ( ) Init background updates
install ( ) Install WC.
install_actions ( ) Install actions when a update button is clicked within the admin area.
plugin_action_links ( mixed $links ) : array Show action links on the plugin screen.
plugin_row_meta ( mixed $links, mixed $file ) : array Show row meta on the plugin screen.
remove_roles ( ) woocommerce_remove_roles function.
update_db_version ( string $version = null ) Update DB version to current.
wpmu_drop_tables ( array $tables ) : string[] Uninstall tables when MU blog is deleted.

Private Methods

Method Description
create_cron_jobs ( ) Create cron jobs (clear them first).
create_files ( ) Create files/directories.
create_options ( ) Default options.
create_tables ( ) Set up the database tables which the plugin needs to function.
create_terms ( ) Add the default terms for WC taxonomies - product types and order statuses. Modify this at your own risk.
format_plugin_slug ( string $key ) : string Get slug from path
get_core_capabilities ( ) : array Get capabilities for WooCommerce - these are assigned to admin/shop manager during installation or reset.
get_schema ( ) : string Get Table schema.
parse_update_notice ( string $content, string $new_version ) : string Parse update notice from readme file.
update ( ) Push all needed DB updates to the queue for processing.
update_wc_version ( ) Update WC version to current.

Method Details

background_installer() public static method

Install a plugin from .org in the background via a cron job (used by installer - opt in).
Since: 2.6.0
public static background_installer ( string $plugin_to_install_id, array $plugin_to_install )
$plugin_to_install_id string
$plugin_to_install array

check_version() public static method

This check is done on all requests and runs if he versions do not match.
public static check_version ( )

create_pages() public static method

Create pages that the plugin relies on, storing page id's in variables.
public static create_pages ( )

create_roles() public static method

Create roles and capabilities.
public static create_roles ( )

cron_schedules() public static method

Add more cron schedules.
public static cron_schedules ( array $schedules ) : array
$schedules array
return array

in_plugin_update_message() public static method

Show plugin changes. Code adapted from W3 Total Cache.
public static in_plugin_update_message ( $args )

init() public static method

Hook in tabs.
public static init ( )

init_background_updater() public static method

Init background updates
public static init_background_updater ( )

install() public static method

Install WC.
public static install ( )

install_actions() public static method

This function is hooked into admin_init to affect admin only.
public static install_actions ( )

plugin_row_meta() public static method

Show row meta on the plugin screen.
public static plugin_row_meta ( mixed $links, mixed $file ) : array
$links mixed Plugin Row Meta
$file mixed Plugin Base file
return array

remove_roles() public static method

woocommerce_remove_roles function.
public static remove_roles ( )

update_db_version() public static method

Update DB version to current.
public static update_db_version ( string $version = null )
$version string

wpmu_drop_tables() public static method

Uninstall tables when MU blog is deleted.
public static wpmu_drop_tables ( array $tables ) : string[]
$tables array
return string[]