Sindbad~EG File Manager

Current Path : /var/www/html/wordpress_alg24news/wp-content/themes/newsbt-mobile/functions/helper/
Upload File :
Current File : /var/www/html/wordpress_alg24news/wp-content/themes/newsbt-mobile/functions/helper/post-meta.php

<?php
/*
 * Security 	: blocking direct access
 * Source		: http://codex.wordpress.org/Theme_Development#Template_Files
*/
defined('ABSPATH') or die("Access Restricted");

/*
 * Slider Hepler
 *
 * human readable format such as "1 hour", "5 mins", "2 days".
 *
*/
function mwp_slider_ago() {
	global $post;
	$time = get_post_time('G', true, $post);
	$time_diff = time() - $time;
	
    if( $time_diff > 0 && $time_diff < 6*60*60 ) { 	
		$display = sprintf(
		_x( '%s ago', '%s = human-readable time difference', MWP_TEXT_DOMAIN ),
		human_time_diff(get_the_time("U"), current_time("timestamp") )
		);
	} else {
        $display = get_the_time('j F Y');
	}
	echo $display;
}
/*
 * Post Meta
 *
 * Displays the post author
 *
*/
function mwp_posted_by() {  
	$author_string = sprintf( '<span class="postby"><a class="'.mwp_csa_color().'" href="%1$s" title="%2$s">%3$s</a></span>', 
		esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
		esc_attr( sprintf( esc_html__( 'View all posts by %s', MWP_TEXT_DOMAIN ), get_the_author() ) ),
		esc_html( get_the_author() )
	);
	$byline = sprintf( esc_html_x( '%s', 'post author', MWP_TEXT_DOMAIN ), $author_string );
	echo $byline;
}
/*
 * Post Meta
 *
 * human readable format such as "1 hour", "5 mins", "2 days".
 *
*/
function mwp_posted_ago() {
	echo get_the_time('j F Y');
}
function mwp_posted_ago_single() {
	global $post;
	$time = get_post_time('G', true, $post);
	$time_diff = time() - $time;
    if( $time_diff > 0 && $time_diff < 6*60*60 ) {
		$display = sprintf(
		_x( '%s ago', '%s = human-readable time difference', MWP_TEXT_DOMAIN ),
		human_time_diff(get_the_time("U"), current_time("timestamp") )
		);
    } else {
        $display = get_the_time('j F Y');
    }
	echo '<span class="post-ago">'.$display.'</span>';
}
/*
 * Post Meta
 *
 * Display Post Views count
 *
*/
function mwp_display_views() {  
	if(function_exists('the_views')) { 
		echo '<span>';
		the_views() .  _e( ' views', MWP_TEXT_DOMAIN );
		echo '</span>';
	} elseif ( class_exists( 'Jetpack' ) && Jetpack::is_module_active( 'stats' ) ) {
		echo '<span>';
			echo jp_get_page_views(get_the_ID()) .  __( ' views', MWP_TEXT_DOMAIN );
		echo '</span>';
	}
}
/*
 * Extract JetPack pageviews
 * courtesy of Topher: http://wpgr.org/2013/03/02/rendering-jetpack-stats/
 *
*/
function jp_get_page_views($post_id) {
	if( class_exists( 'MWP_JETPACK_POSTVIEWS' )){
		$views 	= MWP_JETPACK_POSTVIEWS::post_views( $post_id );
		$output = number_format_i18n($views);
		return apply_filters('jp_get_page_views', $output);
	}
}
/*
 * Post Meta
 *
 * Displays the post update date
 *
*/
function mwp_updated_on() { 
	$display = sprintf(
		_x( '%s ago', '%s = human-readable time difference', MWP_TEXT_DOMAIN ),
		human_time_diff(get_the_time("U"), current_time("timestamp") )
	);
	$modified 	= $display;
	$text		= __( 'Last Update : ', MWP_TEXT_DOMAIN );
	echo '<span class="last-update">'. esc_attr__($text . $modified) . '</span>';
}
/*
 * Post Meta
 *
*/
function mwp_display_postmeta($post_id) {
	echo '<div class="meta">';
	if (mwp_option('metapost-author') == 1) {
		mwp_posted_by();
	}
	if (mwp_option('metapost-date') == 1) {
		if (mwp_option('metapost-date-ago') == 1) {
			mwp_posted_ago_single();
		} else {
			mwp_posted_ago();
		}
	}
	if (mwp_option('metapost-views') == 1) {
		mwp_display_views();
	}
	if (mwp_option('metapost-update') == 1) {
		mwp_updated_on();
	}
	echo '</div>';
}

