Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
Timeline
Manage
Activity
Members
Labels
Plan
Issues
2
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
WP Plugins
Timeline
Commits
985a7993
Commit
985a7993
authored
11 years ago
by
Erick Hitter
Browse files
Options
Downloads
Patches
Plain Diff
WP coding standards cleanup: brace all the things!
parent
10c81072
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
eth-timeline.php
+26
-14
26 additions, 14 deletions
eth-timeline.php
with
26 additions
and
14 deletions
eth-timeline.php
+
26
−
14
View file @
985a7993
...
@@ -130,8 +130,9 @@ class ETH_Timeline {
...
@@ -130,8 +130,9 @@ class ETH_Timeline {
*/
*/
public
function
action_pre_get_posts
(
$query
)
{
public
function
action_pre_get_posts
(
$query
)
{
if
(
$query
->
is_main_query
()
&&
$this
->
post_type
==
$query
->
get
(
'post_type'
)
)
{
if
(
$query
->
is_main_query
()
&&
$this
->
post_type
==
$query
->
get
(
'post_type'
)
)
{
if
(
is_admin
()
&&
isset
(
$_GET
[
'orderby'
]
)
)
if
(
is_admin
()
&&
isset
(
$_GET
[
'orderby'
]
)
)
{
return
;
return
;
}
$query
->
set
(
'orderby'
,
'meta_value_num'
);
$query
->
set
(
'orderby'
,
'meta_value_num'
);
$query
->
set
(
'meta_key'
,
$this
->
meta_start
);
$query
->
set
(
'meta_key'
,
$this
->
meta_start
);
...
@@ -217,29 +218,34 @@ class ETH_Timeline {
...
@@ -217,29 +218,34 @@ class ETH_Timeline {
* @return null
* @return null
*/
*/
public
function
action_save_post
(
$post_id
)
{
public
function
action_save_post
(
$post_id
)
{
if
(
$this
->
post_type
!=
get_post_type
(
$post_id
)
)
if
(
$this
->
post_type
!=
get_post_type
(
$post_id
)
)
{
return
;
return
;
}
if
(
isset
(
$_POST
[
$this
->
get_nonce_name
(
'date'
)
]
)
&&
wp_verify_nonce
(
$_POST
[
$this
->
get_nonce_name
(
'date'
)
],
$this
->
get_field_name
(
'date'
)
)
)
{
if
(
isset
(
$_POST
[
$this
->
get_nonce_name
(
'date'
)
]
)
&&
wp_verify_nonce
(
$_POST
[
$this
->
get_nonce_name
(
'date'
)
],
$this
->
get_field_name
(
'date'
)
)
)
{
$dates
=
isset
(
$_POST
[
'eth-timeline'
]
)
?
$_POST
[
'eth-timeline'
]
:
array
();
$dates
=
isset
(
$_POST
[
'eth-timeline'
]
)
?
$_POST
[
'eth-timeline'
]
:
array
();
if
(
empty
(
$dates
)
)
if
(
empty
(
$dates
)
)
{
return
;
return
;
}
foreach
(
$dates
as
$key
=>
$date
)
{
foreach
(
$dates
as
$key
=>
$date
)
{
if
(
!
in_array
(
$key
,
array
(
'start'
,
'end'
)
)
)
if
(
!
in_array
(
$key
,
array
(
'start'
,
'end'
)
)
)
{
continue
;
continue
;
}
// Timestamp comes from JS
// Timestamp comes from JS
if
(
empty
(
$date
)
)
if
(
empty
(
$date
)
)
{
$timestamp
=
false
;
$timestamp
=
false
;
else
}
else
{
$timestamp
=
strtotime
(
$date
);
$timestamp
=
strtotime
(
$date
);
}
if
(
$timestamp
)
if
(
$timestamp
)
{
update_post_meta
(
$post_id
,
$this
->
{
'meta_'
.
$key
},
$timestamp
);
update_post_meta
(
$post_id
,
$this
->
{
'meta_'
.
$key
},
$timestamp
);
else
}
else
{
delete_post_meta
(
$post_id
,
$this
->
{
'meta_'
.
$key
}
);
delete_post_meta
(
$post_id
,
$this
->
{
'meta_'
.
$key
}
);
}
}
}
}
}
}
}
...
@@ -280,8 +286,9 @@ class ETH_Timeline {
...
@@ -280,8 +286,9 @@ class ETH_Timeline {
$key
=
str_replace
(
'eth_timeline_'
,
''
,
$column
);
$key
=
str_replace
(
'eth_timeline_'
,
''
,
$column
);
$date
=
get_post_meta
(
$post_id
,
$this
->
{
'meta_'
.
$key
},
true
);
$date
=
get_post_meta
(
$post_id
,
$this
->
{
'meta_'
.
$key
},
true
);
if
(
is_numeric
(
$date
)
)
if
(
is_numeric
(
$date
)
)
{
echo
date
(
get_option
(
'date_format'
,
'F j, Y'
),
$date
);
echo
date
(
get_option
(
'date_format'
,
'F j, Y'
),
$date
);
}
}
}
}
}
...
@@ -373,8 +380,9 @@ class ETH_Timeline {
...
@@ -373,8 +380,9 @@ class ETH_Timeline {
// Deal with grouping by month
// Deal with grouping by month
if
(
$month
!=
date
(
'n'
,
$times
[
'start'
]
)
)
{
if
(
$month
!=
date
(
'n'
,
$times
[
'start'
]
)
)
{
if
(
null
!==
$month
)
if
(
null
!==
$month
)
{
echo
'</ul><!-- '
.
$year
.
'-'
.
$month
.
' --></li>'
.
"
\n
"
;
echo
'</ul><!-- '
.
$year
.
'-'
.
$month
.
' --></li>'
.
"
\n
"
;
}
$month
=
(
int
)
date
(
'n'
,
$times
[
'start'
]
);
$month
=
(
int
)
date
(
'n'
,
$times
[
'start'
]
);
...
@@ -399,8 +407,9 @@ class ETH_Timeline {
...
@@ -399,8 +407,9 @@ class ETH_Timeline {
the_content
();
the_content
();
echo
'</span>'
;
echo
'</span>'
;
if
(
$removed
)
if
(
$removed
)
{
add_filter
(
'the_content'
,
'wpautop'
);
add_filter
(
'the_content'
,
'wpautop'
);
}
}
}
?>
?>
</li>
<!-- .eth-timeline-item#eth-timeline-
<?php
the_ID
();
?>
-->
</li>
<!-- .eth-timeline-item#eth-timeline-
<?php
the_ID
();
?>
-->
...
@@ -476,11 +485,13 @@ class ETH_Timeline {
...
@@ -476,11 +485,13 @@ class ETH_Timeline {
$format
=
'j'
;
$format
=
'j'
;
if
(
$loop_year
!=
$ts_year
)
if
(
$loop_year
!=
$ts_year
)
{
$format
.
=
', Y'
;
$format
.
=
', Y'
;
}
if
(
$start
||
$loop_month
!=
$ts_month
)
if
(
$start
||
$loop_month
!=
$ts_month
)
{
$format
=
'F '
.
$format
;
$format
=
'F '
.
$format
;
}
return
date
(
$format
,
$timestamp
);
return
date
(
$format
,
$timestamp
);
}
}
...
@@ -496,8 +507,9 @@ class ETH_Timeline {
...
@@ -496,8 +507,9 @@ class ETH_Timeline {
* @return string
* @return string
*/
*/
public
function
filter_editor_title_prompt
(
$text
,
$post
)
{
public
function
filter_editor_title_prompt
(
$text
,
$post
)
{
if
(
$this
->
post_type
==
get_post_type
(
$post
)
)
if
(
$this
->
post_type
==
get_post_type
(
$post
)
)
{
$text
=
__
(
'Enter destination here'
,
'eth-timeline'
);
$text
=
__
(
'Enter destination here'
,
'eth-timeline'
);
}
return
$text
;
return
$text
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment