/**
 * Adds oEmbed discovery links in the website <head> for the IdeaStream user's profile root page.
 *
 * @since 2.3.0
 */
function wp_idea_stream_oembed_add_discovery_links()
{
    if (!wp_idea_stream_is_user_profile_ideas() || !wp_idea_stream_is_embed_profile()) {
        return;
    }
    $user_link = wp_idea_stream_users_get_user_profile_url(wp_idea_stream_users_displayed_user_id(), '', true);
    $output = '<link rel="alternate" type="application/json+oembed" href="' . esc_url(get_oembed_endpoint_url($user_link)) . '" />' . "\n";
    if (class_exists('SimpleXMLElement')) {
        $output .= '<link rel="alternate" type="text/xml+oembed" href="' . esc_url(get_oembed_endpoint_url($user_link, 'xml')) . '" />' . "\n";
    }
    /**
     * Filter the oEmbed discovery links HTML.
     *
     * @since 2.3.0
     *
     * @param string $output HTML of the discovery links.
     */
    echo apply_filters('wp_idea_stream_users_oembed_add_discovery_links', $output);
}
Beispiel #2
0
/**
 * About screen
 *
 * @package WP Idea Stream
 * @subpackage admin/thanks
 *
 * @since 2.0.0
 *
 * @uses   wp_idea_stream_get_version() to get plugin's version
 * @uses   add_query_arg() to add query vars to an url
 * @uses   admin_url() to build a link inside the current blog's Administration
 * @uses   get_transient() to get the value of a transient
 * @uses   delete_transient() to delete a transient
 * @uses   wp_oembed_get() to get the vidéo démo of the plugin
 * @return string HTML output
 */
