<?php
/**
 * @version    $Id$
 * @package    IT_Theme_Framework
 * @author     InnoThemes Team <support@innothemes.com>
 * @copyright  Copyright (C) 2012 InnoThemes.com. All Rights Reserved.
 * @license    GNU/GPL v2 or later http://www.gnu.org/licenses/gpl-2.0.html
 *
 * Websites: http://www.innothemes.com
 */

/**
 * Class to render theme.
 *
 * @package  IT_Theme_Framework
 * @since    1.0.0
 */
class IT_Theme_Render {
	/**
	 * Hook into WordPress.
	 *
	 * @return  void
	 */
	public static function hook() {
		// Load theme assets
		add_action( 'wp_enqueue_scripts', array( __CLASS__, 'load_assets' ) );

		// Load custom style
		if ( ! defined( 'WP_ADMIN' ) ) {
			self::custom_style();
		}
	}

	/**
	 * Print social icons.
	 *
	 * @param   string  $prefix  Parameter prefix.
	 *
	 * @return  void
	 */
	public static function social_icons( $prefix ) {
		// Localize the global theme options variable
		global $it_options;

		// Load template file
		include IT_Loader::get_path( 'tmpl/social-icons.php' );
	}

	/**
	 * Print comment.
	 *
	 * @param   object   $comment  Comment object.
	 * @param   array    $args     Arguments for reply link generation.
	 * @param   integer  $depth    Maximum level of nested reply.
	 *
	 * @return  void
	 */
	public static function comment( $comment, $args, $depth ) {
		// Localize the global theme options variable
		global $it_options;

		// Load template file
		include IT_Loader::get_path( 'tmpl/comment.php' );
	}

	/**
	 * Print related posts.
	 *
	 * @param   object  $post  Post object.
	 *
	 * @return  void
	 */
	public static function related_posts( $post ) {
		// Localize the global theme options variable
		global $it_options;

		// Load template file
		include IT_Loader::get_path( 'tmpl/related-posts.php' );
	}

	/**
	 * Print page navigation.
	 *
	 * @param   object  $nav_query  Navigation query object.
	 * @param   string  $nav        Type of page navigation.
	 *
	 * @return  void
	 */
	public static function page_navigation( $nav_query = false, $nav = false ) {
		// Localize the global theme options variable
		global $it_options;

		// Load template file
		include IT_Loader::get_path( 'tmpl/page-navigation.php' );
	}

	/**
	 * Print columns.
	 *
	 * @param   string  $prefix  Parameter prefix.
	 *
	 * @return  void
	 */
	public static function columns( $prefix ) {
		// Localize the global theme options variable
		global $it_options;

		// Load template file
		include IT_Loader::get_path( 'tmpl/columns.php' );
	}

	/**
	 * Magic method to load appropriated template file.
	 *
	 * @param   string  $name  Name of function to be called.
	 * @param   array   $args  Arguments to be passed.
	 *
	 * @return  mixed
	 */
	public static function __callStatic( $name, $args ) {
		if ( $tmpl = IT_Loader::get_path( "tmpl/{$name}.php" ) ) {
			// Localize the global theme options variable
			global $it_options;

			// Extract arguments array into local variables
			extract( $args );

			// Load template file
			include $tmpl;
		}
	}
}
