PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 4.9.2
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v4.9.2
4.9.2 4.9.1 4.9.0 4.8.2 4.8.1 4.8.0 4.7.0 4.6.2 4.6.1 4.6.0 4.5.6 4.5.5 4.5.4 4.5.3 4.5.2 4.5.1 4.5.0 4.4.1 4.4.0 3.3.4 3.4.0 3.4.1 3.4.2 3.5.0 3.5.1 All 200 releases
← All changes | includes/Traits/SocialShare.php +58 -36 3.3.44.9.2 View file →
@@ -1,46 +1,68 @@
1 1 <?php
2 2 namespace WPDeveloper\BetterDocs\Traits;
3 3
4 4 trait SocialShare {
5 - public $view_wrapper = 'betterdocs-social-share';
5 + public $view_wrapper = 'betterdocs-social-share';
6 6
7 - public function generate_links() {
8 - $_permalink = get_the_permalink();
7 + public function generate_links() {
8 + $_permalink = get_the_permalink();
9 9
10 - $_defaults = [
11 - 'facebook' => [
12 - 'alt' => 'Facebook',
13 - 'icon' => betterdocs()->assets->icon( 'social/facebook.svg' ),
14 - 'link' => 'https://www.facebook.com/sharer/sharer.php?u=' . $_permalink
15 - ],
16 - 'twitter' => [
17 - 'alt' => 'Twitter',
18 - 'icon' => betterdocs()->assets->icon( 'social/twitter.svg' ),
19 - 'link' => 'https://twitter.com/intent/tweet?url=' . $_permalink
20 - ],
21 - 'linkedin' => [
22 - 'alt' => 'LinkedIn',
23 - 'icon' => betterdocs()->assets->icon( 'social/linkedin.svg' ),
24 - 'link' => 'https://www.linkedin.com/shareArticle?mini=true&url=' . $_permalink
25 - ],
26 - 'pinterest' => [
27 - 'alt' => 'Pinterest',
28 - 'icon' => betterdocs()->assets->icon( 'social/pinterest.svg' ),
29 - 'link' => 'https://pinterest.com/pin/create/button/?url=' . $_permalink
30 - ]
31 - ];
10 + $_defaults = [
11 + 'facebook' => [
12 + 'alt' => 'Facebook',
13 + 'icon' => betterdocs()->assets->icon( 'social/facebook.svg' ),
14 + 'icon-2' => betterdocs()->assets->icon( 'social/facebook-box-line.svg' ),
15 + 'link' => 'https://www.facebook.com/sharer/sharer.php?u=' . $_permalink
16 + ],
17 + 'twitter' => [
18 + 'alt' => 'X',
19 + 'icon' => betterdocs()->assets->icon( 'social/twitter.svg' ),
20 + 'icon-2' => betterdocs()->assets->icon( 'social/twitter-x-line.svg' ),
21 + 'link' => 'https://twitter.com/intent/tweet?url=' . $_permalink
22 + ],
23 + 'linkedin' => [
24 + 'alt' => 'LinkedIn',
25 + 'icon' => betterdocs()->assets->icon( 'social/linkedin.svg' ),
26 + 'icon-2' => betterdocs()->assets->icon( 'social/linkedin-box-line.svg' ),
27 + 'link' => 'https://www.linkedin.com/shareArticle?mini=true&url=' . $_permalink
28 + ],
29 + 'pinterest' => [
30 + 'alt' => 'Pinterest',
31 + 'icon' => betterdocs()->assets->icon( 'social/pinterest.svg' ),
32 + 'icon-2' => betterdocs()->assets->icon( 'social/pinterest-line.svg' ),
33 + 'link' => 'https://pinterest.com/pin/create/button/?url=' . $_permalink
34 + ],
35 + // 'instagram' => [
36 + // 'alt' => 'Instagram',
37 + // 'icon' => betterdocs()->assets->icon( 'social/instagram.svg' ),
38 + // 'icon-2' => betterdocs()->assets->icon( 'social/instagram-line.svg' ),
39 + // 'link' => 'https://pinterest.com/pin/create/button/?url=' . $_permalink
40 + // ]
41 + ];
32 42
33 - return array_filter( $_defaults, function ( $key ) {
34 - return array_key_exists( $key, $this->attributes ) && (bool) filter_var( $this->attributes[$key], FILTER_VALIDATE_BOOLEAN );
35 - }, ARRAY_FILTER_USE_KEY );
36 - }
43 + return array_filter(
44 + $_defaults,
45 + function ( $key ) {
46 + return array_key_exists( $key, $this->attributes ) && (bool) filter_var( $this->attributes[ $key ], FILTER_VALIDATE_BOOLEAN );
47 + },
48 + ARRAY_FILTER_USE_KEY
49 + );
50 + }
37 51
38 - public function view_params() {
39 - $links = $this->generate_links();
40 - $this->attributes['links'] = $links;
52 + public function view_params() {
53 + $links = $this->generate_links();
54 + $this->attributes['links'] = $links;
41 55
42 - return [
43 - 'links' => $links
44 - ];
45 - }
56 + if ( isset( $this->attributes['share_title_select_layout_layout'] ) && $this->attributes['share_title_select_layout_layout'] == 'layout-2' ) { // for elementor only
57 + $this->view_wrapper .= ' layout-2';
58 + }
59 +
60 + if ( isset( $this->attributes['layout'] ) && $this->attributes['layout'] == 'layout-2' ) { //for blocks
61 + $this->view_wrapper .= ' layout-2';
62 + }
63 +
64 + return [
65 + 'links' => $links
66 + ];
67 + }
46 68 }