本文整理汇总了PHP中StringUtils::IsNullOrEmpty方法的典型用法代码示例。如果您正苦于以下问题:PHP StringUtils::IsNullOrEmpty方法的具体用法?PHP StringUtils::IsNullOrEmpty怎么用?PHP StringUtils::IsNullOrEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringUtils
的用法示例。
在下文中一共展示了StringUtils::IsNullOrEmpty方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SetValue
public function SetValue($value)
{
if (!StringUtils::IsNullOrEmpty($value)) {
$this->value = SMDateTime::Parse($value, $this->format);
} else {
$this->value = null;
}
}
示例2: SetTimeZoneIfNeed
public static function SetTimeZoneIfNeed($timezoneIdentifier)
{
if (SystemUtils::GetPHPMinorVersion() >= 3) {
if (StringUtils::IsNullOrEmpty(ini_get('date.timezone'))) {
date_default_timezone_set($timezoneIdentifier);
}
}
}
示例3: GetStyleString
public function GetStyleString()
{
$result = '';
foreach ($this->styles as $paramName => $paramValue) {
StringUtils::AddStr($result, "{$paramName}: {$paramValue};", ' ');
}
foreach ($this->styleStrings as $styleString) {
if (!StringUtils::IsNullOrEmpty($styleString) && !StringUtils::EndsBy($styleString, ';')) {
$styleString .= ';';
}
StringUtils::AddStr($result, $styleString, ' ');
}
return $result;
}
示例4: Render
/**
* @param Renderer $renderer
* @return void
*/
public function Render(Renderer $renderer)
{
/** @var string $term */
$term = '';
if ($this->GetSuperGlobals()->IsGetValueSet('term')) {
$term = $this->GetSuperGlobals()->GetGetValue('term');
}
if (!StringUtils::IsNullOrEmpty($term)) {
$this->dataset->AddFieldFilter($this->valueField, new FieldFilter('%' . $term . '%', 'ILIKE', true));
}
$id = null;
if ($this->GetSuperGlobals()->IsGetValueSet('id')) {
$id = $this->GetSuperGlobals()->GetGetValue('id');
}
if (!StringUtils::IsNullOrEmpty($id)) {
$this->dataset->AddFieldFilter($this->idField, FieldFilter::Equals($id));
}
header('Content-Type: text/html; charset=utf-8');
$this->dataset->Open();
$result = array();
$valueCount = 0;
while ($this->dataset->Next()) {
$result[] = array("id" => $this->dataset->GetFieldValueByName($this->idField), "value" => StringUtils::IsNullOrEmpty($this->captionTemplate) ? $this->dataset->GetFieldValueByName($this->valueField) : DatasetUtils::FormatDatasetFieldsTemplate($this->dataset, $this->captionTemplate));
if (++$valueCount >= 20) {
break;
}
}
echo SystemUtils::ToJSON($result);
$this->dataset->Close();
}
示例5: HasAlias
public function HasAlias()
{
return !StringUtils::IsNullOrEmpty($this->alias);
}
示例6: ApplyHighlight
public function ApplyHighlight($value, $currentFieldName, $displayFieldName, $term)
{
if ($currentFieldName == $displayFieldName && !StringUtils::IsNullOrEmpty($term)) {
$patterns = array();
$patterns[0] = '/(' . preg_quote($term) . ')/i';
$replacements = array();
$replacements[0] = '<em class="highlight_autocomplete">' . '$1' . '</em>';
return preg_replace($patterns, $replacements, $value);
} else {
return $value;
}
}
示例7: GetInputAttributes
/**
* @return string
*/
public function GetInputAttributes($suppressRequiredValidation = false)
{
$result = '';
$validationAttr = '';
foreach ($this->list as $validator) {
if ($suppressRequiredValidation && SMReflection::ClassName($validator) == 'RequiredValidator') {
continue;
}
StringUtils::AddStr($validationAttr, $validator->GetValidatorName(), ' ');
StringUtils::AddStr($result, $validator->GetAdditionalAttributes(), ' ');
}
if (!StringUtils::IsNullOrEmpty($validationAttr)) {
StringUtils::AddStr($result, StringUtils::Format('data-validation="%s"', $validationAttr), ' ');
}
return $result;
}
示例8: SetDatasetFieldValue
public static function SetDatasetFieldValue(Dataset $dataSet, $fieldName, $value)
{
if (!StringUtils::IsNullOrEmpty($fieldName)) {
$dataSet->SetFieldValueByName($fieldName, $value);
}
}
示例9: GetDisplayValueFromDataset
private function GetDisplayValueFromDataset()
{
if (!StringUtils::IsNullOrEmpty($this->captionTemplate)) {
$this->lookupDataset->AddFieldFilter($this->lookupIdFieldName, new FieldFilter($this->GetDataset()->GetFieldValueByName($this->GetFieldName()), '='));
$this->lookupDataset->Open();
if ($this->lookupDataset->Next()) {
$displayValue = DatasetUtils::FormatDatasetFieldsTemplate($this->lookupDataset, $this->captionTemplate);
return $displayValue;
}
$this->lookupDataset->Close();
}
return $this->GetDataset()->GetFieldValueByName($this->displayFieldName);
}
示例10: UpdateSearchControls
public function UpdateSearchControls()
{
/** @var AdvancedSearchControl $advancedSearch */
$advancedSearch = $this->GetPage()->AdvancedSearchControl;
if ($advancedSearch != null) {
foreach ($advancedSearch->GetSearchColumns() as $searchColumn) {
$columnName = $searchColumn->GetFieldName();
$column = $this->FindViewColumnByName($columnName);
/** @var Field $field */
if (!StringUtils::IsNullOrEmpty($column)) {
$field = $this->dataset->GetFieldByName($column->GetName());
} else {
$field = $this->dataset->GetFieldByName($columnName);
}
if ($field && $searchColumn) {
if ($searchColumn instanceof LookupSearchColumn) {
$this->filterBuilder->AddField($searchColumn, $searchColumn->GetFieldName(), $searchColumn->GetCaption(), $field->GetEngFieldType(), 'Typeahead', array('handler' => $searchColumn->GetHandlerName()));
$searchColumnViewData['Value'] = $searchColumn->GetDisplayValue();
} else {
if ($field instanceof DateTimeField || $field instanceof DateField) {
$formatOptions = array('fdow' => GetFirstDayOfWeek());
if (!StringUtils::IsNullOrEmpty($column) && $column instanceof DateTimeViewColumn) {
$formatOptions['format'] = $column->GetOSDateTimeFormat();
}
$this->filterBuilder->AddField($searchColumn, $searchColumn->GetFieldName(), $searchColumn->GetCaption(), $field->GetEngFieldType(), null, $formatOptions);
} else {
$this->filterBuilder->AddField($searchColumn, $searchColumn->GetFieldName(), $searchColumn->GetCaption(), $field->GetEngFieldType(), null, null);
}
}
}
}
}
}
示例11: GetNameInContext
private function GetNameInContext($name)
{
return StringUtils::IsNullOrEmpty($this->context) ? $name : $this->context . '_' . $name;
}
示例12: Render
public function Render(Renderer $renderer)
{
$result = array();
$this->dataset->AddFieldFilter($this->captionFieldName, FieldFilter::Contains($this->arrayWrapper->GetValue(self::SearchTermParamName)));
if (!StringUtils::IsNullOrEmpty($this->parentIdFieldName) && $this->arrayWrapper->IsValueSet(self::ParentParamName)) {
$this->dataset->AddFieldFilter($this->parentIdFieldName, FieldFilter::Equals($this->arrayWrapper->GetValue(self::ParentParamName)));
}
$this->dataset->Open();
$valueCount = 0;
while ($this->dataset->Next()) {
$result[] = array('id' => $this->dataset->GetFieldValueByName($this->idFieldName), 'value' => $this->dataset->GetFieldValueByName($this->captionFieldName));
if (++$valueCount >= 20) {
break;
}
}
$this->dataset->Close();
echo SystemUtils::ToJSON($result);
}
示例13: getActualParamName
private function getActualParamName($paramName)
{
return StringUtils::IsNullOrEmpty($this->prefix) ? $paramName : $this->prefix . '_' . $paramName;
}
示例14: SetValue
public function SetValue($value)
{
if (!StringUtils::IsNullOrEmpty($value)) {
$this->value = SMDateTime::Parse($value, $this->showsTime ? 'Y-m-d H:i:s' : 'Y-m-d');
} else {
$this->value = null;
}
}