-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathclass-helpers.php
More file actions
75 lines (66 loc) · 1.53 KB
/
class-helpers.php
File metadata and controls
75 lines (66 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
/**
* Helpers class.
*
* @since 2.3.0
*
* @package Knowledge_Base
*/
namespace WebberZone\Knowledge_Base\Util;
if ( ! defined( 'WPINC' ) ) {
die;
}
/**
* Helpers class.
*
* @since 2.3.0
*/
class Helpers {
/**
* Constructor class.
*
* @since 2.3.0
*/
public function __construct() {
}
/**
* Get the link to Better Search homepage.
*
* @since 2.3.0
*
* @return string HTML markup.
*/
public static function get_credit_link() {
$output = '<div class="wzkb_credit" style="text-align:center;border-top:1px dotted #000;display:block;margin-top:5px;"><small>';
/* translators: 1: Opening a tag and Better Search, 2: Closing a tag. */
$output .= sprintf( __( 'Powered by %1$s plugin%2$s', 'knowledgebase' ), '<a href="https://webberzone.com/plugins/knowledgebase/" rel="nofollow">Knowledge Base', '</a></small></div>' );
return $output;
}
/**
* Sanitize args.
*
* @since 2.3.1
*
* @param array $args Array of arguments.
* @return array Sanitized array of arguments.
*/
public static function sanitize_args( $args ): array {
foreach ( $args as $key => $value ) {
if ( is_string( $value ) ) {
switch ( $key ) {
case 'class':
case 'className':
case 'extra_class':
$classes = explode( ' ', $value );
$sanitized_classes = array_map( 'sanitize_html_class', $classes );
$args[ $key ] = implode( ' ', $sanitized_classes );
break;
default:
$args[ $key ] = wp_kses_post( $value );
break;
}
}
}
return $args;
}
}