su_expand_short_color

The shortcodes-ultimate su expand short color function.

Published Date - February 15, 2021

Description

Helper function that expands 3-sybol string into 6-sybol by repeating each symbol twice.

su_expand_short_color( $value );

Parameters

  1. $value


Usage

The following example is for adding a hook callback.

if ( !function_exists( 'su_expand_short_color' ) ) {
    require_once ABSPATH . PLUGINDIR . 'shortcodes-ultimateshortcodes-ultimate/includes/functions-colors.php';
}

// The input(s). 
$value = null;

// NOTICE! Understand what this does before running.
$result = su_expand_short_color( $value );
            

Defined

The function is defined in the following location(s).

shortcodes-ultimate/includes/functions-colors.php

function su_expand_short_color( $value ) {

	if ( ! is_string( $value ) || 3 !== strlen( $value ) ) {
		return $value;
	}

	return $value[0] . $value[0] . $value[1] . $value[1] . $value[2] . $value[2];

}