dispatch = 'feedwordpress_posts_settings';
$this->filename = __FILE__;
} /* FeedWordPressPostsPage constructor */
/**
* Outputs "Publication" settings box.
*
* @since 2009.0713
* @param object $page of class FeedWordPressPostsPage tells us whether this is
* a page for one feed's settings or for global defaults
* @param array $box
*
* @uses FeedWordPressPostsPage::these_posts_phrase()
* @uses FeedWordPress::syndicated_status()
* @uses SyndicatedLink::syndicated_status()
* @uses SyndicatedPost::use_api()
* @uses fwp_option_box_opener()
* @uses fwp_option_box_closer()
*/
/*static*/ function publication_box ($page, $box = NULL) {
global $fwp_path;
$post_status_global = FeedWordPress::syndicated_status('post', /*default=*/ 'publish');
$thesePosts = $page->these_posts_phrase();
// Set up array for selector
$setting = array(
'publish' => array ('label' => "Publish %s immediately", 'checked' => ''),
'draft' => array('label' => "Save %s as drafts", 'checked' => ''),
'private' => array('label' => "Save %s as private posts", 'checked' => ''),
);
if (SyndicatedPost::use_api('post_status_pending')) :
$setting['pending'] = array('label' => "Hold %s for review; mark as Pending", 'checked' => '');
endif;
if ($page->for_feed_settings()) :
$href = $fwp_path.'/'.basename(__FILE__);
$currently = str_replace('%s', '', strtolower(strtok($setting[$post_status_global]['label'], ';')));
$setting['site-default'] = array('label' => "Use site-wide setting", 'checked' => '');
$setting['site-default']['label'] .= " (currently: ${currently})";
$checked = $page->link->syndicated_status('post', 'site-default', /*fallback=*/ false);
else :
$checked = $post_status_global;
endif;
// Re-order appropriately
$selector = array();
$order = array(
'site-default',
'publish',
'pending',
'draft',
'private',
);
foreach ($order as $line) :
if (isset($setting[$line])) :
$selector[$line] = $setting[$line];
endif;
endforeach;
$selector[$checked]['checked'] = ' checked="checked"';
// Hey ho, let's go...
?>
__('Publication'),
'formatting_box' => __('Formatting'),
'links_box' => __('Links'),
'comments_and_pings_box' => __('Comments & Pings'),
'custom_post_settings_box' => __('Custom Post Settings (to apply to each syndicated post)'),
);
// Feed-level settings don't exist for these.
if ($postsPage->for_feed_settings()) :
unset($boxes_by_methods['formatting_box']);
unset($boxes_by_methods['links_box']);
endif;
foreach ($boxes_by_methods as $method => $title) :
fwp_add_meta_box(
/*id=*/ 'feedwordpress_'.$method,
/*title=*/ $title,
/*callback=*/ array('FeedWordPressPostsPage', $method),
/*page=*/ $postsPage->meta_box_context(),
/*context=*/ $postsPage->meta_box_context()
);
endforeach;
do_action('feedwordpress_admin_page_posts_meta_boxes', $postsPage);
?>
meta_box_context(), $postsPage->meta_box_context(), $postsPage);
?>
close_sheet();
} /* function fwp_posts_page () */
fwp_posts_page();