public function scripts_and_styles()
 {
     // only on seasons settings pages
     if (filter_input(INPUT_GET, 'page') !== 'podlove_seasons_settings') {
         return;
     }
     wp_enqueue_style('podlove_seasons_admin_style', \Podlove\PLUGIN_URL . '/lib/modules/seasons/css/admin.css', false, \Podlove\get_plugin_header('Version'));
     wp_enqueue_script('podlove_seasons_admin_script', $this->get_module_url() . '/js/admin.js', ['jquery'], \Podlove\get_plugin_header('Version'));
 }
 public static function init()
 {
     add_action('admin_bar_menu', [__CLASS__, 'enhance_admin_bar'], 120);
     add_action('wp_enqueue_scripts', function () {
         if (is_admin_bar_showing()) {
             wp_enqueue_style('podlove-network-cover-style', admin_url('admin-ajax.php') . '?action=podlove-network-cover-style', [], \Podlove\get_plugin_header('Version'));
         }
     });
     add_action('wp_ajax_podlove-network-cover-style', [__CLASS__, 'print_styles']);
 }
Пример #3
0
 public function load()
 {
     add_action('wp', [$this, 'embed_player']);
     add_action('wp_enqueue_scripts', function () {
         wp_enqueue_script('podlove-player-moderator-script', plugins_url('js/podlove-web-moderator.min.js', __FILE__), [], \Podlove\get_plugin_header('Version'));
     });
     add_action('wp_print_footer_scripts', function () {
         echo '<script>jQuery("audio").podlovewebplayer();</script>';
     });
     // backward compatible, but only load if no other plugin has registered this shortcode
     if (!shortcode_exists('podlove-web-player')) {
         add_shortcode('podlove-web-player', [__CLASS__, 'shortcode']);
     }
     add_shortcode('podlove-episode-web-player', [__CLASS__, 'shortcode']);
 }
 public function scripts_and_styles()
 {
     if (!isset($_REQUEST['page'])) {
         return;
     }
     if ($_REQUEST['page'] != 'podlove_analytics') {
         return;
     }
     // libraries
     wp_register_script('podlove-d3-js', \Podlove\PLUGIN_URL . '/js/admin/d3.min.js');
     wp_register_script('podlove-crossfilter-js', \Podlove\PLUGIN_URL . '/js/admin/crossfilter.min.js');
     wp_register_script('podlove-dc-js', \Podlove\PLUGIN_URL . '/js/admin/dc.js', array('podlove-d3-js', 'podlove-crossfilter-js'));
     // application
     wp_register_script('podlove-analytics-common-js', \Podlove\PLUGIN_URL . '/js/analytics/common.js');
     wp_register_script('podlove-analytics-episode-js', \Podlove\PLUGIN_URL . '/js/analytics/episode.js', array('podlove-analytics-common-js', 'podlove-dc-js'));
     wp_register_script('podlove-analytics-totals-js', \Podlove\PLUGIN_URL . '/js/analytics/totals.js', array('podlove-analytics-common-js', 'podlove-dc-js'));
     if (isset($_GET['action']) && $_GET['action'] == 'show') {
         wp_enqueue_script('podlove-analytics-episode-js');
     } else {
         wp_enqueue_script('podlove-analytics-totals-js');
     }
     wp_register_style('podlove-dc-css', \Podlove\PLUGIN_URL . '/css/dc.css', array(), \Podlove\get_plugin_header('Version'));
     wp_enqueue_style('podlove-dc-css');
 }
    public static function right_now()
    {
        $podcasts = \Podlove\Modules\Networks\Model\Network::podcast_blog_ids();
        $number_of_podcasts = count($podcasts);
        if (!$number_of_podcasts) {
            echo __('No podcasts exist yet.', 'podlove');
            return;
        }
        $episodes_total = 0;
        $episodes_total_per_status = array('publish' => 0, 'private' => 0, 'future' => 0, 'draft' => 0);
        $episodes_total_length = 0;
        $episode_total_average_length = 0;
        $media_file_total_average_size = 0;
        $media_file_total_size = 0;
        $days_between_episodes = 0;
        foreach ($podcasts as $podcast) {
            switch_to_blog($podcast);
            $statistics = \Podlove\Settings\Dashboard\Statistics::prepare_statistics();
            $episodes_total += $statistics['total_number_of_episodes'];
            array_walk($statistics['episodes'], function ($posts, $type) use(&$episodes_total_per_status) {
                switch ($type) {
                    case 'publish':
                        $episodes_total_per_status['publish'] += $posts;
                        break;
                    case 'publish':
                        $episodes_total_per_status['private'] += $posts;
                        break;
                    case 'future':
                        $episodes_total_per_status['future'] += $posts;
                        break;
                    case 'draft':
                        $episodes_total_per_status['draft'] += $posts;
                        break;
                }
            });
            $episodes_total_length += $statistics['total_episode_length'];
            $episode_total_average_length += $statistics['average_episode_length'];
            $days_between_episodes += $statistics['days_between_releases'];
            $media_file_total_average_size += $statistics['average_media_file_size'];
            $media_file_total_size += $statistics['total_media_file_size'];
            restore_current_blog();
        }
        // Devide stats by number of Podcasts
        $episode_total_average_length /= $number_of_podcasts;
        $days_between_episodes /= $number_of_podcasts;
        $media_file_total_average_size /= $number_of_podcasts;
        ?>
		<div class="podlove-dashboard-statistics-wrapper">
			<h4>Episodes</h4>
			<table cellspacing="0" cellpadding="0" class="podlove-dashboard-statistics">
				<tr>
					<td class="podlove-dashboard-number-column">
						<?php 
        echo $episodes_total_per_status['publish'];
        ?>
					</td>
					<td>
						<span style="color: #2c6e36;"><?php 
        echo __('Published', 'podlove');
        ?>
</span>
					</td>
				</tr>
				<tr>
					<td class="podlove-dashboard-number-column">
						<?php 
        echo $episodes_total_per_status['private'];
        ?>
					</td>
					<td>
						<span style="color: #b43f56;"><?php 
        echo __('Private', 'podlove');
        ?>
</span>
					</td>
				</tr>
				<tr>
					<td class="podlove-dashboard-number-column">
						<?php 
        echo $episodes_total_per_status['future'];
        ?>
					</td>
					<td>
						<span style="color: #a8a8a8;"><?php 
        echo __('To be published', 'podlove');
        ?>
</span>
					</td>
				</tr>
				<tr>
					<td class="podlove-dashboard-number-column">
						<?php 
        echo $episodes_total_per_status['draft'];
        ?>
					</td>
					<td>
						<span style="color: #c0844c;"><?php 
        echo __('Drafts', 'podlove');
        ?>
</span>
					</td>
				</tr>
				<tr>
					<td class="podlove-dashboard-number-column podlove-dashboard-total-number">
						<?php 
        echo $episodes_total;
        ?>
					</td>
					<td class="podlove-dashboard-total-number">
						<?php 
        echo __('Total', 'podlove');
        ?>
					</td>
				</tr>
			</table>
		</div>
		<div class="podlove-dashboard-statistics-wrapper">
			<h4><?php 
        echo __('Statistics', 'podlove');
        ?>
</h4>
			<table cellspacing="0" cellpadding="0" class="podlove-dashboard-statistics">
				<tr>
					<td class="podlove-dashboard-number-column">
						<?php 
        echo gmdate("H:i:s", $episode_total_average_length);
        ?>
					</td>
					<td>
						<?php 
        echo __('is the average length of an episode', 'podlove');
        ?>
.
					</td>
				</tr>
				<tr>
					<td class="podlove-dashboard-number-column">
						<?php 
        $days = round($episodes_total_length / 3600 / 24, 1);
        echo sprintf(_n('%s day', '%s days', $days, 'podlove'), $days);
        ?>
					</td>
					<td>
						<?php 
        echo __('is the total playback time of all episodes', 'podlove');
        ?>
.
					</td>
				</tr>
				<tr>
					<td class="podlove-dashboard-number-column">
						<?php 
        echo \Podlove\format_bytes($media_file_total_average_size, 1);
        ?>
					</td>
					<td>
						<?php 
        echo __('is the average media file size', 'podlove');
        ?>
.
					</td>
				</tr>
				<tr>
					<td class="podlove-dashboard-number-column">
						<?php 
        echo \Podlove\format_bytes($media_file_total_size, 1);
        ?>
					</td>
					<td>
						<?php 
        echo __('is the total media file size', 'podlove');
        ?>
.
					</td>
				</tr>
				<tr>
					<td class="podlove-dashboard-number-column">
						<?php 
        echo sprintf(_n('%s day', '%s days', round($days_between_episodes), 'podlove'), round($days_between_episodes));
        ?>
					</td>
					<td>
						<?php 
        echo __('is the average interval until a new episode is released', 'podlove');
        ?>
.
					</td>
				</tr>
				<tr>
					<td class="podlove-dashboard-number-column">
						<?php 
        echo sprintf(_n('%s podcast', '%s podcasts', $number_of_podcasts, 'podlove'), $number_of_podcasts);
        ?>
					</td>
					<td>
						<?php 
        echo __('exist in your WordPress installation', 'podlove');
        ?>
.
					</td>
				</tr>
				<?php 
        do_action('podlove_dashboard_statistics_network');
        ?>
			</table>
		</div>
		<p>
			<?php 
        echo sprintf(__('You are using %s', 'podlove'), '<strong>Podlove Publisher ' . \Podlove\get_plugin_header('Version') . '</strong>');
        ?>
.
		</p>
		<?php 
    }
 public function admin_print_styles()
 {
     $screen = get_current_screen();
     if ($screen->base != 'post' && $screen->post_type != 'podcast' && $screen->base != 'podlove_page_podlove_settings_modules_handle') {
         return;
     }
     wp_register_style('podlove_auphonic_admin_style', $this->get_module_url() . '/admin.css', false, \Podlove\get_plugin_header('Version'));
     wp_enqueue_style('podlove_auphonic_admin_style');
     wp_register_script('podlove_auphonic_admin_script', $this->get_module_url() . '/admin.js', array('jquery', 'jquery-ui-tabs', 'podlove_admin'), \Podlove\get_plugin_header('Version'));
     wp_enqueue_script('podlove_auphonic_admin_script');
 }