function wp_idea_stream_admin_about()
{
    $display_version = wp_idea_stream_get_version();
    $settings_url = add_query_arg('page', 'ideastream', admin_url('options-general.php'));
    $has_upgraded = get_transient('_ideastream_reactivated_upgrade');
    $upgraded = __('activating', 'wp-idea-stream');
    if (!empty($has_upgraded)) {
        $upgraded = __('upgrading to', 'wp-idea-stream');
        delete_transient('_ideastream_reactivated_upgrade');
    }
    if (wp_idea_stream_is_embed_profile()) {
        $admin_profile = wp_oembed_get(wp_idea_stream_users_get_user_profile_url(get_current_user_id(), '', true));
    }
    ?>
	<div class="wrap about-wrap">
		<h1><?php 
    printf(esc_html_x('WP Idea Stream %s', 'about screen title', 'wp-idea-stream'), $display_version);
    ?>
</h1>
		<div class="about-text"><?php 
    printf(esc_html__('Thank you for %1$s the latest version of WP Idea Stream! %2$s brings some really cool new features!', 'wp-idea-stream'), $upgraded, $display_version);
    ?>
</div>
		<div class="wp-idea-stream-badge"></div>

		<h2 class="nav-tab-wrapper">
			<a class="nav-tab nav-tab-active" href="<?php 
    echo esc_url(admin_url(add_query_arg(array('page' => 'about-ideastream'), 'index.php')));
    ?>
">
				<?php 
    esc_html_e('About', 'wp-idea-stream');
    ?>
			</a>
			<a class="nav-tab" href="<?php 
    echo esc_url(admin_url(add_query_arg(array('page' => 'credits-ideastream'), 'index.php')));
    ?>
">
				<?php 
    _e('Credits', 'wp-idea-stream');
    ?>
			</a>
		</h2>

		<div class="headline-feature">
			<h2 style="text-align:center"><?php 
    echo esc_html_x('Share ideas, great ones will rise to the top!', 'IdeaStream Headline', 'wp-idea-stream');
    ?>
</h2>

			<div class="feature-section">
				<p>
					<?php 
    esc_html_e('WP Idea Stream is a WordPress plugin to power idea management for your site. Your members will be able to easily create, share and rate ideas.', 'wp-idea-stream');
    ?>
				</p>

				<?php 
    if (!empty($has_upgraded)) {
        ?>
					<h4><?php 
        esc_html_e('Important: these features are not supported anymore.', 'wp-idea-stream');
        ?>
</h4>
					<ul>
						<li><?php 
        esc_html_e('Set the list of ideas as the front page of the blog.', 'wp-idea-stream');
        ?>
</li>
						<li><?php 
        esc_html_e('Sharing options (twitter or email).', 'wp-idea-stream');
        ?>
</li>
						<li><?php 
        esc_html_e('Disabling the built-in rating system.', 'wp-idea-stream');
        ?>
</li>
					</ul>
				<?php 
    }
    ?>
			</div>
		</div>

		<hr />

		<div class="headline-feature">
			<h2 style="text-align:center"><?php 
    esc_html_e('Embed your users profiles', 'wp-idea-stream');
    ?>
</h2>

			<?php 
    if (!empty($admin_profile)) {
        ?>
				<style>blockquote.wp-embedded-content{display:none;}iframe.wp-embedded-content{display:block!important;margin:0 auto;max-height:228px!important;}</style>
				<div class="embed-container" id="#embed-admin-profile">
					<?php 
        echo $admin_profile;
        ?>
				</div>
			<?php 
    } else {
        ?>
				<div class="feature-image" style="text-align:center">
					<img src="https://cldup.com/4t2V1bvOMR.png" alt="<?php 
        esc_attr_e('Embed profile', 'wp-idea-stream');
        ?>
">
				</div>
			<?php 
    }
    ?>

			<div class="feature-section" style="margin-top:1em">
				<h3 style="text-align:center"><?php 
    esc_html_e('Great ideas are found by awesome people!', 'wp-idea-stream');
    ?>
</h3>
				<p><?php 
    esc_html_e('Use the powerful WordPress Embeds provider feature introduced in WordPress 4.4 to let your users show off their lovely profile and statistics about their contributions.', 'wp-idea-stream');
    ?>
</p>
				<p><?php 
    esc_html_e('WP Idea Stream embed profiles are even greater when BuddyPress 2.4 is activated thanks to its new Cover Images feature, check this out!', 'wp-idea-stream');
    ?>
</p>
			</div>

			<div class="feature-image" style="padding-bottom:1.5em;width:600px;margin:0 auto">
				<img src="https://cldup.com/liERrg_WJJ.png" alt="<?php 
    esc_attr_e('Embed profile when BuddyPress is active', 'wp-idea-stream');
    ?>
">
			</div>

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

		<hr />

		<div class="feature-section two-col">
			<div class="col">
				<div class="media-container">
					<img src="https://cldup.com/QOitsGKqou.png" alt=""/>
				</div>
			</div>
			<div class="col">
				<h3><?php 
    esc_html_e('Featured images for ideas.', 'wp-idea-stream');
    ?>
</h3>
				<p><?php 
    esc_html_e('When a user adds an image to the idea, it will now be listed into a list of inserted images from which he will be able to choose the one he wishes to use as featured image.', 'wp-idea-stream');
    ?>
</p>
			</div>
		</div>

		<hr />

		<div class="feature-section two-col">
			<div class="col">
				<div class="media-container">
					<img src="https://cldup.com/GglZMhKiLG.png" alt=""/>
				</div>
			</div>
			<div class="col">
				<h3><?php 
    esc_html_e('Embeds, embeds, embeds!', 'wp-idea-stream');
    ?>
</h3>
				<p>
					<?php 
    esc_html_e('You can share ideas into your WordPress posts, or anyone can do it from everywhere on the internet just like regular posts. Ideas will include one more information: the average rating they got!', 'wp-idea-stream');
    ?>
				</p>
				<p>
					<?php 
    esc_html_e('The way the plugin deal with embeds has been greatly improved and every embed code should be displayed just fine in every single view of ideas (including the one in BuddyPress Groups).', 'wp-idea-stream');
    ?>
				</p>
			</div>
		</div>

		<div class="changelog feature-list">
			<h2 class="about-headline-callout"><?php 
    esc_html_e('The finer points..', 'wp-idea-stream');
    ?>
</h2>
			<div class="feature-section col one-col">
				<div class="col-1">
					<h4><?php 
    esc_html_e('TwentySixteen', 'wp-idea-stream');
    ?>
</h4>
					<p>
						<?php 
    esc_html_e('WP Idea Stream will look really nice into the new WordPress default theme. Its style has been optimized for it.', 'wp-idea-stream');
    ?>
					</p>
					<h4><?php 
    esc_html_e('Bug fixes', 'wp-idea-stream');
    ?>
</h4>
					<ul>
						<li><?php 
    esc_html_e('In users profiles, the issue with the title of commented private ideas is now fixed.', 'wp-idea-stream');
    ?>
</li>
						<li><?php 
    esc_html_e('In users profiles, user rates are now consistent meaning only ideas the displayed user rated will be displayed.', 'wp-idea-stream');
    ?>
</li>
						<li><?php 
    esc_html_e('Spammed users on multisite configs or configs where BuddyPress is activated, will not be displayed anymore. Unless you unspam them :)', 'wp-idea-stream');
    ?>
</li>
						<li><?php 
    esc_html_e('More links on archive pages are now using the link of the idea.', 'wp-idea-stream');
    ?>
</li>
						<li><?php 
    esc_html_e('The Ideas pagination is now completely independant of the Posts one.', 'wp-idea-stream');
    ?>
</li>
					</ul>
				</div>
			</div>
		</div>

		<div class="changelog">
			<div class="return-to-dashboard">
				<a href="<?php 
    echo esc_url($settings_url);
    ?>
" title="<?php 
    _e('Configure WP Idea Stream', 'wp-idea-stream');
    ?>
"><?php 
    _e('Go to the IdeaStream Settings page', 'wp-idea-stream');
    ?>
</a>
			</div>
		</div>

	</div>
	<?php 
}
/**
 * Add a new member-header button to open the embed profile dialog box
 *
 * @since  2.3.0
 */
