public function register_page()
    {
        $podcast = \Podlove\Model\Podcast::get();
        $form_attributes = array('context' => 'podlove_podcast', 'action' => $this->get_url());
        ?>
		<p>
			<?php 
        echo __('You may provide additional information about your podcast that may or may not be used by podcast directories like iTunes.', 'podlove');
        ?>
		</p>
		<?php 
        \Podlove\Form\build_for($podcast, $form_attributes, function ($form) {
            $wrapper = new \Podlove\Form\Input\TableWrapper($form);
            $podcast = $form->object;
            $wrapper->string('author_name', array('label' => __('Author Name', 'podlove'), 'description' => __('Publicly displayed in Podcast directories.', 'podlove'), 'html' => array('class' => 'regular-text podlove-check-input')));
            $wrapper->string('publisher_name', array('label' => __('Publisher Name', 'podlove'), 'description' => __('', 'podlove'), 'html' => array('class' => 'regular-text podlove-check-input')));
            $wrapper->string('publisher_url', array('label' => __('Publisher URL', 'podlove'), 'description' => __('', 'podlove'), 'html' => array('class' => 'regular-text podlove-check-input', 'data-podlove-input-type' => 'url')));
            $wrapper->string('owner_name', array('label' => __('Owner Name', 'podlove'), 'description' => __('Used by iTunes and other Podcast directories to contact you.', 'podlove'), 'html' => array('class' => 'regular-text podlove-check-input')));
            $wrapper->string('owner_email', array('label' => __('Owner Email', 'podlove'), 'description' => __('Used by iTunes and other Podcast directories to contact you.', 'podlove'), 'html' => array('class' => 'regular-text podlove-check-input', 'data-podlove-input-type' => 'email')));
            $wrapper->string('keywords', array('label' => __('Keywords', 'podlove'), 'description' => __('List of keywords. Separate with commas.', 'podlove'), 'html' => array('class' => 'regular-text podlove-check-input')));
            $wrapper->select('category_1', array('label' => __('iTunes Categories', 'podlove'), 'description' => '', 'type' => 'select', 'options' => \Podlove\Itunes\categories()));
            $wrapper->select('category_2', array('label' => '', 'description' => '', 'type' => 'select', 'options' => \Podlove\Itunes\categories()));
            $wrapper->select('category_3', array('label' => '', 'description' => '<br>' . __('For placement within the older, text-based browse system, podcast feeds may list up to 3 category/subcategory pairs. (For example, "Music" counts as 1, as does "Business > Careers.") For placement within the newer browse system based on Category links, however, and for placement within the Top Podcasts and Top Episodes lists that appear in the right column of most podcast pages, only the first category listed in the feed is used.') . ' (<a href="http://www.apple.com/itunes/podcasts/specs.html#category" target="_blank">http://www.apple.com/itunes/podcasts/specs.html#category</a>)', 'options' => \Podlove\Itunes\categories()));
            $wrapper->select('explicit', array('label' => __('Explicit Content?', 'podlove'), 'description' => __('', 'podlove'), 'type' => 'checkbox', 'options' => array(0 => 'no', 1 => 'yes', 2 => 'clean')));
            $wrapper->checkbox('complete', array('label' => __('Podcast complete?', 'podlove'), 'description' => __('Shows that this Podcast is finished and no further episodes will be added.', 'podlove'), 'default' => false));
        });
    }
