HEX
Server: Apache/2
System: Linux localhost 5.4.0-131-generic #147-Ubuntu SMP Fri Oct 14 17:07:22 UTC 2022 x86_64
User: rasad (1007)
PHP: 7.4.33
Disabled: shell_exec,system,passthru,exec,popen,ini_restore,socket_create,socket_create_listen,socket_create_pair,socket_listen,socket_bind,symlink,link,pfsockopen,ini_alter,dl,pcntl_exec,pcntl_fork,proc_close,proc_open,proc_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_uname,show_source,getfile,mkfifo
Upload Files
File: /home/rasad/domains/rasadeardakan.ir/private_html/wp-content/themes/ofogh/myfunctions.php
<?php
/*-----------------------------------------------------------------------------------*/
/* Get url field
/*-----------------------------------------------------------------------------------*/
add_filter('comment_form_default_fields', 'unset_url_field');
function unset_url_field($fields){
    if(isset($fields['url']))
       unset($fields['url']);
       return $fields;
}
/*-----------------------------------------------------------------------------------*/
/* Get email posts
/*-----------------------------------------------------------------------------------*/
function direct_email($text="ارسال نوشته"){
global $post;
$title = htmlspecialchars($post->post_title);
$subject = 'Sur '.htmlspecialchars(get_bloginfo('name')).' : '.$title;
$body = 'I recommend this page : '.$title.'. You can read it on : '.get_permalink($post->ID);
$link = '<a class="tooltip tooltip-left" data-iro=" ارسال نوشته" href="mailto:?subject='.rawurlencode($subject).'&amp;body='.rawurlencode($body).'">'.$text.'<i class="fa fa-envelope" aria-hidden="true" style="font-size: 32px;"></i></a>';
return $link;
}
/*-----------------------------------------------------------------------------------*/
/* Get menus posts
/*-----------------------------------------------------------------------------------*/
	function reg_menu() {
		register_nav_menus(
			array(
			    'top-nav' => "هدر",
				'fot-nav' => "فوتر",
				'mob-nav' => "موبایل"
			)
		);
	}
	add_action( 'init', 'reg_menu' );
/*-----------------------------------------------------------------------------------*/
/* Get thumbnails posts
/*-----------------------------------------------------------------------------------*/
if ( function_exists('add_theme_support') ) {
add_theme_support('post-thumbnails');
add_image_size('medium', 400, 300, true, array( 'center', 'center' ) );
add_image_size('big', 800, 600, true, array( 'center', 'center' ) );
}
/*-----------------------------------------------------------------------------------*/
/* Get PostViews
/*-----------------------------------------------------------------------------------*/
function getPostViews($postID){
$count_key = 'post_views_count';
$count = get_post_meta($postID, $count_key, true);
if($count==''){
delete_post_meta($postID, $count_key);
add_post_meta($postID, $count_key, '0');
return "0 بازدید";
}
return $count.' بازدید';
}
function setPostViews($postID) {
$count_key = 'post_views_count';
$count = get_post_meta($postID, $count_key, true);
if($count==''){
$count = 0;
delete_post_meta($postID, $count_key);
add_post_meta($postID, $count_key, '0');
}else{
$count++;
update_post_meta($postID, $count_key, $count);
}
}
remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0);
/*-----------------------------------------------------------------------------------*/
/* Get sidebar
/*-----------------------------------------------------------------------------------*/
	register_sidebar( array(
		'name'          => 'صفحه اصلی',
		'id'            => 'sidebar',
		'description'   => 'سایدبار اصلی سمت چپ',
		'before_widget' => '<div class="sidebar-box">',
		'before_title'  => '<div class="sidebar-title"><h3>',
		'after_title'   => '</h3></div>',
		'after_widget'  => '</div>',
    ));
	register_sidebar( array(
		'name'          => 'برگه نوشته',
		'id'            => 'post',
		'description'   => 'سایدبار اصلی سمت چپ',
		'before_widget' => '<div class="sidebar-box">',
		'before_title'  => '<div class="sidebar-title"><h3>',
		'after_title'   => '</h3></div>',
		'after_widget'  => '</div>',
    ));	
	register_sidebar( array(
		'name'          => 'ویدئو',
		'id'            => 'video',
		'description'   => 'سایدبار صفحه ویدئو',
		'before_widget' => '<div class="sidebar-box">',
		'before_title'  => '<div class="sidebar-title"><h3>',
		'after_title'   => '</h3></div>',
		'after_widget'  => '</div>',
    ));
	register_sidebar( array(
		'name'          => 'عکس',
		'id'            => 'gallery',
		'description'   => 'سایدبار صفحه عکس',
		'before_widget' => '<div class="sidebar-box">',
		'before_title'  => '<div class="sidebar-title"><h3>',
		'after_title'   => '</h3></div>',
		'after_widget'  => '</div>',
    ));		
/*-----------------------------------------------------------------------------------*/
/* Get pagination posts
/*-----------------------------------------------------------------------------------*/
function qaleb_numeric_posts_nav() {
 
    if( is_singular() )
        return;
 
    global $wp_query;
 
    /** Stop execution if there's only 1 page */
    if( $wp_query->max_num_pages <= 1 ) return; $paged = get_query_var( 'paged' ) ? absint( get_query_var( 'paged' ) ) : 1; $max = intval( $wp_query->max_num_pages );
 
    /** Add current page to the array */
    if ( $paged >= 1 )
        $links[] = $paged;
 
    /** Add the pages around the current page to the array */
    if ( $paged >= 3 ) {
        $links[] = $paged - 1;
        $links[] = $paged - 2;
    }
 
    if ( ( $paged + 2 ) <= $max ) {
        $links[] = $paged + 2;
        $links[] = $paged + 1;
    }
 
    echo '
<div class="navigation">
<ul>' . "\n";
 
    /** Previous Post Link */
    if ( get_previous_posts_link() )
        printf( '
<li>%s</li>
 
' . "\n", get_previous_posts_link() );
 
    /** Link to first page, plus ellipses if necessary */
    if ( ! in_array( 1, $links ) ) {
        $class = 1 == $paged ? ' class="active"' : '';
 
        printf( '<li%s><a href="%s">%s</a></li>
 
' . "\n", $class, esc_url( get_pagenum_link( 1 ) ), '1' );
 
        if ( ! in_array( 2, $links ) )
            echo '
<li>…</li>
 
';
    }
 
    /** Link to current page, plus 2 pages in either direction if necessary */
    sort( $links );
    foreach ( (array) $links as $link ) {
        $class = $paged == $link ? ' class="active"' : '';
        printf( '<li%s><a href="%s">%s</a></li>
 
' . "\n", $class, esc_url( get_pagenum_link( $link ) ), $link );
    }
 
    /** Link to last page, plus ellipses if necessary */
    if ( ! in_array( $max, $links ) ) {
        if ( ! in_array( $max - 1, $links ) )
            echo '
<li>…</li>
 
' . "\n";
 
        $class = $paged == $max ? ' class="active"' : '';
        printf( '<li%s><a href="%s">%s</a></li>
 
' . "\n", $class, esc_url( get_pagenum_link( $max ) ), $max );
    }
 
    /** Next Post Link */
    if ( get_next_posts_link() )
        printf( '
<li>%s</li>
 
' . "\n", get_next_posts_link() );
 
    echo '</ul>
</div>
 
' . "\n";
 
}