コード例 #1
0
 /**
  * The singleton method.
  *
  * @return Muut_Template_Loader The instance.
  * @author Paul Hughes
  * @since  3.0
  */
 public static function instance()
 {
     if (!is_a(self::$instance, __CLASS__)) {
         self::$instance = new self();
     }
     return self::$instance;
 }
コード例 #2
0
 /**
  * Initializes the Template Loader class.
  *
  * @return void
  * @author Paul Hughes
  * @since 3.0
  */
 public function initTemplateLoader()
 {
     $class = 'Muut_Template_Loader';
     if (!in_array($class, $this->alreadyInit)) {
         require_once muut()->getPluginPath() . 'lib/template-loader.class.php';
         if (class_exists($class)) {
             Muut_Template_Loader::instance();
         }
         $this->alreadyInit[] = $class;
     }
 }
コード例 #3
0
 /**
  * Gets the proper comments template when overrides are on.
  *
  * @param string $template The current comments template being fetched.
  * @return string The modified template to fetch.
  * @author Paul Hughes
  * @since 3.0
  */
 public function commentsTemplate($template)
 {
     global $post;
     $disabled_post_types = apply_filters('muut_disabled_comment_override_post_types', array());
     if (muut()->getForumName() != '' && muut()->getOption('replace_comments', false) && !in_array($post->post_type, $disabled_post_types)) {
         if (Muut_Post_Utility::isMuutCommentingPost($post->ID)) {
             // TODO: Make it so it checks if the post type is supposed to be overridden.
             $template = Muut_Template_Loader::instance()->locateTemplate('comments.php');
         }
     }
     return $template;
 }