/** * Checks if a post uses Muut in some way (is a channel embed, uses commenting, etc. * * @param int $post_id The ID of the post we are checking (defaults to current post). * @return bool Whether the post uses Muut or not. * @author Paul Hughes * @since 3.0 */ function muut_post_uses_muut($post_id = null) { if (is_null($post_id)) { $post_id = get_the_ID(); } return Muut_Post_Utility::isMuutPost($post_id); }
/** * Gets the proper Muut template, if necessary. * * @param string $template The current template being requested. * @return string The revised template path to load. * @author Paul Hughes * @since 3.0 */ public function getProperTemplate($template) { if (is_page() && Muut_Post_Utility::isMuutPost(get_the_ID())) { //TODO: Allow for other forum templates to get loaded (not just the one). if (Muut_Post_Utility::getForumPageId() == get_the_ID() && apply_filters('muut_use_packaged_forum_template', true)) { $template = 'forum-page.php'; $located = $this->locateTemplate($template); $template = $located != '' ? $located : $template; } } return $template; }
/** * Checks if the a page needs to include the frontend Muut resources. * * @param int $page_id The page we are checking. * @return bool Whether we need the frontend Muut resources or not. * @author Paul Hughes * @since 3.0 */ public function needsMuutResources($page_id = null) { if (is_null($page_id)) { $page_id = get_the_ID(); } $return = false; if (is_numeric($page_id) && (Muut_Post_Utility::isMuutPost($page_id) || Muut_Post_Utility::isMuutCommentingPost($page_id))) { $return = true; } return apply_filters('muut_requires_muut_resources', $return, $page_id); }
/** * Checks whether we are/should be using escaped fragments on this page load. * * @return bool Whether we are using escaped fragments support on this page load. * @author Paul Hughes * @since 3.0.1 */ public function isUsingEscapedFragments() { if (!isset($this->maybeDoEscapedFragments)) { global $post; if (isset($_GET['_escaped_fragment_']) && isset($post) && is_a($post, 'WP_Post') && (Muut_Post_Utility::isMuutPost($post->ID) || Muut_Post_Utility::isMuutCommentingPost($post->ID))) { $this->maybeDoEscapedFragments = true; } else { $this->maybeDoEscapedFragments = false; } } return apply_filters('muut_is_using_escaped_fragments', $this->maybeDoEscapedFragments); }
<?php /** * The markup for the Muut page editor metabox. * * @package Muut * @copyright 2014 Muut Inc */ global $post; $is_forum = Muut_Post_Utility::isMuutPost($post->ID); $forum_show_class = ''; if ($is_forum != '1') { $forum_show_class = 'hidden'; } $remote_path = '/' . rawurldecode(Muut_Post_Utility::getChannelRemotePathForPage(get_the_ID(), true)); $tabs = Muut_Admin_Post_Editor::instance()->getMetaBoxTabsForCurrentPostType(); $tab_names = array(); foreach ($tabs as $tab) { $tab_names[] = $tab['name']; } $last_active_tab = get_post_meta(get_the_ID(), 'muut_last_active_tab', true); $post_type_object = get_post_type_object(get_post_type()); ?> <div id="muut_metabox_tabs"> <div class="wp-tab-bar"> <ul id="muut_metabox_tabs_list" class="category-tabs"> <?php $first_tab = true; $active_tab = $last_active_tab; foreach ($tabs as $slug => $tab) { $class = '';