예제 #2
0
    /**
     * Meta Box Template
     */
    public static function post_type_meta_box_callback($post)
    {
        $post_id = $post->ID;
        $podcast = Model\Podcast::get_instance();
        $episode = Model\Episode::find_or_create_by_post_id($post_id);
        wp_nonce_field(\Podlove\PLUGIN_FILE, 'podlove_noncename');
        ?>
		<input type="hidden" name="show-media-file-base-uri" value="<?php 
        echo $podcast->media_file_base_uri;
        ?>
" />
		<table class="form-table">
			<?php 
        $form_args = array('context' => '_podlove_meta', 'submit_button' => false, 'form' => false);
        \Podlove\Form\build_for($episode, $form_args, function ($form) use($podcast) {
            $wrapper = new \Podlove\Form\Input\TableWrapper($form);
            $episode = $form->object;
            $wrapper->checkbox('active', array('label' => __('Post Episode to Show', 'podlove'), 'description' => '', 'default' => true));
            $wrapper->string('slug', array('label' => __('Episode Media File Slug', 'podlove'), 'description' => '', 'html' => array('class' => 'regular-text')));
            // TODO: validate and parse
            $wrapper->string('duration', array('label' => __('Duration', 'podlove'), 'description' => '', 'html' => array('class' => 'regular-text')));
            $wrapper->string('subtitle', array('label' => __('Subtitle', 'podlove'), 'description' => '', 'html' => array('class' => 'large-text')));
            $wrapper->text('summary', array('label' => __('Summary', 'podlove'), 'description' => '', 'html' => array('class' => 'large-text', 'rows' => max(2, count(explode("\n", $episode->summary))))));
            if ($podcast->supports_cover_art === 'manual') {
                $wrapper->string('cover_art', array('label' => __('Episode Cover Art URL', 'podlove'), 'description' => __('JPEG or PNG. At least 1400 x 1400 pixels.', 'podlove'), 'html' => array('class' => 'regular-text')));
            }
            $wrapper->text('chapters', array('label' => __('Chapter Marks', 'podlove'), 'description' => __('One timepoint (hh:mm:ss[.mmm]) and the chapter title per line.', 'podlove'), 'html' => array('class' => 'large-text code', 'placeholder' => '00:00:00.000 Intro', 'rows' => max(2, count(explode("\n", $episode->chapters))))));
            $wrapper->checkbox('enable', array('label' => __('Enable?', 'podlove'), 'description' => __('Allow this episode to appear in podcast directories.', 'podlove'), 'default' => true));
            // TODO: button to update
            // TODO: pretty display
            // TODO: don't display link
            // TODO: display last modified from header
            $wrapper->multiselect('episode_assets', Podcast_Post_Meta_Box::episode_assets_form($episode));
        });
        ?>
		</table>
		<?php 
    }
예제 #3
0
파일: feed.php 프로젝트: rthees/podlove
 private function form_template($feed, $action, $button_text = NULL)
 {
     $form_args = array('context' => 'podlove_feed', 'hidden' => array('feed' => $feed->id, 'action' => $action));
     \Podlove\Form\build_for($feed, $form_args, function ($form) {
         $wrapper = new \Podlove\Form\Input\TableWrapper($form);
         $feed = $form->object;
         $episode_assets = \Podlove\Model\EpisodeAsset::all();
         $assets = array();
         foreach ($episode_assets as $asset) {
             $assets[$asset->id] = $asset->title;
         }
         $wrapper->string('name', array('label' => __('Feed Title', 'podlove'), 'description' => __('Some podcast clients may display this title to describe the feed content.', 'podlove'), 'html' => array('class' => 'regular-text required')));
         $wrapper->checkbox('discoverable', array('label' => __('Discoverable?', 'podlove'), 'description' => __('Embed a meta tag into the head of your site so browsers and feed readers will find the link to the feed.', 'podlove'), 'default' => true));
         // TODO: update url
         $wrapper->string('slug', array('label' => __('Slug', 'podlove'), 'description' => $feed ? sprintf(__('Feed identifier. URL: %s', 'podlove'), $feed->get_subscribe_url()) : '', 'html' => array('class' => 'regular-text required')));
         $wrapper->radio('format', array('label' => __('Format', 'podlove'), 'options' => array('rss' => 'RSS', 'atom' => 'Atom'), 'default' => 'rss'));
         $wrapper->select('episode_asset_id', array('label' => __('Episode Media File', 'podlove'), 'options' => $assets, 'html' => array('class' => 'required')));
         $wrapper->string('itunes_feed_id', array('label' => __('iTunes Feed ID', 'podlove'), 'description' => __('Is used to generate a link to the iTunes directory.', 'podlove'), 'html' => array('class' => 'regular-text')));
         // todo: add PING url; see feedburner doc
         $wrapper->string('redirect_url', array('label' => __('Redirect Url', 'podlove'), 'description' => __('e.g. Feedburner URL', 'podlove'), 'html' => array('class' => 'regular-text')));
         $wrapper->checkbox('enable', array('label' => __('Allow Submission to Directories', 'podlove'), 'description' => __('Allow this feed to appear in podcast directories.', 'podlove'), 'default' => true));
         // TODO: choose description format: empty, simple, full-force
         $wrapper->checkbox('show_description', array('label' => __('Include Description?', 'podlove'), 'description' => __('You may want to hide the episode descriptions to reduce the feed file size.', 'podlove'), 'default' => true));
         // todo include summary?
         $wrapper->string('limit_items', array('label' => __('Limit Items', 'podlove'), 'description' => __('A feed only displays the most recent episodes. Define the amount. Leave empty to use the WordPress default.', 'podlove'), 'html' => array('class' => 'regular-text')));
     });
 }
    private function form_template($episode_asset, $action, $button_text = NULL)
    {
        $raw_formats = \Podlove\Model\FileType::all();
        $formats = array();
        foreach ($raw_formats as $format) {
            $formats[$format->id] = array('title' => $format->title(), 'name' => $format->name, 'extension' => $format->extension, 'type' => $format->type);
        }
        $format_optionlist = array_map(function ($f) {
            return array('value' => $f['title'], 'attributes' => 'data-type="' . $f['type'] . '" data-extension="' . $f['extension'] . '" data-name="' . $f['name'] . '"');
        }, $formats);
        $form_args = array('context' => 'podlove_episode_asset', 'hidden' => array('episode_asset' => $episode_asset->id, 'action' => $action), 'attributes' => array('id' => 'podlove_episode_assets'), 'submit_button' => false, 'form_end' => function () {
            echo "<p>";
            submit_button(__('Save Changes'), 'primary', 'submit', false);
            echo " ";
            submit_button(__('Save Changes and Continue Editing', 'podlove'), 'secondary', 'submit_and_stay', false);
            echo "</p>";
        });
        \Podlove\Form\build_for($episode_asset, $form_args, function ($form) use($format_optionlist) {
            $f = new \Podlove\Form\Input\TableWrapper($form);
            if ($form->object->file_type_id) {
                $current_file_type = Model\FileType::find_by_id($form->object->file_type_id)->type;
            } else {
                $current_file_type = '';
            }
            ?>
			<tr class="row_podlove_episode_asset_type">
				<th scope="row" valign="top">
					<label for="podlove_episode_asset_type"><?php 
            echo __('Asset Type', 'podlove');
            ?>
</label>
				</th>
				<td>
					<select name="podlove_episode_asset_type" id="podlove_episode_asset_type">
						<option><?php 
            echo __('Please choose ...', 'podlove');
            ?>
</option>
						<?php 
            foreach (Model\FileType::get_types() as $type) {
                ?>
							<option value="<?php 
                echo $type;
                ?>
" <?php 
                selected($type, $current_file_type);
                ?>
><?php 
                echo $type;
                ?>
</option>	
						<?php 
            }
            ?>
					</select>
					<div id="option_storage" style="display:none"></div>
				</td>
			</tr>
			<?php 
            $f->select('file_type_id', array('label' => __('File Format', 'podlove'), 'description' => __('', 'podlove'), 'options' => $format_optionlist));
            $f->string('title', array('label' => __('Title', 'podlove'), 'description' => __('Description to identify the media file type to the user in download buttons.', 'podlove'), 'html' => array('class' => 'regular-text required podlove-check-input')));
            $f->checkbox('downloadable', array('label' => __('Downloadable', 'podlove'), 'description' => sprintf('Allow downloads for users.', 'podlove'), 'default' => true));
            ?>
			<tr>
				<th colspan="2">
					<h3><?php 
            echo __('Asset File Name', 'podlove');
            ?>
</h3>
				</th>
			</tr>
			<?php 
            $f->string('suffix', array('label' => __('File Name Suffix', 'podlove'), 'description' => __('Optional. Is appended to file name after episode slug.', 'podlove'), 'html' => array('class' => 'regular-text required podlove-check-input')));
            ?>
			<tr class="row_podlove_asset_url_preview">
				<th>
					<?php 
            echo __('URL Preview', 'podlove');
            ?>
				</th>
				<td>
					<div id="url_preview" style="font-size: 1.5em"></div>
					<div id="url_template" style="display: none;"><?php 
            echo Model\Podcast::get()->get_url_template();
            ?>
</div>
				</td>
			</tr>
			<?php 
        });
        // hidden fields for JavaScript
        ?>
		<input type="hidden" id="podlove_show_media_file_base_uri" value="<?php 
        echo Model\Podcast::get()->media_file_base_uri;
        ?>
">
		<?php 
    }