Пример #7
0
 /**
  * Podlove User Agent for cURL requests.
  * 
  * @return string
  */
 public static function user_agent()
 {
     $curl_version = curl_version();
     return sprintf('PHP/%s (; ) cURL/%s(OpenSSL/%s; zlib/%s) Wordpress/%s (; ) %s/%s (; )', phpversion(), $curl_version['version'], $curl_version['ssl_version'], $curl_version['libz_version'], get_bloginfo('version'), \Podlove\get_plugin_header('Name'), \Podlove\get_plugin_header('Version'));
 }
 public function getXml()
 {
     $xml = new \SimpleXMLElement('<wpe:export/>', LIBXML_NOERROR | LIBXML_NOWARNING, false, 'wpe', true);
     // Double xmlns looks strange but is intentionally/required.
     // See http://stackoverflow.com/a/9391673/72448
     $xml->addAttribute('xmlns:xmlns:wpe', self::XML_NAMESPACE);
     $xml->addAttribute('version', '1.0');
     $xml->addAttribute('podlove-publisher-version', \Podlove\get_plugin_header('Version'));
     // add comments
     $comment = "\n\tExport Date: " . date('r');
     $comment .= "\n\t";
     $dom = dom_import_simplexml($xml);
     $commentElement = $dom->ownerDocument->createComment($comment);
     $dom->appendChild($commentElement);
     do_action('podlove_xml_export', $xml);
     // return formatted
     $dom = dom_import_simplexml($xml)->ownerDocument;
     $dom->formatOutput = true;
     return $dom->saveXML();
 }
			<td>
				<?php 
