Subversion Repositories php_utils

Compare Revisions

Regard whitespace Rev 85 → Rev 86

/trunk/color_utils.inc.php
3,7 → 3,7
/*
* Color Utils for PHP
* Copyright 2019 - 2023 Daniel Marschall, ViaThinkSoft
* Revision 2023-01-03
* Revision 2023-08-29
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
105,8 → 105,15
 
// TODO: Also support hsl() and hsla() color schemes
function changeCSSWithRgbFunction($css_content, $rgb_function) {
$css_content = preg_replace('@(\\}\\s*)#@ismU', '\\1'.chr(1), $css_content);
$css_content = preg_replace('@(^\\s*)#@isU', '\\1'.chr(1), $css_content);
 
$i = 0;
do {
$i++;
$dummy = "[$i]";
} while (strpos($css_content, $dummy) !== false);
 
$css_content = preg_replace('@(\\}\\s*)#@ismU', '\\1'.$dummy, $css_content);
$css_content = preg_replace('@(^\\s*)#@isU', '\\1'.$dummy, $css_content);
$css_content = preg_replace_callback('@#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})@ismU',
function ($x) use ($rgb_function) {
if (strlen($x[1]) == 3) {
147,7 → 154,7
$rgb_function($r,$g,$b);
return "-rgb:$r,$g,$b;";
}, $css_content);
$css_content = str_replace(chr(1), '#', $css_content);
$css_content = str_replace($dummy, '#', $css_content);
return $css_content;
}
 
/trunk/oid_utils.inc.php
2,8 → 2,8
 
/*
* OID-Utilities for PHP
* Copyright 2011-2022 Daniel Marschall, ViaThinkSoft
* Version 2022-01-07
* Copyright 2011 - 2023 Daniel Marschall, ViaThinkSoft
* Version 2023-08-25
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
226,7 → 226,7
**/
function oid_len($oid) {
if ($oid == '') return 0;
if ($oid[0] == '.') $oid = substr($oid, 1);
if (substr($oid,0,1) == '.') $oid = substr($oid, 1);
return substr_count($oid, '.')+1;
}
function oid_depth($oid) {
460,7 → 460,7
$oid = sanitizeOID($oid, 'auto');
if ($oid === false) return false;
 
if ($oid[0] != '.') $oid = '.'.$oid;
if (substr($oid,0,1) != '.') $oid = '.'.$oid;
return $oid;
}