/*
 * Post Metadata 2
 * Date : human readable format
 *
*/
function mwp_posted_ago_2() {
	global $post;
	$time = get_post_time('G', true, $post);
	$time_diff = time() - $time;
	
	$display = sprintf(
		_x( '%s ago', '%s = human-readable time difference', MWP_TEXT_DOMAIN ),
		human_time_diff(get_the_time("U"), current_time("timestamp") )
	);
	echo $display;
}
/*
 * Post Metadata 2 (Author)
 *
*/
function mwp_posted_by_2() {  
	$author_string = sprintf( '<a class="'.mwp_csa_color().'" href="%1$s" title="%2$s">%3$s</a>', 
		esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
		esc_attr( sprintf( esc_html__( 'View all posts by %s', MWP_TEXT_DOMAIN ), get_the_author() ) ),
		esc_html( get_the_author() )
	);
	$byline = sprintf( esc_html_x( '%s', 'post author', MWP_TEXT_DOMAIN ), $author_string );
	echo $byline;
}
/*
 * Post Metadata 2 (Views)
 *
*/
function mwp_display_views_2() {  
	if(function_exists('the_views')) { 
		the_views() .  _e( ' views', MWP_TEXT_DOMAIN );
	} else {
		echo jp_get_page_views(get_the_ID());
	}
}
/*
 * Post Metadata 2 (Display)
 *
*/
function mwp_display_postmeta_photo($postid) {
	
	global $authordata;
	
	$img_blank 		= 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==';
	$article_ids 	= mwp_option('category-article');
	$source_name 	= mwp_option('author_name');
	$name 			= get_post_meta($postid, $source_name , true);
	
	if ( !empty($article_ids) && in_category($article_ids) ) {
		?>
		<div class="meta-2">
			<div class="photo">
			<?php 
			$size 			= 100;
			if(mwp_option('ac-thumbnail') == 1) {
				mwp_thumb_size('mwp_small', $size, $size, 'img-responsive' );
			} elseif(mwp_option('ac-thumbnail') == 2) { 
				$author_image 	= esc_url(get_the_author_meta('custom_avatar', get_the_author_meta('ID')));
				$author_name 	= esc_attr(get_the_author_meta('display_name', get_the_author_meta('ID')));
				$meta_image 	= mwp_option('author_photo');
				$print_image 	= esc_url(get_post_meta($postid, $meta_image, true));
				$meta_name 		= mwp_option('author_name');
				$print_name 	= esc_attr(get_post_meta($postid, $meta_name, true));
				
				if (!empty($print_image) && !empty($print_name)) {
					$chk_image = parse_url($print_image, PHP_URL_HOST);
					$chk_local = parse_url(get_bloginfo('url'), PHP_URL_HOST);
					if (mwp_option('thumbnail-type') == 8 && $chk_image == $chk_local) {
						$args 	= array(
							'resize' 	=> $size.','.$size,
							'quality' 	=> '100',
							'fit' 		=> ''
						);
						$author_image_output = jetpack_photon_url( $print_image, $args );
					} else {
						$author_image_output = $print_image;
					}			
					echo '<img class="img-responsive" alt="' .$print_name. '" src="' .$author_image_output. '" width="'.$size.'" height="'.$size.'">';
				} elseif (!empty($author_image) && !empty($author_name)) {
					$chk_image = parse_url($author_image, PHP_URL_HOST);
					$chk_local = parse_url(get_bloginfo('url'), PHP_URL_HOST);
					if (mwp_option('thumbnail-type') == 8 && $chk_image == $chk_local) {
						$args 	= array(
							'resize' 	=> $size.','.$size,
							'quality' 	=> '100',
							'fit' 		=> ''
						);
						$author_image_output = jetpack_photon_url( $author_image, $args );
					} else {
						$author_image_output = $author_image;
					}
					echo '<img class="img-responsive" alt="' .$author_name. '" src="' .$author_image_output. '" width="'.$size.'" height="'.$size.'" >';
				} elseif (function_exists('get_wp_user_avatar')) { 
					get_wp_user_avatar(get_the_author_meta( 'ID' ), $size);
				} elseif (function_exists('get_avatar')) { 
					echo '<img src="'.esc_url( get_avatar_url(get_the_author_meta( 'ID' ), array( 'size' => $size) )).'" alt="'.$author_name.'" />';
				}
			} ?>
			</div>
			<div class="info">
				<div>
					<?php
					esc_html_e( 'Published ', MWP_TEXT_DOMAIN ); 
					mwp_posted_ago_2(); 
					esc_html_e( ' on ', MWP_TEXT_DOMAIN );
					the_time('j F Y'); 
					if (mwp_option('metapost-views') == 1) : 
						?><i>-</i><?php mwp_display_views_2();
					endif; 
					?>
				</div>
				<?php 
				if (!empty($print_image) && !empty($print_name)) { 
					?>
					<div>
						<?php esc_html_e( 'By ', MWP_TEXT_DOMAIN ); ?>
						<strong class="<?php echo mwp_csa_color(); ?>">
							<?php echo mwp_tag_link_by_string($print_name); ?>
						</strong>
					</div>
					<?php 
				} else { 
					?>
					<div>
						<?php 
						esc_html_e( 'By ', MWP_TEXT_DOMAIN ); 
						mwp_posted_by_2(); 
						?>
						<ul class="author-profiles">
							<?php 
							if (!empty($authordata->twitter)) { 
								?>
								<li class="twitter">
									<a title="<?php esc_html_e( 'Twitter', MWP_TEXT_DOMAIN ); ?>" href="<?php echo esc_url($authordata->twitter); ?>" rel="noopener">
										<i class="fa fa-twitter"></i>
									</a>
								</li>
								<?php 
							}
							if (!empty($authordata->facebook)) { 
								?>
								<li class="facebook">
									<a title="<?php esc_html_e( 'Facebook', MWP_TEXT_DOMAIN ); ?>" href="<?php echo esc_url($authordata->facebook); ?>" rel="noopener">
										<i class="fa fa-facebook-official"></i>
									</a>
								</li>
								<?php 
							} ?>
						</ul>
					</div>
					<?php 
				} ?>
			</div>
			<?php 
			if(function_exists('ec_stars_rating')) {
				ec_stars_rating();
			} ?>
		</div>
		<?php
	} else {
		?>
		<div class="meta-2">
			<div class="photo">
			<?php 
			$size 			= 100;
			$img_blank 		= 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==';			
			$get_author_id 	= get_the_author_meta('ID');
			$get_author_img = esc_url(get_avatar_url($get_author_id, array('size' => $size)));
			$author_image 	= esc_url(get_the_author_meta('custom_avatar', get_the_author_meta('ID')));
			$author_name 	= esc_attr(get_the_author_meta('display_name', get_the_author_meta('ID')));
			
			if (!empty($author_image)) {
				$chk_image = parse_url($author_image, PHP_URL_HOST);
				$chk_local = parse_url(get_bloginfo('url'), PHP_URL_HOST);
					if (mwp_option('thumbnail-type') == 8 && $chk_image == $chk_local) {
						$args 	= array(
							'resize' 	=> $size.','.$size,
							'quality' 	=> '100',
							'fit' 		=> ''
					);
					$author_image_output = jetpack_photon_url( $author_image, $args );
				} else {
					$author_image_output = $author_image;
				}
				?><img src="<?php echo $author_image_output; ?>" alt="<?php echo $author_name; ?>" width="<?php echo $size; ?>" height="<?php echo $size; ?>"/><?php
			} else {
				?><img src="<?php echo $get_author_img; ?>" alt="<?php echo $author_name; ?>" width="<?php echo $size; ?>" height="<?php echo $size; ?>"/><?php
			}
			?>
			</div>
			<div class="info">
				<div>
					<?php  
					esc_html_e( 'Published ', MWP_TEXT_DOMAIN );
					mwp_posted_ago_2();
					esc_html_e( ' on ', MWP_TEXT_DOMAIN );
					the_time('j F Y');
					if (mwp_option('metapost-views') == 1) : 
						?><i>-</i><?php mwp_display_views_2();
					endif; 
					?>
				</div>
				<div>
					<?php 
					esc_html_e( 'By ', MWP_TEXT_DOMAIN );
					mwp_posted_by_2();
					?>
					<ul class="author-profiles">
						<?php 
						if (!empty($authordata->twitter)) { 
							?>
							<li class="twitter">
								<a title="<?php esc_html_e( 'Twitter', MWP_TEXT_DOMAIN ); ?>" href="<?php echo esc_url($authordata->twitter); ?>" rel="noopener">
									<i class="fa fa-twitter"></i>
								</a>
							</li><?php 
						}
						if (!empty($authordata->facebook)) { 
							?>
							<li class="facebook">
								<a title="<?php esc_html_e( 'Facebook', MWP_TEXT_DOMAIN ); ?>" href="<?php echo esc_url($authordata->facebook); ?>" rel="noopener">
									<i class="fa fa-facebook-official"></i>
								</a>
							</li><?php 
						} ?>
					</ul>
				</div>
			</div>
			<?php 
			if(function_exists('ec_stars_rating')) {
				ec_stars_rating();
			} ?>
		</div>
		<?php
	}
}
/*
 * Post Info
 *
 * Microformat Helper (SEO)
 * 
*/
function mwp_meta_hidden() { 
	$published 		= get_the_time('c');
	$published2 	= get_the_time('Y-m-d');
	$modified 		= get_the_modified_time('c');
	$modified2 		= get_the_modified_time('Y-m-d');
	$author_string 	= sprintf( '<div class="author vcard meta-hidden"><strong class="fn"><a href="%1$s" title="%2$s">%3$s</a></strong></div>', 
		esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
		esc_attr( sprintf( esc_html__( 'View all posts by %s', MWP_TEXT_DOMAIN ), get_the_author() ) ),
		esc_html( get_the_author() )
	);
	$byline = sprintf( esc_html_x( '%s', 'post author', MWP_TEXT_DOMAIN ), $author_string );
	echo '<div class="meta-hidden">';
		echo $byline;
		if ( get_the_modified_time( 'U' ) > get_the_time( 'U' ) ) {
			echo '<div class="published">'.$published. '</div>';
			echo '<div class="updated">'.$modified. '</div>';
		} else {
			echo '<time class="published updated" datetime="'.$published. '">'.$published. '</time>';
		}
		the_category( '&bull;' );
	echo '</div>';
}
/*
 * Custom Archive
 *
 * Microformat Helper (SEO)
 * 
*/
function mwp_meta_hidden_table() {
	$published 		= get_the_time('c');
	$published2 	= get_the_time('Y-m-d');
	$modified 		= get_the_modified_time('c');
	$modified2 		= get_the_modified_time('Y-m-d');
	$author_string 	= sprintf( '<div class="author vcard meta-hidden"><strong class="fn"><a href="%1$s" title="%2$s">%3$s</a></strong></div>', 
		esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
		esc_attr( sprintf( esc_html__( 'View all posts by %s', MWP_TEXT_DOMAIN ), get_the_author() ) ),
		esc_html( get_the_author() )
	);
	$byline = sprintf( esc_html_x( '%s', 'post author', MWP_TEXT_DOMAIN ), $author_string );
	echo '<td class="meta-hidden">';
	echo $byline;
	if ( get_the_modified_time( 'U' ) > get_the_time( 'U' ) ) {
		echo '<div class="meta-hidden"><time class="published" datetime="'.$published. '">'.$published. '</time></div>';
		echo '<div class="meta-hidden"><time class="updated" datetime="'.$modified. '">'.$modified. '</time></div>';
	} else {
		echo '<div class="meta-hidden"><time class="published updated" datetime="'.$published. '">'.$published. '</time></div>';
	}
	?><div class="meta-hidden"><?php the_category( '&bull;' ); ?></div><?php
	echo '</td>';
}
/*
 * Article Generate Posts List From Tag Name
 *
*/
function mwp_tag_link_by_string($string) {
	if(!empty($string) && mwp_option('ac-name') == 3 ) {
		$link = '<a href="' .esc_url(home_url('/')) .'?tag='.str_replace(' ', '-', $string). '">'.$string.'</a>';
	} else {
		$link = $string;
	}
	return $link;
}

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists