add_message() public static méthode

Add a message.
public static add_message ( string $text )
$text string
 public function save_settings()
 {
     WC_Admin_Settings::save_fields($this->settings);
     $is_api_working = $this->check_api() ? 1 : 0;
     update_option(WC_SiftScience_Options::$is_api_setup, $is_api_working);
     if ($is_api_working === 1) {
         WC_Admin_Settings::add_message('API is correctly configured');
     } else {
         WC_Admin_Settings::add_error('API settings are broken');
     }
 }
 /**
  * Check authentication of access credentials
  */
 public function gf_auth_check()
 {
     $auth = $GLOBALS['wc_graphflow']->get_api()->test_auth();
     if ($auth) {
         $notice_text = "Your Graphflow access keys have been verified!";
         WC_Admin_Settings::add_message($notice_text);
     } else {
         $notice_text = "Your Graphflow access keys failed verification. Please check your Graphflow Account Page to retrieve the correct keys.";
         WC_Admin_Settings::add_error($notice_text);
     }
 }
function woogle_update_license_key_status()
{
    $result = woogle_activate_license_key();
    if ($result == NULL) {
        update_option('woogle_license_key_validated', '0');
        update_option('woogle_license_key_expires', '0');
        WC_Admin_Settings::add_error(__('Your Woogle License Key is invalid!', 'woogle'));
    } elseif ($result->license == 'valid' || $result->license == 'expired') {
        update_option('woogle_license_key_validated', '1');
        update_option('woogle_license_key_expires', $result->expires);
        WC_Admin_Settings::add_message(__('Your Woogle License Key is valid!', 'woogle'));
    } else {
        update_option('woogle_license_key_validated', '0');
        update_option('woogle_license_key_expires', '0');
        WC_Admin_Settings::add_error(__('Your Woogle License Key is invalid!', 'woogle'));
    }
}
 /**
  * Notices.
  */
 private function notices()
 {
     if (isset($_GET['trashed'])) {
         $trashed = absint($_GET['trashed']);
         WC_Admin_Settings::add_message(sprintf(_n('1 webhook moved to the Trash.', '%d webhooks moved to the Trash.', $trashed, 'woocommerce'), $trashed));
     }
     if (isset($_GET['untrashed'])) {
         $untrashed = absint($_GET['untrashed']);
         WC_Admin_Settings::add_message(sprintf(_n('1 webhook restored from the Trash.', '%d webhooks restored from the Trash.', $untrashed, 'woocommerce'), $untrashed));
     }
     if (isset($_GET['deleted'])) {
         $deleted = absint($_GET['deleted']);
         WC_Admin_Settings::add_message(sprintf(_n('1 webhook permanently deleted.', '%d webhooks permanently deleted.', $deleted, 'woocommerce'), $deleted));
     }
     if (isset($_GET['updated'])) {
         WC_Admin_Settings::add_message(__('Webhook updated successfully.', 'woocommerce'));
     }
     if (isset($_GET['created'])) {
         WC_Admin_Settings::add_message(__('Webhook created successfully.', 'woocommerce'));
     }
 }
 /**
  * Manage activations
  */
 public function pages()
 {
     // Anything you need to do before a page is loaded
     do_action('woocommerce_grow_pages_start');
     // Get current tab
     $current_tab = empty($_GET['tab']) ? 'dashboard' : sanitize_title($_GET['tab']);
     $this->add_woocommerce_grow_pages();
     // Save settings if data has been posted
     if (!empty($_POST)) {
         $this->save($current_tab);
     }
     // Add any posted messages
     if (!empty($_GET['wc_grow_error'])) {
         WC_Admin_Settings::add_error(stripslashes($_GET['wc_error']));
     }
     if (!empty($_GET['wc_grow_message'])) {
         WC_Admin_Settings::add_message(stripslashes($_GET['wc_message']));
     }
     WC_Admin_Settings::show_messages();
     // Add tabs on the Grow page
     $tabs = apply_filters('woocommerce_grow_page_tabs_array', array());
     include 'views/html-grow-page.php';
 }
 /**
  * Notices.
  */
 public static function notices()
 {
     if (isset($_GET['revoked']) && 1 == $_GET['revoked']) {
         WC_Admin_Settings::add_message(__('API key revoked successfully.', 'woocommerce'));
     }
 }
 /**
  * Notices.
  */
 public static function notices()
 {
     if (isset($_GET['trashed'])) {
         $trashed = absint($_GET['trashed']);
         /* translators: %d: count */
         WC_Admin_Settings::add_message(sprintf(_n('%d webhook moved to the Trash.', '%d webhooks moved to the Trash.', $trashed, 'woocommerce'), $trashed));
     }
     if (isset($_GET['untrashed'])) {
         $untrashed = absint($_GET['untrashed']);
         /* translators: %d: count */
         WC_Admin_Settings::add_message(sprintf(_n('%d webhook restored from the Trash.', '%d webhooks restored from the Trash.', $untrashed, 'woocommerce'), $untrashed));
     }
     if (isset($_GET['deleted'])) {
         $deleted = absint($_GET['deleted']);
         /* translators: %d: count */
         WC_Admin_Settings::add_message(sprintf(_n('%d webhook permanently deleted.', '%d webhooks permanently deleted.', $deleted, 'woocommerce'), $deleted));
     }
     if (isset($_GET['updated'])) {
         WC_Admin_Settings::add_message(__('Webhook updated successfully.', 'woocommerce'));
     }
     if (isset($_GET['created'])) {
         WC_Admin_Settings::add_message(__('Webhook created successfully.', 'woocommerce'));
     }
     if (isset($_GET['error'])) {
         WC_Admin_Settings::add_error(wc_clean($_GET['error']));
     }
 }
 /**
  * Custom validation function to check that the product icon is usable
  * Called magically by woocommerce
  * If the value is invalid in some way, it fixes minor issues.
  * e.g. converting http to https
  *
  * @param string the name of the field to be validated
  * @return string the validated/corrected url
  */
 public function validate_product_icon_field($key)
 {
     if (!isset($_POST[$this->plugin_id . $this->id . '_' . $key]) || empty($_POST[$this->plugin_id . $this->id . '_' . $key])) {
         return '';
     }
     $image_url = $_POST[$this->plugin_id . $this->id . '_' . $key];
     if (!$this->url_valid($image_url)) {
         $this->errors[] = 'Product Icon url is not valid';
     } else {
         if (substr($image_url, 0, 5) != 'https') {
             //confirmed that base url is valid; now need to make it secure
             $new_url = 'https' . substr($image_url, 4);
             if (!$this->url_valid($new_url)) {
                 //image server does not allow secure connection, so bounce it off our proxy
                 $vendor_id = $this->getPaddleVendorId();
                 $key = $this->getPaddleVendorKey();
                 openssl_public_encrypt($image_url, $urlcode, $key);
                 $new_url = self::IMAGE_BOUNCE_PROXY_URL . $vendor_id . '/' . str_replace(array('+', '/'), array('-', '_'), base64_encode($urlcode));
                 WC_Admin_Settings::add_message("Product Icon URL has been converted to use a secure proxy");
             }
             $image_url = $new_url;
         }
     }
     return $image_url;
 }
 /**
  * Bulk processing for existing posts
  */
 public function bulk_process_products()
 {
     if (!isset($_POST['woocommerce_sale-category_bulk_process'])) {
         return;
     }
     if (!$this->sale_category && !isset($_POST['woocommerce_sale-category_sale_category'])) {
         $this->errors[] = __('Please select your sale category, if you want to bulk process your existing products', 'woocommerce-sale-category');
         return;
     }
     if (isset($_POST['woocommerce_sale-category_sale_category'])) {
         $sale_category = intval($_POST['woocommerce_sale-category_sale_category']);
     } else {
         $sale_category = $this->sale_category;
     }
     $products = wc_get_product_ids_on_sale();
     if (!$products) {
         WC_Admin_Settings::add_error(__('No products on sale found', 'woocommerce-sale-category'));
         return;
     }
     foreach ($products as $post_id) {
         wp_set_object_terms($post_id, $sale_category, 'product_cat', true);
     }
     WC_Admin_Settings::add_message(__(count($products) . ' products processed', 'woocommerce-sale-category'));
 }
 /**
  * Save global settings
  */
 public function save()
 {
     global $current_section;
     if ($current_section && $this->section_save()) {
         update_option('wc_tfls_timestamp', time());
     } else {
         if (!empty($_POST['wc_tfls_debug_ip']) && !filter_var($_POST['wc_tfls_debug_ip'], FILTER_VALIDATE_IP)) {
             WC_Admin_Settings::add_error(__('Debugging IP must be a valid IP address.', 'woocommerce-tfls'));
         } else {
             if (isset($_POST['delete_group'])) {
                 $section_settings = (array) get_option('_oga_tfls_countries_groups');
                 $metakeys = array();
                 foreach ($_POST['delete_group'] as $value) {
                     unset($section_settings[$value]);
                     $metakeys[] = "'_" . $value . "_price'";
                     $metakeys[] = "'_" . $value . "_sale_price'";
                     $metakeys[] = "'_" . $value . "_variable_price'";
                     $metakeys[] = "'_" . $value . "_variable_sale_price'";
                 }
                 update_option('_oga_tfls_countries_groups', $section_settings);
                 //delete postmeta data
                 global $wpdb;
                 $wpdb->query("DELETE FROM " . $wpdb->postmeta . " WHERE meta_key in (" . implode(',', $metakeys) . ")");
             }
             //Database geoip update
             if (!wp_next_scheduled('tfls_update_geoip') && isset($_POST['wc_tfls_update_geoip'])) {
                 $update_errors = tfls_download_geoipdb();
                 if ($update_errors) {
                     WC_Admin_Settings::add_error($update_errors);
                     unset($_POST['wc_tfls_update_geoip']);
                 } else {
                     wp_schedule_event(time() + 2419200, '4weeks', 'tfls_update_geoip');
                     WC_Admin_Settings::add_message(__('GeoIP info has been updated.', 'woocommerce-tfls'));
                 }
             } elseif (wp_next_scheduled('tfls_update_geoip') && !isset($_POST['wc_tfls_update_geoip'])) {
                 wp_unschedule_event(wp_next_scheduled('tfls_update_geoip'), 'tfls_update_geoip');
             }
             //save settings
             $settings = $this->get_settings();
             WC_Admin_Settings::save_fields($settings);
             update_option('wc_tfls_timestamp', time());
         }
     }
 }