installed plugin Easy Digital Downloads
version 3.1.0.3
This commit is contained in:
@ -0,0 +1,136 @@
|
||||
<?php
|
||||
/**
|
||||
* Contextual Help
|
||||
*
|
||||
* @package EDD
|
||||
* @subpackage Admin/Settings
|
||||
* @copyright Copyright (c) 2018, Easy Digital Downloads, LLC
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
||||
* @since 1.4
|
||||
*/
|
||||
|
||||
use EDD\Admin\Pass_Manager;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Settings contextual help.
|
||||
*
|
||||
* @access private
|
||||
* @since 1.4
|
||||
* @return void
|
||||
*/
|
||||
function edd_settings_contextual_help() {
|
||||
$screen = get_current_screen();
|
||||
|
||||
if ( 'download_page_edd-settings' !== $screen->id ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$pass_manager = new Pass_Manager();
|
||||
if ( $pass_manager->isFree() ) {
|
||||
$docs_url = edd_link_helper(
|
||||
'https://easydigitaldownloads.com/docs/',
|
||||
array(
|
||||
'utm_medium' => 'settings-contextual-help',
|
||||
'utm_content' => 'documentation',
|
||||
)
|
||||
);
|
||||
|
||||
$upgrade_url = edd_link_helper(
|
||||
'https://easydigitaldownloads.com/lite-upgrade/',
|
||||
array(
|
||||
'utm_medium' => 'settings-contextual-help',
|
||||
'utm_content' => 'lite-upgrade',
|
||||
)
|
||||
);
|
||||
|
||||
$screen->set_help_sidebar(
|
||||
'<p><strong>' . __( 'For more information:', 'easy-digital-downloads' ) . '</strong></p>' .
|
||||
'<p>' . sprintf( __( 'Visit the <a href="%s">documentation</a> on the Easy Digital Downloads website.', 'easy-digital-downloads' ), $docs_url ) . '</p>' .
|
||||
'<p>' . sprintf(
|
||||
__( 'Need more from your Easy Digital Downloads store? <a href="%s">Upgrade Now!</a>.', 'easy-digital-downloads' ),
|
||||
$upgrade_url
|
||||
) . '</p>'
|
||||
);
|
||||
}
|
||||
|
||||
$screen->add_help_tab( array(
|
||||
'id' => 'edd-settings-general',
|
||||
'title' => __( 'General', 'easy-digital-downloads' ),
|
||||
'content' => '<p>' . __( 'This screen provides the most basic settings for configuring your store. You can set the currency, page templates, and general store settings.', 'easy-digital-downloads' ) . '</p>',
|
||||
) );
|
||||
|
||||
$screen->add_help_tab( array(
|
||||
'id' => 'edd-settings-payment-gateways',
|
||||
'title' => __( 'Payments', 'easy-digital-downloads' ),
|
||||
'content' =>
|
||||
'<p>' . __( 'This screen provides ways to enable Test Mode, toggle payment gateways on or off, manage accounting settings, and configure gateway-specific settings. Any extra payment gateway extensions you have installed will appear on this page, and can be configured to suit your needs.', 'easy-digital-downloads' ) . '</p>' .
|
||||
'<p>' . __( '<strong>Test Payment</strong> - This included gateway is great for testing your store, as it requires no payment, and leads straight to product downloads. However, please remember to turn it off once your site is live!', 'easy-digital-downloads' ) . '</p>' .
|
||||
'<p>' . __( '<strong>PayPal</strong> - A PayPal payment gateway is included as standard with Easy Digital Downloads. To test the PayPal gateway, you need a Sandbox account for PayPal and the site must be placed in Test Mode from the Payments > Gateways tab. Please remember to enter your PayPal account email address in order for payments to get processed.', 'easy-digital-downloads' ) . '</p>' .
|
||||
'<p>' . __( '<strong>Stripe</strong> - The Stripe payment gateway is also included with Easy Digital Downloads. To test the Stripe gateway, you must "Connect with Stripe" and the site must be placed in Test Mode from the Payments > Gateways tab.', 'easy-digital-downloads' ) . '</p>',
|
||||
) );
|
||||
|
||||
$screen->add_help_tab( array(
|
||||
'id' => 'edd-settings-emails',
|
||||
'title' => __( 'Emails', 'easy-digital-downloads' ),
|
||||
'content' =>
|
||||
'<p>' . __( "This screen allows you to customize how emails act throughout your store. You can choose a premade template, set the sender's name, email address, and subject.", 'easy-digital-downloads' ) . '</p>' .
|
||||
'<p>' . __( 'A set of email tag markers has also been provided to allow the creation of personalized emails. A tag consists of a keyword surrounded by curly braces: <code>{tag}</code>.', 'easy-digital-downloads' ) . '</p>'
|
||||
) );
|
||||
|
||||
$screen->add_help_tab( array(
|
||||
'id' => 'edd-settings-marketing',
|
||||
'title' => __( 'Marketing', 'easy-digital-downloads' ),
|
||||
'content' =>
|
||||
'<p>' . __( 'Marketing settings will help you connect with your customers.', 'easy-digital-downloads' ) . '</p>' .
|
||||
'<p>' . __( 'Marketing specific extensions will add their settings here as well.', 'easy-digital-downloads' ) . '</p>',
|
||||
) );
|
||||
|
||||
$screen->add_help_tab( array(
|
||||
'id' => 'edd-settings-styles',
|
||||
'title' => __( 'Styles', 'easy-digital-downloads' ),
|
||||
'content' => '<p>' . __( "This screen allows customization of your store's styles. For complete control, you can completely disable all styles generated by the plugin.", 'easy-digital-downloads' ) . '</p>'
|
||||
) );
|
||||
|
||||
$screen->add_help_tab( array(
|
||||
'id' => 'edd-settings-taxes',
|
||||
'title' => __( 'Taxes', 'easy-digital-downloads' ),
|
||||
'content' =>
|
||||
'<p>' . __( 'This screen allows you to configure the tax rules for your store.', 'easy-digital-downloads' ) . '</p>' .
|
||||
'<p>' . __( 'If you do not wish to charge any tax on purchase, simply leave the Enable Taxes option unchecked.', 'easy-digital-downloads' ) . '</p>' .
|
||||
'<p>' . __( '<strong>Default Tax Rate</strong>: The default tax rate is the tax rate charged to customers located in your base country / state or province.', 'easy-digital-downloads' ) . '</p>' .
|
||||
'<p>' . __( '<strong>Base Country</strong>: This determines the country that is loaded by default on the checkout screen for customers that do not have an address stored in their account.', 'easy-digital-downloads' ) . '</p>' .
|
||||
'<p>' . __( '<strong>Base State / Province</strong>: This determines the region that is loaded by default on the checkout screen for customers that do not have an address stored in their account.', 'easy-digital-downloads' ) . '</p>' .
|
||||
'<p>' . __( '<strong>Prices Entered with Tax</strong>: if enabled, this means that the price entered on the product edit screens is the total amount the customer will pay after taxes. For example, if enabled and the price of a product is $20, the customer will pay 20$ at checkout. The exact amount charged in tax will be calculated automatically.', 'easy-digital-downloads' ) . '</p>' .
|
||||
'<p>' . __( '<strong>Display Tax Rate on Prices</strong>: when enabled, the amount the customer is expected to pay in tax will be displayed below purchase buttons.', 'easy-digital-downloads' ) . '</p>' .
|
||||
'<p>' . __( '<strong>Display During Checkout</strong>: This determines whether prices are shown with taxes or without taxes on checkout. If set to Including Tax, a $10 product with a 10% tax will be shown as $11.', 'easy-digital-downloads' ) . '</p>' .
|
||||
'<p>' . __( '<strong>Calculate Tax After Discounts</strong>: If enabled, this option will make it so that tax is calculated on the after-discount amount. If a purchase of $20 is made and a 20% discount is applied, tax will be calculated off of $16 instead of $20.', 'easy-digital-downloads' ) . '</p>' .
|
||||
'<p>' . __( '<strong>Additional Tax Rates</strong>: This section lets you add tax rates for specific countries and/or states/provinces in those countries.', 'easy-digital-downloads' ) . '</p>'
|
||||
) );
|
||||
|
||||
$screen->add_help_tab( array(
|
||||
'id' => 'edd-settings-privacy',
|
||||
'title' => __( 'Policies', 'easy-digital-downloads' ),
|
||||
'content' =>
|
||||
'<p>' . __( 'This screen provides access to customer privacy policies, terms & agreements, and how to display them on the front of your site.', 'easy-digital-downloads' ) . '</p>' .
|
||||
'<p>' . __( 'You may also override what happens to order records when a customer exercises their right to be forgotten from your site.', 'easy-digital-downloads' ) . '</p>'
|
||||
) );
|
||||
|
||||
$screen->add_help_tab( array(
|
||||
'id' => 'edd-settings-extensions',
|
||||
'title' => __( 'Extensions', 'easy-digital-downloads' ),
|
||||
'content' => '<p>' . __( 'This screen provides access to settings added by most Easy Digital Downloads extensions.', 'easy-digital-downloads' ) . '</p>'
|
||||
) );
|
||||
|
||||
$screen->add_help_tab( array(
|
||||
'id' => 'edd-settings-misc',
|
||||
'title' => __( 'Miscellaneous', 'easy-digital-downloads' ),
|
||||
'content' =>
|
||||
'<p>' . __( 'This screen provides other miscellaneous options such as configuring your store buttons, file download functionality, and terms of service.', 'easy-digital-downloads' ) . '</p>',
|
||||
) );
|
||||
|
||||
do_action( 'edd_settings_contextual_help', $screen );
|
||||
}
|
||||
add_action( 'load-download_page_edd-settings', 'edd_settings_contextual_help' );
|
@ -0,0 +1,396 @@
|
||||
<?php
|
||||
/**
|
||||
* Admin Options Page
|
||||
*
|
||||
* @package EDD
|
||||
* @subpackage Admin/Settings
|
||||
* @copyright Copyright (c) 2018, Easy Digital Downloads, LLC
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
||||
* @since 1.0
|
||||
*/
|
||||
|
||||
// Exit if accessed directly
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* Adds the EDD branded header to the EDD settings pages.
|
||||
*
|
||||
* @since 2.11.3
|
||||
*/
|
||||
function edd_admin_header() {
|
||||
if ( ! edd_is_admin_page( '', '', false ) ) {
|
||||
return;
|
||||
}
|
||||
$numberNotifications = EDD()->notifications->countActiveNotifications();
|
||||
$current_page = ! empty( $_GET['page'] ) ? $_GET['page'] : '';
|
||||
$is_single_view = (bool) apply_filters( 'edd_admin_is_single_view', ! empty( $_GET['view'] ) );
|
||||
|
||||
$page_title = '';
|
||||
switch( $current_page ) {
|
||||
case 'edd-settings':
|
||||
$page_title = __( 'Settings', 'easy-digital-downloads' );
|
||||
break;
|
||||
case 'edd-reports':
|
||||
$page_title = __( 'Reports', 'easy-digital-downloads' );
|
||||
break;
|
||||
case 'edd-payment-history':
|
||||
$page_title = __( 'Orders', 'easy-digital-downloads' );
|
||||
break;
|
||||
case 'edd-discounts':
|
||||
$page_title = __( 'Discounts', 'easy-digital-downloads' );
|
||||
break;
|
||||
case 'edd-customers':
|
||||
$page_title = __( 'Customers', 'easy-digital-downloads' );
|
||||
break;
|
||||
case 'edd-tools':
|
||||
$page_title = __( 'Tools', 'easy-digital-downloads' );
|
||||
break;
|
||||
default:
|
||||
if ( ! empty( $_GET['page'] ) ) {
|
||||
$page_title = ucfirst( str_replace( array( 'edd-', 'fes-' ), '', $current_page ) );
|
||||
} else {
|
||||
if ( ! empty( $_GET['post_type'] ) ) {
|
||||
$post_type = get_post_type_object( $_GET['post_type'] );
|
||||
$page_title = $post_type->labels->name;
|
||||
} else {
|
||||
$page_title = __( 'Downloads', 'easy-digital-downloads' );
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
$page_title = apply_filters( 'edd_settings_page_title', $page_title, $current_page, $is_single_view );
|
||||
if ( ! empty( $page_title ) && empty( $is_single_view ) ) {
|
||||
?>
|
||||
<style>
|
||||
.wrap > h1,
|
||||
.wrap h1.wp-heading-inline {
|
||||
display: none;
|
||||
}
|
||||
.page-title-action {
|
||||
visibility: hidden;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
jQuery(document).ready(function($){
|
||||
const coreAddNew = $( '.page-title-action:visible' );
|
||||
const eddAddNew = $( '.add-new-h2:visible' );
|
||||
|
||||
if ( coreAddNew.length ) {
|
||||
coreAddNew.appendTo( '.edd-header-page-title-wrap' ).addClass( 'button' ).css( 'visibility', 'unset' );
|
||||
}
|
||||
|
||||
if ( eddAddNew.length ) {
|
||||
eddAddNew.appendTo('.edd-header-page-title-wrap').addClass('button');
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<div id="edd-header" class="edd-header">
|
||||
<div id="edd-header-wrapper">
|
||||
<span id="edd-header-branding">
|
||||
<img class="edd-header-logo" alt="" src="<?php echo esc_url( EDD_PLUGIN_URL . '/assets/images/logo-edd-dark.svg' ); ?>" />
|
||||
</span>
|
||||
|
||||
<?php if ( ! empty( $page_title ) ) : ?>
|
||||
<span class="edd-header-page-title-wrap">
|
||||
<span class="edd-header-separator">/</span>
|
||||
<?php $element = true === $is_single_view ? 'span' : 'h1'; ?>
|
||||
<<?php echo esc_attr( $element ); ?> class="edd-header-page-title"><?php echo esc_html( $page_title ); ?></<?php echo esc_attr( $element ); ?>>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
|
||||
<div id="edd-header-actions">
|
||||
<button
|
||||
id="edd-notification-button"
|
||||
class="edd-round"
|
||||
x-data
|
||||
x-init="$store.eddNotifications.numberActiveNotifications = <?php echo esc_js( $numberNotifications ); ?>"
|
||||
@click="$store.eddNotifications.openPanel()"
|
||||
>
|
||||
<span
|
||||
class="edd-round edd-number<?php echo 0 === $numberNotifications ? ' edd-hidden' : ''; ?>"
|
||||
x-show="$store.eddNotifications.numberActiveNotifications > 0"
|
||||
>
|
||||
<?php echo wp_kses( sprintf(
|
||||
/* Translators: %1$s number of notifications; %2$s opening span tag; %3$s closing span tag */
|
||||
__( '%1$s %2$sunread notifications%3$s', 'easy-digital-downloads' ),
|
||||
'<span x-text="$store.eddNotifications.numberActiveNotifications"></span>',
|
||||
'<span class="screen-reader-text">',
|
||||
'</span>'
|
||||
), array( 'span' => array( 'class' => true, 'x-text' => true ) ) ); ?>
|
||||
</span>
|
||||
|
||||
<svg viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg" class="edd-notifications-icon"><path fill-rule="evenodd" clip-rule="evenodd" d="M15.8333 2.5H4.16667C3.25 2.5 2.5 3.25 2.5 4.16667V15.8333C2.5 16.75 3.24167 17.5 4.16667 17.5H15.8333C16.75 17.5 17.5 16.75 17.5 15.8333V4.16667C17.5 3.25 16.75 2.5 15.8333 2.5ZM15.8333 15.8333H4.16667V13.3333H7.13333C7.70833 14.325 8.775 15 10.0083 15C11.2417 15 12.3 14.325 12.8833 13.3333H15.8333V15.8333ZM11.675 11.6667H15.8333V4.16667H4.16667V11.6667H8.34167C8.34167 12.5833 9.09167 13.3333 10.0083 13.3333C10.925 13.3333 11.675 12.5833 11.675 11.6667Z" fill="currentColor"></path></svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
add_action( 'admin_footer', function() {
|
||||
require_once EDD_PLUGIN_DIR . 'includes/admin/views/notifications.php';
|
||||
} );
|
||||
}
|
||||
add_action( 'admin_notices', 'edd_admin_header', 1 );
|
||||
|
||||
/**
|
||||
* Output the primary options page navigation
|
||||
*
|
||||
* @since 3.0
|
||||
*
|
||||
* @param array $tabs All available tabs.
|
||||
* @param string $active_tab Current active tab.
|
||||
*/
|
||||
function edd_options_page_primary_nav( $tabs, $active_tab = '' ) {
|
||||
?>
|
||||
<nav class="nav-tab-wrapper edd-nav-tab-wrapper edd-settings-nav" aria-label="<?php esc_attr_e( 'Secondary menu', 'easy-digital-downloads' ); ?>">
|
||||
<?php
|
||||
|
||||
foreach ( $tabs as $tab_id => $tab_name ) {
|
||||
$tab_url = edd_get_admin_url(
|
||||
array(
|
||||
'settings-updated' => false,
|
||||
'page' => 'edd-settings',
|
||||
'tab' => sanitize_key( $tab_id ),
|
||||
)
|
||||
);
|
||||
|
||||
// Remove the section from the tabs so we always end up at the main section
|
||||
$tab_url = remove_query_arg( 'section', $tab_url );
|
||||
$class = 'nav-tab';
|
||||
if ( $active_tab === $tab_id ) {
|
||||
$class .= ' nav-tab-active';
|
||||
}
|
||||
|
||||
// Link
|
||||
echo '<a href="' . esc_url( $tab_url ) . '" class="' . esc_attr( $class ) . '">';
|
||||
echo esc_html( $tab_name );
|
||||
echo '</a>';
|
||||
}
|
||||
?>
|
||||
</nav>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Output the secondary options page navigation
|
||||
*
|
||||
* @since 3.0
|
||||
*
|
||||
* @param string $active_tab
|
||||
* @param string $section
|
||||
* @param array $sections
|
||||
*/
|
||||
function edd_options_page_secondary_nav( $active_tab = '', $section = '', $sections = array() ) {
|
||||
|
||||
// Back compat for section'less tabs (Licenses, etc...)
|
||||
if ( empty( $sections ) ) {
|
||||
$section = 'main';
|
||||
$sections = array(
|
||||
'main' => __( 'General', 'easy-digital-downloads' )
|
||||
);
|
||||
}
|
||||
|
||||
// Default links array
|
||||
$links = array();
|
||||
|
||||
// Loop through sections
|
||||
foreach ( $sections as $section_id => $section_name ) {
|
||||
|
||||
// Tab & Section
|
||||
$tab_url = add_query_arg(
|
||||
array(
|
||||
'post_type' => 'download',
|
||||
'page' => 'edd-settings',
|
||||
'tab' => $active_tab,
|
||||
'section' => $section_id,
|
||||
),
|
||||
edd_get_admin_base_url()
|
||||
);
|
||||
|
||||
// Settings not updated
|
||||
$tab_url = remove_query_arg( 'settings-updated', $tab_url );
|
||||
|
||||
// Class for link
|
||||
$class = ( $section === $section_id )
|
||||
? 'current'
|
||||
: '';
|
||||
|
||||
// Add to links array
|
||||
$links[ $section_id ] = '<li class="' . esc_attr( $class ) . '"><a class="' . esc_attr( $class ) . '" href="' . esc_url( $tab_url ) . '">' . esc_html( $section_name ) . '</a><li>';
|
||||
} ?>
|
||||
|
||||
<div class="wp-clearfix">
|
||||
<ul class="subsubsub edd-settings-sub-nav">
|
||||
<?php echo implode( '', $links ); ?>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Output the options page form and fields for this tab & section
|
||||
*
|
||||
* @since 3.0
|
||||
*
|
||||
* @param string $active_tab
|
||||
* @param string $section
|
||||
* @param boolean $override
|
||||
*/
|
||||
function edd_options_page_form( $active_tab = '', $section = '', $override = false ) {
|
||||
|
||||
// Setup the action & section suffix
|
||||
$suffix = ! empty( $section )
|
||||
? $active_tab . '_' . $section
|
||||
: $active_tab . '_main';
|
||||
?>
|
||||
|
||||
<div class="edd-settings-wrap wp-clearfix">
|
||||
<div class="edd-settings-content">
|
||||
<form method="post" action="options.php" class="edd-settings-form">
|
||||
<?php
|
||||
|
||||
settings_fields( 'edd_settings' );
|
||||
|
||||
if ( 'main' === $section ) {
|
||||
do_action( 'edd_settings_tab_top', $active_tab );
|
||||
}
|
||||
|
||||
do_action( 'edd_settings_tab_top_' . $suffix );
|
||||
|
||||
do_settings_sections( 'edd_settings_' . $suffix );
|
||||
|
||||
do_action( 'edd_settings_tab_bottom_' . $suffix );
|
||||
|
||||
// For backwards compatibility
|
||||
if ( 'main' === $section ) {
|
||||
do_action( 'edd_settings_tab_bottom', $active_tab );
|
||||
}
|
||||
|
||||
// If the main section was empty and we overrode the view with the
|
||||
// next subsection, prepare the section for saving
|
||||
if ( true === $override ) {
|
||||
?><input type="hidden" name="edd_section_override" value="<?php echo esc_attr( $section ); ?>" /><?php
|
||||
}
|
||||
|
||||
submit_button(); ?>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Output the entire options page
|
||||
*
|
||||
* @since 1.0
|
||||
* @return void
|
||||
*/
|
||||
function edd_options_page() {
|
||||
// Enqueue scripts.
|
||||
wp_enqueue_script( 'edd-admin-settings' );
|
||||
|
||||
// Try to figure out where we are
|
||||
$all_settings = edd_get_registered_settings();
|
||||
$settings_tabs = edd_get_settings_tabs();
|
||||
$settings_tabs = empty( $settings_tabs ) ? array() : $settings_tabs;
|
||||
$active_tab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'general';
|
||||
$active_tab = array_key_exists( $active_tab, $settings_tabs ) && array_key_exists( $active_tab, $all_settings ) ? $active_tab : 'general';
|
||||
$sections = edd_get_settings_tab_sections( $active_tab );
|
||||
$section = ! empty( $_GET['section'] ) && ! empty( $sections[ $_GET['section'] ] ) ? sanitize_text_field( $_GET['section'] ) : 'main';
|
||||
|
||||
// Default values
|
||||
$has_main_settings = true;
|
||||
$override = false;
|
||||
|
||||
// Remove tabs that don't have settings fields.
|
||||
foreach ( array_keys( $settings_tabs ) as $settings_tab ) {
|
||||
if ( empty( $all_settings[ $settings_tab ] ) ) {
|
||||
unset( $settings_tabs[ $settings_tab ] );
|
||||
}
|
||||
}
|
||||
|
||||
// Let's verify we have a 'main' section to show
|
||||
if ( empty( $all_settings[ $active_tab ]['main'] ) ) {
|
||||
$has_main_settings = false;
|
||||
}
|
||||
|
||||
// Check for old non-sectioned settings (see #4211 and #5171)
|
||||
if ( false === $has_main_settings ) {
|
||||
foreach( $all_settings[ $active_tab ] as $sid => $stitle ) {
|
||||
if ( is_string( $sid ) && ! empty( $sections ) && array_key_exists( $sid, $sections ) ) {
|
||||
continue;
|
||||
} else {
|
||||
$has_main_settings = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Unset 'main' if it's empty and default to the first non-empty if it's the chosen section.
|
||||
if ( false === $has_main_settings ) {
|
||||
unset( $sections['main'] );
|
||||
|
||||
if ( 'main' === $section ) {
|
||||
foreach ( $sections as $section_key => $section_title ) {
|
||||
if ( ! empty( $all_settings[ $active_tab ][ $section_key ] ) ) {
|
||||
$section = $section_key;
|
||||
$override = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Start a buffer
|
||||
ob_start(); ?>
|
||||
|
||||
<div class="wrap <?php echo 'wrap-' . esc_attr( $active_tab ); ?>">
|
||||
<h1><?php esc_html_e( 'Settings', 'easy-digital-downloads' ); ?></h1>
|
||||
|
||||
<?php
|
||||
// Primary nav
|
||||
edd_options_page_primary_nav( $settings_tabs, $active_tab );
|
||||
|
||||
// Secondary nav
|
||||
edd_options_page_secondary_nav( $active_tab, $section, $sections );
|
||||
|
||||
// Form
|
||||
edd_options_page_form( $active_tab, $section, $override );
|
||||
|
||||
?></div><!-- .wrap --><?php
|
||||
|
||||
// Output the current buffer
|
||||
echo ob_get_clean();
|
||||
}
|
||||
|
||||
/**
|
||||
* Conditionally shows a notice on the Tax Rates screen if taxes are disabled, to inform users that while they are adding
|
||||
* tax rates, they will not be applied until taxes are enabled.
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
function edd_tax_settings_display_tax_disabled_notice() {
|
||||
if ( edd_use_taxes() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
?>
|
||||
<div class="notice-wrap" style="clear: both;">
|
||||
<div id="edd-tax-disabled-notice">
|
||||
<p>
|
||||
<?php _e( 'Taxes are currently disabled. Rates listed below will not be applied to purchases until taxes are enabled.', 'easy-digital-downloads' ); ?>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
}
|
||||
add_action( 'edd_settings_tab_top_taxes_rates', 'edd_tax_settings_display_tax_disabled_notice', 10 );
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,164 @@
|
||||
<?php
|
||||
/**
|
||||
* Settings Compatibility Functions
|
||||
*
|
||||
* For managing settings compatibility in a reorganized settings structure.
|
||||
*
|
||||
* @package EDD
|
||||
* @subpackage Settings Compatibility
|
||||
* @copyright Copyright (c) 2021, Easy Digital Downloads
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
|
||||
* @since 2.11.4
|
||||
*/
|
||||
|
||||
// Exit if accessed directly
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gives us an area to ensure known compatibility issues with our settings organization by giving us a hook to manage
|
||||
* and alter hooks and filters that are being run against our primary settings array.
|
||||
*
|
||||
* @since 2.11.3
|
||||
*/
|
||||
add_action(
|
||||
'plugins_loaded',
|
||||
function() {
|
||||
|
||||
/**
|
||||
* Ensures compatibility with EDD 2.11.3 and Recurring payments prior to Recurring being released to move
|
||||
* settings for 'checkout' from 'misc' to 'payments'.
|
||||
*/
|
||||
if ( function_exists( 'edd_recurring_guest_checkout_description' ) && false !== has_filter( 'edd_settings_misc', 'edd_recurring_guest_checkout_description' ) ) {
|
||||
remove_filter( 'edd_settings_misc', 'edd_recurring_guest_checkout_description', 10 );
|
||||
add_filter( 'edd_settings_gateways', 'edd_recurring_guest_checkout_description', 10 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures compatibility with EDD 2.11.4 and Recurring payments prior to Recurring being released to move
|
||||
* settings for all extension settings to 'payments'.
|
||||
*/
|
||||
if ( function_exists( 'edd_recurring_settings_section' ) && false !== has_filter( 'edd_settings_sections_extensions', 'edd_recurring_settings_section' ) ) {
|
||||
remove_filter( 'edd_settings_sections_extensions', 'edd_recurring_settings_section' );
|
||||
add_filter( 'edd_settings_sections_gateways', 'edd_recurring_settings_section' );
|
||||
remove_filter( 'edd_settings_extensions', 'edd_recurring_settings' );
|
||||
add_filter( 'edd_settings_gateways', 'edd_recurring_settings' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures compatibility with EDD 2.11.4 and Reviews' settings being in the extensions section.
|
||||
*/
|
||||
if ( function_exists( 'edd_reviews' ) ) {
|
||||
$reviews = edd_reviews();
|
||||
if ( false !== has_filter( 'edd_settings_sections_extensions', array( $reviews, 'register_reviews_section' ) ) ) {
|
||||
remove_filter( 'edd_settings_sections_extensions', array( $reviews, 'register_reviews_section' ) );
|
||||
add_filter( 'edd_settings_sections_marketing', array( $reviews, 'register_reviews_section' ) );
|
||||
remove_filter( 'edd_settings_extensions', array( $reviews, 'misc_settings' ) );
|
||||
add_filter( 'edd_settings_marketing', array( $reviews, 'misc_settings' ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Move the Free Downloads settings to the Marketing section (EDD 2.11.4).
|
||||
*/
|
||||
if ( false !== has_filter( 'edd_settings_sections_extensions', 'edd_free_downloads_add_settings_section' ) ) {
|
||||
remove_filter( 'edd_settings_sections_extensions', 'edd_free_downloads_add_settings_section' );
|
||||
add_filter( 'edd_settings_sections_marketing', 'edd_free_downloads_add_settings_section' );
|
||||
remove_filter( 'edd_settings_extensions', 'edd_free_downloads_add_settings' );
|
||||
add_filter( 'edd_settings_marketing', 'edd_free_downloads_add_settings' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Move the ActiveCampaign settings to the Marketing section (EDD 2.11.4).
|
||||
*/
|
||||
if ( function_exists( 'edd_activecampaign' ) ) {
|
||||
$activecampaign = edd_activecampaign();
|
||||
if ( false !== has_filter( 'edd_settings_sections_extensions', array( $activecampaign, 'settings_section' ) ) ) {
|
||||
remove_filter( 'edd_settings_sections_extensions', array( $activecampaign, 'settings_section' ) );
|
||||
add_filter( 'edd_settings_sections_marketing', array( $activecampaign, 'settings_section' ) );
|
||||
remove_filter( 'edd_settings_extensions', array( $activecampaign, 'register_settings' ) );
|
||||
add_filter( 'edd_settings_marketing', array( $activecampaign, 'register_settings' ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Move the GetResponse settings to the Marketing section (EDD 2.11.4).
|
||||
*/
|
||||
if ( function_exists( 'edd_getresponse_add_settings_section' ) ) {
|
||||
if ( false !== has_filter( 'edd_settings_sections_extensions', 'edd_getresponse_add_settings_section' ) ) {
|
||||
$getresponse = new EDD_GetResponse_Newsletter();
|
||||
remove_filter( 'edd_settings_sections_extensions', 'edd_getresponse_add_settings_section' );
|
||||
add_filter( 'edd_settings_sections_marketing', 'edd_getresponse_add_settings_section' );
|
||||
remove_filter( 'edd_settings_extensions', 'edd_getresponse_add_settings' );
|
||||
add_filter( 'edd_settings_marketing', 'edd_getresponse_add_settings' );
|
||||
remove_filter( 'edd_settings_extensions_sanitize', array( $getresponse, 'save_settings' ) );
|
||||
add_filter( 'edd_settings_marketing_sanitize', array( $getresponse, 'save_settings' ) );
|
||||
remove_filter( 'edd_settings_extensions-getresponse_sanitize', array( $getresponse, 'save_settings' ) );
|
||||
add_filter( 'edd_settings_marketing-getresponse_sanitize', array( $getresponse, 'save_settings' ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Move the Campaign Monitor settings to the Marketing section (EDD 2.11.4).
|
||||
*/
|
||||
if ( function_exists( 'eddcp_settings_section' ) && false !== has_filter( 'edd_settings_sections_extensions', 'eddcp_settings_section' ) ) {
|
||||
remove_filter( 'edd_settings_sections_extensions', 'eddcp_settings_section' );
|
||||
add_filter( 'edd_settings_sections_marketing', 'eddcp_settings_section' );
|
||||
remove_filter( 'edd_settings_extensions', 'eddcp_add_settings' );
|
||||
add_filter( 'edd_settings_marketing', 'eddcp_add_settings' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Move the ConvertKit settings to the Marketing section (EDD 2.11.4).
|
||||
*/
|
||||
if ( class_exists( 'EDD_ConvertKit' ) && method_exists( 'EDD_ConvertKit', 'instance' ) ) {
|
||||
$convertkit = EDD_ConvertKit::instance();
|
||||
if ( false !== has_filter( 'edd_settings_sections_extensions', array( $convertkit, 'subsection' ) ) ) {
|
||||
remove_filter( 'edd_settings_sections_extensions', array( $convertkit, 'subsection' ) );
|
||||
add_filter( 'edd_settings_sections_marketing', array( $convertkit, 'subsection' ) );
|
||||
remove_filter( 'edd_settings_extensions_sanitize', array( $convertkit, 'save_settings' ) );
|
||||
add_filter( 'edd_settings_marketing_sanitize', array( $convertkit, 'save_settings' ) );
|
||||
remove_filter( 'edd_settings_extensions', array( $convertkit, 'settings' ) );
|
||||
add_filter( 'edd_settings_marketing', array( $convertkit, 'settings' ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Move the AWeber settings to the Marketing section (EDD 2.11.4).
|
||||
*/
|
||||
if ( class_exists( 'EDD_Aweber' ) && method_exists( 'EDD_Aweber', 'instance' ) ) {
|
||||
$aweber = EDD_Aweber::instance();
|
||||
if ( false !== has_filter( 'edd_settings_sections_extensions', array( $aweber, 'subsection' ) ) ) {
|
||||
remove_filter( 'edd_settings_sections_extensions', array( $aweber, 'subsection' ) );
|
||||
add_filter( 'edd_settings_sections_marketing', array( $aweber, 'subsection' ) );
|
||||
remove_filter( 'edd_settings_extensions', array( $aweber, 'settings' ) );
|
||||
add_filter( 'edd_settings_marketing', array( $aweber, 'settings' ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Move the MailPoet settings to the Marketing section (EDD 2.11.4).
|
||||
*/
|
||||
if ( class_exists( 'EDD_MailPoet' ) && method_exists( 'EDD_MailPoet', 'instance' ) ) {
|
||||
$mailpoet = EDD_MailPoet::instance();
|
||||
if ( false !== has_filter( 'edd_settings_sections_extensions', array( $mailpoet, 'subsection' ) ) ) {
|
||||
remove_filter( 'edd_settings_sections_extensions', array( $mailpoet, 'subsection' ) );
|
||||
add_filter( 'edd_settings_sections_marketing', array( $mailpoet, 'subsection' ) );
|
||||
remove_filter( 'edd_settings_extensions', array( $mailpoet, 'settings' ) );
|
||||
add_filter( 'edd_settings_marketing', array( $mailpoet, 'settings' ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Move the Invoices settings to the Payments section (EDD 2.11.4).
|
||||
*/
|
||||
if ( false !== has_filter( 'edd_settings_sections_extensions', 'edd_invoices_register_settings_section' ) ) {
|
||||
remove_filter( 'edd_settings_sections_extensions', 'edd_invoices_register_settings_section' );
|
||||
add_filter( 'edd_settings_sections_gateways', 'edd_invoices_register_settings_section', 10 );
|
||||
remove_filter( 'edd_settings_extensions', 'edd_invoices_register_settings', 1 );
|
||||
add_filter( 'edd_settings_gateways', 'edd_invoices_register_settings', 1 );
|
||||
}
|
||||
},
|
||||
99
|
||||
);
|
Reference in New Issue
Block a user