本文整理汇总了PHP中wc_get_screen_ids函数的典型用法代码示例。如果您正苦于以下问题:PHP wc_get_screen_ids函数的具体用法?PHP wc_get_screen_ids怎么用?PHP wc_get_screen_ids使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wc_get_screen_ids函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add_tabs
/**
* Add Contextual help tabs
*/
public function add_tabs()
{
$screen = get_current_screen();
if (!in_array($screen->id, wc_get_screen_ids())) {
return;
}
$video_map = array('wc-settings' => array('title' => __('General Settings', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/mz2l10u5f6?videoFoam=true'), 'wc-settings-general' => array('title' => __('General Settings', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/mz2l10u5f6?videoFoam=true'), 'wc-settings-products' => array('title' => __('Product Settings', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/lolkan4fxf?videoFoam=true'), 'wc-settings-tax' => array('title' => __('Tax Settings', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/qp1v19dwrh?videoFoam=true'), 'wc-settings-checkout' => array('title' => __('Checkout Settings', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/65yjv96z51?videoFoam=true'), 'wc-settings-shipping' => array('title' => __('Shipping Settings', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/9c9008dxnr?videoFoam=true'), 'wc-settings-account' => array('title' => __('Account Settings', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/35mazq7il2?videoFoam=true'), 'wc-settings-email' => array('title' => __('Email Settings', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/svcaftq4xv?videoFoam=true'), 'wc-settings-api' => array('title' => __('Webhook Settings', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/1q0ny74vvq?videoFoam=true'), 'wc-settings-checkout-wc_gateway_paypal' => array('title' => __('PayPal Standard', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/rbl7e7l4k2?videoFoam=true'), 'wc-settings-checkout-wc_gateway_simplify_commerce' => array('title' => __('Simplify Commerce', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/jdfzjiiw61?videoFoam=true'), 'wc-settings-shipping' => array('title' => __('Shipping Settings', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/9c9008dxnr?videoFoam=true'), 'wc-settings-shipping-wc_shipping_free_shipping' => array('title' => __('Free Shipping', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/po191fmvy9?videoFoam=true'), 'wc-settings-shipping-wc_shipping_local_delivery' => array('title' => __('Local Delivery', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/5qjepx9ozj?videoFoam=true'), 'wc-settings-shipping-wc_shipping_local_pickup' => array('title' => __('Local Pickup', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/pe95ph0apb?videoFoam=true'), 'edit-product_cat' => array('title' => __('Product Categories, Tags, Shipping Classes, & Attributes', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/f0j5gzqigg?videoFoam=true'), 'edit-product_tag' => array('title' => __('Product Categories, Tags, Shipping Classes, & Attributes', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/f0j5gzqigg?videoFoam=true'), 'edit-product_shipping_class' => array('title' => __('Product Categories, Tags, Shipping Classes, & Attributes', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/f0j5gzqigg?videoFoam=true'), 'product_attributes' => array('title' => __('Product Categories, Tags, Shipping Classes, & Attributes', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/f0j5gzqigg?videoFoam=true'), 'product' => array('title' => __('Simple Products', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/ziyjmd4kut?videoFoam=true'), 'wc-status' => array('title' => __('System Status', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/xdn733nnhi?videoFoam=true'), 'wc-reports' => array('title' => __('Reports', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/6aasex0w99?videoFoam=true'), 'edit-shop_coupon' => array('title' => __('Coupons', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/gupd4h8sit?videoFoam=true'), 'shop_coupon' => array('title' => __('Coupons', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/gupd4h8sit?videoFoam=true'), 'edit-shop_order' => array('title' => __('Managing Orders', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/n8n0sa8hee?videoFoam=true'), 'shop_order' => array('title' => __('Managing Orders', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/n8n0sa8hee?videoFoam=true'));
$page = empty($_GET['page']) ? '' : sanitize_title($_GET['page']);
$tab = empty($_GET['tab']) ? '' : sanitize_title($_GET['tab']);
$section = empty($_REQUEST['section']) ? '' : sanitize_title($_REQUEST['section']);
$video_key = $page ? implode('-', array_filter(array($page, $tab, $section))) : $screen->id;
// Fallback for sections
if (!isset($video_map[$video_key])) {
$video_key = $page ? implode('-', array_filter(array($page, $tab))) : $screen->id;
}
// Fallback for tabs
if (!isset($video_map[$video_key])) {
$video_key = $page ? $page : $screen->id;
}
if (isset($video_map[$video_key])) {
$screen->add_help_tab(array('id' => 'woocommerce_101_tab', 'title' => __('WooCommerce 101', 'woocommerce'), 'content' => '<h2><a href="http://docs.woothemes.com/document/woocommerce-101-video-series/?utm_source=WooCommerce&utm_medium=Wizard&utm_content=Videos&utm_campaign=Onboarding">' . __('WooCommerce 101', 'woocommerce') . '</a> – ' . esc_html($video_map[$video_key]['title']) . '</h2>' . '<iframe src="' . esc_url($video_map[$video_key]['url']) . '" allowtransparency="true" frameborder="0" scrolling="no" class="wistia_embed" name="wistia_embed" allowfullscreen mozallowfullscreen webkitallowfullscreen oallowfullscreen msallowfullscreen width="480" height="298"></iframe>'));
}
$screen->add_help_tab(array('id' => 'woocommerce_docs_tab', 'title' => __('Documentation', 'woocommerce'), 'content' => '<h2>' . __('Documentation', 'woocommerce') . '</h2>' . '<p>' . __('Should you need help understanding, using, or extending WooCommerce, please read our documentation. You will find all kinds of resources including snippets, tutorials and much more.', 'woocommerce') . '</p>' . '<p><a href="' . 'http://docs.woothemes.com/documentation/plugins/woocommerce/' . '" class="button button-primary">' . __('WooCommerce Documentation', 'woocommerce') . '</a> <a href="' . 'http://docs.woothemes.com/wc-apidocs/' . '" class="button">' . __('Developer API Docs', 'woocommerce') . '</a></p>'));
$screen->add_help_tab(array('id' => 'woocommerce_support_tab', 'title' => __('Support', 'woocommerce'), 'content' => '<h2>' . __('Support', 'woocommerce') . '</h2>' . '<p>' . sprintf(__('After %sreading the documentation%s, for further assistance you can use the %scommunity forums%s on WordPress.org to talk with other users. If however you are a WooThemes customer, or need help with premium add-ons sold by WooThemes, please %suse our helpdesk%s.', 'woocommerce'), '<a href="http://docs.woothemes.com/documentation/plugins/woocommerce/">', '</a>', '<a href="https://wordpress.org/support/plugin/woocommerce">', '</a>', '<a href="http://support.woothemes.com">', '</a>') . '</p>' . '<p>' . __('Before asking for help we recommend checking the system status page to identify any problems with your configuration.', 'woocommerce') . '</p>' . '<p><a href="' . admin_url('admin.php?page=wc-status') . '" class="button button-primary">' . __('System Status', 'woocommerce') . '</a> <a href="' . 'https://wordpress.org/support/plugin/woocommerce' . '" class="button">' . __('WordPress.org Forums', 'woocommerce') . '</a> <a href="' . 'http://support.woothemes.com' . '" class="button">' . __('WooThemes Customer Support', 'woocommerce') . '</a></p>'));
$screen->add_help_tab(array('id' => 'woocommerce_education_tab', 'title' => __('Education', 'woocommerce'), 'content' => '<h2>' . __('Education', 'woocommerce') . '</h2>' . '<p>' . __('If you would like to learn about using WooCommerce from an expert, consider following a WooCommerce course ran by one of our educational partners.', 'woocommerce') . '</p>' . '<p><a href="' . 'http://www.woothemes.com/educational-partners/?utm_source=WooCommerce&utm_medium=Wizard&utm_content=Partners&utm_campaign=Onboarding' . '" class="button button-primary">' . __('View Education Partners', 'woocommerce') . '</a></p>'));
$screen->add_help_tab(array('id' => 'woocommerce_bugs_tab', 'title' => __('Found a bug?', 'woocommerce'), 'content' => '<h2>' . __('Found a bug?', 'woocommerce') . '</h2>' . '<p>' . sprintf(__('If you find a bug within WooCommerce core you can create a ticket via <a href="%s">Github issues</a>. Ensure you read the <a href="%s">contribution guide</a> prior to submitting your report. To help us solve your issue, please be as descriptive as possible and include your <a href="%s">system status report</a>.', 'woocommerce'), 'https://github.com/woothemes/woocommerce/issues?state=open', 'https://github.com/woothemes/woocommerce/blob/master/CONTRIBUTING.md', admin_url('admin.php?page=wc-status')) . '</p>' . '<p><a href="' . 'https://github.com/woothemes/woocommerce/issues?state=open' . '" class="button button-primary">' . __('Report a bug', 'woocommerce') . '</a> <a href="' . admin_url('admin.php?page=wc-status') . '" class="button">' . __('System Status', 'woocommerce') . '</a></p>'));
$screen->set_help_sidebar('<p><strong>' . __('For more information:', 'woocommerce') . '</strong></p>' . '<p><a href="' . 'http://www.woothemes.com/woocommerce/' . '" target="_blank">' . __('About WooCommerce', 'woocommerce') . '</a></p>' . '<p><a href="' . 'http://wordpress.org/extend/plugins/woocommerce/' . '" target="_blank">' . __('WordPress.org Project', 'woocommerce') . '</a></p>' . '<p><a href="' . 'https://github.com/woothemes/woocommerce' . '" target="_blank">' . __('Github Project', 'woocommerce') . '</a></p>' . '<p><a href="' . 'http://www.woothemes.com/product-category/themes/woocommerce/' . '" target="_blank">' . __('Official Themes', 'woocommerce') . '</a></p>' . '<p><a href="' . 'http://www.woothemes.com/product-category/woocommerce-extensions/' . '" target="_blank">' . __('Official Extensions', 'woocommerce') . '</a></p>');
}
示例2: add_tabs
/**
* Add Contextual help tabs.
*/
public function add_tabs()
{
$screen = get_current_screen();
if (!$screen || !in_array($screen->id, wc_get_screen_ids())) {
return;
}
$video_map = array('wc-settings' => array('title' => __('General Settings', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/mz2l10u5f6?videoFoam=true'), 'wc-settings-general' => array('title' => __('General Settings', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/mz2l10u5f6?videoFoam=true'), 'wc-settings-products' => array('title' => __('Product Settings', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/lolkan4fxf?videoFoam=true'), 'wc-settings-tax' => array('title' => __('Tax Settings', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/qp1v19dwrh?videoFoam=true'), 'wc-settings-shipping' => array('title' => __('Shipping Zones', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/95yiocro6p?videoFoam=true'), 'wc-settings-shipping-options' => array('title' => __('Shipping Options', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/9c9008dxnr?videoFoam=true'), 'wc-settings-shipping-classes' => array('title' => __('Shipping Classes', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/tpqg17aq99?videoFoam=true'), 'wc-settings-checkout' => array('title' => __('Checkout Settings', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/65yjv96z51?videoFoam=true'), 'wc-settings-checkout-bacs' => array('title' => __('Bank Transfer (BACS) Payments', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/dh4piy3sek?videoFoam=true'), 'wc-settings-checkout-cheque' => array('title' => __('Check Payments', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/u2m2kcakea?videoFoam=true'), 'wc-settings-checkout-cod' => array('title' => __('Cash on Delivery', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/8hyli8wu5f?videoFoam=true'), 'wc-settings-checkout-paypal' => array('title' => __('PayPal Standard', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/rbl7e7l4k2?videoFoam=true'), 'wc-settings-checkout-paypalbraintree_cards' => array('title' => __('PayPal by Braintree', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/oyksirgn40?videoFoam=true'), 'wc-settings-checkout-stripe' => array('title' => __('Stripe', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/mf975hx5de?videoFoam=true'), 'wc-settings-checkout-simplify_commerce' => array('title' => __('Simplify Commerce', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/jdfzjiiw61?videoFoam=true'), 'wc-settings-account' => array('title' => __('Account Settings', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/35mazq7il2?videoFoam=true'), 'wc-settings-email' => array('title' => __('Email Settings', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/svcaftq4xv?videoFoam=true'), 'wc-settings-api' => array('title' => __('Webhook Settings', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/1q0ny74vvq?videoFoam=true'), 'product' => array('title' => __('Simple Products', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/ziyjmd4kut?videoFoam=true'), 'edit-product_cat' => array('title' => __('Product Categories', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/f0j5gzqigg?videoFoam=true'), 'edit-product_tag' => array('title' => __('Product Categories, Tags, Shipping Classes, & Attributes', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/f0j5gzqigg?videoFoam=true'), 'product_attributes' => array('title' => __('Product Categories, Tags, Shipping Classes, & Attributes', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/f0j5gzqigg?videoFoam=true'), 'wc-status' => array('title' => __('System Status', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/xdn733nnhi?videoFoam=true'), 'wc-reports' => array('title' => __('Reports', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/6aasex0w99?videoFoam=true'), 'edit-shop_coupon' => array('title' => __('Coupons', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/gupd4h8sit?videoFoam=true'), 'shop_coupon' => array('title' => __('Coupons', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/gupd4h8sit?videoFoam=true'), 'edit-shop_order' => array('title' => __('Managing Orders', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/n8n0sa8hee?videoFoam=true'), 'shop_order' => array('title' => __('Managing Orders', 'woocommerce'), 'url' => '//fast.wistia.net/embed/iframe/n8n0sa8hee?videoFoam=true'));
$page = empty($_GET['page']) ? '' : sanitize_title($_GET['page']);
$tab = empty($_GET['tab']) ? '' : sanitize_title($_GET['tab']);
$section = empty($_REQUEST['section']) ? '' : sanitize_title($_REQUEST['section']);
$video_key = $page ? implode('-', array_filter(array($page, $tab, $section))) : $screen->id;
// Fallback for sections
if (!isset($video_map[$video_key])) {
$video_key = $page ? implode('-', array_filter(array($page, $tab))) : $screen->id;
}
// Fallback for tabs
if (!isset($video_map[$video_key])) {
$video_key = $page ? $page : $screen->id;
}
if (isset($video_map[$video_key])) {
$screen->add_help_tab(array('id' => 'woocommerce_101_tab', 'title' => __('WooCommerce 101', 'woocommerce'), 'content' => '<h2><a href="https://docs.woocommerce.com/document/woocommerce-101-video-series/?utm_source=helptab&utm_medium=product&utm_content=videos&utm_campaign=woocommerceplugin">' . __('WooCommerce 101', 'woocommerce') . '</a> – ' . esc_html($video_map[$video_key]['title']) . '</h2>' . '<iframe data-src="' . esc_url($video_map[$video_key]['url']) . '" src="" allowtransparency="true" frameborder="0" scrolling="no" class="wistia_embed" name="wistia_embed" allowfullscreen mozallowfullscreen webkitallowfullscreen oallowfullscreen msallowfullscreen width="480" height="298"></iframe>'));
}
$screen->add_help_tab(array('id' => 'woocommerce_support_tab', 'title' => __('Help & Support', 'woocommerce'), 'content' => '<h2>' . __('Help & Support', 'woocommerce') . '</h2>' . '<p>' . sprintf(__('Should you need help understanding, using, or extending WooCommerce, %splease read our documentation%s. You will find all kinds of resources including snippets, tutorials and much more.', 'woocommerce'), '<a href="https://docs.woocommerce.com/documentation/plugins/woocommerce/?utm_source=helptab&utm_medium=product&utm_content=docs&utm_campaign=woocommerceplugin">', '</a>') . '</p>' . '<p>' . sprintf(__('For further assistance with WooCommerce core you can use the %scommunity forum%s. If you need help with premium add-ons sold by WooThemes, please %suse our helpdesk%s.', 'woocommerce'), '<a href="https://wordpress.org/support/plugin/woocommerce">', '</a>', '<a href="https://woocommerce.com/my-account/tickets/?utm_source=helptab&utm_medium=product&utm_content=tickets&utm_campaign=woocommerceplugin">', '</a>') . '</p>' . '<p>' . __('Before asking for help we recommend checking the system status page to identify any problems with your configuration.', 'woocommerce') . '</p>' . '<p><a href="' . admin_url('admin.php?page=wc-status') . '" class="button button-primary">' . __('System Status', 'woocommerce') . '</a> <a href="' . 'https://wordpress.org/support/plugin/woocommerce' . '" class="button">' . __('Community Forum', 'woocommerce') . '</a> <a href="' . 'https://woocommerce.com/my-account/tickets/?utm_source=helptab&utm_medium=product&utm_content=tickets&utm_campaign=woocommerceplugin' . '" class="button">' . __('WooThemes Helpdesk', 'woocommerce') . '</a></p>'));
$screen->add_help_tab(array('id' => 'woocommerce_bugs_tab', 'title' => __('Found a bug?', 'woocommerce'), 'content' => '<h2>' . __('Found a bug?', 'woocommerce') . '</h2>' . '<p>' . sprintf(__('If you find a bug within WooCommerce core you can create a ticket via <a href="%s">Github issues</a>. Ensure you read the <a href="%s">contribution guide</a> prior to submitting your report. To help us solve your issue, please be as descriptive as possible and include your <a href="%s">system status report</a>.', 'woocommerce'), 'https://github.com/woothemes/woocommerce/issues?state=open', 'https://github.com/woothemes/woocommerce/blob/master/.github/CONTRIBUTING.md', admin_url('admin.php?page=wc-status')) . '</p>' . '<p><a href="' . 'https://github.com/woothemes/woocommerce/issues?state=open' . '" class="button button-primary">' . __('Report a bug', 'woocommerce') . '</a> <a href="' . admin_url('admin.php?page=wc-status') . '" class="button">' . __('System Status', 'woocommerce') . '</a></p>'));
$screen->add_help_tab(array('id' => 'woocommerce_education_tab', 'title' => __('Education', 'woocommerce'), 'content' => '<h2>' . __('Education', 'woocommerce') . '</h2>' . '<p>' . __('If you would like to learn about using WooCommerce from an expert, consider following a WooCommerce course ran by one of our educational partners.', 'woocommerce') . '</p>' . '<p><a href="' . 'https://woocommerce.com/educational-partners/?utm_source=helptab&utm_medium=product&utm_content=edupartners&utm_campaign=woocommerceplugin' . '" class="button button-primary">' . __('View Education Partners', 'woocommerce') . '</a></p>'));
$screen->add_help_tab(array('id' => 'woocommerce_onboard_tab', 'title' => __('Setup Wizard', 'woocommerce'), 'content' => '<h2>' . __('Setup Wizard', 'woocommerce') . '</h2>' . '<p>' . __('If you need to access the setup wizard again, please click on the button below.', 'woocommerce') . '</p>' . '<p><a href="' . admin_url('index.php?page=wc-setup') . '" class="button button-primary">' . __('Setup Wizard', 'woocommerce') . '</a></p>'));
$screen->set_help_sidebar('<p><strong>' . __('For more information:', 'woocommerce') . '</strong></p>' . '<p><a href="' . 'https://woocommerce.com/?utm_source=helptab&utm_medium=product&utm_content=about&utm_campaign=woocommerceplugin' . '" target="_blank">' . __('About WooCommerce', 'woocommerce') . '</a></p>' . '<p><a href="' . 'https://wordpress.org/extend/plugins/woocommerce/' . '" target="_blank">' . __('WordPress.org Project', 'woocommerce') . '</a></p>' . '<p><a href="' . 'https://github.com/woothemes/woocommerce' . '" target="_blank">' . __('Github Project', 'woocommerce') . '</a></p>' . '<p><a href="' . 'https://woocommerce.com/product-category/themes/woocommerce/?utm_source=helptab&utm_medium=product&utm_content=wcthemes&utm_campaign=woocommerceplugin' . '" target="_blank">' . __('Official Themes', 'woocommerce') . '</a></p>' . '<p><a href="' . 'https://woocommerce.com/product-category/woocommerce-extensions/?utm_source=helptab&utm_medium=product&utm_content=wcextensions&utm_campaign=woocommerceplugin' . '" target="_blank">' . __('Official Extensions', 'woocommerce') . '</a></p>');
}
示例3: add_tabs
/**
* Add Contextual help tabs
*/
public function add_tabs()
{
$screen = get_current_screen();
if (!in_array($screen->id, wc_get_screen_ids())) {
return;
}
$screen->add_help_tab(array('id' => 'woocommerce_docs_tab', 'title' => __('Documentation', 'woocommerce'), 'content' => '<p>' . __('Thank you for using WooCommerce :) Should you need help using or extending WooCommerce please read the documentation.', 'woocommerce') . '</p>' . '<p><a href="' . 'http://docs.woothemes.com/documentation/plugins/woocommerce/' . '" class="button button-primary">' . __('WooCommerce Documentation', 'woocommerce') . '</a> <a href="' . 'http://docs.woothemes.com/wc-apidocs/' . '" class="button">' . __('Developer API Docs', 'woocommerce') . '</a></p>'));
$screen->add_help_tab(array('id' => 'woocommerce_support_tab', 'title' => __('Support', 'woocommerce'), 'content' => '<p>' . sprintf(__('After %sreading the documentation%s, for further assistance you can use our %scommunity forum%s if you get stuck. For help with premium add-ons from WooThemes, or if you are a WooThemes customer, you can %suse our helpdesk%s.', 'woocommerce'), '<a href="http://docs.woothemes.com/documentation/plugins/woocommerce/">', '</a>', '<a href="https://support.woothemes.com/hc/communities/public/topics">', '</a>', '<a href="http://support.woothemes.com">', '</a>') . '</p>' . '<p>' . __('Before asking for help we recommend checking the status page to identify any problems with your configuration.', 'woocommerce') . '</p>' . '<p><a href="' . admin_url('admin.php?page=wc-status') . '" class="button button-primary">' . __('System Status', 'woocommerce') . '</a> <a href="' . 'https://support.woothemes.com/hc/communities/public/topics' . '" class="button">' . __('WooThemes Community Support', 'woocommerce') . '</a> <a href="' . 'http://support.woothemes.com' . '" class="button">' . __('WooThemes Customer Support', 'woocommerce') . '</a></p>'));
$screen->add_help_tab(array('id' => 'woocommerce_bugs_tab', 'title' => __('Found a bug?', 'woocommerce'), 'content' => '<p>' . sprintf(__('If you find a bug within WooCommerce core you can create a ticket via <a href="%s">Github issues</a>. Ensure you read the <a href="%s">contribution guide</a> prior to submitting your report. Be as descriptive as possible and please include your <a href="%s">system status report</a>.', 'woocommerce'), 'https://github.com/woothemes/woocommerce/issues?state=open', 'https://github.com/woothemes/woocommerce/blob/master/CONTRIBUTING.md', admin_url('admin.php?page=wc-status')) . '</p>' . '<p><a href="' . 'https://github.com/woothemes/woocommerce/issues?state=open' . '" class="button button-primary">' . __('Report a bug', 'woocommerce') . '</a> <a href="' . admin_url('admin.php?page=wc-status') . '" class="button">' . __('System Status', 'woocommerce') . '</a></p>'));
$screen->set_help_sidebar('<p><strong>' . __('For more information:', 'woocommerce') . '</strong></p>' . '<p><a href="' . 'http://www.woothemes.com/woocommerce/' . '" target="_blank">' . __('About WooCommerce', 'woocommerce') . '</a></p>' . '<p><a href="' . 'http://wordpress.org/extend/plugins/woocommerce/' . '" target="_blank">' . __('WordPress.org Project', 'woocommerce') . '</a></p>' . '<p><a href="' . 'https://github.com/woothemes/woocommerce' . '" target="_blank">' . __('Github Project', 'woocommerce') . '</a></p>' . '<p><a href="' . 'http://www.woothemes.com/product-category/themes/woocommerce/' . '" target="_blank">' . __('Official Themes', 'woocommerce') . '</a></p>' . '<p><a href="' . 'http://www.woothemes.com/product-category/woocommerce-extensions/' . '" target="_blank">' . __('Official Extensions', 'woocommerce') . '</a></p>');
}
示例4: admin_footer_text
/**
* Change the admin footer text on WooCommerce admin pages.
*
* @since 2.3
* @param string $footer_text
* @return string
*/
public function admin_footer_text($footer_text)
{
if (!current_user_can('manage_woocommerce')) {
return;
}
$current_screen = get_current_screen();
$wc_pages = wc_get_screen_ids();
// Set only wc pages
$wc_pages = array_flip($wc_pages);
if (isset($wc_pages['profile'])) {
unset($wc_pages['profile']);
}
if (isset($wc_pages['user-edit'])) {
unset($wc_pages['user-edit']);
}
$wc_pages = array_flip($wc_pages);
// Check to make sure we're on a WooCommerce admin page
if (isset($current_screen->id) && apply_filters('woocommerce_display_admin_footer_text', in_array($current_screen->id, $wc_pages))) {
// Change the footer text
if (!get_option('woocommerce_admin_footer_text_rated')) {
$footer_text = sprintf(__('If you like <strong>WooCommerce</strong> please leave us a %s★★★★★%s rating. A huge thanks in advance!', 'woocommerce'), '<a href="https://wordpress.org/support/view/plugin-reviews/woocommerce?filter=5#postform" target="_blank" class="wc-rating-link" data-rated="' . esc_attr__('Thanks :)', 'woocommerce') . '">', '</a>');
wc_enqueue_js("\n\t\t\t\t\tjQuery( 'a.wc-rating-link' ).click( function() {\n\t\t\t\t\t\tjQuery.post( '" . WC()->ajax_url() . "', { action: 'woocommerce_rated' } );\n\t\t\t\t\t\tjQuery( this ).parent().text( jQuery( this ).data( 'rated' ) );\n\t\t\t\t\t});\n\t\t\t\t");
} else {
$footer_text = __('Thank you for selling with WooCommerce.', 'woocommerce');
}
}
return $footer_text;
}
示例5: admin_scripts
/**
* Enqueue scripts
*/
public function admin_scripts()
{
global $wp_query, $post;
$screen = get_current_screen();
$wc_screen_id = sanitize_title(__('WooCommerce', 'woocommerce'));
$suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
// Register scripts
wp_register_script('woocommerce_admin', WC()->plugin_url() . '/assets/js/admin/woocommerce_admin' . $suffix . '.js', array('jquery', 'jquery-blockui', 'jquery-ui-sortable', 'jquery-ui-widget', 'jquery-ui-core', 'jquery-tiptip'), WC_VERSION);
wp_register_script('jquery-blockui', WC()->plugin_url() . '/assets/js/jquery-blockui/jquery.blockUI' . $suffix . '.js', array('jquery'), '2.66', true);
wp_register_script('jquery-tiptip', WC()->plugin_url() . '/assets/js/jquery-tiptip/jquery.tipTip' . $suffix . '.js', array('jquery'), WC_VERSION, true);
wp_register_script('accounting', WC()->plugin_url() . '/assets/js/admin/accounting' . $suffix . '.js', array('jquery'), '0.3.2');
wp_register_script('round', WC()->plugin_url() . '/assets/js/admin/round' . $suffix . '.js', array('jquery'), WC_VERSION);
wp_register_script('woocommerce_admin_meta_boxes', WC()->plugin_url() . '/assets/js/admin/meta-boxes' . $suffix . '.js', array('jquery', 'jquery-ui-datepicker', 'jquery-ui-sortable', 'accounting', 'round'), WC_VERSION);
wp_register_script('woocommerce_admin_meta_boxes_variations', WC()->plugin_url() . '/assets/js/admin/meta-boxes-variations' . $suffix . '.js', array('jquery', 'jquery-ui-sortable'), WC_VERSION);
wp_register_script('ajax-chosen', WC()->plugin_url() . '/assets/js/chosen/ajax-chosen.jquery' . $suffix . '.js', array('jquery', 'chosen'), WC_VERSION);
wp_register_script('chosen', WC()->plugin_url() . '/assets/js/chosen/chosen.jquery' . $suffix . '.js', array('jquery'), WC_VERSION);
// Accounting
$params = array('mon_decimal_point' => get_option('woocommerce_price_decimal_sep'));
wp_localize_script('accounting', 'accounting_params', $params);
// WooCommerce admin pages
if (in_array($screen->id, wc_get_screen_ids())) {
wp_enqueue_script('woocommerce_admin');
wp_enqueue_script('iris');
wp_enqueue_script('ajax-chosen');
wp_enqueue_script('chosen');
wp_enqueue_script('jquery-ui-sortable');
wp_enqueue_script('jquery-ui-autocomplete');
$locale = localeconv();
$decimal = isset($locale['decimal_point']) ? $locale['decimal_point'] : '.';
$params = array('i18n_decimal_error' => sprintf(__('Please enter in decimal (%s) format without thousand separators.', 'woocommerce'), $decimal), 'i18n_mon_decimal_error' => sprintf(__('Please enter in monetary decimal (%s) format without thousand separators and currency symbols.', 'woocommerce'), get_option('woocommerce_price_decimal_sep')), 'decimal_point' => $decimal, 'mon_decimal_point' => get_option('woocommerce_price_decimal_sep'));
wp_localize_script('woocommerce_admin', 'woocommerce_admin', $params);
}
// Edit product category pages
if (in_array($screen->id, array('edit-product_cat'))) {
wp_enqueue_media();
}
// Products
if (in_array($screen->id, array('edit-product'))) {
wp_enqueue_script('woocommerce_quick-edit', WC()->plugin_url() . '/assets/js/admin/quick-edit' . $suffix . '.js', array('jquery'), WC_VERSION);
}
// Product/Coupon/Orders
if (in_array($screen->id, array('shop_coupon', 'shop_order', 'product', 'edit-shop_coupon', 'edit-shop_order', 'edit-product'))) {
wp_enqueue_script('woocommerce_admin_meta_boxes');
wp_enqueue_script('jquery-ui-datepicker');
wp_enqueue_media();
wp_enqueue_script('ajax-chosen');
wp_enqueue_script('chosen');
wp_enqueue_script('plupload-all');
$params = array('remove_item_notice' => __('Are you sure you want to remove the selected items? If you have previously reduced this item\'s stock, or this order was submitted by a customer, you will need to manually restore the item\'s stock.', 'woocommerce'), 'i18n_select_items' => __('Please select some items.', 'woocommerce'), 'remove_item_meta' => __('Remove this item meta?', 'woocommerce'), 'remove_attribute' => __('Remove this attribute?', 'woocommerce'), 'name_label' => __('Name', 'woocommerce'), 'remove_label' => __('Remove', 'woocommerce'), 'click_to_toggle' => __('Click to toggle', 'woocommerce'), 'values_label' => __('Value(s)', 'woocommerce'), 'text_attribute_tip' => __('Enter some text, or some attributes by pipe (|) separating values.', 'woocommerce'), 'visible_label' => __('Visible on the product page', 'woocommerce'), 'used_for_variations_label' => __('Used for variations', 'woocommerce'), 'new_attribute_prompt' => __('Enter a name for the new attribute term:', 'woocommerce'), 'calc_totals' => __('Calculate totals based on order items, discounts, and shipping?', 'woocommerce'), 'calc_line_taxes' => __('Calculate line taxes? This will calculate taxes based on the customers country. If no billing/shipping is set it will use the store base country.', 'woocommerce'), 'copy_billing' => __('Copy billing information to shipping information? This will remove any currently entered shipping information.', 'woocommerce'), 'load_billing' => __('Load the customer\'s billing information? This will remove any currently entered billing information.', 'woocommerce'), 'load_shipping' => __('Load the customer\'s shipping information? This will remove any currently entered shipping information.', 'woocommerce'), 'featured_label' => __('Featured', 'woocommerce'), 'prices_include_tax' => esc_attr(get_option('woocommerce_prices_include_tax')), 'round_at_subtotal' => esc_attr(get_option('woocommerce_tax_round_at_subtotal')), 'no_customer_selected' => __('No customer selected', 'woocommerce'), 'plugin_url' => WC()->plugin_url(), 'ajax_url' => admin_url('admin-ajax.php'), 'order_item_nonce' => wp_create_nonce("order-item"), 'add_attribute_nonce' => wp_create_nonce("add-attribute"), 'save_attributes_nonce' => wp_create_nonce("save-attributes"), 'calc_totals_nonce' => wp_create_nonce("calc-totals"), 'get_customer_details_nonce' => wp_create_nonce("get-customer-details"), 'search_products_nonce' => wp_create_nonce("search-products"), 'grant_access_nonce' => wp_create_nonce("grant-access"), 'revoke_access_nonce' => wp_create_nonce("revoke-access"), 'add_order_note_nonce' => wp_create_nonce("add-order-note"), 'delete_order_note_nonce' => wp_create_nonce("delete-order-note"), 'calendar_image' => WC()->plugin_url() . '/assets/images/calendar.png', 'post_id' => isset($post->ID) ? $post->ID : '', 'base_country' => WC()->countries->get_base_country(), 'currency_format_num_decimals' => absint(get_option('woocommerce_price_num_decimals')), 'currency_format_symbol' => get_woocommerce_currency_symbol(), 'currency_format_decimal_sep' => esc_attr(stripslashes(get_option('woocommerce_price_decimal_sep'))), 'currency_format_thousand_sep' => esc_attr(stripslashes(get_option('woocommerce_price_thousand_sep'))), 'currency_format' => esc_attr(str_replace(array('%1$s', '%2$s'), array('%s', '%v'), get_woocommerce_price_format())), 'rounding_precision' => WC_ROUNDING_PRECISION, 'tax_rounding_mode' => WC_TAX_ROUNDING_MODE, 'product_types' => array_map('sanitize_title', get_terms('product_type', array('hide_empty' => false, 'fields' => 'names'))), 'default_attribute_visibility' => apply_filters('default_attribute_visibility', false), 'default_attribute_variation' => apply_filters('default_attribute_variation', false), 'i18n_download_permission_fail' => __('Could not grant access - the user may already have permission for this file or billing email is not set. Ensure the billing email is set, and the order has been saved.', 'woocommerce'), 'i18n_permission_revoke' => __('Are you sure you want to revoke access to this download?', 'woocommerce'));
wp_localize_script('woocommerce_admin_meta_boxes', 'woocommerce_admin_meta_boxes', $params);
}
// Product specific
if (in_array($screen->id, array('product', 'edit-product'))) {
wp_enqueue_script('woocommerce_admin_meta_boxes_variations');
$params = array('post_id' => isset($post->ID) ? $post->ID : '', 'plugin_url' => WC()->plugin_url(), 'ajax_url' => admin_url('admin-ajax.php'), 'woocommerce_placeholder_img_src' => wc_placeholder_img_src(), 'add_variation_nonce' => wp_create_nonce("add-variation"), 'link_variation_nonce' => wp_create_nonce("link-variations"), 'delete_variation_nonce' => wp_create_nonce("delete-variation"), 'delete_variations_nonce' => wp_create_nonce("delete-variations"), 'i18n_link_all_variations' => esc_js(__('Are you sure you want to link all variations? This will create a new variation for each and every possible combination of variation attributes (max 50 per run).', 'woocommerce')), 'i18n_enter_a_value' => esc_js(__('Enter a value', 'woocommerce')), 'i18n_enter_a_value_fixed_or_percent' => esc_js(__('Enter a value (fixed or %)', 'woocommerce')), 'i18n_delete_all_variations' => esc_js(__('Are you sure you want to delete all variations? This cannot be undone.', 'woocommerce')), 'i18n_last_warning' => esc_js(__('Last warning, are you sure?', 'woocommerce')), 'i18n_choose_image' => esc_js(__('Choose an image', 'woocommerce')), 'i18n_set_image' => esc_js(__('Set variation image', 'woocommerce')), 'i18n_variation_added' => esc_js(__("variation added", 'woocommerce')), 'i18n_variations_added' => esc_js(__("variations added", 'woocommerce')), 'i18n_no_variations_added' => esc_js(__("No variations added", 'woocommerce')), 'i18n_remove_variation' => esc_js(__('Are you sure you want to remove this variation?', 'woocommerce')));
wp_localize_script('woocommerce_admin_meta_boxes_variations', 'woocommerce_admin_meta_boxes_variations', $params);
}
// Term ordering - only when sorting by term_order
if ((strstr($screen->id, 'edit-pa_') || !empty($_GET['taxonomy']) && in_array($_GET['taxonomy'], apply_filters('woocommerce_sortable_taxonomies', array('product_cat')))) && !isset($_GET['orderby'])) {
wp_register_script('woocommerce_term_ordering', WC()->plugin_url() . '/assets/js/admin/term-ordering.js', array('jquery-ui-sortable'), WC_VERSION);
wp_enqueue_script('woocommerce_term_ordering');
$taxonomy = isset($_GET['taxonomy']) ? wc_clean($_GET['taxonomy']) : '';
$woocommerce_term_order_params = array('taxonomy' => $taxonomy);
wp_localize_script('woocommerce_term_ordering', 'woocommerce_term_ordering_params', $woocommerce_term_order_params);
}
// Product sorting - only when sorting by menu order on the products page
if (current_user_can('edit_others_pages') && $screen->id == 'edit-product' && isset($wp_query->query['orderby']) && $wp_query->query['orderby'] == 'menu_order title') {
wp_enqueue_script('woocommerce_product_ordering', WC()->plugin_url() . '/assets/js/admin/product-ordering.js', array('jquery-ui-sortable'), WC_VERSION, true);
}
// Reports Pages
if (in_array($screen->id, apply_filters('woocommerce_reports_screen_ids', array($wc_screen_id . '_page_wc-reports', 'dashboard')))) {
wp_enqueue_script('wc-reports', WC()->plugin_url() . '/assets/js/admin/reports' . $suffix . '.js', array('jquery', 'jquery-ui-datepicker'), WC_VERSION);
wp_enqueue_script('flot', WC()->plugin_url() . '/assets/js/admin/jquery.flot' . $suffix . '.js', array('jquery'), WC_VERSION);
wp_enqueue_script('flot-resize', WC()->plugin_url() . '/assets/js/admin/jquery.flot.resize' . $suffix . '.js', array('jquery', 'flot'), WC_VERSION);
wp_enqueue_script('flot-time', WC()->plugin_url() . '/assets/js/admin/jquery.flot.time' . $suffix . '.js', array('jquery', 'flot'), WC_VERSION);
wp_enqueue_script('flot-pie', WC()->plugin_url() . '/assets/js/admin/jquery.flot.pie' . $suffix . '.js', array('jquery', 'flot'), WC_VERSION);
wp_enqueue_script('flot-stack', WC()->plugin_url() . '/assets/js/admin/jquery.flot.stack' . $suffix . '.js', array('jquery', 'flot'), WC_VERSION);
}
// Chosen RTL
if (is_rtl()) {
wp_enqueue_script('chosen-rtl', WC()->plugin_url() . '/assets/js/chosen/chosen-rtl' . $suffix . '.js', array('jquery'), WC_VERSION, true);
}
}
示例6: in_settings_page
private function in_settings_page()
{
$screen = get_current_screen();
$wcsids = wc_get_screen_ids();
if (is_array($wcsids) && isset($wcsids[2])) {
$wcsids = $wcsids[2];
} else {
$wcsids = 'woocommerce_page_wc-settings';
}
if (isset($_GET['tab']) && $_GET['tab'] == TM_ADMIN_SETTINGS_ID && in_array($screen->id, array($wcsids))) {
return true;
}
return false;
}
示例7: admin_footer_text
/**
* Change the admin footer text on WooCommerce admin pages
*
* @since 2.3
* @param string $footer_text
* @return string
*/
public function admin_footer_text($footer_text)
{
$current_screen = get_current_screen();
// Check to make sure we're on a WooCommerce admin page
if (isset($current_screen->id) && apply_filters('woocommerce_display_admin_footer_text', in_array($current_screen->id, wc_get_screen_ids()))) {
// Change the footer text
$footer_text = sprintf(__('If you like <strong>WooCommerce</strong> please leave us a <a href="%1$s" target="_blank">★★★★★</a> rating on <a href="%1$s" target="_blank">WordPress.org</a>. A huge thank you from WooThemes in advance!', 'woocommerce'), 'https://wordpress.org/support/view/plugin-reviews/woocommerce?filter=5#postform');
}
return $footer_text;
}