| Linux webm010.cluster103.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 Path : /home/c/u/i/cuisinesj/www/new/wp-content/themes/auberge/assets/sass/starter/tools/ |
| Current File : /home/c/u/i/cuisinesj/www/new/wp-content/themes/auberge/assets/sass/starter/tools/_functions.scss |
/////////////////////
//
// Functions
//
/////////////////////
//
// Power math function
//
// Usage for standard gloden ratio values:
// 2.62 = power( $golden, 2 )
// 3.62 = power( ( 1 + $golden_minor ), 4 )
// 4.25 = power( $golden, 3 )
// 5.00 = power( ( 1 + $golden_minor ), 5 )
//
// @link https://github.com/adambom/Sass-Math/blob/master/math.scss
//
// @param num $base
// @param int $exp
//
// @return num Base raised to the power of exponent
//
@function power( $base, $exp: 1 ) {
// Helper variables
$output: 1;
// Processing
@if 0 <= $exp {
@for $i from 1 through $exp {
$output: $output * $base;
}
} @else {
@for $i from $exp to 0 {
$output: $output / $base;
}
}
// Output
@return $output;
} // /power
//
// Repeat CSS selectors several times
//
// @example
// .foo {
// @at-root #{ repeat_selector( &, 2 ) } {
// ...
// }
// }
//
// @param int $selector The CSS selector to repeat
// @param int $multiply How many times to repeat the selector?
//
@function repeat_selector( $selector, $multiply: 1 ) {
// Helper variables
$output: '';
// Processing
@for $i from 1 through $multiply {
$output: $output + $selector;
}
// Output
@return $output;
} // /repeat_selector
//
// Replace string.
//
// @since 2.9.0
//
// @param string $search
// @param string $replace
// @param string $subject
//
@function _str_replace( $search, $replace, $subject ) {
// Variables
$index: str-index( $subject, $search );
// Processing
@if $index {
@return str-slice( $subject, 1, $index - 1 ) + $replace + _str_replace( $search, $replace, str-slice( $subject, $index + str-length( $search ) ) );
}
// Output
@return $subject;
}
//
// Encode symbols for URL.
//
// @since 2.9.0
//
// @param string $string
//
@function _url_encode( $url ) {
// Variables
$encodes: (
"%": "%25",
"<": "%3C",
">": "%3E",
" ": "%20",
"!": "%21",
"*": "%2A",
"'": "%27",
'"': "%22",
"(": "%28",
")": "%29",
";": "%3B",
":": "%3A",
"@": "%40",
"&": "%26",
"=": "%3D",
"+": "%2B",
"$": "%24",
",": "%2C",
"/": "%2F",
"?": "%3F",
"#": "%23",
"[": "%5B",
"]": "%5D",
);
// Processing
@each $search, $replace in $encodes {
$url: _str_replace( $search, $replace, $url );
}
// Output
@return $url;
}