echo __('is the total media file size', 'podlove');
?>
.
			</td>
		</tr>
		<tr>
			<td class="podlove-dashboard-number-column">
				<?php 
echo sprintf(_n('%s day', '%s days', $statistics['days_between_releases'], 'podlove'), $statistics['days_between_releases']);
?>
			</td>
			<td>
				<?php 
echo __('is the average interval until a new episode is released', 'podlove');
?>
.
			</td>
		</tr>
		<?php 
do_action('podlove_dashboard_statistics');
?>
	</table>
</div>
<p>
	<?php 
echo sprintf(__('You are using %s', 'podlove'), '<strong>Podlove Publisher ' . \Podlove\get_plugin_header('Version') . '</strong>');
?>
.
</p>
 public function scripts_and_styles()
 {
     wp_register_style('podlove_network_admin_style', \Podlove\PLUGIN_URL . '/lib/modules/networks/css/admin.css', false, \Podlove\get_plugin_header('Version'));
     wp_enqueue_style('podlove_network_admin_style');
 }
Пример #11
0
 public function frontend_print_styles()
 {
     wp_register_script('podlove_bitlove_widget_script', $this->get_module_url() . '/js/widget.js', array(), \Podlove\get_plugin_header('Version'));
     wp_enqueue_script('podlove_bitlove_widget_script');
 }
 public function admin_print_styles()
 {
     wp_register_script('podlove_related_episodes', $this->get_module_url() . '/js/admin.js', array('jquery', 'podlove_admin_data_table'), \Podlove\get_plugin_header('Version'));
     wp_enqueue_script('podlove_related_episodes');
 }
 public function admin_print_styles()
 {
     wp_register_script('podlove_contributor_jquery_visible', $this->get_module_url() . '/js/jquery.visible.min.js', array('jquery', 'jquery-ui-tabs'), \Podlove\get_plugin_header('Version'));
     wp_enqueue_script('podlove_contributor_jquery_visible');
 }
<?php

/**
 * register frontend styles
 */
