hello
Server : Apache/2.4.52 (Ubuntu) System : Linux HAN2 5.15.0-185-generic #195-Ubuntu SMP Fri Jun 19 17:11:50 UTC 2026 x86_64 User : servadmin ( 1000) PHP Version : 8.1.2-1ubuntu2.25 Disable Function : NONE Directory : /www/docs/home.obu.edu.bak/wp-content/themes/Backup/ |
<?php
if ( function_exists('register_sidebar') )
{
register_sidebar(array(
'before_widget' => '<div class="section widget %2$s" id="%1$s">',
'after_widget' => '</div>',
'before_title' => '<div class="section-title">',
'after_title' => '</div>',
));
}
function sm_site_description()
{
if ( $descr = get_bloginfo('description') )
{
echo '<div id="site-description">' . $descr . '</div>' . "\n";
}
}
function sm_loadsplash()
{
if ( file_exists( TEMPLATEPATH . '/splash.php') ){
load_template( TEMPLATEPATH . '/splash.php');
}
}
function sm_splash()
{
if ( !is_paged() )
{
if ( function_exists('is_front_page') && is_front_page() ){
sm_loadsplash();
}
else if ( function_exists('is_home') && is_home() ){
sm_loadsplash();
}
}
}
function sm_footerpages($args='depth=1', $separator = ' <span class="text-separator">|</span> ')
{
$pages = get_pages($args);
if ( $pages )
{
$page_links = array();
foreach ( $pages as $page )
{
$page_links[] = '<a href="' . get_page_link($page->ID) . '">' . $page->post_title . '</a>';
}
echo join($separator, $page_links) . $separator;
}
}
function sm_mainnav($args=array())
{
$defaults = array(
'depth' => 1,
'title_li' => '',
'sort_column' => 'menu_order, post_title',
);
$args = array_merge($defaults, $args);
if ( is_home() ){
$home_link = '<li class="current_page_item"><a href="' . get_bloginfo('url') . '">' . __('About') . '</a></li>';
}
else {
$home_link = '<li><a href="' . get_bloginfo('url') . '">' . __('About') . '</a></li>';
}
//echo $home_link;
wp_list_pages($args);
}
function sm_subnav()
{
global $post, $wpdb;
if ( is_page() )
{
$child_of = null;
if ( $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_type='page' && post_parent = ".$post->ID) > 0 ){
$child_of = $post->ID;
}
else if ( $post->post_parent != 0 ){
$child_of = $post->post_parent;
}
if ( !is_null($child_of) )
{
echo '<div class="navigation" id="sub-nav">' . "\n";
echo '<ul class="tabbed">' . "\n";
wp_list_pages('title_li=&child_of='.$child_of);
echo '</ul>' . "\n";
echo '<div class="clearer"> </div>' . "\n";
echo '</div>' . "\n";
}
}
}
/*
Comment author name fix
----------------------------------------------------------------- */
function sm_str_cut($str, $maxlen, $after='..'){
return ( strlen($str) > $maxlen ) ? substr($str, 0, $maxlen-strlen($after)) . $after : $str;
}
function sm_comment_author_link($str){
return sm_str_cut($str, 18);
}
add_filter('get_comment_author', 'sm_comment_author_link');
/*
List comments
----------------------------------------------------------------- */
function sm_comment($comment, $args, $depth)
{
$GLOBALS['comment'] = $comment;
if ( $depth == 1 ) : ?>
<li class="comment <?php if ( $args['has_children'] ) : ?>comment-parent<?php else : ?>comment-single<?php endif; ?>" id="comment-<?php comment_ID(); ?>">
<div class="comment-profile-wrapper left">
<div class="comment-profile">
<div class="comment-gravatar"><?php echo get_avatar($comment,40); ?></div>
<div class="comment-author"><?php comment_author_link() ?></div>
</div>
</div>
<div class="comment-content-wrapper right">
<div class="comment-content-wrapper-2">
<div class="comment-body">
<div class="comment-arrow"></div>
<div class="post-date">
<div class="left"><?php comment_date('F jS, Y') ?> at <?php comment_time() ?><?php if ( $depth < $args['max_depth'] ) : ?> <span class="text-separator">|</span> <?php comment_reply_link(array_merge($args, array('reply_text' => 'Reply »', 'depth' => $depth, 'max_depth' => $args['max_depth']))); ?><?php endif; ?></div>
<div class="right"><?php edit_comment_link('Edit', '', ' <span class="text-separator">|</span> '); ?><a href="#comment-<?php comment_ID() ?>" title="Permanent link to this reply">#<?php comment_ID() ?></a></div>
<div class="clearer"> </div>
</div>
<div class="comment-text">
<?php if ( $comment->comment_approved == '0' ) : ?>
<p><em>Your comment is awaiting moderation.</em></p>
<?php endif; ?>
<?php comment_text(); ?>
<div class="clearer"> </div>
</div>
<div class="clearer"> </div>
</div>
</div>
</div>
<div class="clearer"> </div>
<?php else : ?>
<li class="comment" id="comment-<?php comment_ID(); ?>">
<div class="comment-content">
<div class="comment-body">
<div class="post-date">
<div class="left"><?php echo get_avatar($comment, 14); ?> <span class="loud"><?php comment_author_link() ?></span> - <?php comment_date('F jS, Y') ?> at <?php comment_time() ?><?php if ( $depth < $args['max_depth'] ) : ?> <span class="text-separator">|</span> <?php comment_reply_link(array_merge($args, array('reply_text' => 'Reply »', 'depth' => $depth, 'max_depth' => $args['max_depth']))); ?><?php endif; ?></div>
<div class="right"><?php edit_comment_link('Edit', '', ' <span class="text-separator">|</span> '); ?><a href="#comment-<?php comment_ID() ?>" title="Permanent link to this reply">#<?php comment_ID() ?></a></div>
<div class="clearer"> </div>
</div>
<?php if ( $comment->comment_approved == '0' ) : ?>
<p><em>Your comment is awaiting moderation.</em></p>
<?php endif; ?>
<div class="comment-text">
<?php comment_text(); ?>
<div class="clearer"> </div>
</div>
</div>
</div>
<?php endif; ?>
<?php
}
/*
Page navigation
----------------------------------------------------------------- */
function sm_page_navigation($object_type, $position=false)
{
if ( $object_type == 'comments' )
{
$next = get_next_comments_link();
$prev = get_previous_comments_link();
}
else if ( $object_type == 'archive' )
{
$next = get_next_posts_link();
$prev = get_previous_posts_link();
}
if ( $next || $prev ) {
if ( !$next ) $next = ' ';
if ( !$prev ) $prev = ' ';
?>
<div class="pagination <?php echo $object_type; ?>-pagination <?php if ( $position ) : ?>pagination-<?php echo $position; endif; ?>">
<div class="left"><?php echo $prev; ?> </div>
<div class="right"> <?php echo $next; ?></div>
<div class="clearer"> </div>
</div>
<?php
}
else {
echo '<div class="archive-separator"></div>' . "\n";
}
}
/*------------------Admin Panel Customizations-------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------*/
add_action( 'login_head', 'custom_login_css' );
function custom_login_css() {
echo '<link rel="stylesheet" href="' . get_stylesheet_directory_uri() . '/admin-styles.css" type="text/css" media="all" />';
}
//Only load if in admin panel--
if ( is_admin() ) : // why execute all the code below at all if we're not in admin?
//----Call in custom admin stylesheet - this will be global for admin and also login
add_action( 'admin_print_styles', 'load_custom_admin_css' );
function load_custom_admin_css() {
wp_enqueue_style( 'custom_admin_css', get_stylesheet_directory_uri() . '/admin-styles.css' );
}
//---overriding footer "credit" text
add_filter( 'admin_footer_text', 'custom_footer_text' );
function custom_footer_text($default_text) {
return '<span id="footer-thankyou">Site managed by <a href="http://home.obu.edu/itservices/">OBU IT Services</a><span> | Powered by <a href="http://www.wordpress.org">WordPress</a>';
}
//REMOVE menu items------------------------------------------------------------
add_action( 'admin_menu', 'my_admin_menu' );
function my_admin_menu() {
remove_menu_page('link-manager.php'); //remove Links
remove_menu_page('edit.php'); //remove Posts
remove_menu_page('edit-comments.php'); //remove Comments
}
//REMOVE Widgets - cleaning up and customizing the dashboard-------------------
add_action('wp_dashboard_setup', 'custom_dashboard_widgets');
function custom_dashboard_widgets() {
global $wp_meta_boxes;
// remove unnecessary widgets
// var_dump( $wp_meta_boxes['dashboard'] ); // use to get all the widget IDs
unset(
$wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins'],
$wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary'],
$wp_meta_boxes['dashboard']['side']['core']['dashboard_primary'],
$wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links'],
$wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press'],
$wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments'],
$wp_meta_boxes['dashboard']['normal']['core']['tptn_pop_dashboard'],
$wp_meta_boxes['dashboard']['normal']['core']['tptn_pop_daily_dashboard']
);
//custom dashboard widgets
wp_add_dashboard_widget('dashboard_custom_feed', 'News from IT Services', 'dashboard_custom_feed_output'); //add new rss feed output
wp_add_dashboard_widget('custom_help_widget', 'Help and Support', 'custom_dashboard_help'); // add a new custom widget for help and support
}
function dashboard_custom_feed_output() {
echo '<div class="rss-widget">';
wp_widget_rss_output(array(
'url' => 'http://home2.obu.edu/itservices/feed',
'title' => 'OBU IT Services News',
'items' => 2,
'show_summary' => 1,
'show_author' => 0,
'show_date' => 1
));
echo "</div>";
}
function custom_dashboard_help() {
echo '
<p>Need help? That "help" tab up top provides contextual help throughout the administrative panel. If you need additional support, you can contact your web team at <a href="http://home2.obu.edu/itservices">IT Services</a>:</p>
<p><strong>phone:</strong> 870.245.5667</p>
<p><strong>email:</strong> <a href="mailto:webmaster@obu.edu">webmaster@obu.edu</a><p>
';
}
// ------Custom contextual help - tack on our support information to the end of the contextual help
add_filter( 'contextual_help', 'custom_help_support', 100 ); //giving a very late priority (100) to make sure it's always at the end (10 is default)
function custom_help_support($help) {
$help .= '
<p><strong>Additional support</strong> - Contact the web team at <a href="http://home2.obu.edu/itservices">OBU IT Services</a>
by phone at 870.245.5667 or by email at <a href="mailto:webmaster@obu.edu">webmaster@obu.edu</a>.<p>
';
return $help;
}
//-------Hijack the text translation an globally replace "post" with "article" in the admin.
/*--- not using right now--
add_filter( 'gettext', 'change_post_to_article' );
add_filter( 'ngettext', 'change_post_to_article' );
function change_post_to_article( $translated ) {
$translated = str_ireplace( 'Post', 'Article', $translated ); // ireplace is PHP5 only
return $translated;
}
---*/
//--------Eliminate some sidebar widgets we know the client will never use----------------
add_action( 'widgets_init', 'custom_remove_widgets' );
function custom_remove_widgets() {
unregister_widget( 'WP_Widget_Categories' );
unregister_widget( 'WP_Widget_Archives' );
unregister_widget( 'WP_Widget_Meta' );
unregister_widget( 'WP_Widget_Links' );
}
endif; //wrapper for admin functions
?>