1 | <?php |
||
2 | /** |
||
3 | * LSX Search functions. |
||
4 | * |
||
5 | * @package lsx-search |
||
6 | */ |
||
7 | |||
8 | namespace lsx\sharing\includes\functions; |
||
9 | |||
10 | /** |
||
11 | * Gets the sharing text. |
||
12 | * |
||
13 | * @return array |
||
14 | */ |
||
15 | function get_restricted_post_types() { |
||
0 ignored issues
–
show
Coding Style
introduced
by
![]() |
|||
16 | $post_types = array( |
||
17 | 'page', |
||
18 | 'attachment', |
||
19 | 'forum', |
||
20 | 'topic', |
||
21 | 'lesson', |
||
22 | 'quiz', |
||
23 | 'question', |
||
24 | 'reply', |
||
25 | 'popup', |
||
26 | 'sensei_message', |
||
27 | 'envira', |
||
28 | 'soliloquy', |
||
29 | 'certificate_template', |
||
30 | 'certificate', |
||
31 | 'project', |
||
32 | ); |
||
33 | return apply_filters( 'lsx_sharing_get_restricted_post_types', $post_types ); |
||
34 | } |
||
0 ignored issues
–
show
|
|||
35 | |||
36 | /** |
||
37 | * Gets the sharing text. |
||
38 | * |
||
39 | * @return array |
||
40 | */ |
||
41 | function get_to_post_types() { |
||
42 | $post_types = array( |
||
43 | 'accommodation', |
||
44 | 'tour', |
||
45 | 'destination', |
||
46 | 'review', |
||
47 | 'special', |
||
48 | 'vehicle', |
||
49 | 'activity', |
||
50 | ); |
||
51 | return apply_filters( 'lsx_sharing_get_to_post_types', $post_types ); |
||
52 | } |
||
0 ignored issues
–
show
|
|||
53 | |||
54 | /** |
||
55 | * Gets the LSX HP Post types |
||
56 | * |
||
57 | * @return array |
||
58 | */ |
||
59 | function get_hp_post_types() { |
||
60 | $post_types = array( |
||
61 | 'workout', |
||
62 | 'exercise', |
||
63 | 'recipe', |
||
64 | 'meal', |
||
65 | 'tip', |
||
66 | ); |
||
67 | return apply_filters( 'lsx_sharing_get_hp_post_types', $post_types ); |
||
68 | } |
||
0 ignored issues
–
show
|
|||
69 | |||
70 | /** |
||
0 ignored issues
–
show
|
|||
71 | * Gets a specific option from the array. |
||
72 | * |
||
73 | * @return boolean |
||
74 | */ |
||
75 | function is_button_disabled( $post_type = '', $service = '' ) { |
||
76 | $sharing = lsx_sharing(); |
||
77 | $option = false; |
||
78 | if ( false === $sharing->is_new_options && isset( $sharing->options['display'] ) && ! empty( $sharing->options['display'][ 'sharing_disable_' . $service ] ) ) { |
||
0 ignored issues
–
show
|
|||
79 | $option = true; |
||
80 | } elseif ( true === $sharing->is_new_options && ! empty( $sharing->options[ $post_type . '_disable_' . $service ] ) ) { |
||
0 ignored issues
–
show
|
|||
81 | $option = true; |
||
82 | } |
||
0 ignored issues
–
show
|
|||
83 | return apply_filters( 'lsx_sharing_is_button_disabled', $option ); |
||
84 | } |
||
0 ignored issues
–
show
|
|||
85 | |||
86 | /** |
||
0 ignored issues
–
show
|
|||
87 | * Gets a specific option from the array. |
||
88 | * |
||
89 | * @return boolean |
||
90 | */ |
||
91 | function is_pt_disabled( $post_type = '' ) { |
||
92 | $sharing = lsx_sharing(); |
||
93 | $option = false; |
||
94 | if ( false === $sharing->is_new_options && isset( $sharing->options['display'] ) && ! empty( $sharing->options['display'][ 'sharing_disable_pt_' . $post_type ] ) ) { |
||
0 ignored issues
–
show
|
|||
95 | $option = true; |
||
96 | } elseif ( true === $sharing->is_new_options && isset( $sharing->options[ $post_type . '_disable_pt' ] ) ) { |
||
0 ignored issues
–
show
|
|||
97 | $option = true; |
||
98 | } |
||
0 ignored issues
–
show
|
|||
99 | return apply_filters( 'lsx_sharing_is_pt_disabled', $option ); |
||
100 | } |
||
0 ignored issues
–
show
|
|||
101 | |||
102 | /** |
||
103 | * If the sharing has been disabled. |
||
104 | * |
||
105 | * @return boolean |
||
106 | */ |
||
107 | function is_disabled() { |
||
108 | $sharing = lsx_sharing(); |
||
109 | $option = false; |
||
110 | if ( false === $sharing->is_new_options && isset( $sharing->options['display'] ) && ! empty( $sharing->options['display']['sharing_disable_all'] ) ) { |
||
0 ignored issues
–
show
|
|||
111 | $option = true; |
||
112 | } elseif ( true === $sharing->is_new_options && isset( $sharing->options['global_disable_all'] ) ) { |
||
0 ignored issues
–
show
|
|||
113 | $option = true; |
||
114 | } |
||
0 ignored issues
–
show
|
|||
115 | return apply_filters( 'lsx_sharing_is_disabled', $option ); |
||
116 | } |
||
0 ignored issues
–
show
|
|||
117 | |||
118 | /** |
||
0 ignored issues
–
show
|
|||
119 | * Gets the sharing text. |
||
120 | * |
||
121 | * @return string |
||
122 | */ |
||
123 | function get_sharing_text( $post_type = '' ) { |
||
124 | $sharing = lsx_sharing(); |
||
125 | $text = ''; |
||
126 | if ( false === $sharing->is_new_options && isset( $sharing->options['display'] ) && ! empty( $sharing->options['display']['sharing_label_text'] ) ) { |
||
0 ignored issues
–
show
|
|||
127 | $text = $sharing->options['display']['sharing_label_text']; |
||
128 | } elseif ( true === $sharing->is_new_options ) { |
||
0 ignored issues
–
show
|
|||
129 | if ( isset( $sharing->options[ $post_type . '_label_text' ] ) ) { |
||
0 ignored issues
–
show
|
|||
130 | $text = $sharing->options[ $post_type . '_label_text' ]; |
||
131 | } elseif ( isset( $sharing->options['global_label_text'] ) ) { |
||
0 ignored issues
–
show
|
|||
132 | $text = $sharing->options['global_label_text']; |
||
133 | } |
||
134 | } |
||
0 ignored issues
–
show
|
|||
135 | return $text; |
||
136 | } |
||
0 ignored issues
–
show
|
|||
137 |