add_action('init', function () {
    if (is_admin()) {
        return;
    }
    wp_register_style('podlove-frontend-css', \Podlove\PLUGIN_URL . '/css/frontend.css', array(), '1.0');
    wp_enqueue_style('podlove-frontend-css');
    wp_register_style('podlove-admin-font', \Podlove\PLUGIN_URL . '/css/admin-font.css', array(), \Podlove\get_plugin_header('Version'));
    wp_enqueue_style('podlove-admin-font');
});
Пример #15
0
function podlove_about_page($_)
{
    ?>

<div class="wrap podlove-about-wrap">
	
	<h1>
		<?php 
    printf(__('Welcome to Podlove Publisher&nbsp;%s', 'podlove'), \Podlove\get_plugin_header('Version'));
    ?>
	</h1>

	<div class="about-text">
		<?php 
    printf(__('Thank you for updating! This version focuses on podcasting in WordPress Multisite environments.', 'podlove'));
    ?>
	</div>

	<div class="podlove-badge"></div>

	<h2 class="nav-tab-wrapper">
		<a href="#" class="nav-tab nav-tab-active">
			<?php 
    _e('What&#8217;s New', 'podlove');
    ?>
		</a>
	</h2>

	<div class="changelog headline-feature">
		<h2><?php 
    _e('Networks: WordPress Multisite Support is Here', 'podlove');
    ?>
</h2>
		
		<!-- <div class="featured-image">
			<img src="//s.w.org/images/core/4.1/theme.png?0" />
		</div> -->

		<div class="feature-section top-feature">

			<img src="<?php 
    echo \Podlove\PLUGIN_URL . '/images/about/network.png';
    ?>
" style="width: 50%; margin-left: 25%; margin-top: 1em" />

			<h3>
				Podlove Publisher joins the networks section.<br>
				Get an overview of your network and quickly switch between podcasts.
			</h3>
			<p>
				<ul class="ul-disc">
					<li>The network dashboard provides a birds-eye view over your podcast empire.</li>
					<li>Manage templates in your network and access them in all podcasts.</li>
					<li>Create podcast lists and use them in templates spanning multiple podcasts, for example to list the 10 latest episodes in your network.</li>
				</ul>
			</p>

		</div>

		<div class="clear"></div>

		<hr />

		<div class="feature-section">
			<div class="col">
				<h3>
					A new Home &amp; Professional Support
				</h3>
				<p>
					Podlove Podcast Publishing for WordPress has a new home at 
					<a href="//publisher.podlove.org" target="_blank">publisher.podlove.org</a>. Come visit us :)
				</p>
				<p>
					It’s not just a pretty page, it has something new to offer: 
					<a href="//publisher.podlove.org/support/" target="_blank">Professional Support</a>. 
					If you need quick, private and competent support, this is the place to go.
					Subscriptions start at an affordable 5&#x20AC; per month.
				</p>
				<p>
					Here’s an overview of our support &amp; communication channels:

					<ul class="ul-disc">
						<li><a target="_blank" href="//github.com/podlove/podlove-publisher/issues">GitHub</a> will continue to be the bug tracker.</li>
						<li><a target="_blank" href="//community.podlove.org">Podlove Community</a> is the best place to find answers, ask the community for help and discuss features.</li>
						<li><a target="_blank" href="//trello.com/board/podlove-publisher/508293f65573fa3f62004e0a">Trello</a> shows our roadmap.</li>
						<li>Finally, <a target="_blank" href="//publisher.podlove.org/support/">Professional Support</a> is the new place to get quick help, privately.</li>
					</ul>
				</p>
			</div>
			<div class="col">
				<img style="padding-top: 60px;" src="<?php 
    echo \Podlove\PLUGIN_URL . '/images/about/home.png';
    ?>
" />
			</div>
		</div>
	</div>

	<hr />

	<div class="feature-section col two-col">
		<h2>Upgrade Notices</h2>

		<div>
			<h4>Custom Template Parameters are Handled Differently.</h4>
			<p>
				This section is relevant if you are using templates with custom variables passed in shortcodes, like this: 
			</p>
			<p>
				<code>[podlove-template template="example" param="foo" dog="wow"]</code>
			</p>
			<p>
				Before 2.1 you have accessed those variables simply by calling <code>param</code> and <code>dog</code>.
				For compatibility, all shortcode options are now prefixed with <code>option.</code>, 
				so you need to change those calls to <code>option.param</code> and <code>option.dog</code> etc.
			</p>
		</div>

		<div class="last-feature">
			<h4>Other</h4>
			<p>
				The Flattr parameter in <code>[podlove-episode-contributor-list]</code> now defaults to "no". If you like to include Flattr, use <code>[podlove-episode-contributor-list flattr="yes"]</code>
			</p>
			<p>
				<code>[podlove-web-player]</code> was renamed to <code>[podlove-episode-web-player]</code> to avoid clashes with the standalone web player plugin. For now, the old shortcode still works.
			</p>
			<p>
				<code>[podlove-subscribe-button]</code> was renamed to <code>[podlove-podcast-subscribe-button]</code> to avoid clashes with the standalone button plugin. For now, the old shortcode still works.
			</p>
			<p>
				It is now preferred to reference templates using the <code>template</code> parameter instead of <code>id</code>: <code>[podlove-template template="example"]</code>.
			</p>
		</div>
	</div>

	<hr />

	<div class="return-to-dashboard">
	
		<a href="<?php 
    echo esc_url(admin_url('admin.php?page=podlove_settings_handle'));
    ?>
"><?php 
    _e('Go to Podlove Dashboard &rarr;');
    ?>
</a>
	</div>

</div>

