| 1 |
<?php |
| 2 |
class UpdatedPostsControl { |
| 3 |
var $page; |
| 4 |
function UpdatedPostsControl (&$page) { |
| 5 |
$this->page =& $page; |
| 6 |
} /* UpdatedPostsControl constructor */ |
| 7 |
|
| 8 |
function display () { |
| 9 |
$settings = array( |
| 10 |
// This is all bass-ackwards because the actual yes/no |
| 11 |
// setting is whether to *freeze* posts out of being |
| 12 |
// updated, not whether to *expose* it to being updated, |
| 13 |
// but in the UI we ask whether the user wants to |
| 14 |
// *expose* it. I have my reasons. Stop judging me! |
| 15 |
'no' => __('Yes, update the syndicated copy to match'), |
| 16 |
'yes' => __('No, leave the syndicated copy unmodified'), |
| 17 |
); |
| 18 |
$params = array( |
| 19 |
'setting-default' => 'default', |
| 20 |
'global-setting-default' => 'no', |
| 21 |
'labels' => array('yes' => 'leave unmodified', 'no' => 'update to match'), |
| 22 |
'default-input-value' => 'default', |
| 23 |
); |
| 24 |
|
| 25 |
if ($this->page->for_feed_settings()) : |
| 26 |
$aFeed = 'this feed'; |
| 27 |
else : |
| 28 |
$aFeed = 'a syndicated feed'; |
| 29 |
endif; |
| 30 |
?> |
| 31 |
<tr> |
| 32 |
<th scope="row"><?php _e('Updated posts:') ?></th> |
| 33 |
<td><p>When <?php print $aFeed; ?> includes updated content for |
| 34 |
a post that was already syndicated, should the syndicated copy |
| 35 |
of the post be updated to match the revised version?</p> |
| 36 |
|
| 37 |
<?php |
| 38 |
$this->page->setting_radio_control( |
| 39 |
'freeze updates', 'freeze_updates', |
| 40 |
$settings, $params |
| 41 |
); |
| 42 |
?> |
| 43 |
|
| 44 |
</td></tr> |
| 45 |
<?php |
| 46 |
} /* UpdatedPostsControl::display() */ |
| 47 |
|
| 48 |
function accept_POST ($post) { |
| 49 |
if ($this->page->for_feed_settings()) : |
| 50 |
if (isset($post['freeze_updates'])) : |
| 51 |
$this->page->link->settings['freeze updates'] = $post['freeze_updates']; |
| 52 |
endif; |
| 53 |
else : |
| 54 |
// Updated posts |
| 55 |
if (isset($post['freeze_updates'])) : |
| 56 |
update_option('feedwordpress_freeze_updates', $post['freeze_updates']); |
| 57 |
endif; |
| 58 |
endif; |
| 59 |
} /* UpdatedPostsControl::accept_POST() */ |
| 60 |
} /* class UpdatedPostsControl */ |
| 61 |
|
| 62 |
|
| 63 |
|