403Webshell
Server IP : 217.160.0.15  /  Your IP : 216.73.216.30
Web Server : Apache
System : Linux info 3.0 #1337 SMP Tue Jan 01 00:00:00 CEST 2000 all GNU/Linux
User : u37981780 ( 1696858)
PHP Version : 8.2.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /homepages/43/d124547881/htdocs/app395378437/wp-content/themes/sonar/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /homepages/43/d124547881/htdocs/app395378437/wp-content/themes/sonar//functions.php
<?php
/**
 * sonar functions and definitions
 *
 * When using a child theme (see http://codex.wordpress.org/Theme_Development and
 * http://codex.wordpress.org/Child_Themes), you can override certain functions
 * (those wrapped in a function_exists() call) by defining them first in your child theme's
 * functions.php file. The child theme's functions.php file is included before the parent
 * theme's file, so the child theme functions would be used.
 *
 */

/**
 * Set the content width based on the theme's design and stylesheet.
 */
if ( ! isset( $content_width ) )
	$content_width = 640;

/** Tell WordPress to run sonar_setup() when the 'after_setup_theme' hook is run. */
add_action( 'after_setup_theme', 'sonar_setup' );

if ( ! function_exists( 'sonar_setup' ) ):
/**
 * Sets up theme defaults and registers support for various WordPress features.
 */
function sonar_setup() {

	// This theme styles the visual editor with editor-style.css to match the theme style.
	add_editor_style();

	// Post Format support. You can also use the legacy "gallery", "status" or "asides" categories.
	add_theme_support( 'post-formats', array( 'aside', 'gallery', 'status' ) );

	// This theme uses post thumbnails
	add_theme_support( 'post-thumbnails' );

	// Add default posts and comments RSS feed links to head
	add_theme_support( 'automatic-feed-links' );

	// Translations can be filed in the /languages/ directory
	load_theme_textdomain( 'sonar', TEMPLATEPATH . '/languages' );

	$locale = get_locale();
	$locale_file = TEMPLATEPATH . "/languages/$locale.php";
	if ( is_readable( $locale_file ) )
		require_once( $locale_file );

	// wp_nav_menu().
	register_nav_menus( array(
		'primary' => __( 'Primary Navigation', 'sonar' ),
	) );

	// Custom background
	add_custom_background();

	// Your changeable header business starts here
	if ( ! defined( 'HEADER_TEXTCOLOR' ) )
		define( 'HEADER_TEXTCOLOR', '' );

	// No CSS, just IMG call. The %s is a placeholder for the theme template directory URI.
	if ( ! defined( 'HEADER_IMAGE' ) )
		define( 'HEADER_IMAGE', '%s/images/headers/transparent.png' );

	// The height and width of your custom header. You can hook into the theme's own filters to change these values.
	// Add a filter to sonar_header_image_width and sonar_header_image_height to change these values.
	define( 'HEADER_IMAGE_WIDTH', apply_filters( 'sonar_header_image_width', 940 ) );
	define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'sonar_header_image_height', 110 ) );

	// Larger images will be auto-cropped to fit, smaller ones will be ignored. See header.php.
	set_post_thumbnail_size( HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT, true );

	// Don't support text inside the header image.
	if ( ! defined( 'NO_HEADER_TEXT' ) )
		define( 'NO_HEADER_TEXT', true );

	// Add a way for the custom header to be styled in the admin panel that controls
	add_custom_image_header( '', 'sonar_admin_header_style' );

	// Default custom headers packaged with the theme. %s is a placeholder for the theme template directory URI.
	register_default_headers( array(
		'transparent' => array(
			'url' => '%s/images/headers/transparent.png',
			'thumbnail_url' => '%s/images/headers/transparent-thumbnail.png',
			/* translators: header image description */
			'description' => __( 'Transparent', 'sonar' )
		),
		'sonarflower' => array(
			'url' => '%s/images/headers/sonarflower.png',
			'thumbnail_url' => '%s/images/headers/sonarflower-thumbnail.png',
			/* translators: header image description */
			'description' => __( 'Sonar Flower Sketch', 'sonar' )
		),
		'purpleorb' => array(
			'url' => '%s/images/headers/purpleorb.png',
			'thumbnail_url' => '%s/images/headers/purpleorb-thumbnail.png',
			/* translators: header image description */
			'description' => __( 'Purple Orb', 'sonar' )
		),
		'cherryblossom' => array(
			'url' => '%s/images/headers/cherryblossoms.jpg',
			'thumbnail_url' => '%s/images/headers/cherryblossoms-thumbnail.jpg',
			/* translators: header image description */
			'description' => __( 'Cherry Blossoms', 'sonar' )
		),
		'fern' => array(
			'url' => '%s/images/headers/fern.jpg',
			'thumbnail_url' => '%s/images/headers/fern-thumbnail.jpg',
			/* translators: header image description */
			'description' => __( 'Fern', 'sonar' )
		),
		'forestfloor' => array(
			'url' => '%s/images/headers/forestfloor.jpg',
			'thumbnail_url' => '%s/images/headers/forestfloor-thumbnail.jpg',
			/* translators: header image description */
			'description' => __( 'Forest Floor', 'sonar' )
		),
		'inkwell' => array(
			'url' => '%s/images/headers/inkwell.jpg',
			'thumbnail_url' => '%s/images/headers/inkwell-thumbnail.jpg',
			/* translators: header image description */
			'description' => __( 'Inkwell', 'sonar' )
		),
		'sunset' => array(
			'url' => '%s/images/headers/sunset.jpg',
			'thumbnail_url' => '%s/images/headers/sunset-thumbnail.jpg',
			/* translators: header image description */
			'description' => __( 'Sunset', 'sonar' )
		)
	) );
}
endif;

if ( ! function_exists( 'sonar_admin_header_style' ) ) :
/**
 * Styles the header image displayed on the Appearance > Header admin panel.
 */
function sonar_admin_header_style() {
?>
<style type="text/css">
/* Shows the same border as on front end */
#headimg {
	border-bottom: 0px solid #000;
	border-top: 0px solid #000;
}
/* If NO_HEADER_TEXT is false, you would style the text with these selectors:
	#headimg #name { }
	#headimg #desc { }
*/
</style>
<?php
}
endif;

// Clicky Analytics 
function sonar_clicky_script() {
	$options = get_option('sonar_theme_options');

	if ( isset ($options['sonar_clicky_site_id']) &&  ($options['sonar_clicky_site_id']!="") && !is_preview() ) { ?>

	<script type="text/javascript">
	var clicky_site_ids = clicky_site_ids || [];
	clicky_site_ids.push(<?php echo $options['sonar_clicky_site_id']; ?>);
	(function() {
	  var s = document.createElement('script');
	  s.type = 'text/javascript';
	  s.async = true;
	  s.src = '//static.getclicky.com/js';
	  ( document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0] ).appendChild( s );
	})();
	</script>
	<noscript><p><img alt="Clicky" width="1" height="1" src="http://in.getclicky.com/<?php echo $options['sonar_clicky_site_id']; ?>ns.gif" /></p></noscript>
	<!-- End Clicky Tracking -->
<?php
	}
}
add_action('wp_footer','sonar_clicky_script',90);

/**
 * Get our wp_nav_menu() fallback, wp_page_menu(), to show a home link.
 */
function sonar_page_menu_args( $args ) {
	$args['show_home'] = true;
	return $args;
}
add_filter( 'wp_page_menu_args', 'sonar_page_menu_args' );

/**
 * Sets the post excerpt length to 40 characters.
 */
function sonar_excerpt_length( $length ) {
	return 40;
}
add_filter( 'excerpt_length', 'sonar_excerpt_length' );

/**
 * Returns a "Read More" link for excerpts.
 */
function sonar_excerpt_reading_link() {
	return ' <a href="'. get_permalink() . '">' . __( 'Read More <span class="meta-nav">&rarr;</span>', 'sonar' ) . '</a>';
}

/**
 * Replaces "[...]" (appended to automatically generated excerpts) with an ellipsis and sonar_excerpt_reading_link().
 */
function sonar_auto_excerpt_more( $more ) {
	return ' &hellip;' . sonar_excerpt_reading_link();
}
add_filter( 'excerpt_more', 'sonar_auto_excerpt_more' );

/**
 * Adds a pretty "Read More" link to custom post excerpts.
 */
function sonar_custom_excerpt_more( $output ) {
	if ( has_excerpt() && ! is_attachment() ) {
		$output .= sonar_excerpt_reading_link();
	}
	return $output;
}
add_filter( 'get_the_excerpt', 'sonar_custom_excerpt_more' );

/**
 * Remove inline styles printed when the gallery shortcode is used.
 *
 * Galleries are styled by the theme in Sonar's style.css. This is just
 * a simple filter call that tells WordPress to not use the default styles.
 */
add_filter( 'use_default_gallery_style', '__return_false' );

/**
 * Deprecated way to remove inline styles printed when the gallery shortcode is used.
 */
function sonar_remove_gallery_css( $css ) {
	return preg_replace( "#<style type='text/css'>(.*?)</style>#s", '', $css );
}
// Backwards compatibility with WordPress 3.0.
if ( version_compare( $GLOBALS['wp_version'], '3.1', '<' ) )
	add_filter( 'gallery_style', 'sonar_remove_gallery_css' );

if ( ! function_exists( 'sonar_comment' ) ) :
/**
 * Template for comments and pingbacks.
 */
function sonar_comment( $comment, $args, $depth ) {
	$GLOBALS['comment'] = $comment;
	switch ( $comment->comment_type ) :
		case 'pingback' :
		case 'trackback' :
	?>
	<li class="post pingback">
		<p><?php _e( 'Pingback:', 'sonar' ); ?> <?php comment_author_link(); ?><?php edit_comment_link( __( '(Edit)', 'sonar' ), ' ' ); ?></p>
	<?php
			break;
		default :
	?>
	<li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
		<article id="comment-<?php comment_ID(); ?>" class="comment">
			<footer class="comment-meta">
				<div class="comment-author vcard">
					<?php
						$avatar_size = 68;
						if ( '0' != $comment->comment_parent )
							$avatar_size = 39;

						echo get_avatar( $comment, $avatar_size );

						printf( __( '%1$s on %2$s%3$s at %4$s%5$s <span class="says">said:</span>', 'sonar' ),
							sprintf( '<span class="fn">%s</span>', get_comment_author_link() ),
							'<a href="' . esc_url( get_comment_link( $comment->comment_ID ) ) . '"><time pubdate datetime="' . get_comment_time( 'c' ) . '">',
							get_comment_date(),
							get_comment_time(),
							'</time></a>'
						);
					?>

					<?php edit_comment_link( __( '[Edit]', 'sonar' ), ' ' ); ?>
				</div><!-- .comment-author .vcard -->

				<?php if ( $comment->comment_approved == '0' ) : ?>
					<em class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.', 'sonar' ); ?></em>
					<br />
				<?php endif; ?>

			</footer>

			<div class="comment-content"><?php comment_text(); ?></div>

			<div class="reply">
				<?php comment_reply_link( array_merge( $args, array( 'reply_text' => __( 'Reply &darr;', 'sonar' ), 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
			</div><!-- .reply -->
		</article><!-- #comment-## -->

	<?php
			break;
	endswitch;
}
endif; // ends check for sonar_comment()

/**
 * Register widgetized areas, including two sidebars and three widget-ready columns in the footer.
 */
function sonar_widgets_init() {
	// Area 1, located at the top of the sidebar.
	register_sidebar( array(
		'name' => __( 'Primary Widget Area', 'sonar' ),
		'id' => 'primary-widget-area',
		'description' => __( 'The primary widget area', 'sonar' ),
		'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
		'after_widget' => '</li>',
		'before_title' => '<h3 class="widget-title">',
		'after_title' => '</h3>',
	) );

	// Area 2, located below the Primary Widget Area in the sidebar. Empty by default.
	register_sidebar( array(
		'name' => __( 'Secondary Widget Area', 'sonar' ),
		'id' => 'secondary-widget-area',
		'description' => __( 'The secondary widget area', 'sonar' ),
		'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
		'after_widget' => '</li>',
		'before_title' => '<h3 class="widget-title">',
		'after_title' => '</h3>',
	) );

	// Area 3, located in the footer. Empty by default.
	register_sidebar( array(
		'name' => __( 'First Footer Widget Area', 'sonar' ),
		'id' => 'first-footer-widget-area',
		'description' => __( 'The first footer widget area', 'sonar' ),
		'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
		'after_widget' => '</li>',
		'before_title' => '<h3 class="widget-title">',
		'after_title' => '</h3>',
	) );

	// Area 4, located in the footer. Empty by default.
	register_sidebar( array(
		'name' => __( 'Second Footer Widget Area', 'sonar' ),
		'id' => 'second-footer-widget-area',
		'description' => __( 'The second footer widget area', 'sonar' ),
		'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
		'after_widget' => '</li>',
		'before_title' => '<h3 class="widget-title">',
		'after_title' => '</h3>',
	) );

	// Area 5, located in the footer. Empty by default.
	register_sidebar( array(
		'name' => __( 'Third Footer Widget Area', 'sonar' ),
		'id' => 'third-footer-widget-area',
		'description' => __( 'The third footer widget area', 'sonar' ),
		'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
		'after_widget' => '</li>',
		'before_title' => '<h3 class="widget-title">',
		'after_title' => '</h3>',
	) );
}
/** Register sidebars by running sonar_widgets_init() on the widgets_init hook. */
add_action( 'widgets_init', 'sonar_widgets_init' );

/**
 * Removes the default styles that are packaged with the Recent Comments widget.
 */
function sonar_remove_recent_comments_style() {
	add_filter( 'show_recent_comments_widget_style', '__return_false' );
}
add_action( 'widgets_init', 'sonar_remove_recent_comments_style' );

if ( ! function_exists( 'sonar_posted_on' ) ) :
/**
 * Prints HTML with meta information for the current post-date/time and author.
 */
function sonar_posted_on() {
	printf( __( '<span class="%1$s">Posted on</span> %2$s <span class="meta-sep">by</span> %3$s', 'sonar' ),
		'meta-prep meta-prep-author',
		sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"><span class="entry-date">%3$s</span></a>',
			get_permalink(),
			esc_attr( get_the_time() ),
			get_the_date()
		),
		sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s">%3$s</a></span>',
			get_author_posts_url( get_the_author_meta( 'ID' ) ),
			sprintf( esc_attr__( 'View all posts by %s', 'sonar' ), get_the_author() ),
			get_the_author()
		)
	);
}
endif;

if ( ! function_exists( 'sonar_posted_in' ) ) :
/**
 * Prints HTML with meta information for the current post (category, tags and permalink).
 */
function sonar_posted_in() {
	// Retrieves tag list of current post, separated by commas.
	$tag_list = get_the_tag_list( '', ', ' );
	if ( $tag_list ) {
		$posted_in = __( 'This entry was posted in %1$s and tagged %2$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'sonar' );
	} elseif ( is_object_in_taxonomy( get_post_type(), 'category' ) ) {
		$posted_in = __( 'This entry was posted in %1$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'sonar' );
	} else {
		$posted_in = __( 'Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'sonar' );
	}
	// Prints the string, replacing the placeholders.
	printf(
		$posted_in,
		get_the_category_list( ', ' ),
		$tag_list,
		get_permalink(),
		the_title_attribute( 'echo=0' )
	);
}
endif;

function sonar_page_menu() {
    /* handle sf-menu for wp_page_menu */
    $menu = wp_page_menu(array('echo' => false));
	if ( isset ($sonar_options['sonar_remove_superfish'])) {
	echo $menu;
	}
	else {
	$ulpos = stripos($menu, '<ul>');
	if ($ulpos !== false) {
	    echo substr_replace($menu, '<ul class="sf-menu">',$ulpos, 4);
	}
    }
} 

function sonar_pagination($pages = '', $range = 3)
{	/* handle pagination for post pages*/
     $showitems = ($range * 2)+1;  
 
     global $paged;
     if(empty($paged)) $paged = 1;
 
     if($pages == '')
     {
         global $wp_query;
         $pages = $wp_query->max_num_pages;
         if(!$pages)
         {
             $pages = 1;
         }
     }   
 
     if(1 != $pages)
     {
         echo "<div class=\"pagination\"><span>Page ".$paged." of ".$pages."</span>";
         if($paged > 2 && $paged > $range+1 && $showitems < $pages) echo "<a href='".get_pagenum_link(1)."'>&laquo; First</a>";
         if($paged > 1 && $showitems < $pages) echo "<a href='".get_pagenum_link($paged - 1)."'>&lsaquo; Previous</a>";
 
         for ($i=1; $i <= $pages; $i++)
         {
             if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems ))
             {
                 echo ($paged == $i)? "<span class=\"current\">".$i."</span>":"<a href='".get_pagenum_link($i)."' class=\"inactive\">".$i."</a>";
             }
         }
 
         if ($paged < $pages && $showitems < $pages) echo "<a href=\"".get_pagenum_link($paged + 1)."\">Next &rsaquo;</a>";
         if ($paged < $pages-1 &&  $paged+$range-1 < $pages && $showitems < $pages) echo "<a href='".get_pagenum_link($pages)."'>Last &raquo;</a>";
         echo "</div>\n";
     }
}
/**
 * Where the post has no post title, but must still display a link to the single-page post view.
 */
add_filter('the_title', 'sonar_title');

function sonar_title($title) {
    if ($title == '') {
        return 'Untitled';
    } else {
        return $title;
    }
}

//Retrieve Theme Options Data
global $sonar_options;
$sonar_options = get_option('sonar_theme_options');

// Add a link to the theme's options page in the admin bar
function sonar_wp_admin_bar_theme_options(){
	global $wp_admin_bar;
	$wp_admin_bar->add_menu(array(
								'parent' => 'appearance',
								'id' => 'sonar_options',
								'title' => 'Sonar Options',
								'href' => admin_url('themes.php?page=sonar-options')
							));
}
add_action( 'admin_bar_menu', 'sonar_wp_admin_bar_theme_options', 61 );

//Add Theme Options File
$functions_path = TEMPLATEPATH . '/admin/';
require_once ($functions_path . 'sonar-options.php');
require_once ($functions_path . 'sonar-custom-header.php');

//Add Widget File
$widgets_path = TEMPLATEPATH . '/widget/';
require_once($widgets_path . 'two-column-text.php');

//Redirect to Theme Options Page on Activation
if ( is_admin() && isset($_GET['activated'] ) && $pagenow =="themes.php" )
	wp_redirect( 'admin.php?page=sonar-options.php' );
?>

Youez - 2016 - github.com/yon3zu
LinuXploit