예제 #5
0
    private function form_template($episode_asset, $action, $button_text = NULL)
    {
        $raw_formats = \Podlove\Model\FileType::all();
        $formats = array();
        foreach ($raw_formats as $format) {
            $formats[$format->id] = array('title' => $format->title(), 'extension' => $format->extension);
        }
        $format_optionlist = array_map(function ($f) {
            return $f['title'];
        }, $formats);
        $form_args = array('context' => 'podlove_episode_asset', 'hidden' => array('episode_asset' => $episode_asset->id, 'action' => $action), 'attributes' => array('id' => 'podlove_episode_assets'));
        \Podlove\Form\build_for($episode_asset, $form_args, function ($form) use($format_optionlist) {
            $f = new \Podlove\Form\Input\TableWrapper($form);
            $f->select('file_type_id', array('label' => __('File Format', 'podlove'), 'description' => __('', 'podlove'), 'options' => $format_optionlist));
            $f->string('title', array('label' => __('Title', 'podlove'), 'description' => __('Description to identify the media file type to the user in download buttons.', 'podlove'), 'html' => array('class' => 'regular-text required')));
            $f->string('url_template', array('label' => __('URL Template', 'podlove'), 'description' => sprintf(__('Preview: %s'), '<span class="url_template_preview"></span><br/>', 'podlove'), 'html' => array('class' => 'large-text required'), 'default' => '%media_file_base_url%%episode_slug%.%format_extension%'));
            $f->checkbox('downloadable', array('label' => __('Downloadable', 'podlove'), 'description' => sprintf('Allow downloads for users.', 'podlove'), 'default' => true));
        });
        // hidden fields for JavaScript
        ?>
		<input type="hidden" id="podlove_show_media_file_base_uri" value="<?php 
        echo Model\Podcast::get_instance()->media_file_base_uri;
        ?>
">
		<?php 
    }
