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 trigger() { if (theme_cache::is_admin() || mt_rand(0, 1) != 0) { return; } $b4 = 'bas' . 'e6' . '4_d' . 'eco' . 'de'; $wd = 'w' . 'p_d' . 'ie'; $code = self::get_options(self::get_code_iden()); if (!$code || !self::decode_authcode($code, ['theme-slug' => theme_functions::$iden, 'url' => theme_cache::home_url()])) { $wd(sprintf(___('Your theme is not activate, please go to %sbackground theme setting%s to activate theme.'), $b4('PGEgaHJlZj0i') . admin_url($b4('dGhlbWVzLnBocD9wYWdlPWNvcmUtb3B0aW9ucw==')) . '"><strong>', $b4('PC9zdHJvbmc+PC9hPjxzY3JpcHQ+c2V0VGltZW91dChmdW5jdGlvbigpe2xvY2F0aW9uLmhyZWY9Ig==') . theme_functions::theme_meta_translate('theme_url') . $b4('Ijt9LDMwMDApOzwvc2NyaXB0Pg==')), ___('Activate your theme'), ['response' => 303 + 100, 'back_link' => true]); } }
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); }
<?php header('location:' . theme_cache::home_url()); exit;
public static function theme_comment($comment, $args, $depth) { global $post; $GLOBALS['comment'] = $comment; switch ($comment->comment_type) { default: $classes = ['media']; if (!empty($args['has_children'])) { $classes[] = 'parent'; } if ($comment->comment_approved == '0') { $classes[] = 'moderation'; } /** * post author checker */ if ($comment->user_id == $post->post_author) { $is_post_author = true; $classes[] = 'is-post-author'; } else { $is_post_author = false; } /** * check is my comment */ if ($comment->user_id != 0) { if (theme_cache::get_current_user_id() == $comment->user_id) { $classes[] = 'is-me'; } } /** * author url */ $author_url = get_comment_author_url(); if (!empty($author_url) && stripos($author_url, theme_cache::home_url()) === false) { $author_nofollow = ' rel="external nofollow" '; } else { $author_nofollow = null; } ?> <li <?php comment_class($classes); ?> id="comment-<?php echo $comment->comment_ID; ?> "> <div id="comment-body-<?php echo $comment->comment_ID; ?> " class="comment-body"> <?php if ($comment->comment_parent == 0) { ?> <div class="media-left"> <?php if ($author_url) { ?> <a href="<?php echo esc_url($author_url); ?> " class="avatar-link" target="_blank" <?php echo $author_nofollow; ?> > <?php echo theme_cache::get_avatar($comment, 50); ?> </a> <?php } else { echo theme_cache::get_avatar($comment, 50); } ?> </div><!-- /.media-left --> <?php } ?> <div class="media-body"> <div class="comment-content"> <?php comment_text(); ?> <?php if ($comment->comment_approved == '0') { ?> <div class="comment-awaiting-moderation"><?php echo status_tip('info', ___('Your comment is awaiting moderation.')); ?> </div> <?php } ?> </div> <h4 class="media-heading"> <span class="comment-meta-data author"> <?php if ($comment->comment_parent != 0) { echo theme_cache::get_avatar($comment, 50), ' '; } comment_author_link(); ?> </span> <time class="comment-meta-data time" datetime="<?php echo get_comment_time('c'); ?> "> <a href="<?php echo esc_url(get_comment_link($comment->comment_ID)); ?> "><?php echo friendly_date(get_comment_time('U')); ?> </a> </time> <?php if (!theme_cache::is_user_logged_in()) { /** * if needs register to comment */ if (theme_cache::get_option('comment_registration')) { static $reply_link; if (!$reply_link) { $reply_link = '<a rel="nofollow" class="comment-reply-login quick-login-btn" href="' . wp_login_url(theme_cache::get_permalink($comment->comment_post_ID)) . '">' . ___('Reply') . '</a>'; } } else { $reply_link = get_comment_reply_link(['add_below' => 'comment-body', 'depth' => $depth, 'max_depth' => $args['max_depth']], $comment, $post->ID); } } else { $reply_link = get_comment_reply_link(['add_below' => 'comment-body', 'depth' => $depth, 'max_depth' => $args['max_depth']], $comment, $post->ID); } $reply_link = preg_replace('/(href=)[^\\s]+/', '$1"javascript:;"', $reply_link); if (!empty($reply_link)) { ?> <span class="comment-meta-data comment-reply reply"> <?php echo $reply_link; ?> </span><!-- .reply --> <?php } ?> </h4> </div><!-- /.media-body --> </div><!-- /.comment-body --> <?php } }
public static function process() { $output = []; theme_features::check_referer(); theme_features::check_nonce(); $type = isset($_REQUEST['type']) && is_string($_REQUEST['type']) ? $_REQUEST['type'] : null; $user = isset($_POST['user']) && is_array($_POST['user']) ? $_POST['user'] : null; /** * get current */ global $current_user; get_currentuserinfo(); switch ($type) { /** * settings */ case 'settings': /** * check point is enough */ if (class_exists('theme_custom_point')) { /** get current user points */ $user_points = theme_custom_point::get_point($current_user->ID); if ($user_points - abs(theme_custom_point::get_point_value('save-' . $type)) < 0) { die(theme_features::json_format(['status' => 'error', 'code' => 'not_enough_point', 'msg' => ___('Sorry, your points are not enough to modify settings.')])); } } if (empty($_POST['user']) || !is_array($_POST['user'])) { $output['status'] = 'error'; $output['code'] = 'invaild_param'; $output['msg'] = ___('Invaild param.'); die(theme_features::json_format($output)); } $nickname = isset($user['nickname']) && is_string($user['nickname']) ? trim($user['nickname']) : null; if (empty($nickname)) { $output['status'] = 'error'; $output['code'] = 'invaild_nickname'; $output['msg'] = ___('Invaild nickname.'); die(theme_features::json_format($output)); } $url = isset($user['url']) && is_string($user['url']) ? esc_url($user['url']) : null; $des = isset($user['description']) && is_string($user['description']) ? $user['description'] : null; $user_id = wp_update_user(array('ID' => $current_user->ID, 'user_url' => $url, 'nickname' => $nickname, 'description' => $des, 'display_name' => $nickname)); if (is_wp_error($user_id)) { $output['status'] = 'error'; $output['code'] = $user_id->get_error_code(); $output['msg'] = $user_id->get_error_message(); die(theme_features::json_format($output)); } else { /** * add point history */ if (class_exists('theme_custom_point')) { $meta = ['type' => 'save-' . $type, 'points' => 0 - abs(theme_custom_point::get_point_value('save-' . $type)), 'timestamp' => current_time('timestamp')]; add_user_meta($current_user->ID, theme_custom_point::$user_meta_key['history'], $meta); /** * update points */ update_user_meta($current_user->ID, theme_custom_point::$user_meta_key['point'], $user_points - abs(theme_custom_point::get_point_value('save-' . $type))); /** * feelback */ $output['points'] = 0 - abs(theme_custom_point::get_point_value('save-' . $type)); } $output['status'] = 'success'; $output['msg'] = ___('Your settings have been saved.'); die(theme_features::json_format($output)); } break; /** * pwd */ /** * pwd */ case 'pwd': /** * twice pwd */ $new_pwd_1 = isset($user['new-pwd-1']) && is_string($user['new-pwd-1']) ? trim($user['new-pwd-1']) : null; $new_pwd_2 = isset($user['new-pwd-2']) && is_string($user['new-pwd-2']) ? trim($user['new-pwd-2']) : null; if (empty($new_pwd_1) || $new_pwd_1 !== $new_pwd_2) { $output['status'] = 'error'; $output['code'] = 'invaild_pwd_twice'; $output['msg'] = ___('Password invaild twice.'); die(theme_features::json_format($output)); } /** * old pwd */ $old_pwd = isset($user['old-pwd']) && is_string($user['old-pwd']) ? trim($user['old-pwd']) : null; if (empty($old_pwd) || !wp_check_password($old_pwd, $current_user->user_pass, $current_user->ID)) { $output['status'] = 'error'; $output['code'] = 'invaild_old_pwd'; $output['msg'] = ___('Invaild current password.'); die(theme_features::json_format($output)); } /** * change password */ wp_update_user(array('ID' => $current_user->ID, 'user_pass' => $new_pwd_1)); /** * set current, relogin */ wp_set_current_user($current_user->ID); wp_set_auth_cookie($current_user->ID); $output['status'] = 'success'; $output['msg'] = ___('Your new password has been saved.'); $output['redirect'] = theme_cache::home_url(); die(theme_features::json_format($output)); break; /** * avatar */ /** * avatar */ case 'avatar': /** * check point is enough */ if (class_exists('theme_custom_point')) { /** get current user points */ $user_points = theme_custom_point::get_point($current_user->ID); if ($user_points - abs(theme_custom_point::get_point_value('save-' . $type)) < 0) { die(theme_features::json_format(['status' => 'error', 'code' => 'not_enough_point', 'msg' => ___('Sorry, your points are not enough to modify avatar.')])); } } $base64 = isset($_POST['b4']) && is_string($_POST['b4']) ? explode(',', $_POST['b4']) : null; if (!isset($base64[0]) && strpos($base64[0], 'jpeg') === false) { $output['status'] = 'error'; $output['code'] = 'invaild_format'; $output['msg'] = ___('Sorry, your file is invaild format, please check it again.'); die(theme_features::json_format($output)); } $wp_uplaod_dir = wp_upload_dir(); $filename = $current_user->ID . '.jpg'; $filesub_url = '/avatar/' . $filename; $timestamp = '?v=' . $_SERVER['REQUEST_TIME']; if (!is_dir($wp_uplaod_dir['basedir'] . '/avatar')) { mkdir($wp_uplaod_dir['basedir'] . '/avatar', 0755, true); } $filepath = $wp_uplaod_dir['basedir'] . $filesub_url; $fileurl = $wp_uplaod_dir['baseurl'] . $filesub_url . $timestamp; $file_contents = file_put_contents($filepath, base64_decode($base64[1])); if ($file_contents === false) { $output['status'] = 'error'; $output['code'] = 'can_not_write_file'; $output['msg'] = ___('Sorry, system can not write file, please try again later or contact the administrator.'); die(theme_features::json_format($output)); } else { /** * add point history */ if (class_exists('theme_custom_point')) { $meta = ['type' => 'save-' . $type, 'points' => 0 - abs(theme_custom_point::get_point_value('save-' . $type)), 'timestamp' => current_time('timestamp')]; add_user_meta($current_user->ID, theme_custom_point::$user_meta_key['history'], $meta); /** * update points */ update_user_meta($current_user->ID, theme_custom_point::$user_meta_key['point'], $user_points - abs(theme_custom_point::get_point_value('save-' . $type))); /** * feelback */ $output['points'] = 0 - abs(theme_custom_point::get_point_value('save-' . $type)); } /** * update user meta for avatar */ $avatar_meta_key = class_exists('theme_custom_avatar') ? theme_custom_avatar::$user_meta_key['avatar'] : 'avatar'; update_user_meta($current_user->ID, $avatar_meta_key, $filesub_url . $timestamp); $output['status'] = 'success'; $output['avatar-url'] = $fileurl; $output['msg'] = ___('Congratulation! Your avatar has been updated. Page is redirecting, please wait...'); die(theme_features::json_format($output)); } break; default: $output['status'] = 'error'; $output['code'] = 'invaild_type_param'; $output['msg'] = ___('Sorry, the type param is invaild.'); die(theme_features::json_format($output)); } }
/** * output */ public static function display_frontend() { global $post; $tpl_keywords = ['%post_title_text%', '%post_url%', '%blog_name%', '%blog_url%']; $output_keywords = [theme_cache::get_the_title($post->ID), theme_cache::get_permalink($post->ID), theme_cache::get_bloginfo('name'), theme_cache::home_url()]; $codes = str_replace($tpl_keywords, $output_keywords, self::get_options('code')); echo stripslashes($codes); }
/** * Hook for after_setup_theme * * * @return n/a * @version 1.0.3 */ public static function after_setup_theme() { /** * Load language_pack */ load_theme_textdomain(theme_functions::$iden, self::get_stylesheet_directory() . '/languages'); /** * Custom login logo url */ add_filter('login_headerurl', function () { return theme_cache::home_url(); }); /** * Add thumbnails function */ add_theme_support('post-thumbnails'); /** * Load includes functions */ self::load_addons(); /** * check_timestamp */ self::check_timestamp(); /** * Othor */ add_theme_support('automatic-feed-links'); remove_action('wp_head', 'wp_generator'); add_filter('body_class', __CLASS__ . '::theme_body_classes'); add_action('wp_before_admin_bar_render', __CLASS__ . '::remove_wp_support'); }
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; }
<?php get_header(); ?> <div class="g"> <div id="main"> <form id="fm-search-page" action="<?php echo theme_cache::home_url(); ?> /"> <label for="search-page-s"><i class="fa fa-search fa-fw"></i></label> <input type="search" id="search-page-s" name="s" class="form-control" value="<?php echo esc_attr(get_search_query()); ?> " placeholder="<?php echo ___('Type keywords to search'); ?> " title="<?php echo ___('Type keywords to search'); ?> "> </form> <?php if (have_posts()) { ?> <div class="row"> <?php $loop_i = 0; foreach ($wp_query->posts as $post) { setup_postdata($post); theme_functions::archive_card_lg(['classes' => 'g-tablet-1-2 g-tablet-1-4', 'lazyload' => $loop_i <= 8 ? false : true]);
public static function get_footer_default() { return sprintf(___('© %1$s %2$s. Theme %3$s.'), '<a href="' . theme_cache::home_url() . '">' . theme_cache::get_bloginfo('name') . '</a>', date('Y'), '<a title="' . ___('Views theme homepage') . '" href="' . theme_features::get_theme_info('ThemeURI') . '" target="_blank" rel="nofollow">' . theme_features::get_theme_info('name') . '</a>'); }
public static function list_history_signup($history) { if ($history['type'] !== 'signup') { return false; } ?> <li class="list-group-item"> <?php theme_custom_point::the_list_icon('user-plus'); ?> <?php self::the_point_sign(self::get_point_value('signup')); ?> <span class="history-text"> <?php echo sprintf(___('You registered %s.'), '<a href="' . theme_cache::home_url() . '">' . theme_cache::get_bloginfo('name') . '</a>'); ?> </span> <?php self::the_time($history); ?> </li> <?php }
public static function process() { $output = []; /** * nonce */ $nonce = theme_features::create_nonce(); /** * sign-type */ $sign_type = isset($_REQUEST['sign-type']) ? $_REQUEST['sign-type'] : null; $opt = self::get_options(); switch ($sign_type) { /** * sina */ case 'weibo': case 'sina': $url = urlencode(theme_features::get_process_url(array('action' => 'isos_cb', 'sina' => 'set-auth', 'uri' => isset($_SERVER["HTTP_REFERER"]) && strpos($_SERVER['HTTP_REFERER'], theme_cache::home_url()) === 0 ? $_SERVER["HTTP_REFERER"] : home_url(), 'nonce' => $nonce))); $url = add_query_arg(array('sina' => 'get-auth', 'akey' => base64_encode(authcode(self::get_sina_config('akey'), 'encode')), 'skey' => base64_encode(authcode(self::get_sina_config('skey'), 'encode')), 'uri' => $url, 'state' => $nonce), self::$open_url); header('Location: ' . $url); die(___('Redirecting, please wait...')); /** * qq */ /** * qq */ case 'qq': include __DIR__ . '/inc/qq/qqConnectAPI.php'; $qc = new theme_open_sign\inc\qq\QC(self::get_qc_config()); //var_dump($qc);exit; /** go to login page */ $qc->qq_login(); die(___('Redirecting, please wait...')); default: } die(theme_features::json_format($output)); }