what-did-they-say/classes/WDTSTranscriptOptions.inc

41 lines
1.3 KiB
PHP
Raw Permalink Normal View History

2009-09-06 15:04:38 +00:00
<?php
class WDTSTranscriptOptions {
var $post_id;
function __construct($post_id = null) {
if (is_numeric($post_id)) { $this->post_id = $post_id; }
}
function WDTSTranscriptOptions($post_id = null) { $this->__construct($post_id); }
/**
* Set whether or not the indicated post can accept new queued transcriptions.
* @param int $post_id The post ID to affect.
* @param boolean $allow True if the post can accept new queued transcriptions.
*/
2009-09-11 01:00:10 +00:00
function set_allow_transcripts($allow = true) { $this->_update_option('allow_transcripts', $allow); }
2009-09-06 15:04:38 +00:00
/**
* See if the indicated post is accepting new transcripts.
* @return boolean True if the post is acceptin new transcripts.
*/
2009-09-11 01:20:01 +00:00
function are_new_transcripts_allowed() {
2009-09-11 01:00:10 +00:00
$options = $this->_get_transcript_options();
2009-09-11 01:20:01 +00:00
return isset($options['allow_transcripts']) ? $options['allow_transcripts'] : false;
2009-09-11 01:00:10 +00:00
}
function _get_transcript_options() {
2009-09-13 16:35:20 +00:00
$current_options = get_post_meta($this->post_id, "transcript_options", true);
if (!is_array($current_options)) { $current_options = array(); }
return $current_options;
2009-09-11 01:00:10 +00:00
}
function _update_option($option, $value) {
$current_options = $this->_get_transcript_options();
2009-09-13 16:35:20 +00:00
$current_options[$option] = $value;
update_post_meta($this->post_id, "transcript_options", $current_options);
2009-09-06 15:04:38 +00:00
}
}
?>