function __construct($settings = null)
{
// Don't re-fetch settings if they've been previously obtained.
// However, this class may be used within themes and therefore may
// need to get it's own settings.
if (!empty($settings)) {
$this->settings = $settings;
} else {
$admin_settings = new Admin_Apple_Settings();
$this->settings = $admin_settings->fetch_settings();
}
// Register update hooks if needed
if ('yes' == $settings->get('api_autosync') || 'yes' == $settings->get('api_autosync_update')) {
// This needs to happen after meta boxes save
add_action('save_post', array($this, 'do_publish'), 99, 2);
add_action('before_delete_post', array($this, 'do_delete'));
}
}