Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
WP Plugins
ETH Escape Headspace
Commits
db705537
Commit
db705537
authored
Jan 30, 2016
by
Erick Hitter
Browse files
Reduce repetition by mapping HeadSpace2 postmeta keys to their equivalent meta names
parent
67363557
Changes
1
Show whitespace changes
Inline
Side-by-side
eth-escape-headspace.php
View file @
db705537
...
@@ -55,6 +55,11 @@ class ETH_Escape_HeadSpace2 {
...
@@ -55,6 +55,11 @@ class ETH_Escape_HeadSpace2 {
'_headspace_noydir'
,
'_headspace_noydir'
,
);
);
private
$hs_keys_to_meta_names
=
array
(
'_headspace_description'
=>
'description'
,
'_headspace_metakey'
=>
'keywords'
,
);
/**
/**
* Register plugin's hooks
* Register plugin's hooks
*
*
...
@@ -96,11 +101,8 @@ class ETH_Escape_HeadSpace2 {
...
@@ -96,11 +101,8 @@ class ETH_Escape_HeadSpace2 {
foreach
(
$hs_data
as
$hs_key
=>
$hs_value
)
{
foreach
(
$hs_data
as
$hs_key
=>
$hs_value
)
{
switch
(
$hs_key
)
{
switch
(
$hs_key
)
{
case
'_headspace_description'
:
case
'_headspace_description'
:
echo
'<meta name="description" content="'
.
esc_attr
(
$hs_value
)
.
'" />'
.
"
\n
"
;
break
;
case
'_headspace_metakey'
:
case
'_headspace_metakey'
:
echo
'<meta name="
keywords
" content="'
.
esc_attr
(
$hs_value
)
.
'" />'
.
"
\n
"
;
echo
'<meta name="
'
.
esc_attr
(
$this
->
hs_keys_to_meta_names
[
$hs_key
]
)
.
'
" content="'
.
esc_attr
(
$hs_value
)
.
'" />'
.
"
\n
"
;
break
;
break
;
default
:
default
:
...
...
Write
Preview
Supports
Markdown
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