<?php




function wp_pagination() {
global $wp_query;
$big = 12345678;
$page_format = paginate_links( array(
    'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
    'format' => '?paged=%#%',
    'current' => max( 1, get_query_var('paged') ),
    'total' => $wp_query->max_num_pages,
    'type'  => 'array'
) );
if( is_array($page_format) ) {
            $paged = ( get_query_var('paged') == 0 ) ? 1 : get_query_var('paged');
            echo '<div><ul>';
            echo '<li><span>'. $paged . ' &#1575;&#1586; ' . $wp_query->max_num_pages .'</span></li>';
            foreach ( $page_format as $page ) {
                    echo "<li>$page</li>";
            }
           echo '</ul></div>';
}
}



function the_content_limit($max_char, $more_link_text = '&#1575;&#1583;&#1575;&#1605;&#1607; ...', $stripteaser = 0, $more_file = '') {
$content = get_the_content($more_link_text, $stripteaser, $more_file);
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]&gt;', $content);
$content = strip_tags($content,'');
if (strlen($_GET['p']) > 0) {
echo "<p>";
echo $content;
echo "&nbsp;<a href='";
the_permalink();
echo "'>"."&#1575;&#1583;&#1575;&#1605;&#1607; &#1605;&#1591;&#1604;&#1576; &rarr;</a>";
echo "</p>";
}
else if ((strlen($content)>$max_char) && ($espacio = strpos($content, " ", $max_char ))) {
$content = mb_substr($content, 0, $espacio);
$content = $content;
echo "<p>";
echo $content;
echo "...";
echo "&nbsp;<a href='";
the_permalink();
echo "'>".$more_link_text."</a>";
echo "</p>";
}
else {
echo "<p>";
echo $content;
echo "&nbsp;<a href='";
the_permalink();
echo "'>"."&#1575;&#1583;&#1575;&#1605;&#1607; &#1605;&#1591;&#1604;&#1576; &rarr;</a>";
echo "</p>";
}
}

function register_foooter_menuen(){
	register_nav_menus(
		array(
			'foooter_menuen' =>__(' &#1605;&#1606;&#1608;&#1607;&#1575;&#1740; &#1575;&#1740;&#1606;&#1711;&#1604;&#1740;&#1587;&#1740; &#1662;&#1575;&#1574;&#1740;&#1606; ')
			)
		);
}

		add_action( 'iphorm_pre_process', array( &$this, 'notification_form' ) );

add_action('init','register_foooter_menuen');

function register_toop_menuen(){
	register_nav_menus(
		array(
			'toop_menuen' =>__('&#1605;&#1606;&#1608;&#1607;&#1575;&#1740; &#1575;&#1740;&#1606;&#1711;&#1604;&#1740;&#1587;&#1740; &#1576;&#1575;&#1604;&#1575;')
			)
		);
}
add_action('init','register_toop_menuen');

function register_top_menu(){
	register_nav_menus(
		array(
			'top_menu' =>__('&#1605;&#1606;&#1608;&#1607;&#1575;&#1740; &#1576;&#1575;&#1604;&#1575;')
			)
		);
}
add_action('init','register_top_menu');


function register_footer_menu(){
	register_nav_menus(
		array(
			'footer_menu' =>__('&#1605;&#1606;&#1608;&#1607;&#1575;&#1740; footer')
			)
		);
}


add_action('init','register_footer_menu');

function wpsaz_comment($comment, $args, $depth) {
$GLOBALS['comment'] = $comment; ?>
<li <?php comment_class(); ?>>
<div>
<div><?php echo get_avatar($comment,$size='74'); ?></div>
<div>
<?php printf(__('<span>&#1606;&#1608;&#1740;&#1587;&#1606;&#1583;&#1607; &#1583;&#1740;&#1583;&#1711;&#1575;&#1607;:</span> <cite>%s</cite>'), get_comment_author_link()) ?>
</div>
<?php if ($comment->comment_approved == '0') : ?><em><?php _e('Your comment is awaiting moderation.') ?></em><br /><?php endif; ?>
<div><?php printf(__('%1s'), get_comment_date(),  get_comment_time()) ?></div>
<?php comment_text() ?>
<div><?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?></div>
</div>
<?php
}


add_theme_support('post-thumbnails');
if ( function_exists('add_theme_support') ) {
add_theme_support('post-thumbnails');
}

function mrcodeirwp_scripts() {
	wp_enqueue_style( 'style', get_template_directory_uri().'/style.css', array(), '1.0' );
	wp_enqueue_script('jsname', get_template_directory_uri().'/scripts.js', array(), '1.3.2', false );

}



function mrcodeirwp_register_sidebars() {
$args = array(
	'name'          => 'Main Sidebar',
	'description'   => 'Main Sidebar',
	'before_widget' => '<div class="gadget">',
	'after_widget'  => '</div><!-- End Widget -->',
	'before_title'  => '<h2 class="star">',
	'after_title'   => '</h2>' );
	register_sidebar( $args );
	
$args = array(
	'name'          => 'Footer Sidebar 1',
	'description'   => 'Footer Sidebar 1',
	'before_widget' => '',
	'after_widget'  => '<!-- End Widget -->',
	'before_title'  => '<h2>',
	'after_title'   => '</h2>' );
	register_sidebar( $args );
	
$args = array(
	'name'          => 'Footer Sidebar 2',
	'description'   => 'Footer Sidebar 2',
	'before_widget' => '',
	'after_widget'  => '<!-- End Widget -->',
	'before_title'  => '<h2>',
	'after_title'   => '</h2>' );
	register_sidebar( $args );
	
$args = array(
	'name'          => 'Footer Sidebar 3',
	'description'   => 'Footer Sidebar 3',
	'before_widget' => '',
	'after_widget'  => '<!-- End Widget -->',
	'before_title'  => '<h2>',
	'after_title'   => '</h2>' );
	register_sidebar( $args );
}

add_action( 'widgets_init', 'mrcodeirwp_register_sidebars' );

function mw_admin_bar_remove() {
global $wp_admin_bar;
$wp_admin_bar->remove_menu('wp-logo');
}
add_action('wp_before_admin_bar_render', 'mw_admin_bar_remove', 0);



add_action('admin_menu','wphidenag');
function wphidenag() {
remove_action( 'admin_notices', 'update_nag', 3 );
}
