Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Expose is_liveblog_post and get_liveblog_state methods - they're usef…

…ul externally as well.
  • Loading branch information...
commit 508b44423edf9ef247a6deda25e16d92bcd5ae3f 1 parent 3ea7a2f
@cfg cfg authored
Showing with 30 additions and 30 deletions.
  1. +30 −30 liveblog.php
View
60 liveblog.php
@@ -270,7 +270,17 @@ public static function ajax_entries_between() {
self::json_return( $result_for_json );
}
- /** Private _is_ Methods **************************************************/
+ /**
+ * Is a given post_id a liveblog enabled post?
+ *
+ * @global WP_Post $post
+ * @param int $post_id
+ * @return bool
+ */
+ public static function is_liveblog_post( $post_id = null ) {
+ $state = self::get_liveblog_state( $post_id );
+ return (bool)$state;
+ }
/**
* Are we viewing a liveblog post?
@@ -279,11 +289,29 @@ public static function ajax_entries_between() {
* @uses is_liveblog_post()
* @return bool
*/
- private static function is_viewing_liveblog_post() {
+ public static function is_viewing_liveblog_post() {
return (bool) ( is_single() && self::is_liveblog_post() );
}
/**
+ * One of: 'enable', 'archive', false.
+ */
+ public static function get_liveblog_state( $post_id = null ) {
+ if ( empty( $post_id ) ) {
+ global $post;
+ $post_id = $post->ID;
+ }
+ $state = get_post_meta( $post_id, self::key, true );
+ // backwards compatibility with older values
+ if ( 1 == $state ) {
+ $state = 'enable';
+ }
+ return $state;
+ }
+
+ /** Private _is_ Methods **************************************************/
+
+ /**
* Is this the initial page request?
*
* Note that we do not use get_query_var() - it returns '' for all requests,
@@ -309,34 +337,6 @@ private static function is_entries_ajax_request() {
}
/**
- * Is a given post_id a liveblog enabled post?
- *
- * @global WP_Post $post
- * @param int $post_id
- * @return bool
- */
- private static function is_liveblog_post( $post_id = null ) {
- $state = self::get_liveblog_state( $post_id );
- return (bool)$state;
- }
-
- /**
- * One of: 'enable', 'archive', false.
- */
- private static function get_liveblog_state( $post_id = null ) {
- if ( empty( $post_id ) ) {
- global $post;
- $post_id = $post->ID;
- }
- $state = get_post_meta( $post_id, self::key, true );
- // backwards compatibility with older values
- if ( 1 == $state ) {
- $state = 'enable';
- }
- return $state;
- }
-
- /**
* Get timestamps from the current WP_Query
*
* Ensures that two timestamps exist, and returns a properly formatted empty
Please sign in to comment.
Something went wrong with that request. Please try again.