예제 #1
0
function woogle_license_key_status_notices()
{
    if (isset($_REQUEST['section']) && $_REQUEST['section'] == 'woogle') {
        return;
    }
    $license_key = woogle_get_license_key();
    $settings_page_url = esc_attr(admin_url('/admin.php?page=wc-settings&tab=products&section=woogle'));
    $license_url = esc_attr(Woogle_License_Url);
    if (empty($license_key)) {
        $message = <<<MESSAGE
Your <a href="{$settings_page_url}">Woogle License Key</a> is missing. Please go to
<a href="{$license_url}">{$license_url}</a> to purchase a license and receive core updates.
MESSAGE;
        woogle_add_message(__($message, 'woogle'), 'error');
    } else {
        $license_key_is_valid = woogle_license_key_is_valid();
        if ($license_key_is_valid) {
            $license_key_is_expired = woogle_license_key_is_expired();
            if ($license_key_is_expired) {
                $message = <<<MESSAGE
Your <a href="{$settings_page_url}">Woogle License Key</a> has expired. Please go to
<a href="{$license_url}">{$license_url}</a> to purchase a license and receive core updates.
MESSAGE;
                woogle_add_message(__($message, 'woogle'), 'update-nag');
            }
        } else {
            $message = <<<MESSAGE
Your <a href="{$settings_page_url}">Woogle License Key</a> is invalid. Please go to
<a href="{$license_url}">{$license_url}</a> to purchase a license and receive core updates.
MESSAGE;
            woogle_add_message(__($message, 'woogle'), 'error');
        }
    }
}
예제 #2
0
function woogle_update_notifications()
{
    if (!is_admin()) {
        return;
    }
    if (is_ajax()) {
        return;
    }
    // Products query
    $product_query_args = array('post_type' => 'product', 'post_status' => 'publish', 'posts_per_page' => -1, 'meta_query' => array(array('key' => '_woogle_enabled', 'value' => 'yes', 'compare' => '='), array('relation' => 'OR', array('key' => '_woogle_expiration_time', 'compare' => 'NOT EXISTS'), array('key' => '_woogle_expiration_time', 'value' => time(), 'compare' => '<'))));
    $products_result = get_posts($product_query_args);
    $count = count($products_result);
    if ($count > 0) {
        woogle_add_message(__("You have {$count} products to update in your Google Merchant Center. " . '<a href="' . admin_url('/admin.php?page=wc-settings&tab=products&section=woogle') . '#update-google-shopping-api-button">' . 'Update them now' . '</a>', 'woogle'), 'update-nag');
    }
}