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


PHP sanitize_hex_color_no_hash函数代码示例

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


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

示例1: radiate_sanitize_hex_color

 function radiate_sanitize_hex_color($color)
 {
     if ($unhashed = sanitize_hex_color_no_hash($color)) {
         return '#' . $unhashed;
     }
     return $color;
 }
开发者ID:proudchild,项目名称:sdmblog,代码行数:7,代码来源:customizer.php

示例2: travelify_sanitize_hexcolor

/**
 * Adds sanitization callback function: colors
 * @package Travelify
 */
function travelify_sanitize_hexcolor($color)
{
    if ($unhashed = sanitize_hex_color_no_hash($color)) {
        return '#' . $unhashed;
    }
    return $color;
}
开发者ID:TakenCdosG,项目名称:chefs,代码行数:11,代码来源:customizer.php

示例3: sanitize_hex_color_no_hash_with_transparency

 public static function sanitize_hex_color_no_hash_with_transparency($content)
 {
     $return = $content;
     if (trim($content) == 'transparent') {
         $return = trim($content);
     } else {
         $return = sanitize_hex_color_no_hash($content);
     }
     return $return;
 }
开发者ID:igniterealtime,项目名称:community-plugins,代码行数:10,代码来源:cc2-color-control.php

示例4: phg_gold_sanitize_hexcolor

/**
 * Adds sanitization callback function: colors
 * @package phg_gold
 */
function phg_gold_sanitize_hexcolor($color)
{
    if ($unhashed = sanitize_hex_color_no_hash($color)) {
        return '#' . $unhashed;
    }
    return $color;
}
开发者ID:aeekayy,项目名称:phggold,代码行数:11,代码来源:customizer.php

示例5: accelerate_color_option_hex_sanitize

 function accelerate_color_option_hex_sanitize($color)
 {
     if ($unhashed = sanitize_hex_color_no_hash($color)) {
         return '#' . $unhashed;
     }
     return $color;
 }
开发者ID:nanookYs,项目名称:orientreizen,代码行数:7,代码来源:customizer.php

示例6: sparkling_sanitize_hexcolor

/**
 * Adds sanitization callback function: colors
 * @package Sparkling
 */
function sparkling_sanitize_hexcolor($color)
{
    if ($unhashed = sanitize_hex_color_no_hash($color)) {
        return '#' . $unhashed;
    }
    return $color;
}
开发者ID:mikesprague,项目名称:Sparkling,代码行数:11,代码来源:customizer.php

示例7: creative_blog_color_option_hex_sanitize

 function creative_blog_color_option_hex_sanitize($color)
 {
     if ($unhashed = sanitize_hex_color_no_hash($color)) {
         return '#' . $unhashed;
     }
     return $color;
 }
开发者ID:mebishalnapit,项目名称:creative-blog,代码行数:7,代码来源:customizer.php

示例8: flat_responsive_sanitize_hex_color

/**
 * adds sanitization callback function : colors
 * @package flat_responsive 
*/
function flat_responsive_sanitize_hex_color($color)
{
    if ($unhashed = sanitize_hex_color_no_hash($color)) {
        return '#' . $unhashed;
    }
    return $color;
}
开发者ID:ReConcepts,项目名称:mashariki,代码行数:11,代码来源:customizer.php

示例9: _sanitize_header_textcolor

 /**
  * Callback for validating the header_textcolor value.
  *
  * Accepts 'blank', and otherwise uses sanitize_hex_color_no_hash().
  *
  * @since 3.4.0
  */
 public function _sanitize_header_textcolor($color)
 {
     return 'blank' === $color ? 'blank' : sanitize_hex_color_no_hash($color);
 }
开发者ID:par-orillonsoft,项目名称:Wishmagnet,代码行数:11,代码来源:class-wp-customize-manager.php

示例10: _sanitize_header_textcolor

 /**
  * Callback for validating the header_textcolor value.
  *
  * Accepts 'blank', and otherwise uses sanitize_hex_color_no_hash().
  * Returns default text color if hex color is empty.
  *
  * @since 3.4.0
  *
  * @param string $color
  * @return mixed
  */
 public function _sanitize_header_textcolor($color)
 {
     if ('blank' === $color) {
         return 'blank';
     }
     $color = sanitize_hex_color_no_hash($color);
     if (empty($color)) {
         $color = get_theme_support('custom-header', 'default-text-color');
     }
     return $color;
 }
开发者ID:RA2WP,项目名称:RA2WP,代码行数:22,代码来源:class-wp-customize-manager.php

示例11: puresimple_sanitize_hex_color

function puresimple_sanitize_hex_color($color)
{
    if ($unhashed = sanitize_hex_color_no_hash($color)) {
        return '#' . $unhashed;
    }
    return $color;
}
开发者ID:karthikakamalanathan,项目名称:wp-cookieLawInfo,代码行数:7,代码来源:customizer.php

