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


PHP wc_format_hex函数代码示例

本文整理汇总了PHP中wc_format_hex函数的典型用法代码示例。如果您正苦于以下问题:PHP wc_format_hex函数的具体用法?PHP wc_format_hex怎么用?PHP wc_format_hex使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: woocommerce_format_hex

 /**
  * @deprecated
  */
 function woocommerce_format_hex($hex)
 {
     return wc_format_hex($hex);
 }
开发者ID:nayemDevs,项目名称:woocommerce,代码行数:7,代码来源:wc-deprecated-functions.php

示例2: test_wc_format_hex

 /**
  * Test wc_format_hex().
  *
  * @since 2.2
  */
 public function test_wc_format_hex()
 {
     $this->assertEquals('#CCCCCC', wc_format_hex('CCC'));
     $this->assertEquals('#CCCCCC', wc_format_hex('#CCC'));
     $this->assertEquals(null, wc_format_hex(null));
 }
开发者ID:jimlove7273,项目名称:woocommerce,代码行数:11,代码来源:functions.php

示例3: save

 /**
  * Save settings
  */
 public function save()
 {
     $settings = $this->get_settings();
     WC_Admin_Settings::save_fields($settings);
     if (isset($_POST['qsot_frontend_css_form_bg'])) {
         // Save settings
         $colors = array();
         foreach (array('form_bg', 'form_border', 'form_action_bg', 'form_helper') as $k) {
             $colors[$k] = !empty($_POST['qsot_frontend_css_' . $k]) ? wc_format_hex($_POST['qsot_frontend_css_' . $k]) : '';
         }
         foreach (array('good_msg', 'bad_msg', 'remove') as $K) {
             foreach (array('_bg', '_border', '_text') as $k) {
                 $colors[$K . $k] = !empty($_POST['qsot_frontend_css_' . $K . $k]) ? wc_format_hex($_POST['qsot_frontend_css_' . $K . $k]) : '';
             }
         }
         foreach (array('past_calendar_item', 'calendar_item') as $K) {
             foreach (array('_bg', '_border', '_text', '_text_hover') as $k) {
                 $colors[$K . $k] = !empty($_POST['qsot_frontend_css_' . $K . $k]) ? wc_format_hex($_POST['qsot_frontend_css_' . $K . $k]) : '';
             }
         }
         // Check the colors.
         $valid_colors = true;
         foreach ($colors as $color) {
             if (!preg_match('/^#[a-f0-9]{6}$/i', $color)) {
                 $valid_colors = false;
                 WC_Admin_Settings::add_error(sprintf(__('Error saving the Frontend Styles, %s is not a valid color, please use only valid colors code.', 'opentickets-community-edition'), $color));
                 break;
             }
         }
         if ($valid_colors) {
             $old_colors = get_option('woocommerce_frontend_css_colors');
             $options = qsot_options::instance();
             $options->{'qsot-event-frontend-colors'} = $colors;
             if ($old_colors != $colors) {
                 QSOT::compile_frontend_styles();
             }
         }
     }
 }
开发者ID:galapas,项目名称:opentickets-community,代码行数:42,代码来源:frontend.php

示例4: save

 /**
  * Save settings
  */
 public function save()
 {
     $settings = $this->get_settings();
     WC_Admin_Settings::save_fields($settings);
     if (isset($_POST['woocommerce_frontend_css_primary'])) {
         // Save settings
         $primary = !empty($_POST['woocommerce_frontend_css_primary']) ? wc_format_hex($_POST['woocommerce_frontend_css_primary']) : '';
         $secondary = !empty($_POST['woocommerce_frontend_css_secondary']) ? wc_format_hex($_POST['woocommerce_frontend_css_secondary']) : '';
         $highlight = !empty($_POST['woocommerce_frontend_css_highlight']) ? wc_format_hex($_POST['woocommerce_frontend_css_highlight']) : '';
         $content_bg = !empty($_POST['woocommerce_frontend_css_content_bg']) ? wc_format_hex($_POST['woocommerce_frontend_css_content_bg']) : '';
         $subtext = !empty($_POST['woocommerce_frontend_css_subtext']) ? wc_format_hex($_POST['woocommerce_frontend_css_subtext']) : '';
         $colors = array('primary' => $primary, 'secondary' => $secondary, 'highlight' => $highlight, 'content_bg' => $content_bg, 'subtext' => $subtext);
         // Check the colors.
         $valid_colors = true;
         foreach ($colors as $color) {
             if (!preg_match('/^#[a-f0-9]{6}$/i', $color)) {
                 $valid_colors = false;
                 WC_Admin_Settings::add_error(sprintf(__('Error saving the Frontend Styles, %s is not a valid color, please use only valid colors code.', 'woocommerce'), $color));
                 break;
             }
         }
         if ($valid_colors) {
             $old_colors = get_option('woocommerce_frontend_css_colors');
             update_option('woocommerce_frontend_css_colors', $colors);
             if ($old_colors != $colors) {
                 woocommerce_compile_less_styles();
             }
         }
     }
 }
