' . '' . '' . '' . ''; } /** * Wordmark (bird + "Beep!") shown at the top of the feed. * Uses the real Sami-designed bird PNG with CSS color filter * to match brand colours. */ function beep_logo_svg() { // Allow site-owners to swap in a custom logo via settings. $custom = Beep_Settings::get( 'logo_url' ); if ( $custom ) { return ''; } // Real bird PNG as — CSS filter turns black silhouette → brand blue. $filter = 'brightness(0) saturate(100%) invert(30%) sepia(100%) saturate(10000%) hue-rotate(190deg)'; return ''; } /** * The "Beep!" brand wordmark shown at the bottom-right of every beep and reply. * * Rendered as a crisp inline SVG recreation of the 3D extruded brand logo — * a blue-violet face with a darker-blue depth and navy outline. Stays sharp at * any size and ships as ~1KB of markup (no image request). The matching raster * version lives at assets/beep-wordmark.png (used in the feed header). * To swap in the PNG here instead, hook the filter: * add_filter('beep_post_wordmark', fn() => ''); */ function beep_post_wordmark() { // Build the 3D extrusion: stacked copies offset down-left, deepest first. $depth = 7; $extrude = ''; for ( $i = $depth; $i >= 1; $i-- ) { $x = 9 - $i; $y = 49 + $i; $extrude .= 'Beep!'; } $svg = '' . '' . $extrude // Front face: blue-violet fill with a navy outline drawn behind it. . 'Beep!' . ''; return apply_filters('beep_post_wordmark', $svg); } /** * Is this user banned from posting/liking/replying? */ function beep_user_is_banned($user_id) { if (!$user_id) { return false; } return get_user_meta($user_id, 'beep_banned', true) === '1'; } /** * Render the composer textarea (for logged-in, non-banned users). */ function beep_render_composer() { $user = wp_get_current_user(); $beep_avatar = get_user_meta($post->post_author, 'beep_avatar', true); if ($beep_avatar) { $avatar_url = $beep_avatar; $filter = ''; } elseif ($author && !empty($author->user_email)) { $avatar_url = 'https://www.gravatar.com/avatar/' . md5(strtolower($author->user_email)) . '?s=96&d=mp'; $filter = ''; } else { $avatar_url = BEEP_URL . 'assets/beep-bird.png'; $filter = 'brightness(0) saturate(100%) invert(22%) sepia(100%) saturate(10000%) hue-rotate(190deg)'; } $avatar = ''; ob_start(); ?>
post_author); $beep_avatar = get_user_meta($post->post_author, 'beep_avatar', true); if ($beep_avatar) { $avatar_url = $beep_avatar; $filter = ''; } elseif ($author && !empty($author->user_email)) { $avatar_url = 'https://www.gravatar.com/avatar/' . md5(strtolower($author->user_email)) . '?s=96&d=mp'; $filter = ''; } else { $avatar_url = BEEP_URL . 'assets/beep-bird.png'; $filter = 'brightness(0) saturate(100%) invert(22%) sepia(100%) saturate(10000%) hue-rotate(190deg)'; } $avatar = ''; $name = $author ? esc_html($author->display_name) : 'Unknown'; $handle = $author ? '@' . esc_html($author->user_login) : ''; $ts = strtotime($post->post_date_gmt . ' UTC'); $time = beep_relative_time($ts); $time_iso = gmdate('c', $ts); $time_full = mysql2date('F j, Y g:i a', $post->post_date); $content = beep_format_content($post->post_content); $like_count = Beep_Likes::get_count($post->ID, 'post'); $reply_count = Beep_Replies::reply_count($post->ID); $user_liked = Beep_Likes::user_has_liked($post->ID, 'post'); $can_delete = current_user_can('delete_post', $post->ID); $can_interact = is_user_logged_in() && !beep_user_is_banned(get_current_user_id()); $beep_images = Beep_Media::get_images($post->ID); $beep_video = Beep_Media::get_video_url($post->ID); $beep_voice = Beep_Media::get_voice_url($post->ID); ob_start(); ?>
18, 'fill' => '#0064cd', 'class' => 'beep-post-badge'] ); ?> ·
ID); ?>
ID); ?>
ID); ?>
ID, 'beep_gif_url', true); ?>
GIF
ID); if ($poll) : ?>
%
votes Final results · Ends
ID, 0); ?>
ID); echo beep_render_replies_tree($all, 0, 0, $post->ID, $can_interact); ?>
comment_parent !== (int) $parent_id) { continue; } $out .= beep_render_reply($c, $comments, $depth, $post_id, $can_interact); } return $out; } /** * Render a single reply, plus its nested children. */ function beep_render_reply($comment, $all_comments = [], $depth = 0, $post_id = 0, $can_interact = false) { if (!$comment) { return ''; } $author_id = (int) $comment->user_id; $avatar_url = BEEP_URL . 'assets/beep-bird.png'; $filter = 'brightness(0) saturate(100%) invert(22%) sepia(100%) saturate(10000%) hue-rotate(190deg)'; $avatar = ''; $author = $author_id ? get_userdata($author_id) : null; $name = $author ? esc_html($author->display_name) : esc_html($comment->comment_author); $handle = $author ? '@' . esc_html($author->user_login) : ''; $ts = strtotime($comment->comment_date_gmt . ' UTC'); $time = beep_relative_time($ts); $time_iso = gmdate('c', $ts); $content = beep_format_content($comment->comment_content); $can_delete = current_user_can('moderate_comments'); $like_count = Beep_Likes::get_count($comment->comment_ID, 'reply'); $user_liked = Beep_Likes::user_has_liked($comment->comment_ID, 'reply'); $depth_class = 'beep-depth-' . min((int) $depth, 2); ob_start(); ?>
16, 'fill' => '#0064cd', 'class' => 'beep-post-badge beep-post-badge-sm'] ); ?> · 16, 'fill' => '#0064cd', 'class' => 'beep-post-badge beep-post-badge-sm'] ); ?>
comment_ID); ?>
comment_ID, $depth + 1, $post_id, $can_interact); if ($children) { echo '
' . $children . '
'; } ?>
#' . esc_html($m[2]) . ''; }, $text); // @mentions $text = preg_replace_callback('/(^|\s)@([a-zA-Z0-9_]+)/', function ($m) { $user = get_user_by('login', $m[2]); if ($user) { return $m[1] . '@' . esc_html($m[2]) . ''; } return $m[1] . '@' . esc_html($m[2]) . ''; }, $text); // URLs $text = preg_replace_callback('#(https?://[^\s<]+)#i', function ($m) { $url = esc_url($m[1]); $display = parse_url($url, PHP_URL_HOST); if (!$display) { $display = $url; } return '' . esc_html($display) . ''; }, $text); // Line breaks $text = nl2br($text); return $text; } function beep_relative_time($timestamp) { $now = time(); $diff = $now - $timestamp; if ($diff < 0) { $diff = 0; } if ($diff < 60) { return $diff . 's'; } if ($diff < 3600) { return floor($diff / 60) . 'm'; } if ($diff < 86400) { return floor($diff / 3600) . 'h'; } if ($diff < 604800) { return floor($diff / 86400) . 'd'; } return gmdate('M j', $timestamp); } function beep_icon($name) { $icons = [ 'reply' => '', 'heart' => '', 'heart_filled' => '', 'share' => '', 'beep_bird' => '', ]; return isset($icons[$name]) ? $icons[$name] : ''; } /** * Render the thread/conversation modal (sits outside individual posts). */ function beep_render_thread_modal() { return ''; } /** * Render the GIF picker modal. */ function beep_render_gif_modal() { return ''; }