示例12: get_default_color

 /**
  * Return the default HEX value for a color in a scheme.
  *
  * @param  string $color
  * @param  string $scheme (optional)
  * @param  bool   $hash   (optional)
  *
  * @return string|null
  */
 public function get_default_color($color, $scheme = '', $hash = false)
 {
     /**
      * Load for backwards compatibility prior to WordPress 4.6.
      *
      * @link  https://core.trac.wordpress.org/ticket/27583
      * @since 1.0.0
      */
     if (!function_exists('sanitize_hex_color') || !function_exists('sanitize_hex_color_no_hash')) {
         require_once ABSPATH . 'wp-includes/class-wp-customize-manager.php';
     }
     $scheme = empty($scheme) ? $this->get_current_color_scheme_array() : $this->color_schemes[$this->sanitize_color_scheme($scheme)];
     $hex = isset($scheme['colors'][$color]) ? trim($scheme['colors'][$color], '#') : null;
     return $hash ? sanitize_hex_color('#' . $hex) : sanitize_hex_color_no_hash($hex);
 }
开发者ID:faithmade,项目名称:rock,代码行数:24,代码来源:colors.php

示例13: screenr_sanitize_repeatable_data_field

/**
 * Sanitize repeatable data
 *
 * @param $input
 * @param $setting object $wp_customize
 * @return bool|mixed|string|void
 */
function screenr_sanitize_repeatable_data_field($input, $setting)
{
    $control = $setting->manager->get_control($setting->id);
    $fields = $control->fields;
    $input = json_decode($input, true);
    $data = wp_parse_args($input, array());
    if (!is_array($data)) {
        return false;
    }
    if (!isset($data['_items'])) {
        return false;
    }
    $data = $data['_items'];
    foreach ($data as $i => $item_data) {
        foreach ($item_data as $id => $value) {
            if (isset($fields[$id])) {
                switch (strtolower($fields[$id]['type'])) {
                    case 'text':
                        $data[$i][$id] = sanitize_text_field($value);
                        break;
                    case 'textarea':
                        $data[$i][$id] = force_balance_tags($value);
                        break;
                    case 'color':
                        $data[$i][$id] = sanitize_hex_color_no_hash($value);
                        break;
                    case 'coloralpha':
                        $data[$i][$id] = screenr_sanitize_color_alpha($value);
                        break;
                    case 'checkbox':
                        $data[$i][$id] = screenr_sanitize_checkbox($value);
                        break;
                    case 'select':
                        $data[$i][$id] = '';
                        if (is_array($fields[$id]['options']) && !empty($fields[$id]['options'])) {
                            // if is multiple choices
                            if (is_array($value)) {
                                foreach ($value as $k => $v) {
                                    if (isset($fields[$id]['options'][$v])) {
                                        $value[$k] = $v;
                                    }
                                }
                                $data[$i][$id] = $value;
                            } else {
                                // is single choice
                                if (isset($fields[$id]['options'][$value])) {
                                    $data[$i][$id] = $value;
                                }
                            }
                        }
                        break;
                    case 'radio':
                        $data[$i][$id] = sanitize_text_field($value);
                        break;
                    case 'media':
                        $value = wp_parse_args($value, array('url' => '', 'id' => false));
                        $value['id'] = absint($value['id']);
                        $data[$i][$id]['url'] = sanitize_text_field($value['url']);
                        if ($url = wp_get_attachment_url($value['id'])) {
                            $data[$i][$id]['id'] = $value['id'];
                            $data[$i][$id]['url'] = $url;
                        } else {
                            $data[$i][$id]['id'] = '';
                        }
                        break;
                    default:
                        $data[$i][$id] = wp_kses_post($value);
                }
            } else {
                $data[$i][$id] = wp_kses_post($value);
            }
            if (count($data[$i]) != count($fields)) {
                foreach ($fields as $k => $f) {
                    if (!isset($data[$i][$k])) {
                        $data[$i][$k] = '';
                    }
                }
            }
        }
    }
    return $data;
}
开发者ID:kixortillan,项目名称:dfosashworks,代码行数:89,代码来源:customizer-controls.php

示例14: encounters_lite_sanitize_hex_color

/**
 * adds sanitization callback function : colors
 * @package Encounters Lite 
*/
function encounters_lite_sanitize_hex_color($color)
{
    if ($unhashed = sanitize_hex_color_no_hash($color)) {
        return '#' . $unhashed;
    }
    return $color;
}
开发者ID:double360,项目名称:wordpress,代码行数:11,代码来源:theme-customizer.php

示例15: ttfmake_hex_to_rgb

/**
 * Convert a hex string into a comma separated RGB string.
 *
 * @link http://bavotasan.com/2011/convert-hex-color-to-rgb-using-php/
 *
 * @since 1.5.0.
 *
 * @param  $value
 * @return bool|string
 */
function ttfmake_hex_to_rgb($value)
{
    $hex = sanitize_hex_color_no_hash($value);
    if (6 === strlen($hex)) {
        $r = hexdec(substr($hex, 0, 2));
        $g = hexdec(substr($hex, 2, 2));
        $b = hexdec(substr($hex, 4, 2));
    } else {
        if (3 === strlen($hex)) {
            $r = hexdec(substr($hex, 0, 1) . substr($hex, 0, 1));
            $g = hexdec(substr($hex, 1, 1) . substr($hex, 1, 1));
            $b = hexdec(substr($hex, 2, 1) . substr($hex, 2, 1));
        } else {
            return false;
        }
    }
    return "{$r}, {$g}, {$b}";
}
开发者ID:fovoc,项目名称:make,代码行数:28,代码来源:color.php


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