當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。