public static function process_theme_api($type) { $type = isset($_REQUEST['type']) && is_string($_REQUEST['type']) ? $_REQUEST['type'] : false; switch ($type) { case 'login': /** if logged */ if (theme_cache::is_user_logged_in()) { die(theme_features::json_format(['status' => 'error', 'code' => 'logged', 'msg' => ___('Sorry, you logged.')])); } /** email */ $email = isset($_REQUEST['user_email']) ? filter_var($_REQUEST['user_email'], FILTER_VALIDATE_EMAIL) : false; if (!$email) { die(theme_features::json_format(['status' => 'error', 'code' => 'invaild_email', 'msg' => ___('Sorry, the email is invaild, please try again.')])); } /** check password */ $pwd = isset($_REQUEST['user_pwd']) && is_string($_REQUEST['user_pwd']) ? $_REQUEST['user_pwd'] : false; if (!$pwd) { die(theme_features::json_format(['status' => 'error', 'code' => 'invaild_pwd', 'msg' => ___('Sorry, the password is invaild, please try again.')])); } $user = self::user_login(array('email' => $email, 'pwd' => $pwd, 'remember' => true)); if ($user['status'] === 'success') { $output = ['status' => 'success', 'msg' => ___('Login successfully'), 'user' => ['nicename' => theme_cache::get_the_author_meta('user_nicename', $user['user-id']), 'description' => theme_cache::get_the_author_meta('description', $user['user-id']), 'id' => $user['user-id'], 'avatar_url' => theme_cache::get_avatar_url($user['user-id']), 'display_name' => theme_cache::get_the_author_meta('display_name', $user['user-id'])]]; /** filter theme_api */ $output['user'] = apply_filters('theme_api_' . __CLASS__ . '_after_login_user_data', $output['user'], $user['user-id']); die(theme_features::json_format($output)); } else { die(theme_features::json_format($user)); } break; } }
public static function get_roles($user_id_or_role) { $roles = ['subscriber' => ['name' => ___('Author'), 'label' => 'default'], 'contributor' => ['name' => ___('Author'), 'label' => 'warning'], 'author' => ['name' => ___('Certification Author'), 'label' => 'primary'], 'editor' => ['name' => ___('Editor'), 'label' => 'success'], 'administrator' => ['name' => ___('Editor'), 'label' => 'danger']]; if (is_numeric($user_id_or_role)) { $user_id_or_role = array_keys(theme_cache::get_the_author_meta('wp_capabilities', $user_id_or_role)); $user_id_or_role = isset($user_id_or_role[0]) ? $user_id_or_role[0] : 'contributor'; } return isset($roles[$user_id_or_role]) ? $roles[$user_id_or_role] : false; }
public static function display($args = []) { global $post; $opt = self::get_options(); $img_url = theme_features::get_thumbnail_src($post->ID); $defaults = array('post_title_text' => theme_cache::get_the_title($post->ID), 'post_url' => theme_cache::get_permalink($post->ID), 'blog_name' => theme_cache::get_bloginfo('name'), 'blog_url' => theme_cache::home_url(), 'img_url' => esc_url($img_url), 'post_excerpt' => esc_attr(mb_substr(html_minify(strip_tags(get_the_excerpt())), 0, 120)), 'post_content' => esc_attr(mb_substr(html_minify(strip_tags(get_the_content())), 0, 120)), 'author' => theme_cache::get_the_author_meta('display_name', $post->post_author)); $output_keywords = array_merge($defaults, $args); $tpl_keywords = array('%post_title_text%', '%post_url%', '%blog_name%', '%blog_url%', '%img_url%', '%post_excerpt%', '%post_content%', '%author%'); $post_share_code = stripslashes(str_ireplace($tpl_keywords, $output_keywords, $opt['code'])); echo $post_share_code; }
public static function frontend_display(array $args = [], $instance) { global $post; $instance = array_merge(['title' => ___('Author posts'), 'posts_per_page' => 12, 'orderby' => 'random', 'content_type' => 'img'], $instance); echo $args['before_title']; ?> <a href="<?php echo class_exists('theme_custom_author_profile') ? theme_custom_author_profile::get_tabs('works', $post->post_author)['url'] : theme_cache::get_author_posts_url($post->post_author); ?> " title="<?php echo ___('Views more author posts.'); ?> "> <i class="fa fa-file-text"></i> <?php echo sprintf($instance['title'], theme_cache::get_the_author_meta('display_name', $post->post_author)); ?> </a> <?php echo $args['after_title']; $query = new WP_Query(['posts_per_page' => (int) $instance['posts_per_page'], 'orderby' => $instance['orderby'], 'author' => $post->post_author, 'post_not__in' => [$post->ID], 'ignore_sticky_posts' => true]); ?> <div class="card-container"> <?php if ($query->have_posts()) { ?> <div class="row widget-author-post-<?php echo $instance['orderby']; ?> "> <?php foreach ($query->posts as $post) { setup_postdata($post); theme_functions::archive_card_xs(['classes' => 'g-phone-1-2']); } wp_reset_postdata(); ?> </div> <?php } else { ?> <div class="page-tip not-found"> <?php echo status_tip('info', ___('No data yet.')); ?> </div> <?php } ?> </div> <?php unset($query); }
<div class="content"> <?php echo theme_point_lottery::get_des(); ?> <form action="javascript:;" method="post" id="fm-lottery"> <div class="form-group my-info"> <span class="meta"> <img class="avatar" src="<?php echo theme_cache::get_avatar_url(theme_cache::get_current_user_id()); ?> " alt="<?php echo theme_cache::get_the_author_meta('display_name', theme_cache::get_current_user_id()); ?> " width="16" height="16"> <span class="author"><?php echo theme_cache::get_the_author_meta('display_name', theme_cache::get_current_user_id()); ?> </span> </span> <span class="meta"> <img src="<?php echo theme_custom_point::get_point_img_url(); ?> " alt="point-icon" width="16" height="16"> <span id="point-count"><?php echo theme_custom_point::get_point(theme_cache::get_current_user_id()); ?> </span><span id="modify-count"></span> </span> </div> <div class="form-group">
/** * list noti be-bomb */ public static function list_noti_be_bomb($noti) { if ($noti['type'] !== 'be-bomb') { return false; } if ($noti['hit']) { $points = '<strong class="label label-success">' . $noti['points'] . '</strong>'; } else { $points = '<strong class="label label-danger">+' . $noti['points'] . '</strong>'; } if (class_exists('number_user_nicename')) { $fight_back_url = self::get_tabs('bomb', $noti['attacker-id'] + number_user_nicename::$prefix_number)['url']; } else { $fight_back_url = self::get_tabs('bomb', $noti['attacker-id'])['url']; } ?> <div class="media"> <div class="media-left"> <a href="<?php theme_cache::get_author_posts_url($noti['attacker-id']); ?> "> <img src="<?php echo theme_cache::get_avatar_url($noti['attacker-id']); ?> " class="avatar media-object" alt="avatar" width="60" height="60"> </a> </div> <div class="media-body"> <h4 class="media-heading"> <a class="label label-default" href="<?php echo self::get_tabs('bomb')['url']; ?> "><i class="fa fa-<?php echo self::get_tabs('bomb')['icon']; ?> "></i> <?php echo ___('Bomb world'); ?> </a> <?php echo $points; ?> <?php theme_custom_point::the_time($noti); ?> <?php if ($noti['hit']) { ?> <a class="fight-back btn btn-danger btn-xs" href="<?php echo $fight_back_url; ?> " target="_blank"><strong><?php echo ___('It is time to fight back'); ?> <i class="fa fa-external-link"></i></strong></a> <?php } ?> </h4> <div class="excerpt"> <p> <?php $attacker_name = theme_cache::get_the_author_meta('display_name', $noti['attacker-id']); $attacker_name = '<a href="' . theme_cache::get_author_posts_url($noti['attacker-id']) . '" target="_blank">' . $attacker_name . '</a>'; if ($noti['hit']) { echo sprintf(___('%1$s bombed you and hit. You lost %2$s %3$s.'), $attacker_name, '<strong>' . (0 - abs($noti['points'])) . '</strong>', theme_custom_point::get_point_name()); } else { echo sprintf(___('%1$s bombed you but miss! You got %2$s %3$s.'), $attacker_name, '<strong>+' . abs($noti['points']) . '</strong>', theme_custom_point::get_point_name()); } ?> </p> </div> </div><!-- /.media-body --> </div><!-- /.media --> <?php }
/** * Echo the user list within loop * * @param array $args * @return * @version 1.0.2 */ public static function the_user_list(array $args) { $args = array_merge(['classes' => 'g-phone-1-3', 'user_id' => null, 'extra_title' => '', 'extra' => 'point', 'target' => theme_functions::$link_target], $args); /** * extra point value */ switch ($args['extra']) { /** * user point */ case 'point': if (class_exists('theme_custom_point')) { $point_value = theme_custom_point::get_point($args['user_id']); } break; /** * user fav be_count */ /** * user fav be_count */ case 'fav': if (class_exists('custom_post_fav')) { $point_value = custom_post_fav::get_user_be_fav_count($args['user_id']); } break; /** * user posts count */ /** * user posts count */ case 'posts': if (class_exists('theme_custom_author_profile')) { $point_value = theme_custom_author_profile::get_count('works', $args['user_id']); } else { $point_value = count_user_posts($args['user_id']); } break; default: $point_value = null; } if (!empty($args['extra_title']) && $point_value) { $args['extra_title'] = str_replace('%', $point_value, $args['extra_title']); } $display_name = theme_cache::get_the_author_meta('display_name', $args['user_id']); $avatar_url = theme_cache::get_avatar_url($args['user_id']); ?> <div class="user-list <?php echo $args['classes']; ?> "> <a href="<?php echo theme_cache::get_author_posts_url($args['user_id']); ?> " title="<?php echo $display_name; ?> " target="<?php echo $args['target']; ?> " > <div class="avatar-container"> <img src="<?php echo theme_functions::$avatar_placeholder; ?> " data-src="<?php echo $avatar_url; ?> " alt="<?php echo $display_name; ?> " class="avatar"> </div> <h3 class="author"><?php echo $display_name; ?> </h3> <?php if ($args['extra']) { ?> <div class="extra"> <span class="<?php echo $args['extra']; ?> " title="<?php echo $args['extra_title']; ?> "> <?php echo number_format($point_value); ?> </span> </div> <?php } /** end args extra */ ?> </a> </div> <?php }
<?php } else { ?> - <?php } ?> </td> </tr> <tr> <th><?php echo ___('Description'); ?> </th> <td><?php echo theme_cache::get_the_author_meta('description', $author) ? theme_cache::get_the_author_meta('description', $author) : '-'; ?> </td> </tr> </tbody> </table> </fieldset> <!-- Statistics --> <fieldset class="author-profile"> <legend> <i class="fa fa-pie-chart"></i> <?php echo ___('Statistics'); ?> </legend> <table class="table">
/** * get_crumb * * * @return string The html code * @version 2.0.7 * */ public static function get_crumb(array $args = []) { $args = array_merge(['header' => null, 'footer' => null], $args); $links = []; if (theme_cache::is_home()) { return null; } $links['home'] = '<a href="' . theme_cache::home_url() . '" class="home" title="' . ___('Back to Homepage') . '"> <i class="fa fa-home fa-fw"></i> <span class="hide">' . ___('Back to Homepage') . '</span> </a>'; $split = '<span class="split"><i class="fa fa-angle-right"></i></span>'; /* category */ if (theme_cache::is_category()) { $cat_curr = theme_features::get_current_cat_id(); if ($cat_curr > 1) { $links_cat = get_category_parents($cat_curr, true, '%split%'); $links_cats = explode('%split%', $links_cat); array_pop($links_cats); $links['category'] = implode($split, $links_cats); $links['curr_text'] = ___('Category Browser'); } /* tag */ } else { if (theme_cache::is_tag()) { $tag_id = theme_features::get_current_tag_id(); $tag_obj = get_tag($tag_id); $links['tag'] = '<a href="' . esc_url(get_tag_link($tag_id)) . '">' . esc_html(theme_features::get_current_tag_name()) . '</a>'; $links['curr_text'] = ___('Tags Browser'); /* date */ } else { if (theme_cache::is_date()) { global $wp_query; $day = $wp_query->query_vars['day']; $month = $wp_query->query_vars['monthnum']; $year = $wp_query->query_vars['year']; /* day */ if (theme_cache::is_day()) { $date_link = get_day_link(null, null, $day); /* month */ } else { if (theme_cache::is_month()) { $date_link = get_month_link($year, $month); /* year */ } else { if (theme_cache::is_year()) { $date_link = get_year_link($year); } } } $links['date'] = '<a href="' . $date_link . '">' . theme_cache::wp_title('', false) . '</a>'; $links['curr_text'] = ___('Date Browser'); /* search*/ } else { if (theme_cache::is_search()) { // $nav_link = null; $links['curr_text'] = sprintf(___('Search Result: %s'), esc_html(get_search_query())); /* author */ } else { if (theme_cache::is_author()) { global $author; $user = get_user_by('id', $author); $links['author'] = '<a href="' . theme_cache::get_author_posts_url($author) . '">' . theme_cache::get_the_author_meta('display_name', $user->ID) . '</a>'; $links['curr_text'] = ___('Author posts'); /* archive */ } else { if (theme_cache::is_archive()) { $links['archive'] = '<a href="' . get_current_url() . '">' . theme_cache::wp_title('', false) . '</a>'; $links['curr_text'] = ___('Archive Browser'); /* Singular */ } else { if (theme_cache::is_singular()) { global $post; /* The page parent */ if ($post->post_parent) { $links['singluar'] = '<a href="' . theme_cache::get_permalink($post->post_parent) . '">' . theme_cache::get_the_title($post->post_parent) . '</a>'; } /** * post / page */ if (theme_features::get_current_cat_id() > 1) { $categories = get_the_category(); foreach ($categories as $key => $row) { $parent_id[$key] = $row->category_parent; } array_multisort($parent_id, SORT_ASC, $categories); foreach ($categories as $cat) { $cat_name = esc_html($cat->name); $links['singluar'] = '<a href="' . esc_url(get_category_link($cat->cat_ID)) . '" title="' . sprintf(___('View all posts in %s'), $cat_name) . '">' . $cat_name . '</a>'; } } $links['curr_text'] = theme_cache::get_the_title($post->ID); /* 404 */ } else { if (theme_cache::is_404()) { // $nav_link = null; $links['curr_text'] = ___('Not found'); } } } } } } } } return '<div class="crumb-container"> ' . $args['header'] . ' <nav class="crumb"> ' . implode($split, apply_filters('crumb_links', $links)) . ' </nav> ' . $args['footer'] . ' </div>'; }
get_header(); global $author; $tab_active = get_query_var('tab'); $tabs = theme_custom_author_profile::get_tabs(null, $author); if (empty($tab_active) || !isset($tabs[$tab_active])) { $tab_active = 'profile'; } ?> <div class="g"> <h3 class="crumb-title"> <?php echo theme_cache::get_avatar($author); ?> <?php echo theme_cache::get_the_author_meta('display_name', $author); ?> - <small><?php echo $tabs[$tab_active]['text']; ?> </small> </h3> <nav class="nav"> <?php foreach ($tabs as $k => $v) { $class_active = $tab_active === $k ? ' active ' : null; ?> <a class="<?php echo $class_active; ?> " href="<?php
public static function get_userdata($user_id) { return ['name' => theme_cache::get_the_author_meta('display_name', $user_id), 'avatar' => theme_cache::get_avatar_url($user_id), 'description' => theme_cache::get_the_author_meta('description', $user_id), 'url' => theme_cache::get_author_posts_url($user_id)]; }
function widget($args, $instance) { global $post; $author_id = $post->post_author; echo $args['before_widget']; /** * author profile page url */ if (class_exists('theme_custom_author_profile')) { $author_url = theme_custom_author_profile::get_tabs('profile', $author_id)['url']; } else { $author_url = theme_cache::get_author_posts_url($author_id); } $description = theme_cache::get_the_author_meta('description', $author_id); ?> <div id="widget-author-card" class="widget-container content"> <a href="<?php echo $author_url; ?> " class="author-link" title="<?php echo ___('Views the author information detail'); ?> "> <?php echo theme_cache::get_avatar($author_id, 100); ?> <h3 class="author-card-name"> <?php echo theme_cache::get_the_author_meta('display_name', $author_id); ?> </h3> <?php if (class_exists('theme_custom_author_profile')) { ?> <small class="label label-<?php echo theme_custom_author_profile::get_roles($author_id)['label']; ?> "><?php echo theme_custom_author_profile::get_roles($author_id)['name']; ?> </small> <?php } ?> </a><!-- ./author-link --> <p class="author-card-description" title="<?php echo $description; ?> " > <?php if (empty($description)) { echo ___('The author is lazy, nothing writes here.'); } else { echo $description; } ?> </p> <?php if (class_exists('theme_custom_author_profile')) { ?> <div class="author-card-meta-links"> <!-- works count --> <a class="tooltip" href="<?php echo theme_custom_author_profile::get_tabs('works', $author_id)['url']; ?> " title="<?php echo ___('Views author posts'); ?> " target="_blank"> <span class="tx"><i class="fa fa-fw fa-<?php echo theme_custom_author_profile::get_tabs('works', $author_id)['icon']; ?> "></i></span> <span class="count"><?php echo (int) theme_custom_author_profile::get_tabs('works', $author_id)['count']; ?> </span> </a> <!-- comments count --> <a class="tooltip" href="<?php echo theme_custom_author_profile::get_tabs('comments', $author_id)['url']; ?> " title="<?php echo ___('Views author comments'); ?> " target="_blank"> <span class="tx"><i class="fa fa-fw fa-<?php echo theme_custom_author_profile::get_tabs('comments', $author_id)['icon']; ?> "></i></span> <span class="count"><?php echo (int) theme_custom_author_profile::get_tabs('comments', $author_id)['count']; ?> </span> </a> <!-- point --> <?php if (class_exists('theme_custom_point_bomb')) { if (class_exists('number_user_nicename')) { $target_id = number_user_nicename::$prefix_number + $author_id; } else { $target_id = $author_id; } ?> <!-- followers count --> <a class="tooltip" href="<?php echo theme_custom_point_bomb::get_tabs('bomb', $target_id)['url']; ?> " rel="nofollow" title="<?php echo ___('Bomb!'); ?> " target="_blank"> <span class="tx"><i class="fa fa-fw fa-bomb"></i></span> <span class="count"><?php echo theme_custom_point::get_point($author_id); ?> </span> </a> <?php } ?> <!-- pm --> <?php if (class_exists('theme_custom_pm')) { ?> <a target="_blank" class="tooltip" href="<?php echo theme_custom_pm::get_user_pm_url($author_id); ?> " title="<?php echo ___('Send a private message.'); ?> "> <span class="tx"><i class="fa fa-<?php echo theme_custom_pm::get_tabs('pm')['icon']; ?> "></i></span><span class="count"><?php echo __x('P.M.', 'Widget author card PM.'); ?> </span> </a> <?php } ?> </div> <?php } ?> </div> <?php echo $args['after_widget']; }
public static function the_dialogs() { $current_user_id = theme_cache::get_current_user_id(); $pm_lists = self::get_lists($current_user_id); $history_users = theme_custom_pm::get_histories($current_user_id); $dialog_histories = []; if (empty($pm_lists)) { return false; } foreach ($pm_lists as $user_id) { if ($history_users && isset($history_users[$user_id])) { foreach ($history_users[$user_id] as $history) { if ($history->pm_author == $user_id || $history->pm_receiver == $user_id) { if (!isset($dialog_histories[$user_id])) { $dialog_histories[$user_id] = [$history->pm_id => $history]; } $dialog_histories[$user_id][$history->pm_id] = $history; } } } /** sort */ foreach ($pm_lists as $v) { if (isset($dialog_histories[$v])) { ksort($dialog_histories[$v]); } } } foreach ($pm_lists as $user_id) { ?> <form action="javascript:;" id="pm-dialog-<?php echo self::get_niceid($user_id); ?> " class="pm-dialog"> <div class="form-group pm-dialog-list"> <?php if (isset($history_users[$user_id])) { foreach ($dialog_histories[$user_id] as $history) { $name = $current_user_id == $history->pm_author ? ___('Me') : theme_cache::get_the_author_meta('display_name', $user_id); ?> <section class="pm-dialog-<?php echo $current_user_id == $history->pm_author ? 'me' : 'sender'; ?> "> <div class="pm-dialog-bg"> <h4> <span class="name"><a href="<?php echo theme_cache::get_author_posts_url($history->pm_author); ?> " target="_blank"><?php echo $name; ?> </a></span> <span class="date"><?php echo date('Y/m/d H:i:s', strtotime($history->pm_date)); ?> </span> </h4> <div class="media-content"> <?php echo $history->pm_content; ?> </div> </div> </section> <?php } /** end dialog loop */ } /** end if histories */ ?> </div> <div class="form-group"> <input type="text" id="pm-dialog-content-<?php echo self::get_niceid($user_id); ?> " name="content" class="pm-dialog-conteng form-control" placeholder="<?php echo ___('Enter to send P.M.'); ?> " required title="<?php echo ___('P.M. content'); ?> " autocomplete="off"> </div> <div class="form-group"> <button class="btn btn-success btn-block" type="submit"><i class="fa fa-check"></i> <?php echo ___('Send P.M.'); ?> </button> </div> </form> <?php } }
public static function filter_theme_api_theme_custom_sign_after_login(array $user = [], $user_id) { $user['uid'] = theme_cache::get_the_author_meta('user_nicename', $user_id); return $user; }
* author email */ add_filter('get_comment_author_email', function ($comment_author_email, $comment_ID, $comment) { static $caches; $cache_id = md5(serialize(func_get_args())); if (isset($caches[$cache_id])) { return $caches[$cache_id]; } if ((int) $comment->user_id === 0) { $caches[$cache_id] = $comment_author_email; return $caches[$cache_id]; } $caches[$cache_id] = theme_cache::get_the_author_meta('user_email', $comment->user_id, true); return $caches[$cache_id]; }, 10, 3); /** * author email link */ add_filter('comment_email', function ($comment_author_email, $comment) { static $caches; $cache_id = md5(serialize(func_get_args())); if (isset($caches[$cache_id])) { return $caches[$cache_id]; } if ((int) $comment->user_id === 0) { $caches[$cache_id] = $comment_author_email; return $caches[$cache_id]; } $caches[$cache_id] = theme_cache::get_the_author_meta('user_email', $comment->user_id); return $caches[$cache_id]; }, 10, 2);
public static function display_backend() { $opt = self::get_options(); ?> <fieldset> <legend><i class="fa fa-fw fa-tags"></i> <?php echo ___('Tags index settings'); ?> </legend> <p class="description"><?php echo ___('Display Chinese pinyin tag name index on tags index page.'); ?> </p> <table class="form-table"> <tbody> <tr> <th><?php echo ___('Whitelist - users '); ?> </th> <td> <textarea name="<?php echo __CLASS__; ?> [whitelist][user-ids]" id="<?php echo __CLASS__; ?> -whitelist-user-ids" rows="3" class="widefat code"><?php echo isset($opt['whitelist']['user-ids']) ? esc_textarea($opt['whitelist']['user-ids']) : null; ?> </textarea> <p class="description"><?php echo ___('User ID, multiple users separated by ,(commas). E.g. 1,2,3,4'); ?> </p> <?php if (isset($opt['whitelist']['user-ids']) && !empty($opt['whitelist']['user-ids'])) { $user_display_names = []; foreach (explode(',', $opt['whitelist']['user-ids']) as $id) { $user_display_names[] = '<a href="' . theme_cache::get_author_posts_url($id) . '" target="_blank">' . $id . '-' . theme_cache::get_the_author_meta('display_name', $id) . '</a>'; } echo sprintf(___('User list: %s'), implode(' ', $user_display_names)); ?> <?php } ?> </td> </tr> <tr> <th><?php echo ___('Control'); ?> </th> <td> <a href="javascript:;" class="button" id="<?php echo __CLASS__; ?> -clean-cache"><i class="fa fa-refresh"></i> <?php echo ___('Flush cache'); ?> </a> </td> </tr> </tbody> </table> </fieldset> <?php }
public static function keywords_convert($content) { global $post; $meta = self::get_post_meta($post->ID); $source_url = isset($meta['reprint']['url']) ? esc_url($meta['reprint']['url']) : ___('unknow'); $source_author_name = isset($meta['reprint']['author']) ? esc_html($meta['reprint']['author']) : ___('unknow'); return str_replace(['%site_name%', '%site_url%', '%post_author_name%', '%post_author_url%', '%post_url%', '%source_url%', '%source_author_name%'], [theme_cache::get_bloginfo('name'), theme_cache::home_url(), theme_cache::get_the_author_meta('display_name', $post->post_author), theme_cache::get_author_posts_url($post->post_author), theme_cache::get_permalink($post->ID), $source_url, $source_author_name], $content); }
public static function rank_img_content($args = []) { global $post; $args = array_merge(['classes' => '', 'lazyload' => true, 'excerpt' => true, 'index' => false, 'target' => theme_functions::$link_target], $args); $post_title = theme_cache::get_the_title($post->ID); $excerpt = get_the_excerpt(); if (!empty($excerpt)) { $excerpt = esc_html($excerpt); } $thumbnail_real_src = theme_functions::get_thumbnail_src($post->ID); ?> <div class="list-group-item <?php echo $args['classes']; ?> "> <div class="row"> <div class="g-tablet-1-6"> <a href="<?php echo theme_cache::get_permalink($post->ID); ?> " title="<?php echo $post_title; ?> " target="<?php echo $args['target']; ?> " class="thumbnail-container"> <?php if ($args['lazyload'] === true) { ?> <img class="thumbnail" src="<?php echo theme_functions::$thumbnail_placeholder; ?> " data-src="<?php echo $thumbnail_real_src; ?> " alt="<?php echo $post_title; ?> " width="<?php echo theme_functions::$thumbnail_size[1]; ?> " height="<?php echo theme_functions::$thumbnail_size[2]; ?> "> <?php } else { ?> <img class="thumbnail" src="<?php echo $thumbnail_real_src; ?> " alt="<?php echo $post_title; ?> " width="<?php echo theme_functions::$thumbnail_size[1]; ?> " height="<?php echo theme_functions::$thumbnail_size[2]; ?> "> <?php } ?> </a> </div> <div class="g-tablet-5-6"> <h3 class="media-heading"> <a href="<?php echo theme_cache::get_permalink($post->ID); ?> " title="<?php echo $post_title; ?> " target="<?php echo $args['target']; ?> " ><?php echo $post_title; ?> </a> </h3> <?php /** * output excerpt */ if ($args['excerpt'] === true) { ?> <div class="excerpt"><?php echo str_sub(strip_tags($excerpt), 200); ?> </div> <?php } ?> <div class="extra"> <div class="metas row"> <!-- author --> <a class="author meta g-phone-1-2 g-tablet-1-4 g-desktop-1-5" href="<?php echo theme_cache::get_author_posts_url($post->post_author); ?> " target="<?php echo $args['target']; ?> " > <img src="<?php echo theme_functions::$avatar_placeholder; ?> " data-src="<?php echo theme_cache::get_avatar_url($post->post_author); ?> " alt="avatar" width="16" height="16" class="avatar"> <?php echo theme_cache::get_the_author_meta('display_name', $post->post_author); ?> </a> <!-- category --> <div class="category meta g-phone-1-2 g-tablet-1-4 g-desktop-1-5"> <?php $cats = get_the_category_list('<i class="split"> / </i> '); if (!empty($cats)) { ?> <i class="fa fa-folder-open"></i> <?php echo $cats; ?> <?php } ?> </div> <!-- views --> <?php if (class_exists('theme_post_views') && theme_post_views::is_enabled()) { ?> <div class="view meta g-phone-1-2 g-tablet-1-4 g-desktop-1-5"> <i class="fa fa-play-circle"></i> <?php echo theme_post_views::get_views(); ?> </div> <?php } ?> <?php if (!wp_is_mobile()) { ?> <div class="comments meta g-phone-1-2 g-tablet-1-4 g-desktop-1-5"> <i class="fa fa-comment"></i> <?php echo (int) $post->comment_count; ?> </div> <?php } ?> <?php /** * point */ if (class_exists('custom_post_point')) { ?> <div class="point meta g-phone-1-2 g-tablet-1-4 g-desktop-1-5"> <i class="fa fa-paw"></i> <?php echo (int) custom_post_point::get_post_points_count($post->ID); ?> </div> <?php } ?> </div><!-- /.metas --> </div> <?php if ($args['index']) { ?> <i class="index"><?php echo $args['index']; ?> </i> <?php } ?> </div> </div> </div> <?php }