Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
313
Merge Requests
313
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
33813073
Commit
33813073
authored
Jun 24, 2001
by
Kjartan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Changed field_get/set() to be more efficent.
parent
0743b2cd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
25 deletions
+5
-25
includes/common.inc
includes/common.inc
+5
-25
No files found.
includes/common.inc
View file @
33813073
...
...
@@ -191,34 +191,14 @@ function form_submit($value) {
}
function
field_get
(
$string
,
$name
)
{
foreach
(
explode
(
","
,
$string
)
as
$data
)
{
$entry
=
explode
(
"="
,
$data
);
if
(
$entry
[
0
]
==
$name
)
return
$entry
[
1
];
}
ereg
(
",
$name
=([^,]+)"
,
",
$string
"
,
$regs
);
return
$regs
[
1
];
}
function
field_set
(
$string
,
$name
,
$value
)
{
if
(
!
$value
)
{
// remove entry:
foreach
(
explode
(
","
,
$string
)
as
$data
)
{
$entry
=
explode
(
"="
,
$data
);
if
(
$entry
[
0
]
!=
$name
)
$rval
.
=
"
$entry[0]=$entry[1]
,"
;
}
}
else
if
(
strstr
(
$string
,
"
$name
="
))
{
// found: update exsisting entry:
foreach
(
explode
(
","
,
$string
)
as
$data
)
{
$entry
=
explode
(
"="
,
$data
);
if
(
$entry
[
0
]
==
$name
)
$entry
[
1
]
=
$value
;
$rval
.
=
"
$entry[0]=$entry[1]
,"
;
}
}
else
{
// not found:
$rval
=
"
$string$name
=
$value
,"
;
}
return
$rval
;
$rval
=
ereg_replace
(
",
$name
=[^,]+"
,
""
,
",
$string
"
);
if
(
$value
)
$rval
.
=
(
$rval
==
","
?
""
:
","
)
.
"
$name
=
$value
"
;
return
substr
(
$rval
,
1
);
}
function
field_merge
(
$a
,
$b
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment