' . esc_html__('Settings', 'tich-courses') . ''; array_unshift($links, $settings_link); return $links; } /** * The leading "| " is ours, not WordPress core's - unlike the plugins-list * row actions, the action-link rows on these two completion screens are * core-joined with a plain space (see Plugin_Upgrader_Skin::after() and * Plugin_Installer_Skin::after()), so without it our link runs straight * into core's own preceding one with no visual separation at all. */ function tich_wc_settings_page_action_link() { return sprintf( '| %s', esc_url(admin_url('admin.php?page=tich')), esc_html__('Go to Tich settings', 'tich-courses') ); } /** * Adds a link to our own settings page alongside "לכל התוספים"/"Return to * Plugins page" on the single-plugin update results screen (update.php? * action=upgrade-plugin) - $plugin here is the plugin's basename (per this * filter's own definition in class-plugin-upgrader-skin.php), never a data * array, so it's a plain identity check against our own file. */ function tich_wc_update_complete_actions($actions, $plugin) { if ($plugin !== plugin_basename(TICH_WC_PLUGIN_FILE)) { return $actions; } $actions['tich_settings_page'] = tich_wc_settings_page_action_link(); return $actions; } add_filter('update_plugin_complete_actions', 'tich_wc_update_complete_actions', 10, 2); /** * Same as tich_wc_update_complete_actions, but for the "upload a plugin ZIP * that replaces an already-installed plugin" flow (update.php? * action=upload-plugin), which WordPress core drives through a different * skin and filter - $plugin_file here is also the plugin's basename, per * this filter's own definition in class-plugin-installer-skin.php. */ function tich_wc_install_complete_actions($actions, $api, $plugin_file) { if ($plugin_file !== plugin_basename(TICH_WC_PLUGIN_FILE)) { return $actions; } $actions['tich_settings_page'] = tich_wc_settings_page_action_link(); return $actions; } add_filter('install_plugin_complete_actions', 'tich_wc_install_complete_actions', 10, 3); function tich_wc_bootstrap() { if (!class_exists('WooCommerce')) { add_action('admin_notices', 'tich_wc_missing_woocommerce_notice'); return; } // Only while WooCommerce (and so the settings page itself) is actually // registered - otherwise this would be a dead link on the Plugins page. add_filter('plugin_action_links_' . plugin_basename(TICH_WC_PLUGIN_FILE), 'tich_wc_settings_link'); require_once TICH_WC_PLUGIN_DIR . 'includes/class-tich-api.php'; require_once TICH_WC_PLUGIN_DIR . 'includes/class-tich-key-health.php'; require_once TICH_WC_PLUGIN_DIR . 'includes/class-tich-settings.php'; require_once TICH_WC_PLUGIN_DIR . 'includes/class-tich-grants-field.php'; require_once TICH_WC_PLUGIN_DIR . 'includes/class-tich-product-panel.php'; require_once TICH_WC_PLUGIN_DIR . 'includes/class-tich-enroller.php'; require_once TICH_WC_PLUGIN_DIR . 'includes/class-tich-order-context.php'; require_once TICH_WC_PLUGIN_DIR . 'includes/class-tich-orders.php'; new Tich_Settings(); new Tich_Key_Health(); new Tich_Product_Panel(); new Tich_Orders(); } function tich_wc_missing_woocommerce_notice() { echo '
' . esc_html__( '"Tich Courses for WooCommerce" requires the WooCommerce plugin to be installed and active.', 'tich-courses' ) . '