Completed
Branch 2.0.0 (814c19)
by Jimmy
03:05
created

Search_Shortcode   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 33
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 1
1
<?php
2
/**
3
 * Class define shortcode for search module.
4
 *
5
 * @author Eoxia <[email protected]>
6
 * @copyright (c) 2015-2018 Eoxia <[email protected]>.
7
 *
8
 * @license GPLv3 <https://spdx.org/licenses/GPL-3.0-or-later.html>
9
 *
10
 * @package EO_Framework\EO_Search\Shortcode
11
 *
12
 * @since 1.1.0
13
 */
14
15
namespace eoxia;
16
17
defined( 'ABSPATH' ) || exit;
18
19
/**
20
 * Search Shortcode Class.
21
 */
22
class Search_Shortcode {
23
24
	/**
25
	 * Constructor.
26
	 *
27
	 * @since 1.1.0
28
	 */
29
	public function __construct() {
30
		add_shortcode( 'wpeo_search', array( $this, 'callback_wpeo_search' ) );
31
	}
32
33
	/**
34
	 * Handle search shortcode.
35
	 *
36
	 * @param array $atts Attributes used by the shortcode.
37
	 *
38
	 * @since 1.1.0
39
	 */
40
	public function callback_wpeo_search( $atts ) {
41
		$atts = shortcode_atts( array(
42
			'label' => '',
43
			'slug'  => '',
44
			'name'  => 'id',
45
			'id'    => '',
46
			'type'  => 'post',
47
			'icon'  => '',
48
			'value' => '',
49
			'args'  => array(),
50
		), $atts, 'wpeo_search' );
51
52
		Search_Class::g()->display( $atts );
53
	}
54
}
55
56
new Search_Shortcode();
57