當前位置: 首頁>>代碼示例>>PHP>>正文


PHP dmString::hexColor方法代碼示例

本文整理匯總了PHP中dmString::hexColor方法的典型用法代碼示例。如果您正苦於以下問題:PHP dmString::hexColor方法的具體用法?PHP dmString::hexColor怎麽用?PHP dmString::hexColor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在dmString的用法示例。


在下文中一共展示了dmString::hexColor方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: checkBackground

 public function checkBackground($validator, $values)
 {
     if ('fit' == $values['method'] && !dmString::hexColor($values['background'])) {
         throw new sfValidatorErrorSchema($validator, array('background' => new sfValidatorError($validator, 'This is not a valid hexadecimal color')));
     }
     return $values;
 }
開發者ID:runopencode,項目名稱:diem-extended,代碼行數:7,代碼來源:dmWidgetContentImageForm.php

示例2: background

 public function background($v)
 {
     if (!($hexColor = dmString::hexColor($v))) {
         throw new dmException(sprintf('%s is not a valid hexadecimal color', $v));
     }
     return $this->setOption('background', $hexColor);
 }
開發者ID:theolymp,項目名稱:diem,代碼行數:7,代碼來源:dmMediaTagImage.php

示例3: dirname

require_once dirname(__FILE__) . '/helper/dmUnitTestHelper.php';
$helper = new dmUnitTestHelper();
$helper->boot();
$t = new lime_test(59);
$t->comment('iconv available : ' . function_exists('iconv'));
$t->is(dmString::slugify(" phrâse avèc dés accënts "), $expected = "phrase-avec-des-accents", $expected);
$t->is(dmString::slugify("fonctionnalité"), $expected = "fonctionnalite", $expected);
$t->is(dmString::urlize(" phrâse avèc dés accënts "), $expected = "phrase-avec-des-accents", $expected);
$t->is(dmString::urlize("fonctionnalité"), $expected = "fonctionnalite", $expected);
$t->is(dmString::slugify("an-url.htm"), $expected = "an-url-htm", $expected);
$t->is(dmString::slugify("an-url.html"), $expected = "an-url-html", $expected);
$t->is(dmString::urlize("an-url.htm"), $expected = "an-url.htm", $expected);
$t->is(dmString::urlize("an-url.html"), $expected = "an-url.html", $expected);
$hexTests = array(array('ffffff', 'FFFFFF'), array('#ffffff', 'FFFFFF'), array('#0Cd4fe', '0CD4FE'), array('aaa', null), array('fffff', null), array('fffxff', null));
foreach ($hexTests as $hexTest) {
    $t->is(dmString::hexColor($hexTest[0]), $hexTest[1], 'dmString::hexColor(' . $hexTest[0] . ') = ' . (null === $hexTest[1] ? 'NULL' : $hexTest[1]));
}
$t->is(dmString::lcfirst('TEST'), 'tEST', 'lcfirst test');
$t->is(dmString::lcfirst('another test'), 'another test', 'lcfirst test');
// ::retrieveOptFromString()
$t->diag('::retrieveOptFromString()');
// Empty string
$t->diag('  ::retrieveOptFromString() empty string');
$string = '';
$opt = array('aa' => 'bb');
$originalOpt = $opt;
$t->is_deeply(dmString::retrieveOptFromString($string, $opt), null, '::retrieveOptFromString() with an empty string returns null');
$t->is_deeply($opt, $originalOpt, '::retrieveOptFromString() with an empty string does not modify opt');
$t->is_deeply($string, '', '::retrieveOptFromString() with an empty string does not modify string');
// Non-empty string
$t->diag('  ::retrieveOptFromString() non-empty string');
開發者ID:theolymp,項目名稱:diem,代碼行數:31,代碼來源:dmStringTest.php


注:本文中的dmString::hexColor方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。