开发者ID:joshquila,项目名称:demo2-youse,代码行数:33,代码来源:class-wc-settings-general.php

示例5: update_color_options

 /**
  * Update plugin color options.
  *
  * @return void
  * @since 1.0.0
  */
 public function update_color_options($value = false)
 {
     global $pagenow;
     $colors_options = array();
     foreach (YITH_WCWL_Init()->colors_options as $name => $option) {
         foreach ($option as $id => $color) {
             $default_value = isset($colors_options[$name][$id]) ? $colors_options[$name][$id] : '';
             if (isset($_POST['yith_wcwl_color_' . $name . '_' . $id]) && !empty($_POST['yith_wcwl_color_' . $name . '_' . $id])) {
                 $colors_options[$name][$id] = function_exists('wc_format_hex') ? wc_format_hex($_POST['yith_wcwl_color_' . $name . '_' . $id]) : woocommerce_format_hex($_POST['yith_wcwl_color_' . $name . '_' . $id]);
             } else {
                 $colors_options[$name][$id] = $default_value;
             }
         }
     }
     update_option('yith_wcwl_frontend_css_colors', maybe_serialize($colors_options));
     return null;
 }
开发者ID:VitaliyProdan,项目名称:wp_shop,代码行数:23,代码来源:class.yith-wcwl-admin-init.php

示例6: update_options

 /**
  * Update plugin options.
  *
  * @return void
  * @since 1.0.0
  */
 public function update_options()
 {
     foreach ($this->options as $option) {
         woocommerce_update_options($option);
     }
     foreach ($this->colors_options as $name => $option) {
         foreach ($option as $id => $color) {
             if (function_exists('wc_format_hex')) {
                 $this->colors_options[$name][$id] = isset($_POST['yith_wcwl_color_' . $name . '_' . $id]) && !empty($_POST['yith_wcwl_color_' . $name . '_' . $id]) ? wc_format_hex($_POST['yith_wcwl_color_' . $name . '_' . $id]) : '';
             } else {
                 $this->colors_options[$name][$id] = isset($_POST['yith_wcwl_color_' . $name . '_' . $id]) && !empty($_POST['yith_wcwl_color_' . $name . '_' . $id]) ? woocommerce_format_hex($_POST['yith_wcwl_color_' . $name . '_' . $id]) : '';
             }
         }
     }
     update_option('yith_wcwl_frontend_css_colors', maybe_serialize($this->colors_options));
 }
开发者ID:zgomotos,项目名称:Bazar,代码行数:22,代码来源:class.yith-wcwl-init.php