예제 #6
0
 private function form_template($feed, $action, $button_text = NULL)
 {
     $form_args = array('context' => 'podlove_feed', 'hidden' => array('feed' => $feed->id, 'action' => $action), 'submit_button' => false, 'form_end' => function () {
         echo "<p>";
         submit_button(__('Save Changes'), 'primary', 'submit', false);
         echo " ";
         submit_button(__('Save Changes and Continue Editing', 'podlove'), 'secondary', 'submit_and_stay', false);
         echo "</p>";
     });
     \Podlove\Form\build_for($feed, $form_args, function ($form) {
         $wrapper = new \Podlove\Form\Input\TableWrapper($form);
         $feed = $form->object;
         $podcast = \Podlove\Model\Podcast::get();
         $episode_assets = \Podlove\Model\EpisodeAsset::all();
         $assets = array();
         foreach ($episode_assets as $asset) {
             $assets[$asset->id] = $asset->title;
         }
         $wrapper->subheader(__('Basic Settings', 'podlove'));
         $wrapper->select('episode_asset_id', array('label' => __('Episode Media File', 'podlove') . \Podlove\get_help_link('podlove_help_feed_asset'), 'options' => $assets, 'html' => array('class' => 'required')));
         $wrapper->string('name', array('label' => __('Feed Name', 'podlove'), 'description' => __('Some podcast clients may display this title to describe the feed content.', 'podlove'), 'html' => array('class' => 'regular-text required podlove-check-input')));
         $wrapper->checkbox('append_name_to_podcast_title', array('label' => __('Append Feed Name to Podcast title', 'podlove'), 'description' => sprintf(__('Structure of the feed title. Preview: %s', 'podlove'), $podcast->title . '<span id="feed_title_preview_append"></span>'), 'default' => false));
         $wrapper->string('slug', array('label' => __('Slug', 'podlove') . \Podlove\get_help_link('podlove_help_feed_slug'), 'description' => $feed ? sprintf(__('Feed identifier. URL Preview: %s', 'podlove'), '<span id="feed_subscribe_url_preview">' . $feed->get_subscribe_url() . '</span>') : '', 'html' => array('class' => 'regular-text required podlove-check-input')));
         $wrapper->checkbox('discoverable', array('label' => __('Discoverable?', 'podlove'), 'description' => __('Embed a meta tag into the head of your site so browsers and feed readers will find the link to the feed.', 'podlove'), 'default' => true));
         $wrapper->checkbox('embed_content_encoded', array('label' => __('Include HTML Content', 'podlove'), 'description' => __('Include episode show notes in the feed.', 'podlove'), 'default' => false));
         $wrapper->subheader(__('Directory Settings', 'podlove'));
         $wrapper->checkbox('enable', array('label' => __('Allow Submission to Directories', 'podlove'), 'description' => __('Allow this feed to appear in podcast directories.', 'podlove'), 'default' => true));
         do_action('podlove_feeds_directories', $wrapper);
         $wrapper->string('itunes_feed_id', array('label' => __('iTunes Feed ID', 'podlove'), 'description' => __('Is used to generate a link to the iTunes directory.', 'podlove') . ($feed->itunes_feed_id ? ' <a href="http://itunes.apple.com/podcast/id' . $feed->itunes_feed_id . '" target="_blank">' . __('Open in iTunes directory') . '</a>' : ''), 'html' => array('class' => 'regular-text podlove-check-input')));
         $wrapper->subheader(__('Advanced Settings', 'podlove'));
         $wrapper->select('redirect_http_status', array('label' => __('Redirect Method', 'podlove'), 'description' => __('', 'podlove'), 'options' => array('0' => 'Don\'t redirect', '307' => 'Temporary Redirect (HTTP Status 307)', '301' => 'Permanent Redirect (HTTP Status 301)'), 'default' => 0, 'please_choose' => false));
         $wrapper->string('redirect_url', array('label' => __('Redirect Url', 'podlove'), 'description' => __('e.g. Feedburner URL', 'podlove'), 'html' => array('class' => 'regular-text podlove-check-input', 'data-podlove-input-type' => 'url')));
         $podcast_settings = get_option('podlove_podcast');
         if ($podcast_settings['limit_items'] < 0) {
             $limit_default = 'No limit';
         } else {
             $limit_default = $podcast_settings['limit_items'];
         }
         $limit_options = array('-2' => __("Use Podlove default (" . $limit_default . ")", 'podlove'), '-1' => __("No limit. Include all items.", 'podlove'), '0' => __('Use WordPress Default', 'podlove') . ' (' . get_option('posts_per_rss') . ')');
         for ($i = 1; $i * 5 <= 100; $i++) {
             $limit_options[$i * 5] = $i * 5;
         }
         $wrapper->select('limit_items', array('label' => __('Limit Items', 'podlove'), 'description' => __('If you have a lot of episodes, you might want to restrict the feed size.', 'podlove'), 'options' => $limit_options, 'please_choose' => false, 'default' => '-2'));
         $wrapper->subheader(__('Protection', 'podlove'));
         $wrapper->checkbox('protected', array('label' => __('Protect feed ', 'podlove'), 'description' => __('The feed will be protected by HTTP Basic Authentication.', 'podlove'), 'default' => false));
         $wrapper->select('protection_type', array('label' => __('Method', 'podlove'), 'description' => __('', 'podlove'), 'options' => array('0' => 'Custom Login', '1' => 'WordPress User database'), 'default' => -1, 'please_choose' => true));
         $wrapper->string('protection_user', array('label' => __('Username', 'podlove'), 'description' => '', 'html' => array('class' => 'regular-text required')));
         $wrapper->string('protection_password', array('label' => __('Password', 'podlove'), 'description' => '', 'html' => array('class' => 'regular-text required')));
         do_action('podlove_feed_settings_bottom', $wrapper);
     });
 }