当前位置: 首页>>代码示例>>PHP>>正文


PHP WC_Admin_Settings::add_message方法代码示例

本文整理汇总了PHP中WC_Admin_Settings::add_message方法的典型用法代码示例。如果您正苦于以下问题:PHP WC_Admin_Settings::add_message方法的具体用法?PHP WC_Admin_Settings::add_message怎么用?PHP WC_Admin_Settings::add_message使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WC_Admin_Settings的用法示例。


在下文中一共展示了WC_Admin_Settings::add_message方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: save_settings

 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');
     }
 }
开发者ID:Fermiac,项目名称:woocommerce-siftscience,代码行数:11,代码来源:class-wc-siftscience-hooks-admin.php

示例2: gf_auth_check

 /**
  * 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);
     }
 }
开发者ID:asafmaoz1234,项目名称:woocommerce-recommendations-by-graphflow,代码行数:14,代码来源:class-wc-settings-graphflow.php

示例3: woogle_update_license_key_status

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'));
    }
}
开发者ID:bear12345678,项目名称:keylessoption,代码行数:17,代码来源:license.php

示例4: notices

 /**
  * 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'));
     }
 }
开发者ID:abesamislyndon,项目名称:femaccms,代码行数:24,代码来源:class-wc-settings-webhooks.php

示例5: pages

 /**
  * 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';
 }
开发者ID:raisonon,项目名称:woocommerce-grow,代码行数:26,代码来源:class-woocommerce-grow-menu.php

示例6: notices

 /**
  * Notices.
  */
 public static function notices()
 {
     if (isset($_GET['revoked']) && 1 == $_GET['revoked']) {
         WC_Admin_Settings::add_message(__('API key revoked successfully.', 'woocommerce'));
     }
 }
开发者ID:Korkey128k,项目名称:woocommerce,代码行数:9,代码来源:class-wc-admin-api-keys.php

示例7: notices

 /**
  * 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']));
     }
 }
开发者ID:woocommerce,项目名称:woocommerce,代码行数:30,代码来源:class-wc-admin-webhooks.php

示例8: validate_product_icon_field

 /**
  * 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;
 }
开发者ID:jarsgt,项目名称:paddle-woocommerce,代码行数:34,代码来源:woocommerce-paddle-checkout.php

示例9: bulk_process_products

 /**
  * 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'));
 }
开发者ID:jurajk,项目名称:WooCommerce-Sale-Category,代码行数:27,代码来源:class-wc-integration-sale-category.php

示例10: save

 /**
  * 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());
         }
     }
 }
开发者ID:voice-brand-agency,项目名称:the-fairy-light-shop-site-plugin,代码行数:47,代码来源:class-wc-settings-tfls.php


注:本文中的WC_Admin_Settings::add_message方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。