public function load()
    {
        $this->api = new API_Wrapper($this);
        $module_url = $this->get_module_url();
        $user = null;
        $selected_role = $this->get_module_option('adn_contributor_filter_role');
        $selected_group = $this->get_module_option('adn_contributor_filter_group');
        add_action('podlove_module_was_activated_app_dot_net', array($this, 'was_activated'));
        add_action('wp_ajax_podlove-refresh-channel', array($this, 'ajax_refresh_channel'));
        add_action('wp_ajax_podlove-adn-post', array($this, 'ajax_post_to_adn'));
        add_action('wp_ajax_podlove-preview-adn-post', array($this, 'ajax_preview_alpha_post'));
        if ($this->get_module_option('adn_auth_key') !== "") {
            add_action('publish_podcast', array($this, 'post_to_adn_handler'));
            add_action('publish_future_podcast', array($this, 'post_to_adn_handler'));
            add_action('delayed_adn_post', array($this, 'post_to_adn'), 10, 2);
        }
        if (isset($_GET["page"]) && $_GET["page"] == "podlove_settings_modules_handle") {
            add_action('admin_bar_init', array($this, 'reset_adn_auth'));
        }
        // Import all posts as already published
        add_filter('wp_import_post_meta', function ($postmetas, $post_id, $post) {
            $postmetas[] = array('key' => '_podlove_episode_was_published', 'value' => true);
            return $postmetas;
        }, 10, 3);
        if ($this->get_module_option('adn_auth_key') == "") {
            $description = '<i class="podlove-icon-remove"></i> ' . __('You need to allow Podlove Publisher to access your App.net account. To do so please start the authorization process, follow the instructions and paste the obtained code in the field above.', 'podlove') . '<br><a href="https://auth.podlove.org/adn.php?step=1" class="button button-primary" target="_blank">' . __('Start authorization process now', 'podlove') . '</a>';
            $this->register_option('adn_auth_key', 'string', array('label' => __('Authorization', 'podlove'), 'description' => $description, 'html' => array('class' => 'regular-text podlove-check-input', 'placeholder' => 'App.net authentication code')));
        } else {
            if ($user = $this->api->fetch_authorized_user()) {
                $description = '<i class="podlove-icon-ok"></i> ' . sprintf(__('You are logged in as %s. If you want to logout, click %shere%s.', 'podlove'), '<strong>' . $user->username . '</strong>', '<a href="' . admin_url('admin.php?page=podlove_settings_modules_handle&reset_appnet_auth_code=1') . '">', '</a>');
            } else {
                $description = '<i class="podlove-icon-remove"></i> ' . sprintf(__('Something went wrong with the App.net connection. Please start the authorization process again. To do so click %shere%s', 'podlove'), '<a href="' . admin_url('admin.php?page=podlove_settings_modules_handle&reset_appnet_auth_code=1') . '">', '</a>');
            }
            $this->register_option('adn_auth_key', 'hidden', array('label' => __('Authorization', 'podlove'), 'description' => $description, 'html' => array('class' => 'regular-text podlove-check-input')));
            $this->register_option('adn_language_annotation', 'select', array('label' => __('Language of Announcement', 'podlove'), 'description' => 'Selecting the language of the Announcement, will include an <a href="http://developers.app.net/docs/meta/annotations/" target="_blank">App.net language annotation</a>.', 'html' => array('class' => 'regular-text adn-dropdown'), 'options' => $this->get_languages()));
            $this->register_option('adn_patter_room_announcement', 'checkbox', array('label' => __('Patter', 'podlove'), 'description' => 'Post announcement to Patter room, too.'));
            $this->register_option('adn_patter_room', 'select', array('description' => '<span class="podlove_adn_patter_refresh" data-category="patter_room"><i class="podlove-icon-repeat"></i></span>From the list of subscribed <a href="http://patter-app.net/faq.html" target="_blank">Patter rooms</a>, choose the one related to your Podcast.', 'html' => array('class' => 'regular-text adn-dropdown'), 'options' => $this->api->fetch_patter_rooms()));
            $this->register_option('adn_broadcast', 'checkbox', array('label' => __('Broadcast', 'podlove'), 'description' => 'Send announcement via App.net Broadcast Channel.'));
            $this->register_option('adn_broadcast_channel', 'select', array('description' => '<span class="podlove_adn_broadcast_refresh" data-category="broadcast_channel"><i class="podlove-icon-repeat"></i></span> From the list of your Broadcast channels, choose the one related to your Podcast.', 'html' => array('class' => 'regular-text adn-dropdown'), 'options' => $this->api->fetch_broadcast_channels()));
            $this->register_option('adn_automatic_announcement', 'checkbox', array('label' => __('Automatic Announcement', 'podlove'), 'description' => 'Announces new podcast episodes on App.net'));
            $adn_post_delay_hours = str_pad($this->get_module_option('adn_post_delay_hours'), 2, 0, STR_PAD_LEFT);
            $adn_post_delay_minutes = str_pad($this->get_module_option('adn_post_delay_minutes'), 2, 0, STR_PAD_LEFT);
            $this->register_option('adn_post_delay', 'callback', array('label' => __('Post delay', 'podlove'), 'callback' => function () use($adn_post_delay_hours, $adn_post_delay_minutes) {
                ?>
							<input type="text" name="podlove_module_app_dot_net[adn_post_delay_hours]" id="podlove_module_app_dot_net_adn_post_delay_hours" value="<?php 
                echo $adn_post_delay_hours ? $adn_post_delay_hours : '';
                ?>
" class="regular-text podlove-check-input" placeholder="00" >
								<label for="podlove_module_app_dot_net_adn_post_delay_hours">Hours</label>
							<input type="text" name="podlove_module_app_dot_net[adn_post_delay_minutes]" id="podlove_module_app_dot_net_adn_post_delay_minutes" value="<?php 
                echo $adn_post_delay_minutes ? $adn_post_delay_minutes : '';
                ?>
" class="regular-text podlove-check-input" placeholder="00" >
								<label for="podlove_module_app_dot_net_adn_post_delay_minutes">Minutes</label>
						<?php 
            }));
            $description = '';
            if ($this->get_module_option('adn_poster_announcement_text') == "") {
                $description = '<i class="podlove-icon-remove"></i>' . __('You need to set a text to announce new episodes.', 'podlove');
            }
            $description .= __('App.net allows 256 characters per post. Try to keep the announcement text short. Your episode titles will need more space than the placeholders.', 'podlove');
            $description .= '
					' . __('Use these placeholders to customize your announcement', 'podlove') . ':
					<code title="' . __('The title of your podcast', 'podlove') . '">{podcastTitle}</code>
					<code title="' . __('The title of your episode, linking to it', 'podlove') . '">{linkedEpisodeTitle}</code>
					<code title="' . __('The title of the episode', 'podlove') . '">{episodeTitle}</code>
					<code title="' . __('The permalink of the current episode', 'podlove') . '">{episodeLink}</code>
					<code title="' . __('The subtitle of the episode', 'podlove') . '">{episodeSubtitle}</code>';
            $preview_text = $this->get_module_option('adn_poster_announcement_text');
            $this->register_option('adn_poster_announcement_text', 'callback', array('label' => __('Announcement text', 'podlove'), 'callback' => function () use($description, $preview_text) {
                $description = apply_filters('podlove_adn_tags_description', $description);
                ?>
							<div>		
								<textarea name="podlove_module_app_dot_net[adn_poster_announcement_text]" class"podlove-check-input" id="podlove_module_app_dot_net_adn_poster_announcement_text" cols="50" rows="4" placeholder="Check out the new {podcastTitle} episode: {linkedEpisodeTitle}"><?php 
                echo $preview_text;
                ?>
</textarea>
							</div>
							<span class="description"><?php 
                echo $description;
                ?>
</span>
						<?php 
            }));
            $this->register_option('adn_poster_image_fallback', 'checkbox', array('label' => __('Announcement Image', 'podlove'), 'description' => 'Use Podcast Cover as Fallback'));
            $this->register_option('adn_preview', 'callback', array('label' => __('Announcement preview', 'podlove'), 'callback' => function () use($selected_role, $selected_group, $user, $module_url) {
                if (!$user) {
                    return;
                }
                $podcast = Model\Podcast::get();
                if ($episode = Model\Episode::find_one_by_where('slug IS NOT NULL')) {
                    $example_data = array('episode' => get_the_title($episode->post_id), 'episode-link' => get_permalink($episode->post_id), 'subtitle' => $episode->subtitle, 'episode-image' => $episode->cover_art() ? $episode->cover_art()->url() : '', 'podcast-image' => $podcast->cover_art()->url(), 'contributors' => '');
                    $example_data = apply_filters('podlove_adn_example_data', $example_data, $episode->post_id, $selected_role, $selected_group);
                } else {
                    $example_data = array('episode' => 'My Example Episode', 'episode-link' => 'http://www.example.com/episode/001', 'subtitle' => 'My Example Subtitle', 'contributors' => '@example @elpmaxe', 'podcast-image' => '', 'episode-image' => '');
                }
                ?>
						<div id="podlove_adn_post_preview"
								data-podcast="<?php 
                echo $podcast->title;
                ?>
"
								data-episode="<?php 
                echo $example_data['episode'];
                ?>
"
								data-episode-link="<?php 
                echo $example_data['episode-link'];
                ?>
"
								data-episode-subtitle="<?php 
                echo $example_data['subtitle'];
                ?>
"
								data-contributors="<?php 
                echo $example_data['contributors'];
                ?>
"
								data-episode-image="<?php 
                echo $example_data['episode-image'];
                ?>
"
								data-podcast-image="<?php 
                echo $example_data['podcast-image'];
                ?>
">
							<div class="adn avatar" style="background-image:url(<?php 
                echo $user->avatar_image->url;
                ?>
);"></div>
							<div class="adn content">
								<div class="adn image"><img src="" /></div>
								<div class="adn username"><?php 
                echo $user->username;
                ?>
</div>
								<div class="adn body">Lorem ipsum dolor ...</div>
						
								<div class="adn footer">
									<ul>
										<li>
											<i class="podlove-icon-time"></i> now
										</li>
										<li>
											<i class="podlove-icon-reply"></i> Reply
										</li>
										<li>
											<i class="podlove-icon-share"></i> via Podlove Publisher
										</li>
									</ul>
								</div>
							</div>

							<div style="clear: both"></div>
						</div>

						<script type="text/javascript" src="<?php 
                echo $module_url;
                ?>
/adn.js"></script>
						<link rel="stylesheet" type="text/css" href="<?php 
                echo $module_url;
                ?>
/adn.css" />
						<?php 
            }));
            $this->register_option('adn_manual_post', 'callback', array('label' => __('Manual Announcement', 'podlove'), 'callback' => function () {
                ?>
							<select id="adn_manual_post_episode_selector" class="chosen">
								<?php 
                $episodes = Model\Episode::find_all_by_time();
                foreach ($episodes as $episode) {
                    $post = get_post($episode->post_id);
                    echo "<option value='" . $episode->post_id . "'>" . $post->post_title . "</option>";
                }
                ?>
							</select>
							<span class="button" id="adn_manual_post_alpha">
								Announce, as configured 
								<span class="adn-post-status-pending">
									<i class="podlove-icon-spinner rotate"></i>
								</span>
								<span class="adn-post-status-ok">
									<i class="podlove-icon-ok"></i>
								</span>
							</span>
						<?php 
            }));
        }
    }