[ Index ]

MailPress 7.2

[ Index ]     [ Classes ]     [ Functions ]     [ Variables ]     [ Constants ]     [ Statistics ]    

title

Body

[close]

/mp-includes/class/ -> MP_theme_html_.class.php (source)

   1  <?php
   2  abstract class MP_theme_html_
   3  {
   4      var $style = '';
   5  
   6  	function __construct()
   7      { 
   8          add_action( 'MailPress_build_mail_content_start',    array( $this, 'build_mail_content_start' ) );
   9          add_action( 'MailPress_build_mail_content_end',        array( $this, 'build_mail_content_end' ) );
  10      }
  11  
  12  	function build_mail_content_start( $type )
  13      {
  14          if ( 'html' != $type ) return;
  15  
  16          add_action( 'MailPress_theme_html_header_image',        array( $this, 'header_image' ), 8, 2 );
  17  
  18          add_filter( 'comments_popup_link_attributes',         array( $this, 'comments_popup_link_attributes' ), 8, 1 );
  19          add_filter( 'the_category',                     array( $this, 'the_category' ), 8, 3 );
  20          add_filter( 'term_links-post_tag',                 array( $this, 'term_links_post_tag' ), 8, 1 );
  21      }
  22  
  23  	function build_mail_content_end( $type )
  24      {
  25          if ( 'html' != $type ) return;
  26  
  27          remove_filter( 'MailPress_theme_html_header_image',    array( $this, 'header_image' ), 8, 2 );
  28  
  29          remove_filter( 'comments_popup_link_attributes',    array( $this, 'comments_popup_link_attributes' ) );
  30          remove_filter( 'the_category',                     array( $this, 'the_category' ) );
  31          remove_filter( 'term_links-post_tag',             array( $this, 'term_links_post_tag' ) );
  32      }
  33  
  34  	function header_image( $default, $post_id = false )
  35      {
  36          switch ( true )
  37          {
  38              case ( $post_id && function_exists( 'has_post_thumbnail' ) && function_exists( 'get_post_thumbnail_id' ) && function_exists( 'wp_get_attachment_image_src' ) && $post_id && has_post_thumbnail( $post_id ) && ( $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post_id ), 'post-thumbnail' ) ) && ( $image[1] >= $this->HEADER_IMAGE_WIDTH ) ) :
  39                  echo $image[0];
  40              break;
  41              case ( function_exists( 'get_header_image' ) && get_header_image() ) :
  42                  echo get_header_image();
  43              break;
  44              default:
  45                  echo $default;
  46              break;
  47          }
  48      }
  49  
  50  	function comments_popup_link_attributes( $attrs = '' )
  51      {
  52          return "$attrs {$this->style} ";
  53      }
  54  
  55  	function the_category( $thelist, $separator, $parents )
  56      {
  57          return str_replace( array( 'a href=', 'rel="category"' ), array( "a class=\"hover_underline\" {$this->style} href=", '' ), $thelist );
  58      }
  59  
  60  	function term_links_post_tag( $term_links )
  61      {
  62          foreach( $term_links as $k => $v )
  63              $term_links[$k] = str_replace( 'a href=', "a class=\"hover_underline\" {$this->style} href=", $v );
  64          return $term_links;
  65      }
  66  }


Generated: Fri Mar 20 15:22:40 2020 Cross-referenced by PHPXref 0.7.1