<style type="text/css">
#screen-meta-links { display: none; }
</style>

	<?php 
    return true;
}
    if ($is_podlove_settings_screen || $is_episode_edit_screen) {
        wp_enqueue_style('podlove-admin', \Podlove\PLUGIN_URL . '/css/admin.css', [], $version);
        wp_enqueue_style('podlove-admin-font', \Podlove\PLUGIN_URL . '/css/admin-font.css', [], $version);
        // chosen.js scripts & styles
        wp_enqueue_style('podlove-admin-chosen', \Podlove\PLUGIN_URL . '/js/admin/chosen/chosen.min.css', [], $version);
        wp_enqueue_style('podlove-admin-image-chosen', \Podlove\PLUGIN_URL . '/js/admin/chosen/chosenImage.css', [], $version);
        wp_enqueue_script('podlove_admin_chosen', \Podlove\PLUGIN_URL . '/js/admin/chosen/chosen.jquery.min.js', ['jquery'], $version);
        wp_enqueue_script('podlove_admin_chosen_image', \Podlove\PLUGIN_URL . '/js/admin/chosen/chosenImage.jquery.js', ['jquery'], $version);
        // other scripts
        wp_enqueue_script('podlove-cryptojs', \Podlove\PLUGIN_URL . '/js/admin/cryptojs/md5.js');
        wp_enqueue_script('podlove_admin_episode', \Podlove\PLUGIN_URL . '/js/admin/episode.js', ['jquery', 'podlove_admin'], $version);
        wp_enqueue_script('podlove_admin_audio_duration_loader', \Podlove\PLUGIN_URL . '/js/admin/audio_duration_loader.js', ['jquery'], $version);
        wp_enqueue_script('podlove_admin_episode_duration', \Podlove\PLUGIN_URL . '/js/admin/episode_duration.js', ['jquery'], $version);
        wp_enqueue_script('podlove_admin_dashboard_asset_validation', \Podlove\PLUGIN_URL . '/js/admin/dashboard_asset_validation.js', ['jquery'], $version);
        wp_enqueue_script('podlove_admin_dashboard_feed_validation', \Podlove\PLUGIN_URL . '/js/admin/dashboard_feed_validation.js', ['jquery'], $version);
        wp_enqueue_script('podlove_admin_episode_asset_settings', \Podlove\PLUGIN_URL . '/js/admin/episode_asset_settings.js', ['jquery', 'jquery-ui-sortable'], $version);
        wp_enqueue_script('podlove_admin_episode_feed_settings');
        wp_enqueue_script('podlove_admin_count_characters', \Podlove\PLUGIN_URL . '/js/admin/jquery.count_characters.js', ['jquery'], $version);
        wp_enqueue_script('podlove_admin_license', \Podlove\PLUGIN_URL . '/js/admin/license.js', ['jquery'], $version);
        wp_enqueue_script('podlove_admin_protected_feed', \Podlove\PLUGIN_URL . '/js/admin/protected_feed.js', ['jquery'], $version);
        wp_enqueue_script('podlove_admin_data_table');
        wp_enqueue_script('podlove_admin_media', \Podlove\PLUGIN_URL . '/js/admin/media.js', ['jquery'], $version);
        wp_enqueue_script('podlove_admin');
        wp_enqueue_style('jquery-ui-style', \Podlove\PLUGIN_URL . '/js/admin/jquery-ui/css/smoothness/jquery-ui.css');
    }
});
// frontend styles & scripts
add_action('wp_enqueue_scripts', function () {
    $version = \Podlove\get_plugin_header('Version');
    wp_enqueue_script('podlove_frontend', \Podlove\PLUGIN_URL . '/js/frontend.js', ['jquery'], $version);
});
Пример #17
0
function override_feed_head($hook, $podcast, $feed, $format)
{
    $filter_hooks = array('podlove_feed_itunes_author', 'podlove_feed_itunes_owner', 'podlove_feed_itunes_subtitle', 'podlove_feed_itunes_keywords', 'podlove_feed_itunes_summary', 'podlove_feed_itunes_complete', 'podlove_feed_itunes_explicit');
    foreach ($filter_hooks as $filter) {
        add_filter($filter, 'convert_chars');
    }
    add_filter('podlove_feed_content', '\\Podlove\\Feeds\\prepare_for_feed');
    remove_action($hook, 'the_generator');
    add_action($hook, function () use($hook) {
        switch ($hook) {
            case 'rss2_head':
                $gen = '<generator>' . \Podlove\get_plugin_header('Name') . ' v' . \Podlove\get_plugin_header('Version') . '</generator>';
                break;
            case 'atom_head':
                $gen = '<generator uri="' . \Podlove\get_plugin_header('PluginURI') . '" version="' . \Podlove\get_plugin_header('Version') . '">' . \Podlove\get_plugin_header('Name') . '</generator>';
                break;
        }
        echo $gen;
    });
    add_action($hook, function () use($feed) {
        echo $feed->get_self_link();
        echo $feed->get_alternate_links();
    }, 9);
    // add rss image
    add_action($hook, function () use($podcast, $hook) {
        $image = ['url' => $podcast->cover_art()->url(), 'title' => $podcast->title, 'link' => apply_filters('podlove_feed_link', \Podlove\get_landing_page_url())];
        $image = apply_filters('podlove_feed_image', $image);
        if (!$image['url']) {
            return;
        }
        // remove WordPress provided favicon
        remove_action($hook, 'rss2_site_icon');
        // generate our own image tag
        $dom = new \Podlove\DomDocumentFragment();
        $image_tag = $dom->createElement('image');
        foreach ($image as $tag_name => $tag_text) {
            if ($tag_text) {
                $tag = $dom->createElement($tag_name);
                $tag_text = $dom->createTextNode($tag_text);
                $tag->appendChild($tag_text);
                $image_tag->appendChild($tag);
            }
        }
        $dom->appendChild($image_tag);
        echo (string) $dom;
    }, 5);
    // let it run early so we can stop the `rss2_site_icon` call
    add_action($hook, function () use($podcast, $feed, $format) {
        echo PHP_EOL;
        $author = "\t" . sprintf('<itunes:author>%s</itunes:author>', $podcast->author_name);
        echo apply_filters('podlove_feed_itunes_author', $author);
        echo PHP_EOL;
        $summary = "\t" . sprintf('<itunes:summary>%s</itunes:summary>', $podcast->summary);
        echo apply_filters('podlove_feed_itunes_summary', $summary);
        echo PHP_EOL;
        $categories = \Podlove\Itunes\categories(false);
        $category_html = '';
        for ($i = 1; $i <= 3; $i++) {
            $category_id = $podcast->{'category_' . $i};
            if (!$category_id) {
                continue;
            }
            list($cat, $subcat) = explode('-', $category_id);
            if ($subcat == '00') {
                $category_html .= sprintf('<itunes:category text="%s"></itunes:category>', htmlspecialchars($categories[$category_id]));
            } else {
                $category_html .= sprintf('<itunes:category text="%s"><itunes:category text="%s"></itunes:category></itunes:category>', htmlspecialchars($categories[$cat . '-00']), htmlspecialchars($categories[$category_id]));
            }
        }
        echo apply_filters('podlove_feed_itunes_categories', $category_html);
        echo PHP_EOL;
        $owner = sprintf('
	<itunes:owner>
		<itunes:name>%s</itunes:name>
		<itunes:email>%s</itunes:email>
	</itunes:owner>', $podcast->owner_name, $podcast->owner_email);
        echo "\t" . apply_filters('podlove_feed_itunes_owner', $owner);
        echo PHP_EOL;
        if ($podcast->cover_art()->url()) {
            $coverimage = sprintf('<itunes:image href="%s" />', $podcast->cover_art()->url());
        } else {
            $coverimage = '';
        }
        echo "\t" . apply_filters('podlove_feed_itunes_image', $coverimage);
        echo PHP_EOL;
        $subtitle = sprintf('<itunes:subtitle>%s</itunes:subtitle>', $podcast->subtitle);
        echo "\t" . apply_filters('podlove_feed_itunes_subtitle', $subtitle);
        echo PHP_EOL;
        $keywords = sprintf('<itunes:keywords>%s</itunes:keywords>', $podcast->keywords);
        echo "\t" . apply_filters('podlove_feed_itunes_keywords', $keywords);
        echo PHP_EOL;
        $block = sprintf('<itunes:block>%s</itunes:block>', $feed->enable ? 'no' : 'yes');
        echo "\t" . apply_filters('podlove_feed_itunes_block', $block);
        echo PHP_EOL;
        $explicit = sprintf('<itunes:explicit>%s</itunes:explicit>', $podcast->explicit == 2 ? 'clean' : ($podcast->explicit ? 'yes' : 'no'));
        echo "\t" . apply_filters('podlove_feed_itunes_explicit', $explicit);
        echo PHP_EOL;
        $complete = sprintf('<itunes:complete>%s</itunes:complete>', $podcast->complete ? 'yes' : 'no');
        echo apply_filters('podlove_feed_itunes_complete', $podcast->complete ? "\t{$complete}" : '');
        echo PHP_EOL;
        do_action('podlove_append_to_feed_head', $podcast, $feed, $format);
    });
}
Пример #18
0
function override_feed_head($hook, $podcast, $feed, $format)
{
    add_filter('podlove_feed_itunes_author', 'convert_chars');
    add_filter('podlove_feed_itunes_owner', 'convert_chars');
    add_filter('podlove_feed_itunes_subtitle', 'convert_chars');
    add_filter('podlove_feed_itunes_keywords', 'convert_chars');
    add_filter('podlove_feed_itunes_summary', 'convert_chars');
    remove_action($hook, 'the_generator');
    add_action($hook, function () use($hook) {
        switch ($hook) {
            case 'rss2_head':
                $gen = '<generator>Podlove Publishing Plugin for WordPress v' . \Podlove\get_plugin_header('Version') . '</generator>';
                break;
            case 'atom_head':
                $gen = '<generator uri="' . \Podlove\get_plugin_header('PluginURI') . '" version="' . \Podlove\get_plugin_header('Version') . '">' . \Podlove\get_plugin_header('Name') . '</generator>';
                break;
        }
        echo $gen;
    });
    add_action($hook, function () use($podcast, $feed, $format) {
        echo PHP_EOL;
        $author = "\t" . sprintf('<itunes:author>%s</itunes:author>', $podcast->author_name);
        echo apply_filters('podlove_feed_itunes_author', $author);
        echo PHP_EOL;
        $summary = "\t" . sprintf('<itunes:summary>%s</itunes:summary>', $podcast->summary);
        echo apply_filters('podlove_feed_itunes_summary', $summary);
        echo PHP_EOL;
        $categories = \Podlove\Itunes\categories(false);
        $category_html = '';
        for ($i = 1; $i <= 3; $i++) {
            $category_id = $podcast->{'category_' . $i};
            if (!$category_id) {
                continue;
            }
            list($cat, $subcat) = explode('-', $category_id);
            if ($subcat == '00') {
                $category_html .= sprintf('<itunes:category text="%s"></itunes:category>', htmlspecialchars($categories[$category_id]));
            } else {
                $category_html .= sprintf('<itunes:category text="%s"><itunes:category text="%s"></itunes:category></itunes:category>', htmlspecialchars($categories[$cat . '-00']), htmlspecialchars($categories[$category_id]));
            }
        }
        echo apply_filters('podlove_feed_itunes_categories', $category_html);
        echo PHP_EOL;
        $owner = sprintf('
	<itunes:owner>
		<itunes:name>%s</itunes:name>
		<itunes:email>%s</itunes:email>
	</itunes:owner>', $podcast->owner_name, $podcast->owner_email);
        echo "\t" . apply_filters('podlove_feed_itunes_owner', $owner);
        echo PHP_EOL;
        if ($podcast->cover_image) {
            $coverimage = sprintf('<itunes:image href="%s" />', $podcast->cover_image);
        } else {
            $coverimage = '';
        }
        echo "\t" . apply_filters('podlove_feed_itunes_image', $coverimage);
        echo PHP_EOL;
        $subtitle = sprintf('<itunes:subtitle>%s</itunes:subtitle>', $podcast->subtitle);
        echo "\t" . apply_filters('podlove_feed_itunes_subtitle', $subtitle);
        echo PHP_EOL;
        $keywords = sprintf('<itunes:keywords>%s</itunes:keywords>', $podcast->keywords);
        echo "\t" . apply_filters('podlove_feed_itunes_keywords', $keywords);
        echo PHP_EOL;
        $block = sprintf('<itunes:block>%s</itunes:block>', $feed->enable ? 'no' : 'yes');
        echo "\t" . apply_filters('podlove_feed_itunes_block', $block);
        echo PHP_EOL;
        $explicit = sprintf('<itunes:explicit>%s</itunes:explicit>', $podcast->explicit == 2 ? 'clean' : ($podcast->explicit ? 'yes' : 'no'));
        echo "\t" . apply_filters('podlove_feed_itunes_explicit', $explicit);
        echo PHP_EOL;
    });
}
Пример #19
0
 public function admin_print_styles()
 {
     wp_register_style('podlove_social_admin_style', $this->get_module_url() . '/admin.css', false, \Podlove\get_plugin_header('Version'));
     wp_enqueue_style('podlove_social_admin_style');
     wp_register_script('podlove_social_admin_script', $this->get_module_url() . '/js/admin.js', array('jquery'), \Podlove\get_plugin_header('Version'));
     wp_enqueue_script('podlove_social_admin_script');
 }
Пример #20
0
 public function __construct()
 {
     $errors =& $this->errors;
     $notices =& $this->notices;
     $this->fields = array('site' => array('title' => 'Website', 'callback' => function () {
         return get_site_url();
     }), 'php_version' => array('title' => 'PHP Version', 'callback' => function () {
         return phpversion();
     }), 'wp_version' => array('title' => 'WordPress Version', 'callback' => function () {
         return get_bloginfo('version');
     }), 'podlove_version' => array('title' => 'Publisher Version', 'callback' => function () {
         return \Podlove\get_plugin_header('Version');
     }), 'player_version' => array('title' => 'Web Player Version', 'callback' => function () {
         if (!defined('PODLOVEWEBPLAYER_DIR')) {
             return 'no web player found';
         }
         $pwp_file = PODLOVEWEBPLAYER_DIR . 'podlove-web-player.php';
         if (!is_readable($pwp_file)) {
             return 'not readable';
         }
         $plugin_data = \get_plugin_data($pwp_file);
         return $plugin_data['Version'];
     }), 'twig_version' => array('title' => 'Twig Version', 'callback' => function () {
         return \Twig_Environment::VERSION;
     }), 'open_basedir' => array('callback' => function () use(&$notices) {
         $open_basedir = trim(ini_get('open_basedir'));
         if ($open_basedir != '.') {
             $notices[] = 'The PHP setting "open_basedir" is not empty. This is incompatible with curl, a library required by Podlove Publisher. We have a workaround in place but it is preferred to fix the issue. Please ask your hoster to unset "open_basedir".';
         }
         if ($open_basedir) {
             return $open_basedir;
         } else {
             return 'ok';
         }
     }), 'curl' => array('title' => 'curl Version', 'callback' => function () use(&$errors) {
         $module_loaded = in_array('curl', get_loaded_extensions());
         $function_disabled = stripos(ini_get('disable_functions'), 'curl_exec') !== false;
         $out = '';
         if ($module_loaded) {
             $curl = curl_version();
             $out .= $curl['version'];
         } else {
             $out .= 'EXTENSION MISSING';
             $errors[] = 'curl extension is not loaded';
         }
         if ($function_disabled) {
             $out .= ' | curl_exec is disabled';
             $errors[] = 'curl_exec is disabled';
         }
         return $out;
     }), 'iconv' => array('callback' => function () use(&$errors) {
         $iconv_available = function_exists('iconv');
         if (!$iconv_available) {
             $errors[] = 'You need to install/activate php5-iconv';
         }
         return $iconv_available ? "available" : "MISSING";
     }), 'simplexml' => array('callback' => function () use(&$errors) {
         if (!($simplexml = in_array('SimpleXML', get_loaded_extensions()))) {
             $errors[] = 'You need to install/activate the PHP SimpleXML module';
         }
         return $simplexml ? 'ok' : 'missing!';
     }), 'max_execution_time' => array('callback' => function () {
         return ini_get('max_execution_time');
     }), 'upload_max_filesize' => array('callback' => function () {
         return ini_get('upload_max_filesize');
     }), 'memory_limit' => array('callback' => function () {
         return ini_get('memory_limit');
     }), 'disable_classes' => array('callback' => function () {
         return ini_get('disable_classes');
     }), 'disable_functions' => array('callback' => function () {
         return ini_get('disable_functions');
     }), 'permalinks' => array('callback' => function () use(&$errors) {
         $permalinks = \get_option('permalink_structure');
         if (!$permalinks) {
             $errors[] = sprintf(__('You are using the default WordPress permalink structure. This may cause problems with some podcast clients. Go to %s and set it to anything but default (for example "Post name").', 'podlove'), admin_url('options-permalink.php'));
             return __("\"non-pretty\" Permalinks: Please change permalink structure", 'podlove');
         }
         return "ok ({$permalinks})";
     }), 'podlove_permalinks' => array('callback' => function () use(&$errors) {
         if (\Podlove\get_setting('website', 'use_post_permastruct') == 'on') {
             return 'ok';
         }
         if (stristr(\Podlove\get_setting('website', 'custom_episode_slug'), '%podcast%') === FALSE) {
             $website_options = get_option('podlove_website');
             $website_options['use_post_permastruct'] = 'on';
             update_option('podlove_website', $website_options);
         }
         return 'ok';
     }), 'podcast_settings' => array('callback' => function () use(&$errors) {
         $out = '';
         $podcast = Model\Podcast::get();
         if (!$podcast->title) {
             $error = __('Your podcast needs a title.', 'podlove');
             $errors[] = $error;
             $out .= $error;
         }
         if (!$podcast->media_file_base_uri) {
             $error = __('Your podcast needs an upload location for file storage.', 'podlove');
             $errors[] = $error;
             $out .= $error;
         }
         if (!$out) {
             $out = "ok";
         }
         return $out;
     }), 'web_player' => array('callback' => function () use(&$errors) {
         foreach (get_option('podlove_webplayer_formats', array()) as $_ => $media_types) {
             foreach ($media_types as $extension => $asset_id) {
                 if ($asset_id) {
                     return "ok";
                 }
             }
         }
         $error = __('You need to assign at least one asset to the web player.', 'podlove');
         $errors[] = $error;
         return $error;
     }), 'podlove_cache' => array('callback' => function () {
         return \Podlove\Cache\TemplateCache::is_enabled() ? 'on' : 'off';
     }), 'assets' => array('callback' => function () {
         $assets = array();
         foreach (\Podlove\Model\EpisodeAsset::all() as $asset) {
             $file_type = $asset->file_type();
             $assets[] = array('extension' => $file_type->extension, 'mime_type' => $file_type->mime_type);
         }
         return "\n\t" . implode("\n\t", array_map(function ($asset) {
             return str_pad($asset['extension'], 7) . $asset['mime_type'];
         }, $assets));
     }));
     $this->fields = apply_filters('podlove_system_report_fields', $this->fields);
     $this->run();
 }