License: GPL2 or later */ class APContent { function APContent() { add_action( 'admin_menu', array($this, 'admin_menu' )); add_filter( 'the_content', array($this, 'the_content' )); } function admin_menu() { add_submenu_page( 'options-general.php', 'Append Content', 'Append Content', 8, basename(__FILE__), array($this,'main' )); } function the_content( $content ) { $apc_ignore_pages = get_option ( 'apc_ignore_pages' ); if ( is_array( $apc_ignore_pages ) && in_array( get_the_ID(), $apc_ignore_pages ) ) return $content; if ( is_home() && get_option( 'apc_omit_home' ) == 1 ) return $content; if ( is_front_page() && get_option( 'apc_omit_front' ) == 1 ) return $content; if ( is_category() && get_option( 'apc_omit_cat' ) == 1 ) return $content; if ( is_tag() && get_option( 'apc_omit_tag' ) == 1 ) return $content; if ( is_date() && get_option( 'apc_omit_date' ) == 1 ) return $content; $publish = get_option( 'apc_publish' ); $apc_content = wpautop( get_option( 'apc_content' ) ); switch ( $publish ) { case 'all': $content .= "\n\n" . $apc_content; break; case 'posts': if ( !is_page(get_the_ID()) ) { $content .= "\n\n" . $apc_content; } break; case 'pages': if ( is_page(get_the_ID()) ) { $content .= "\n\n" . $apc_content; } break; default: break; } return $content; } function main() { ?>
Content settings updated.
Publishing settings updated.
'; } } $apc_publish = get_option( 'apc_publish', 'all' ); ?>