示例7: save

 /**
  * Save settings
  */
 public function save()
 {
     $settings = $this->get_settings();
     WC_Admin_Settings::save_fields($settings);
     if (isset($_POST['woocommerce_frontend_css_primary'])) {
         // Save settings
         $primary = !empty($_POST['woocommerce_frontend_css_primary']) ? wc_format_hex($_POST['woocommerce_frontend_css_primary']) : '';
         $secondary = !empty($_POST['woocommerce_frontend_css_secondary']) ? wc_format_hex($_POST['woocommerce_frontend_css_secondary']) : '';
         $highlight = !empty($_POST['woocommerce_frontend_css_highlight']) ? wc_format_hex($_POST['woocommerce_frontend_css_highlight']) : '';
         $content_bg = !empty($_POST['woocommerce_frontend_css_content_bg']) ? wc_format_hex($_POST['woocommerce_frontend_css_content_bg']) : '';
         $subtext = !empty($_POST['woocommerce_frontend_css_subtext']) ? wc_format_hex($_POST['woocommerce_frontend_css_subtext']) : '';
         $colors = array('primary' => $primary, 'secondary' => $secondary, 'highlight' => $highlight, 'content_bg' => $content_bg, 'subtext' => $subtext);
         $old_colors = get_option('woocommerce_frontend_css_colors');
         update_option('woocommerce_frontend_css_colors', $colors);
         if ($old_colors != $colors) {
             woocommerce_compile_less_styles();
         }
     }
 }
开发者ID:Joaquinsemp,项目名称:patriestausado,代码行数:22,代码来源:class-wc-settings-general.php

示例8: save

 /**
  * Save settings
  */
 public function save()
 {
     $settings = $this->get_settings();
     $filtered_settings = $image_id_fields = array();
     // filter out the image ids types, because WC barfs on itself over them
     foreach ($settings as $field) {
         if ('qsot-image-ids' == $field['type']) {
             $image_id_fields[] = $field;
         } else {
             $filtered_settings[] = $field;
         }
     }
     // only allow wc to save the 'safe' ones
     WC_Admin_Settings::save_fields($filtered_settings);
     // handle any image id fields
     foreach ($image_id_fields as $field) {
         // if the field did not have any values passed, then skip it
         if (!isset($_POST[$field['id']])) {
             continue;
         }
         $raw_values = $_POST[$field['id']];
         // next sanitize the individual values for the field
         $values = array_filter(array_map('absint', $raw_values));
         // allow modification of the data
         $values = apply_filters('woocommerce_admin_settings_sanitize_option', $values, $field, $raw_values);
         $values = apply_filters('woocommerce_admin_settings_sanitize_option_' . $field['id'], $values, $field, $raw_values);
         // update the value
         update_option($field['id'], $values);
     }
     if (isset($_POST['qsot_frontend_css_form_bg'])) {
         // Save settings
         $colors = array();
         foreach (array('form_bg', 'form_border', 'form_action_bg', 'form_helper') as $k) {
             $colors[$k] = !empty($_POST['qsot_frontend_css_' . $k]) ? wc_format_hex($_POST['qsot_frontend_css_' . $k]) : '';
         }
         foreach (array('good_msg', 'bad_msg', 'remove') as $K) {
             foreach (array('_bg', '_border', '_text') as $k) {
                 $colors[$K . $k] = !empty($_POST['qsot_frontend_css_' . $K . $k]) ? wc_format_hex($_POST['qsot_frontend_css_' . $K . $k]) : '';
             }
         }
         foreach (array('past_calendar_item', 'calendar_item') as $K) {
             foreach (array('_bg', '_border', '_text', '_text_hover') as $k) {
                 $colors[$K . $k] = !empty($_POST['qsot_frontend_css_' . $K . $k]) ? wc_format_hex($_POST['qsot_frontend_css_' . $K . $k]) : '';
             }
         }
         // Check the colors.
         $valid_colors = true;
         foreach ($colors as $color) {
             if (!preg_match('/^#[a-f0-9]{6}$/i', $color)) {
                 $valid_colors = false;
                 WC_Admin_Settings::add_error(sprintf(__('Error saving the Frontend Styles, %s is not a valid color, please use only valid colors code.', 'opentickets-community-edition'), $color));
                 break;
             }
         }
         if ($valid_colors) {
             $old_colors = get_option('woocommerce_frontend_css_colors');
             $options = qsot_options::instance();
             $options->{'qsot-event-frontend-colors'} = $colors;
             if ($old_colors != $colors) {
                 QSOT::compile_frontend_styles();
             }
         }
     }
 }
开发者ID:Jayriq,项目名称:opentickets-community,代码行数:67,代码来源:frontend.php


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