Пример #1
0
    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);
    }
Пример #2
0
 public static function get_tabs($key, $author_id)
 {
     static $caches = [], $baseurl = [];
     if (isset($caches[$author_id])) {
         if ($key) {
             return isset($caches[$author_id][$key]) ? $caches[$author_id][$key] : null;
         }
         return $caches[$author_id];
     }
     if (!isset($baseurl[$author_id])) {
         $baseurl[$author_id] = theme_cache::get_author_posts_url($author_id);
     }
     $caches[$author_id] = array('profile' => array('text' => ___('Profile'), 'icon' => 'newspaper-o', 'url' => esc_url($baseurl[$author_id])), 'works' => array('text' => ___('Works'), 'icon' => 'file-text', 'url' => esc_url(add_query_arg('tab', 'works', $baseurl[$author_id])), 'count' => self::get_count('works', $author_id)), 'comments' => array('text' => ___('Comments'), 'icon' => 'comments', 'url' => esc_url(add_query_arg('tab', 'comments', $baseurl[$author_id])), 'count' => self::get_count('comments', $author_id)));
     if (class_exists('custom_post_point')) {
         $caches[$author_id]['rates'] = array('text' => ___('Rates'), 'icon' => 'star', 'url' => esc_url(add_query_arg('tab', 'rates', $baseurl[$author_id])), 'count' => self::get_count('followers_count', $author_id));
     }
     if ($key) {
         return isset($caches[$author_id][$key]) ? $caches[$author_id][$key] : null;
     }
     return $caches[$author_id];
 }
Пример #3
0
    /**
     * 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 
    }
Пример #4
0
    /**
     * 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 
    }
Пример #5
0
		<table class="table">
			<tbody>
				<tr>
					<th><abbr title="<?php 
echo ___('Unique identifier');
?>
"><?php 
echo ___('UID');
?>
</abbr></th>
					<td>
						<a href="<?php 
echo theme_cache::get_author_posts_url($author);
?>
" title="<?php 
echo theme_cache::get_author_posts_url($author);
?>
">
							<?php 
echo theme_cache::get_the_author_meta('user_nicename', $author);
?>
						</a>
					</td>
				</tr>
				<tr>
					<th><?php 
echo ___('Nickname');
?>
</th>
					<td>
						<strong><?php 
 public static function cache_request(array $output = [])
 {
     if (isset($_GET[self::$iden]) && is_array($_GET[self::$iden])) {
         $get = $_GET[self::$iden];
         $post_id = isset($get['post-id']) && is_string($get['post-id']) ? (int) $get['post-id'] : null;
         $type = isset($get['type']) && is_string($get['type']) ? $get['type'] : null;
         switch ($type) {
             case 'get-comments':
                 if (!$post_id) {
                     return $output;
                 }
                 $post = theme_cache::get_post($post_id);
                 $pages = theme_features::get_comment_pages_count(self::get_comments(['post_id' => $post->ID]));
                 /**
                  * cpage
                  */
                 if (isset($get['capge']) && is_numeric($get['capge'])) {
                     $cpage = (int) $get['capge'];
                 } else {
                     $cpage = theme_cache::get_option('default_comments_page') == 'newest' ? $pages : 1;
                 }
                 if (!theme_cache::is_user_logged_in()) {
                     $commenter = wp_get_current_commenter();
                     $user_name = $commenter['comment_author'];
                     $user_url = $commenter['comment_author_url'];
                     $avatar_url = theme_cache::get_avatar_url($commenter['comment_author_email']);
                     $user_email = $commenter['comment_author_email'];
                 } else {
                     global $current_user;
                     get_currentuserinfo();
                     $user_name = $current_user->display_name;
                     $user_url = theme_cache::get_author_posts_url($current_user->ID);
                     $avatar_url = theme_cache::get_avatar_url($current_user->ID);
                 }
                 $output[self::$iden] = ['comments' => self::get_comments_list($post_id, $cpage), 'count' => $post ? $post->comment_count : 0, 'pages' => $pages, 'cpage' => $cpage, 'logged' => theme_cache::is_user_logged_in(), 'registration' => theme_cache::get_option('comment_registration'), 'user-name' => esc_html($user_name), 'user-url' => esc_url($user_url), 'avatar-url' => $avatar_url];
                 if (isset($user_email)) {
                     $output[self::$iden]['user-email'] = $user_email;
                 }
                 break;
         }
     }
     return $output;
 }
Пример #7
0
 public static function dynamic_request_process($datas)
 {
     if (theme_cache::is_user_logged_in()) {
         global $current_user;
         get_currentuserinfo();
         $datas['user'] = array('logged' => true, 'display_name' => $current_user->display_name, 'posts_url' => theme_cache::get_author_posts_url($current_user->ID), 'logout_url' => wp_logout_url(theme_cache::home_url()), 'avatar_url' => theme_cache::get_avatar_url($current_user->ID));
     } else {
         $datas['user'] = array('logged' => false);
     }
     return $datas;
 }
Пример #8
0
    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('&nbsp;&nbsp;', $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 
    }
Пример #9
0
 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)];
 }
Пример #10
0
    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'];
    }
Пример #11
0
</legend>
	<!-- uid -->
	<div class="form-group">
		<div class="control-label g-tablet-1-6">
			<abbr title="<?php 
echo ___('Unique identifier');
?>
">
				<?php 
