| @@ -1,40 +1,115 @@ | ||
| 1 | -<?php | |
| 2 | -// Hooks. | |
| 3 | -add_action( 'bbpc-resolved-topics', 'bbpc_resolved_topics', 10, 2 ); | |
| 4 | - | |
| 5 | -// functions | |
| 6 | -function bbpc_resolved_topics( $content = '', $topic_id = 0 ) { | |
| 7 | - | |
| 8 | - if ( bbpc_get_opt( 'is_solved_topics', true ) ) { | |
| 9 | - | |
| 10 | - if ( empty( $topic_id ) ) { | |
| 11 | - $topic_id = bbp_get_topic_id( $topic_id ); | |
| 12 | - } | |
| 13 | - | |
| 14 | - $open = ''; | |
| 15 | - $close = ''; | |
| 16 | - $resolved = ''; | |
| 17 | - $has_best_answer = ''; | |
| 18 | - | |
| 19 | - $obj = features\bbp_solved_topic(); | |
| 20 | - | |
| 21 | - if ( $obj->is_solved( $topic_id ) || $obj->has_best_answer( $topic_id ) ) { | |
| 22 | - $open = '<div class="solved-topic-bar">'; | |
| 23 | - $close = '</div>'; | |
| 24 | - } | |
| 25 | - | |
| 26 | - if ( $obj->is_solved( $topic_id ) ) { | |
| 27 | - $resolved = '<span class="accepted-ans-mark badge"><i class="icon_check_alt"></i> ' . esc_html__( 'Resolved', 'ama-core' ) . '</span>'; | |
| 28 | - } | |
| 29 | - | |
| 30 | - $content = $content . $open . $resolved . $has_best_answer . $close; | |
| 31 | - | |
| 32 | - $allowed_html = [ | |
| 33 | - 'div' => [ 'class' => [] ], | |
| 34 | - 'span' => [ 'class' => [] ], | |
| 35 | - 'i' => [ 'class' => [] ], | |
| 36 | - ]; | |
| 37 | - | |
| 38 | - echo wp_kses( $content, $allowed_html ); | |
| 39 | - } | |
| 1 | +<?php | |
| 2 | +// Hooks. | |
| 3 | +add_action('bbpc-resolved-topics', 'forumax_solve_topic_callback', 10, 2); | |
| 4 | + | |
| 5 | +// functions | |
| 6 | +function forumax_solve_topic_callback($content = '', $topic_id = 0) | |
| 7 | +{ | |
| 8 | + | |
| 9 | + if (forumax_get_opt('is_solved_topics', true)) { | |
| 10 | + | |
| 11 | + if (empty($topic_id)) { | |
| 12 | + $topic_id = bbp_get_topic_id($topic_id); | |
| 13 | + } | |
| 14 | + | |
| 15 | + $open = ''; | |
| 16 | + $close = ''; | |
| 17 | + $resolved = ''; | |
| 18 | + $has_best_answer = ''; | |
| 19 | + | |
| 20 | + $obj = features\forumax_solve_topic(); | |
| 21 | + | |
| 22 | + if ($obj->is_solved($topic_id) || $obj->has_best_answer($topic_id)) { | |
| 23 | + $open = '<div class="solved-topic-bar">'; | |
| 24 | + $close = '</div>'; | |
| 25 | + } | |
| 26 | + | |
| 27 | + if ($obj->is_solved($topic_id)) { | |
| 28 | + $resolved = '<span class="accepted-ans-mark badge"><i class="icon_check_alt"></i> ' . esc_html__('Resolved', 'forumax') . '</span>'; | |
| 29 | + } | |
| 30 | + | |
| 31 | + $content = $content . $open . $resolved . $has_best_answer . $close; | |
| 32 | + | |
| 33 | + $allowed_html = [ | |
| 34 | + 'div' => ['class' => []], | |
| 35 | + 'span' => ['class' => []], | |
| 36 | + 'i' => ['class' => []], | |
| 37 | + ]; | |
| 38 | + | |
| 39 | + echo wp_kses($content, $allowed_html); | |
| 40 | + } | |
| 41 | +} | |
| 42 | + | |
| 43 | +// Forumax Social Share Hook - Triggered manually in content-single-topic-lead.php | |
| 44 | +// add_action( 'bbp_theme_after_topic_content', 'forumax_topic_social_share' ); | |
| 45 | + | |
| 46 | +function forumax_topic_social_share() | |
| 47 | +{ | |
| 48 | + | |
| 49 | + $is_copy_link = forumax_get_opt('is_copy_link'); | |
| 50 | + $copy_link_text_success = forumax_get_opt('copy_link_text_success', esc_html__('Copied!', 'forumax')); | |
| 51 | + $copy_link_label = forumax_get_opt('copy_link_label', esc_html__('Or copy link', 'forumax')); | |
| 52 | + | |
| 53 | + if (is_user_logged_in()): | |
| 54 | + ?> | |
| 55 | + <a href="#" class="forumax-share-btn modal-toggle" data-id="forumax_share_modal"> | |
| 56 | + <i class="social_share_square"></i> | |
| 57 | + <?php echo esc_html(forumax_get_opt('share_btn_label', esc_html__('Share this Topic', 'forumax'))) ?> | |
| 58 | + </a> | |
| 59 | + | |
| 60 | + <div class="forumax-modal" id='forumax_share_modal'> | |
| 61 | + <div class="forumax-modal-overlay modal-toggle"></div> | |
| 62 | + <div class="forumax-modal-dialog" role="document"> | |
| 63 | + <div class="forumax-modal-content"> | |
| 64 | + <a class="close forumax-close"> | |
| 65 | + <i class="icon_close"></i> | |
| 66 | + </a> | |
| 67 | + <div class="forumax-share-wrap"> | |
| 68 | + <h2> <?php the_title(); ?> </h2> | |
| 69 | + <div class="social-links"> | |
| 70 | + <a href="mailto:?subject=<?php echo rawurlencode(bbp_get_topic_title(bbp_get_topic_id())); ?>&body=<?php echo rawurlencode(bbp_get_topic_permalink(bbp_get_topic_id())); ?>" | |
| 71 | + target="_blank"> | |
| 72 | + <i class="icon_mail"></i> | |
| 73 | + </a> | |
| 74 | + <a | |
| 75 | + href="https://www.facebook.com/sharer/sharer.php?u=<?php echo urlencode(bbp_get_topic_permalink(bbp_get_topic_id())); ?>"> | |
| 76 | + <i class="social_facebook_circle"></i> | |
| 77 | + </a> | |
| 78 | + <a | |
| 79 | + href="https://www.linkedin.com/sharing/share-offsite/?url=<?php echo urlencode(bbp_get_topic_permalink(bbp_get_topic_id())); ?>"> | |
| 80 | + <i class="social_linkedin_square"></i> | |
| 81 | + </a> | |
| 82 | + <a | |
| 83 | + href="https://x.com/intent/tweet?url=<?php echo urlencode(bbp_get_topic_permalink(bbp_get_topic_id())); ?>&text=<?php echo urlencode(bbp_get_topic_title(bbp_get_topic_id())); ?>"> | |
| 84 | + <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16"><path d="M12.6.75h2.454l-5.36 6.142L16 15.25h-4.937l-3.867-5.07-4.425 5.07H.316l5.733-6.57L0 .75h5.063l3.495 4.633L12.601.75Zm-.86 13.028h1.36L4.323 2.145H2.865z"/></svg> | |
| 85 | + </a> | |
| 86 | + </div> | |
| 87 | + | |
| 88 | + <?php | |
| 89 | + if ($is_copy_link): | |
| 90 | + ?> | |
| 91 | + <p> <?php echo esc_html($copy_link_label); ?> </p> | |
| 92 | + <div class="copy-url-wrap"> | |
| 93 | + <input readonly type="text" | |
| 94 | + value="<?php echo esc_url(bbp_get_topic_permalink(bbp_get_topic_id())); ?>" | |
| 95 | + class="word-wrap"> | |
| 96 | + <div class="share-this-doc" title="<?php esc_attr_e('Copy Link', 'forumax'); ?>"> | |
| 97 | + <img src="<?php echo FORUMAX_FRONT_ASS . 'img/clone.svg'; ?>" | |
| 98 | + alt="<?php esc_attr_e('Clipboard Icon', 'forumax'); ?>"> | |
| 99 | + </div> | |
| 100 | + <div class="forumax-link-copied-wrap"> | |
| 101 | + <i class="icon_check_alt2"></i> | |
| 102 | + <?php echo esc_attr($copy_link_text_success) ?> | |
| 103 | + <i class="icon_close close-notice"></i> | |
| 104 | + </div> | |
| 105 | + </div> | |
| 106 | + <?php | |
| 107 | + endif; | |
| 108 | + ?> | |
| 109 | + | |
| 110 | + </div> | |
| 111 | + </div> | |
| 112 | + </div> | |
| 113 | + </div> | |
| 114 | + <?php endif; | |
| 40 | 115 | } |