function wp_idea_stream_buddypress_add_profile_sharing_dialog_button()
{
    if (!(bp_is_user() && bp_is_current_component('ideastream') && wp_idea_stream_is_embed_profile())) {
        return;
    }
    // Temporarly map IdeaStream Displayed user with BuddyPress One
    add_filter('wp_idea_stream_users_displayed_user_id', 'bp_displayed_user_id');
    wp_idea_stream_users_sharing_button();
    // Stop mapping IdeaStream Displayed user with BuddyPress One
    remove_filter('wp_idea_stream_users_displayed_user_id', 'bp_displayed_user_id');
}
/**
 * Create the Utility page for embed profile if needed
 *
 * @since 2.3.0
 *
 * @param  int $option the embed profile setting
 * @return int         the new embed profile setting
 */
function wp_idea_stream_sanitize_embed_profile($option = 0)
{
    $utility_page_id = wp_idea_stream_is_embed_profile();
    if ($utility_page_id) {
        $utility_page = get_post($utility_page_id);
    }
    if (isset($utility_page->post_type) && 'ideastream_utility' !== $utility_page->post_type) {
        $utility_page = null;
    }
    if (!empty($option)) {
        if (empty($utility_page->ID)) {
            $option = wp_insert_post(array('comment_status' => 'closed', 'ping_status' => 'closed', 'post_status' => 'publish', 'post_title' => 'ideastream_user_page', 'post_type' => 'ideastream_utility'));
        } else {
            $option = $utility_page->ID;
        }
    } elseif (!empty($utility_page->ID)) {
        wp_delete_post($utility_page->ID, true);
    }
    return absint($option);
}
Beispiel #5
0
/**
 * Displays the sharing dialog box on user's profile so
 * that people can easily get the embed code.
 *
 * @since 2.3.0
 */
function wp_idea_stream_users_sharing_button()
{
    // No need to carry on.
    if (!wp_idea_stream_is_embed_profile()) {
        return;
    }
    wp_idea_stream_users_embed_content_meta();
    // Print the sharing dialog
    print_embed_sharing_dialog();
    // Reset the post
    wp_idea_stream_users_embed_content_reset_post();
}
/**
 * In case a user's profile is embed, we need to reset all the parts we've altered
 * to make the user's embed profile works.
 *
 * @since 2.3.0
 *
 * @param  string  $output  the HTML output for the embed object
 * @param  WP_Post $post    the post object relative to the output
 * @return string  Unchanged the HTML output for the embed object
 */
function wp_idea_stream_embed_html($output, $post)
{
    if (isset($post->ID) && wp_idea_stream_is_embed_profile() === (int) $post->ID) {
        // Remove temporarly filters
        remove_filter('post_type_link', 'wp_idea_stream_users_oembed_link', 10, 2);
        remove_filter('the_title', 'wp_idea_stream_users_oembed_title', 10, 2);
        // Reset the globalized user.
        wp_idea_stream_set_idea_var('embed_user_data', null);
    }
    return $output;
}
Beispiel #7
0
/**
 * Fire the 'wp_idea_stream_enqueue_embed_scripts' action.
 * But do it only if needed
 *
 * Used to register and enqueue custom scripts for the WordPress
 * & IdeaStream embed templates
 *
 * @since 2.3.0
 */
function wp_idea_stream_enqueue_embed_scripts()
{
    // Bail if not an idea or not an embed profile
    if (wp_idea_stream_get_post_type() === get_query_var('post_type') && !wp_idea_stream_is_rating_disabled() || wp_idea_stream_get_idea_var('is_user_embed') && wp_idea_stream_is_embed_profile()) {
        do_action('wp_idea_stream_enqueue_embed_scripts');
    }
}