echo ___('UID');
?>
			</abbr>
		</div>
		<div class="g-tablet-5-6"><p class="form-control-static"><strong>
			<a href="<?php 
echo theme_cache::get_author_posts_url($current_user->ID);
?>
"><?php 
echo $current_user->user_nicename;
?>
</a>
			</strong></p></div>
	</div>
	<!-- nickname -->
	<div class="form-group">
		<label for="my-settings-nickname" class="control-label g-tablet-1-6">
			<i class="fa fa-user"></i>
			<?php 
echo ___('Nickname');
?>
		</label>
Пример #12
0
 public static function frontend_js_config(array $config)
 {
     if (!self::is_page()) {
         return $config;
     }
     $config[__CLASS__] = ['process_url' => theme_features::get_process_url(['action' => __CLASS__]), 'lang' => ['M01' => ___('Loading, please wait...'), 'M02' => ___('Enter to send P.M.'), 'M03' => ___('P.M. content'), 'M04' => ___('Send P.M.'), 'M05' => ___('Hello, I am %name%, welcome to chat with me what do you want.'), 'M06' => ___('P.M. is sending, please wait...'), 'M07' => ___('Me'), 'E01' => ___('Sorry, server is busy now, can not respond your request, please try again later.')], 'my_uid' => self::get_niceid(theme_cache::get_current_user_id()), 'userdata' => ['me' => ['name' => ___('Me'), 'url' => theme_cache::get_author_posts_url(theme_cache::get_current_user_id())]]];
     return $config;
 }
Пример #13
0
    ?>
				<?php 
    if (wp_is_mobile()) {
        ?>
					<a class="tool tool-avatar" href="javascript:;" data-mobile-target=".header-nav-account-menu" >
						<img class="avatar" width="32" height="32" src="<?php 
        echo theme_cache::get_avatar_url(theme_cache::get_current_user_id());
        ?>
" alt="avatar">
					</a>
				<?php 
    } else {
        ?>
					<div class="tool tool-me">
						<a href="<?php 
        echo theme_cache::get_author_posts_url(theme_cache::get_current_user_id());
        ?>
">
							<img class="avatar" width="32" height="32" src="<?php 
        echo theme_cache::get_avatar_url(theme_cache::get_current_user_id());
        ?>
" alt="avatar">&nbsp;<?php 
        echo theme_cache::get_the_author_meta('display_name', theme_cache::get_current_user_id());
        ?>
 <i class="fa fa-caret-down"></i>
						</a>
						<div class="box">
							<!-- points -->
							<div class="box-points">
								<?php 
        if (class_exists('theme_custom_point')) {
 * @version 1.0.0
 */
/**
 * author url
 */
add_filter('get_comment_author_url', function ($url, $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] = $url;
        return $url;
    }
    $caches[$cache_id] = theme_cache::get_author_posts_url($comment->user_id);
    return $caches[$cache_id];
}, 10, 3);
/**
 * 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];
    }
Пример #15
0
 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);
 }
Пример #16
0
    /**
     * 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>';
    }
Пример #17
0
    /**
     * My statistics
     */
    public static function my_statistics()
    {
        $current_user_id = theme_cache::get_current_user_id();
        ?>
		<div class="panel">
			<div class="heading">
				<i class="fa fa-pie-chart"></i>
				<?php 
        echo ___('My statistics');
        ?>
			</div>
			<div class="content">
				<a class="media" href="<?php 
        echo theme_custom_user_settings::get_tabs('history')['url'];
        ?>
" title="<?php 
        echo ___('Views my histories');
        ?>
">
					<div class="media-left">
						<img class="media-object" src="<?php 
        echo theme_custom_point::get_point_img_url();
        ?>
" alt="">
					</div>
					<div class="media-body">
						<h4 class="media-heading"><strong class="total-point"><?php 
        echo number_format(theme_custom_point::get_point($current_user_id));
        ?>
</strong></h4>
					</div>
				</a>
				<div class="row">
					<!-- posts count -->
					<div class="g-phone-1-2">
						<?php 
        echo sprintf(___('My posts: %s'), '<a href="' . theme_cache::get_author_posts_url($current_user_id) . '">' . theme_custom_author_profile::get_count('works', $current_user_id) . '</a>');
        ?>
					</div>
					<!-- comments count -->
					<div class="g-phone-1-2">
						<?php 
        echo sprintf(___('My comments: %s'), '<a href="' . theme_custom_author_profile::get_tabs('comments', $current_user_id)['url'] . '">' . theme_custom_author_profile::get_count('comments', $current_user_id) . '</a>');
        ?>
					</div>
					<!-- followers count -->
					<div class="g-phone-1-2">
						<?php 
        echo sprintf(___('My followers: %s'), '<a href="' . theme_custom_author_profile::get_tabs('followers_count', $current_user_id)['url'] . '">' . theme_custom_author_profile::get_count('followers_count', $current_user_id) . '</a>');
        ?>
					</div>
					<!-- following count -->
					<div class="g-tablet-1-2 g-desktop-1-3">
						<?php 
        echo sprintf(___('My following: %s'), '<a href="' . theme_custom_author_profile::get_tabs('following_count', $current_user_id)['url'] . '">' . theme_custom_author_profile::get_count('following_count', $current_user_id) . '</a>');
        ?>
					</div>
				</div>
			</div>
		</div>
		<?php 
    }
Пример #18
0
    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 
    }