@@ -6,142 +6,142 @@ |
||
6 | 6 | */ |
7 | 7 | class LSX_Search_FacetWP { |
8 | 8 | |
9 | - /** |
|
10 | - * @var object \lsx\search\classes\facetwp\Hierarchy() |
|
11 | - */ |
|
12 | - public $hierarchy; |
|
13 | - |
|
14 | - /** |
|
15 | - * @var object \lsx\search\classes\facetwp\Post_Connections() |
|
16 | - */ |
|
17 | - public $post_connections; |
|
18 | - |
|
19 | - /** |
|
20 | - * Class Constructor. |
|
21 | - */ |
|
22 | - public function __construct() { |
|
23 | - |
|
24 | - require_once LSX_SEARCH_PATH . '/classes/facetwp/class-hierarchy.php'; |
|
25 | - $this->hierarchy = lsx\search\classes\facetwp\Hierarchy::get_instance(); |
|
26 | - |
|
27 | - require_once LSX_SEARCH_PATH . '/classes/facetwp/class-post-connections.php'; |
|
28 | - $this->post_connections = lsx\search\classes\facetwp\Post_Connections::get_instance(); |
|
29 | - |
|
30 | - add_filter( 'facetwp_pager_html', array( $this, 'facetwp_pager_html' ), 10, 2 ); |
|
31 | - add_filter( 'facetwp_result_count', array( $this, 'facetwp_result_count' ), 10, 2 ); |
|
32 | - add_filter( 'facetwp_facet_html', array( $this, 'facetwp_slide_html' ), 10, 2 ); |
|
33 | - add_filter( 'facetwp_load_css', array( $this, 'facetwp_load_css' ), 10, 1 ); |
|
34 | - add_filter( 'facetwp_index_row', array( $this, 'index_row' ), 10, 2 ); |
|
35 | - } |
|
36 | - |
|
37 | - /** |
|
38 | - * Change FaceWP pagination HTML to be equal LSX pagination. |
|
39 | - */ |
|
40 | - public function facetwp_pager_html( $output, $params ) { |
|
41 | - $output = ''; |
|
42 | - $page = (int) $params['page']; |
|
43 | - $per_page = (int) $params['per_page']; |
|
44 | - $total_pages = (int) $params['total_pages']; |
|
45 | - |
|
46 | - if ( 1 < $total_pages ) { |
|
47 | - $output .= '<div class="lsx-pagination-wrapper facetwp-custom">'; |
|
48 | - $output .= '<div class="lsx-pagination">'; |
|
49 | - // $output .= '<span class="pages">Page '. $page .' of '. $total_pages .'</span>'; |
|
50 | - |
|
51 | - if ( 1 < $page ) { |
|
52 | - $output .= '<a class="prev page-numbers facetwp-page" rel="prev" data-page="' . ( $page - 1 ) . '">«</a>'; |
|
53 | - } |
|
54 | - |
|
55 | - $temp = false; |
|
56 | - |
|
57 | - for ( $i = 1; $i <= $total_pages; $i++ ) { |
|
58 | - if ( $i == $page ) { |
|
59 | - $output .= '<span class="page-numbers current">' . $i . '</span>'; |
|
60 | - } elseif ( ( $page - 2 ) < $i && ( $page + 2 ) > $i ) { |
|
61 | - $output .= '<a class="page-numbers facetwp-page" data-page="' . $i . '">' . $i . '</a>'; |
|
62 | - } elseif ( ( $page - 2 ) >= $i && $page > 2 ) { |
|
63 | - if ( ! $temp ) { |
|
64 | - $output .= '<span class="page-numbers dots">...</span>'; |
|
65 | - $temp = true; |
|
66 | - } |
|
67 | - } elseif ( ( $page + 2 ) <= $i && ( $page + 2 ) <= $total_pages ) { |
|
68 | - $output .= '<span class="page-numbers dots">...</span>'; |
|
69 | - break; |
|
70 | - } |
|
71 | - } |
|
72 | - |
|
73 | - if ( $page < $total_pages ) { |
|
74 | - $output .= '<a class="next page-numbers facetwp-page" rel="next" data-page="' . ( $page + 1 ) . '">»</a>'; |
|
75 | - } |
|
76 | - |
|
77 | - $output .= '</div>'; |
|
78 | - $output .= '</div>'; |
|
79 | - } |
|
80 | - |
|
81 | - return $output; |
|
82 | - } |
|
83 | - |
|
84 | - /** |
|
85 | - * Change FaceWP result count HTML. |
|
86 | - */ |
|
87 | - public function facetwp_result_count( $output, $params ) { |
|
88 | - $output = $params['total']; |
|
89 | - return $output; |
|
90 | - } |
|
91 | - |
|
92 | - /** |
|
93 | - * Change FaceWP slider HTML. |
|
94 | - */ |
|
95 | - public function facetwp_slide_html( $html, $args ) { |
|
96 | - if ( 'slider' === $args['facet']['type'] ) { |
|
97 | - $html = str_replace( 'class="facetwp-slider-reset"', 'class="btn btn-md facetwp-slider-reset"', $html ); |
|
98 | - } |
|
99 | - |
|
100 | - return $html; |
|
101 | - } |
|
102 | - |
|
103 | - /** |
|
104 | - * Change FaceWP slider HTML. |
|
105 | - */ |
|
106 | - public function facetwp_counts_html( $html, $args ) { |
|
107 | - if ( 'slider' === $args['facet']['type'] ) { |
|
108 | - $html = str_replace( 'class="facetwp-slider-reset"', 'class="btn btn-md facetwp-slider-reset"', $html ); |
|
109 | - } |
|
110 | - return $html; |
|
111 | - } |
|
112 | - |
|
113 | - /** |
|
114 | - * Disable FacetWP styles. |
|
115 | - */ |
|
116 | - public function facetwp_load_css( $boolean ) { |
|
117 | - $boolean = false; |
|
118 | - return $boolean; |
|
119 | - } |
|
120 | - |
|
121 | - /** |
|
122 | - * Get the price including the tax |
|
123 | - * @param $params |
|
124 | - * @param $class |
|
125 | - * |
|
126 | - * @return mixed |
|
127 | - */ |
|
128 | - public function index_row( $params, $class ) { |
|
129 | - // Custom woo fields |
|
130 | - if ( 0 === strpos( $params['facet_source'], 'woo' ) ) { |
|
131 | - $product = wc_get_product( $params['post_id'] ); |
|
132 | - |
|
133 | - // Price |
|
134 | - if ( in_array( $params['facet_source'], array( 'woo/price', 'woo/sale_price', 'woo/regular_price' ) ) ) { |
|
135 | - $price = $params['facet_value']; |
|
136 | - if ( $product->is_taxable() ) { |
|
137 | - $price = wc_get_price_including_tax( $product ); |
|
138 | - } |
|
139 | - $params['facet_value'] = $price; |
|
140 | - $params['facet_display_value'] = $price; |
|
141 | - |
|
142 | - } |
|
143 | - } |
|
144 | - return $params; |
|
145 | - } |
|
9 | + /** |
|
10 | + * @var object \lsx\search\classes\facetwp\Hierarchy() |
|
11 | + */ |
|
12 | + public $hierarchy; |
|
13 | + |
|
14 | + /** |
|
15 | + * @var object \lsx\search\classes\facetwp\Post_Connections() |
|
16 | + */ |
|
17 | + public $post_connections; |
|
18 | + |
|
19 | + /** |
|
20 | + * Class Constructor. |
|
21 | + */ |
|
22 | + public function __construct() { |
|
23 | + |
|
24 | + require_once LSX_SEARCH_PATH . '/classes/facetwp/class-hierarchy.php'; |
|
25 | + $this->hierarchy = lsx\search\classes\facetwp\Hierarchy::get_instance(); |
|
26 | + |
|
27 | + require_once LSX_SEARCH_PATH . '/classes/facetwp/class-post-connections.php'; |
|
28 | + $this->post_connections = lsx\search\classes\facetwp\Post_Connections::get_instance(); |
|
29 | + |
|
30 | + add_filter( 'facetwp_pager_html', array( $this, 'facetwp_pager_html' ), 10, 2 ); |
|
31 | + add_filter( 'facetwp_result_count', array( $this, 'facetwp_result_count' ), 10, 2 ); |
|
32 | + add_filter( 'facetwp_facet_html', array( $this, 'facetwp_slide_html' ), 10, 2 ); |
|
33 | + add_filter( 'facetwp_load_css', array( $this, 'facetwp_load_css' ), 10, 1 ); |
|
34 | + add_filter( 'facetwp_index_row', array( $this, 'index_row' ), 10, 2 ); |
|
35 | + } |
|
36 | + |
|
37 | + /** |
|
38 | + * Change FaceWP pagination HTML to be equal LSX pagination. |
|
39 | + */ |
|
40 | + public function facetwp_pager_html( $output, $params ) { |
|
41 | + $output = ''; |
|
42 | + $page = (int) $params['page']; |
|
43 | + $per_page = (int) $params['per_page']; |
|
44 | + $total_pages = (int) $params['total_pages']; |
|
45 | + |
|
46 | + if ( 1 < $total_pages ) { |
|
47 | + $output .= '<div class="lsx-pagination-wrapper facetwp-custom">'; |
|
48 | + $output .= '<div class="lsx-pagination">'; |
|
49 | + // $output .= '<span class="pages">Page '. $page .' of '. $total_pages .'</span>'; |
|
50 | + |
|
51 | + if ( 1 < $page ) { |
|
52 | + $output .= '<a class="prev page-numbers facetwp-page" rel="prev" data-page="' . ( $page - 1 ) . '">«</a>'; |
|
53 | + } |
|
54 | + |
|
55 | + $temp = false; |
|
56 | + |
|
57 | + for ( $i = 1; $i <= $total_pages; $i++ ) { |
|
58 | + if ( $i == $page ) { |
|
59 | + $output .= '<span class="page-numbers current">' . $i . '</span>'; |
|
60 | + } elseif ( ( $page - 2 ) < $i && ( $page + 2 ) > $i ) { |
|
61 | + $output .= '<a class="page-numbers facetwp-page" data-page="' . $i . '">' . $i . '</a>'; |
|
62 | + } elseif ( ( $page - 2 ) >= $i && $page > 2 ) { |
|
63 | + if ( ! $temp ) { |
|
64 | + $output .= '<span class="page-numbers dots">...</span>'; |
|
65 | + $temp = true; |
|
66 | + } |
|
67 | + } elseif ( ( $page + 2 ) <= $i && ( $page + 2 ) <= $total_pages ) { |
|
68 | + $output .= '<span class="page-numbers dots">...</span>'; |
|
69 | + break; |
|
70 | + } |
|
71 | + } |
|
72 | + |
|
73 | + if ( $page < $total_pages ) { |
|
74 | + $output .= '<a class="next page-numbers facetwp-page" rel="next" data-page="' . ( $page + 1 ) . '">»</a>'; |
|
75 | + } |
|
76 | + |
|
77 | + $output .= '</div>'; |
|
78 | + $output .= '</div>'; |
|
79 | + } |
|
80 | + |
|
81 | + return $output; |
|
82 | + } |
|
83 | + |
|
84 | + /** |
|
85 | + * Change FaceWP result count HTML. |
|
86 | + */ |
|
87 | + public function facetwp_result_count( $output, $params ) { |
|
88 | + $output = $params['total']; |
|
89 | + return $output; |
|
90 | + } |
|
91 | + |
|
92 | + /** |
|
93 | + * Change FaceWP slider HTML. |
|
94 | + */ |
|
95 | + public function facetwp_slide_html( $html, $args ) { |
|
96 | + if ( 'slider' === $args['facet']['type'] ) { |
|
97 | + $html = str_replace( 'class="facetwp-slider-reset"', 'class="btn btn-md facetwp-slider-reset"', $html ); |
|
98 | + } |
|
99 | + |
|
100 | + return $html; |
|
101 | + } |
|
102 | + |
|
103 | + /** |
|
104 | + * Change FaceWP slider HTML. |
|
105 | + */ |
|
106 | + public function facetwp_counts_html( $html, $args ) { |
|
107 | + if ( 'slider' === $args['facet']['type'] ) { |
|
108 | + $html = str_replace( 'class="facetwp-slider-reset"', 'class="btn btn-md facetwp-slider-reset"', $html ); |
|
109 | + } |
|
110 | + return $html; |
|
111 | + } |
|
112 | + |
|
113 | + /** |
|
114 | + * Disable FacetWP styles. |
|
115 | + */ |
|
116 | + public function facetwp_load_css( $boolean ) { |
|
117 | + $boolean = false; |
|
118 | + return $boolean; |
|
119 | + } |
|
120 | + |
|
121 | + /** |
|
122 | + * Get the price including the tax |
|
123 | + * @param $params |
|
124 | + * @param $class |
|
125 | + * |
|
126 | + * @return mixed |
|
127 | + */ |
|
128 | + public function index_row( $params, $class ) { |
|
129 | + // Custom woo fields |
|
130 | + if ( 0 === strpos( $params['facet_source'], 'woo' ) ) { |
|
131 | + $product = wc_get_product( $params['post_id'] ); |
|
132 | + |
|
133 | + // Price |
|
134 | + if ( in_array( $params['facet_source'], array( 'woo/price', 'woo/sale_price', 'woo/regular_price' ) ) ) { |
|
135 | + $price = $params['facet_value']; |
|
136 | + if ( $product->is_taxable() ) { |
|
137 | + $price = wc_get_price_including_tax( $product ); |
|
138 | + } |
|
139 | + $params['facet_value'] = $price; |
|
140 | + $params['facet_display_value'] = $price; |
|
141 | + |
|
142 | + } |
|
143 | + } |
|
144 | + return $params; |
|
145 | + } |
|
146 | 146 | |
147 | 147 | } |
@@ -21,57 +21,57 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function __construct() { |
23 | 23 | |
24 | - require_once LSX_SEARCH_PATH . '/classes/facetwp/class-hierarchy.php'; |
|
24 | + require_once LSX_SEARCH_PATH.'/classes/facetwp/class-hierarchy.php'; |
|
25 | 25 | $this->hierarchy = lsx\search\classes\facetwp\Hierarchy::get_instance(); |
26 | 26 | |
27 | - require_once LSX_SEARCH_PATH . '/classes/facetwp/class-post-connections.php'; |
|
27 | + require_once LSX_SEARCH_PATH.'/classes/facetwp/class-post-connections.php'; |
|
28 | 28 | $this->post_connections = lsx\search\classes\facetwp\Post_Connections::get_instance(); |
29 | 29 | |
30 | - add_filter( 'facetwp_pager_html', array( $this, 'facetwp_pager_html' ), 10, 2 ); |
|
31 | - add_filter( 'facetwp_result_count', array( $this, 'facetwp_result_count' ), 10, 2 ); |
|
32 | - add_filter( 'facetwp_facet_html', array( $this, 'facetwp_slide_html' ), 10, 2 ); |
|
33 | - add_filter( 'facetwp_load_css', array( $this, 'facetwp_load_css' ), 10, 1 ); |
|
34 | - add_filter( 'facetwp_index_row', array( $this, 'index_row' ), 10, 2 ); |
|
30 | + add_filter('facetwp_pager_html', array($this, 'facetwp_pager_html'), 10, 2); |
|
31 | + add_filter('facetwp_result_count', array($this, 'facetwp_result_count'), 10, 2); |
|
32 | + add_filter('facetwp_facet_html', array($this, 'facetwp_slide_html'), 10, 2); |
|
33 | + add_filter('facetwp_load_css', array($this, 'facetwp_load_css'), 10, 1); |
|
34 | + add_filter('facetwp_index_row', array($this, 'index_row'), 10, 2); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
38 | 38 | * Change FaceWP pagination HTML to be equal LSX pagination. |
39 | 39 | */ |
40 | - public function facetwp_pager_html( $output, $params ) { |
|
40 | + public function facetwp_pager_html($output, $params) { |
|
41 | 41 | $output = ''; |
42 | 42 | $page = (int) $params['page']; |
43 | 43 | $per_page = (int) $params['per_page']; |
44 | 44 | $total_pages = (int) $params['total_pages']; |
45 | 45 | |
46 | - if ( 1 < $total_pages ) { |
|
46 | + if (1 < $total_pages) { |
|
47 | 47 | $output .= '<div class="lsx-pagination-wrapper facetwp-custom">'; |
48 | 48 | $output .= '<div class="lsx-pagination">'; |
49 | 49 | // $output .= '<span class="pages">Page '. $page .' of '. $total_pages .'</span>'; |
50 | 50 | |
51 | - if ( 1 < $page ) { |
|
52 | - $output .= '<a class="prev page-numbers facetwp-page" rel="prev" data-page="' . ( $page - 1 ) . '">«</a>'; |
|
51 | + if (1 < $page) { |
|
52 | + $output .= '<a class="prev page-numbers facetwp-page" rel="prev" data-page="'.($page - 1).'">«</a>'; |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | $temp = false; |
56 | 56 | |
57 | - for ( $i = 1; $i <= $total_pages; $i++ ) { |
|
58 | - if ( $i == $page ) { |
|
59 | - $output .= '<span class="page-numbers current">' . $i . '</span>'; |
|
60 | - } elseif ( ( $page - 2 ) < $i && ( $page + 2 ) > $i ) { |
|
61 | - $output .= '<a class="page-numbers facetwp-page" data-page="' . $i . '">' . $i . '</a>'; |
|
62 | - } elseif ( ( $page - 2 ) >= $i && $page > 2 ) { |
|
63 | - if ( ! $temp ) { |
|
57 | + for ($i = 1; $i <= $total_pages; $i++) { |
|
58 | + if ($i == $page) { |
|
59 | + $output .= '<span class="page-numbers current">'.$i.'</span>'; |
|
60 | + } elseif (($page - 2) < $i && ($page + 2) > $i) { |
|
61 | + $output .= '<a class="page-numbers facetwp-page" data-page="'.$i.'">'.$i.'</a>'; |
|
62 | + } elseif (($page - 2) >= $i && $page > 2) { |
|
63 | + if (!$temp) { |
|
64 | 64 | $output .= '<span class="page-numbers dots">...</span>'; |
65 | 65 | $temp = true; |
66 | 66 | } |
67 | - } elseif ( ( $page + 2 ) <= $i && ( $page + 2 ) <= $total_pages ) { |
|
67 | + } elseif (($page + 2) <= $i && ($page + 2) <= $total_pages) { |
|
68 | 68 | $output .= '<span class="page-numbers dots">...</span>'; |
69 | 69 | break; |
70 | 70 | } |
71 | 71 | } |
72 | 72 | |
73 | - if ( $page < $total_pages ) { |
|
74 | - $output .= '<a class="next page-numbers facetwp-page" rel="next" data-page="' . ( $page + 1 ) . '">»</a>'; |
|
73 | + if ($page < $total_pages) { |
|
74 | + $output .= '<a class="next page-numbers facetwp-page" rel="next" data-page="'.($page + 1).'">»</a>'; |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | $output .= '</div>'; |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | /** |
85 | 85 | * Change FaceWP result count HTML. |
86 | 86 | */ |
87 | - public function facetwp_result_count( $output, $params ) { |
|
87 | + public function facetwp_result_count($output, $params) { |
|
88 | 88 | $output = $params['total']; |
89 | 89 | return $output; |
90 | 90 | } |
@@ -92,9 +92,9 @@ discard block |
||
92 | 92 | /** |
93 | 93 | * Change FaceWP slider HTML. |
94 | 94 | */ |
95 | - public function facetwp_slide_html( $html, $args ) { |
|
96 | - if ( 'slider' === $args['facet']['type'] ) { |
|
97 | - $html = str_replace( 'class="facetwp-slider-reset"', 'class="btn btn-md facetwp-slider-reset"', $html ); |
|
95 | + public function facetwp_slide_html($html, $args) { |
|
96 | + if ('slider' === $args['facet']['type']) { |
|
97 | + $html = str_replace('class="facetwp-slider-reset"', 'class="btn btn-md facetwp-slider-reset"', $html); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | return $html; |
@@ -103,9 +103,9 @@ discard block |
||
103 | 103 | /** |
104 | 104 | * Change FaceWP slider HTML. |
105 | 105 | */ |
106 | - public function facetwp_counts_html( $html, $args ) { |
|
107 | - if ( 'slider' === $args['facet']['type'] ) { |
|
108 | - $html = str_replace( 'class="facetwp-slider-reset"', 'class="btn btn-md facetwp-slider-reset"', $html ); |
|
106 | + public function facetwp_counts_html($html, $args) { |
|
107 | + if ('slider' === $args['facet']['type']) { |
|
108 | + $html = str_replace('class="facetwp-slider-reset"', 'class="btn btn-md facetwp-slider-reset"', $html); |
|
109 | 109 | } |
110 | 110 | return $html; |
111 | 111 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | /** |
114 | 114 | * Disable FacetWP styles. |
115 | 115 | */ |
116 | - public function facetwp_load_css( $boolean ) { |
|
116 | + public function facetwp_load_css($boolean) { |
|
117 | 117 | $boolean = false; |
118 | 118 | return $boolean; |
119 | 119 | } |
@@ -125,18 +125,18 @@ discard block |
||
125 | 125 | * |
126 | 126 | * @return mixed |
127 | 127 | */ |
128 | - public function index_row( $params, $class ) { |
|
128 | + public function index_row($params, $class) { |
|
129 | 129 | // Custom woo fields |
130 | - if ( 0 === strpos( $params['facet_source'], 'woo' ) ) { |
|
131 | - $product = wc_get_product( $params['post_id'] ); |
|
130 | + if (0 === strpos($params['facet_source'], 'woo')) { |
|
131 | + $product = wc_get_product($params['post_id']); |
|
132 | 132 | |
133 | 133 | // Price |
134 | - if ( in_array( $params['facet_source'], array( 'woo/price', 'woo/sale_price', 'woo/regular_price' ) ) ) { |
|
134 | + if (in_array($params['facet_source'], array('woo/price', 'woo/sale_price', 'woo/regular_price'))) { |
|
135 | 135 | $price = $params['facet_value']; |
136 | - if ( $product->is_taxable() ) { |
|
137 | - $price = wc_get_price_including_tax( $product ); |
|
136 | + if ($product->is_taxable()) { |
|
137 | + $price = wc_get_price_including_tax($product); |
|
138 | 138 | } |
139 | - $params['facet_value'] = $price; |
|
139 | + $params['facet_value'] = $price; |
|
140 | 140 | $params['facet_display_value'] = $price; |
141 | 141 | |
142 | 142 | } |
@@ -12,475 +12,475 @@ discard block |
||
12 | 12 | */ |
13 | 13 | class Admin { |
14 | 14 | |
15 | - /** |
|
16 | - * Holds class instance |
|
17 | - * |
|
18 | - * @since 1.0.0 |
|
19 | - * |
|
20 | - * @var object \lsx\search\classes\Admin() |
|
21 | - */ |
|
22 | - protected static $instance = null; |
|
23 | - /** |
|
24 | - * Holds the options for the search. |
|
25 | - * |
|
26 | - * @var array() |
|
27 | - */ |
|
28 | - public $options = false; |
|
29 | - |
|
30 | - /** |
|
31 | - * Holds the facetwp data for use in the fields. |
|
32 | - * |
|
33 | - * @var array() |
|
34 | - */ |
|
35 | - public $facet_data = false; |
|
36 | - |
|
37 | - /** |
|
38 | - * Holds the Alpha betical facetwp data for use in the fields. |
|
39 | - * |
|
40 | - * @var array() |
|
41 | - */ |
|
42 | - public $az_facets = array(); |
|
43 | - |
|
44 | - /** |
|
45 | - * Holds the settings page theme functions |
|
46 | - * |
|
47 | - * @var object \lsx\search\classes\admin\Settings_Theme(); |
|
48 | - */ |
|
49 | - public $settings_theme; |
|
50 | - |
|
51 | - /** |
|
52 | - * Construct method. |
|
53 | - */ |
|
54 | - public function __construct() { |
|
55 | - $this->load_classes(); |
|
56 | - add_action( 'cmb2_admin_init', array( $this, 'register_settings_page' ) ); |
|
57 | - add_action( 'lsx_search_settings_page', array( $this, 'configure_settings_search_engine_fields' ), 15, 1 ); |
|
58 | - add_action( 'lsx_search_settings_page', array( $this, 'configure_settings_search_archive_fields' ), 15, 1 ); |
|
59 | - add_action( 'admin_enqueue_scripts', array( $this, 'assets' ) ); |
|
60 | - |
|
61 | - if ( is_admin() ) { |
|
62 | - add_filter( 'lsx_customizer_colour_selectors_body', array( $this, 'customizer_body_colours_handler' ), 15, 2 ); |
|
63 | - add_filter( 'lsx_customizer_colour_selectors_button', array( $this, 'customizer_button_colours' ), 10, 2 ); |
|
64 | - } |
|
65 | - } |
|
66 | - |
|
67 | - /** |
|
68 | - * Return an instance of this class. |
|
69 | - * |
|
70 | - * @since 1.0.0 |
|
71 | - * |
|
72 | - * @return object \lsx\member_directory\search\Admin() A single instance of this class. |
|
73 | - */ |
|
74 | - public static function get_instance() { |
|
75 | - // If the single instance hasn't been set, set it now. |
|
76 | - if ( null === self::$instance ) { |
|
77 | - self::$instance = new self(); |
|
78 | - } |
|
79 | - return self::$instance; |
|
80 | - } |
|
81 | - |
|
82 | - /** |
|
83 | - * Loads the variable classes and the static classes. |
|
84 | - */ |
|
85 | - private function load_classes() { |
|
86 | - require_once LSX_SEARCH_PATH . 'classes/admin/class-settings-theme.php'; |
|
87 | - $this->settings_theme = admin\Settings_Theme::get_instance(); |
|
88 | - } |
|
89 | - |
|
90 | - /** |
|
91 | - * Configure Business Directory custom fields for the Settings page. |
|
92 | - * |
|
93 | - * @return void |
|
94 | - */ |
|
95 | - public function register_settings_page() { |
|
96 | - $args = array( |
|
97 | - 'id' => 'lsx_search_settings', |
|
98 | - 'title' => '<h1>' . esc_html__( 'LSX Search Settings', 'lsx-search' ) . ' <span class="version">' . LSX_SEARCH_VER . '</span></h1>', |
|
99 | - 'menu_title' => esc_html__( 'LSX Search', 'search' ), // Falls back to 'title' (above). |
|
100 | - 'object_types' => array( 'options-page' ), |
|
101 | - 'option_key' => 'lsx-search-settings', // The option key and admin menu page slug. |
|
102 | - 'parent_slug' => 'options-general.php', |
|
103 | - 'capability' => 'manage_options', // Cap required to view options-page. |
|
104 | - ); |
|
105 | - $cmb = new_cmb2_box( $args ); |
|
106 | - do_action( 'lsx_search_settings_page', $cmb ); |
|
107 | - } |
|
108 | - |
|
109 | - /** |
|
110 | - * Sets post types with active search options. |
|
111 | - */ |
|
112 | - public function register_post_type_tabs( $post_types_plural ) { |
|
113 | - $post_types_plural = array( |
|
114 | - 'project' => 'projects', |
|
115 | - 'service' => 'services', |
|
116 | - 'team' => 'team', |
|
117 | - 'testimonial' => 'testimonials', |
|
118 | - 'video' => 'videos', |
|
119 | - 'product' => 'products', // WooCommerce |
|
120 | - 'post' => 'posts', |
|
121 | - ); |
|
122 | - return $post_types_plural; |
|
123 | - } |
|
124 | - |
|
125 | - /** |
|
126 | - * Gets the Tour Operator Post Types. |
|
127 | - * |
|
128 | - * @return array |
|
129 | - */ |
|
130 | - public function get_to_post_types() { |
|
131 | - $to_types = array( |
|
132 | - 'accommodation', |
|
133 | - 'tour', |
|
134 | - 'destination', |
|
135 | - 'review', |
|
136 | - 'activity', |
|
137 | - 'special', |
|
138 | - 'vehicle', |
|
139 | - ); |
|
140 | - return $to_types; |
|
141 | - } |
|
142 | - |
|
143 | - /** |
|
144 | - * Sets the FacetWP variables. |
|
145 | - * |
|
146 | - * @return void |
|
147 | - */ |
|
148 | - public function set_facetwp_vars() { |
|
149 | - if ( function_exists( '\FWP' ) ) { |
|
150 | - $facet_data = \FWP()->helper->get_facets(); |
|
151 | - } |
|
152 | - $this->facet_data = array(); |
|
153 | - $this->az_facets = array( |
|
154 | - '' => __( 'Do not show', 'lsx-search' ), |
|
155 | - ); |
|
156 | - if ( ! empty( $facet_data ) && is_array( $facet_data ) ) { |
|
157 | - foreach ( $facet_data as $facet ) { |
|
158 | - if ( 'alpha' === $facet['type'] ) { |
|
159 | - $this->az_facets[ $facet['name'] ] = $facet['label'] . '(' . $facet['name'] . ')'; |
|
160 | - } else { |
|
161 | - $this->facet_data[ $facet['name'] ] = $facet['label'] . '(' . $facet['name'] . ')'; |
|
162 | - } |
|
163 | - } |
|
164 | - } |
|
165 | - } |
|
166 | - |
|
167 | - /** |
|
168 | - * Enqueue JS and CSS. |
|
169 | - */ |
|
170 | - public function assets( $hook ) { |
|
171 | - wp_enqueue_script( 'lsx-search-admin', LSX_SEARCH_URL . 'assets/js/src/lsx-search-admin.js', array( 'jquery' ), LSX_SEARCH_VER, true ); |
|
172 | - wp_enqueue_style( 'lsx-search-admin', LSX_SEARCH_URL . 'assets/css/lsx-search-admin.css', array(), LSX_SEARCH_VER ); |
|
173 | - } |
|
174 | - |
|
175 | - /** |
|
176 | - * Enable Business Directory Search settings only if LSX Search plugin is enabled. |
|
177 | - * |
|
178 | - * @return void |
|
179 | - */ |
|
180 | - public function configure_settings_search_engine_fields( $cmb ) { |
|
181 | - $global_args = array( |
|
182 | - 'title' => __( 'Global', 'lsx-search' ), |
|
183 | - 'desc' => esc_html__( 'Control the filters which show on your WordPress search results page.', 'lsx-search' ), |
|
184 | - ); |
|
185 | - $this->search_fields( $cmb, 'engine', $global_args ); |
|
186 | - } |
|
187 | - |
|
188 | - /** |
|
189 | - * Enable Business Directory Search settings only if LSX Search plugin is enabled. |
|
190 | - * |
|
191 | - * @param object $cmb The CMB2() class. |
|
192 | - * @param string $position either top of bottom. |
|
193 | - * @return void |
|
194 | - */ |
|
195 | - public function configure_settings_search_archive_fields( $cmb ) { |
|
196 | - $archives = array(); |
|
197 | - $post_type_args = array( |
|
198 | - 'public' => true, |
|
199 | - ); |
|
200 | - $post_types = get_post_types( $post_type_args ); |
|
201 | - if ( ! empty( $post_types ) ) { |
|
202 | - foreach ( $post_types as $post_type_key => $post_type_value ) { |
|
203 | - switch ( $post_type_key ) { |
|
204 | - case 'post': |
|
205 | - $page_url = home_url(); |
|
206 | - $page_title = __( 'Home', 'lsx-search' ); |
|
207 | - $show_on_front = get_option( 'show_on_front' ); |
|
208 | - if ( 'page' === $show_on_front ) { |
|
209 | - $page_for_posts = get_option( 'page_for_posts' ); |
|
210 | - if ( '' !== $page_for_posts ) { |
|
211 | - $page_title = get_the_title( $page_for_posts ); |
|
212 | - $page_url = get_permalink( $page_for_posts ); |
|
213 | - } |
|
214 | - } |
|
215 | - $description = sprintf( |
|
216 | - /* translators: %s: The subscription info */ |
|
217 | - __( 'Control the filters which show on your <a target="_blank" href="%1$s">%2$s</a> page.', 'lsx-search' ), |
|
218 | - $page_url, |
|
219 | - $page_title |
|
220 | - ); |
|
221 | - $archives[ $post_type_key ] = array( |
|
222 | - 'title' => __( 'Blog', 'lsx-search' ), |
|
223 | - 'desc' => $description, |
|
224 | - ); |
|
225 | - break; |
|
226 | - |
|
227 | - case 'product': |
|
228 | - $page_url = home_url(); |
|
229 | - $page_title = __( 'Shop', 'lsx-search' ); |
|
230 | - if ( function_exists( 'wc_get_page_id' ) ) { |
|
231 | - $shop_page = wc_get_page_id( 'shop' ); |
|
232 | - $page_url = get_permalink( $shop_page ); |
|
233 | - $page_title = get_the_title( $shop_page ); |
|
234 | - } |
|
235 | - $description = sprintf( |
|
236 | - /* translators: %s: The subscription info */ |
|
237 | - __( 'Control the filters which show on your <a target="_blank" href="%1$s">%2$s</a> page.', 'lsx-search' ), |
|
238 | - $page_url, |
|
239 | - $page_title |
|
240 | - ); |
|
241 | - $archives[ $post_type_key ] = array( |
|
242 | - 'title' => __( 'Shop', 'lsx-search' ), |
|
243 | - 'desc' => $description, |
|
244 | - ); |
|
245 | - break; |
|
246 | - |
|
247 | - default: |
|
248 | - if ( ! in_array( $post_type_key, \lsx\search\includes\get_restricted_post_types() ) ) { |
|
249 | - $temp_post_type = get_post_type_object( $post_type_key ); |
|
250 | - if ( ! is_wp_error( $temp_post_type ) ) { |
|
251 | - $page_url = get_post_type_archive_link( $temp_post_type->name ); |
|
252 | - $description = sprintf( |
|
253 | - /* translators: %s: The subscription info */ |
|
254 | - __( 'Control the filters which show on your <a target="_blank" href="%1$s">%2$s</a> archive.', 'lsx-search' ), |
|
255 | - $page_url, |
|
256 | - $temp_post_type->label |
|
257 | - ); |
|
258 | - |
|
259 | - $archives[ $post_type_key ] = array( |
|
260 | - 'title' => $temp_post_type->label, |
|
261 | - 'desc' => $description, |
|
262 | - ); |
|
263 | - } |
|
264 | - } |
|
265 | - break; |
|
266 | - } |
|
267 | - } |
|
268 | - } |
|
269 | - if ( ! empty( $archives ) ) { |
|
270 | - foreach ( $archives as $archive_key => $archive_args ) { |
|
271 | - $this->search_fields( $cmb, $archive_key, $archive_args ); |
|
272 | - } |
|
273 | - } |
|
274 | - } |
|
275 | - |
|
276 | - /** |
|
277 | - * Enable Business Directory Search settings only if LSX Search plugin is enabled. |
|
278 | - * |
|
279 | - * @param object $cmb The CMB2() class. |
|
280 | - * @param string $section either engine,archive or single. |
|
281 | - * @return void |
|
282 | - */ |
|
283 | - public function search_fields( $cmb, $section, $args ) { |
|
284 | - $this->set_facetwp_vars(); |
|
285 | - $cmb->add_field( |
|
286 | - array( |
|
287 | - 'id' => 'settings_' . $section . '_search', |
|
288 | - 'type' => 'title', |
|
289 | - 'name' => $args['title'], |
|
290 | - 'default' => $args['title'], |
|
291 | - 'description' => $args['desc'], |
|
292 | - ) |
|
293 | - ); |
|
294 | - do_action( 'lsx_search_settings_section', $cmb, 'top' ); |
|
295 | - $cmb->add_field( |
|
296 | - array( |
|
297 | - 'name' => esc_html__( 'Enable Search Filters', 'lsx-search' ), |
|
298 | - 'id' => $section . '_search_enable', |
|
299 | - 'description' => esc_html__( 'Display FacetWP filters on your search results page.', 'lsx-search' ), |
|
300 | - 'type' => 'checkbox', |
|
301 | - ) |
|
302 | - ); |
|
303 | - |
|
304 | - $cmb->add_field( |
|
305 | - array( |
|
306 | - 'name' => esc_html__( 'Page Layout', 'lsx-search' ), |
|
307 | - 'id' => $section . '_search_layout', |
|
308 | - 'type' => 'select', |
|
309 | - 'options' => array( |
|
310 | - '' => esc_html__( 'Follow the theme layout', 'lsx-search' ), |
|
311 | - '2cr' => esc_html__( 'Sidebar on left', 'lsx-search' ), |
|
312 | - '2cl' => esc_html__( 'Sidebar on right', 'lsx-search' ), |
|
313 | - ), |
|
314 | - 'default' => '', |
|
315 | - ) |
|
316 | - ); |
|
317 | - |
|
318 | - if ( 'product' === $section ) { |
|
319 | - $cmb->add_field( |
|
320 | - array( |
|
321 | - 'name' => esc_html__( 'Results Layout', 'lsx-search' ), |
|
322 | - 'id' => $section . '_search_grid_list', |
|
323 | - 'type' => 'select', |
|
324 | - 'show_option_none' => false, |
|
325 | - 'description' => __( 'Set a default layout for the search results.', 'lsx-search' ), |
|
326 | - 'options' => array( |
|
327 | - 'grid' => esc_html__( 'Grid', 'lsx-search' ), |
|
328 | - 'list' => esc_html__( 'List', 'lsx-search' ), |
|
329 | - ), |
|
330 | - 'default' => 'grid', |
|
331 | - ) |
|
332 | - ); |
|
333 | - $cmb->add_field( |
|
334 | - array( |
|
335 | - 'name' => esc_html__( 'Layout Switcher', 'lsx-search' ), |
|
336 | - 'id' => $section . '_search_layout_switcher_enable', |
|
337 | - 'type' => 'checkbox', |
|
338 | - 'description' => __( 'Display the layout switcher to allow the user to toggle between the list and grid layouts.', 'lsx-search' ), |
|
339 | - ) |
|
340 | - ); |
|
341 | - } |
|
342 | - if ( 'engine' === $section && function_exists('is_plugin_active') && is_plugin_active( 'tour-operator/tour-operator.php' ) ) { |
|
343 | - $cmb->add_field( |
|
344 | - array( |
|
345 | - 'name' => esc_html__( 'List layout images', 'lsx-search' ), |
|
346 | - 'id' => $section . '_search_list_layout_image_style', |
|
347 | - 'type' => 'select', |
|
348 | - 'options' => array( |
|
349 | - '' => esc_html__( 'Full Height', 'lsx-search' ), |
|
350 | - 'max-height' => esc_html__( 'Max Height', 'lsx-search' ), |
|
351 | - ), |
|
352 | - 'default' => '', |
|
353 | - ) |
|
354 | - ); |
|
355 | - } |
|
356 | - if ( 'engine' === $section ) { |
|
357 | - $cmb->add_field( |
|
358 | - array( |
|
359 | - 'name' => esc_html__( 'Display Excerpt', 'lsx-search' ), |
|
360 | - 'id' => $section . '_excerpt_enable', |
|
361 | - 'type' => 'checkbox', |
|
362 | - 'description' => __( 'Display the excerpt of a listing.', 'lsx-search' ), |
|
363 | - ) |
|
364 | - ); |
|
365 | - $cmb->add_field( |
|
366 | - array( |
|
367 | - 'name' => esc_html__( 'Enable Post Type Label', 'lsx-search' ), |
|
368 | - 'id' => $section . '_search_enable_pt_label', |
|
369 | - 'type' => 'checkbox', |
|
370 | - 'description' => __( 'This enables the post type label from entries on search results page.', 'lsx-search' ), |
|
371 | - ) |
|
372 | - ); |
|
373 | - if ( function_exists('is_plugin_active') && is_plugin_active( 'tour-operator/tour-operator.php' ) ) { |
|
374 | - $cmb->add_field( |
|
375 | - array( |
|
376 | - 'name' => esc_html__( 'Enable Continent Filter', 'lsx-search' ), |
|
377 | - 'id' => $section . '_search_enable_continent_filter', |
|
378 | - 'type' => 'checkbox', |
|
379 | - 'description' => __( 'This enables the continent filter in FacetWP destinations filter.', 'lsx-search' ), |
|
380 | - ) |
|
381 | - ); |
|
382 | - $cmb->add_field( |
|
383 | - array( |
|
384 | - 'name' => esc_html__( 'Enable Continental Regions', 'lsx-search' ), |
|
385 | - 'id' => $section . '_search_enable_continental_regions', |
|
386 | - 'type' => 'checkbox', |
|
387 | - 'description' => __( 'This disable continents and enabled the sub regions.', 'lsx-search' ), |
|
388 | - ) |
|
389 | - ); |
|
390 | - } |
|
391 | - } |
|
392 | - |
|
393 | - if ( function_exists('is_plugin_active') && is_plugin_active( 'tour-operator/tour-operator.php' ) && 'accommodation' === $section ) { |
|
394 | - $cmb->add_field( |
|
395 | - array( |
|
396 | - 'name' => esc_html__( 'Results Layout - list vs map', 'lsx-search' ), |
|
397 | - 'id' => $section . '_search_results_layout', |
|
398 | - 'type' => 'select', |
|
399 | - 'options' => array( |
|
400 | - 'list_map' => esc_html__( 'List and Map', 'lsx-search' ), |
|
401 | - 'list' => esc_html__( 'List only', 'lsx-search' ), |
|
402 | - ), |
|
403 | - 'default' => '', |
|
404 | - ) |
|
405 | - ); |
|
406 | - } |
|
407 | - |
|
408 | - $cmb->add_field( |
|
409 | - array( |
|
410 | - 'name' => esc_html__( 'Enable Collapse', 'lsx-search' ), |
|
411 | - 'id' => $section . '_search_collapse', |
|
412 | - 'type' => 'checkbox', |
|
413 | - 'description' => __( 'Enable collapsible filters on search results.', 'lsx-search' ), |
|
414 | - ) |
|
415 | - ); |
|
416 | - |
|
417 | - $cmb->add_field( |
|
418 | - array( |
|
419 | - 'name' => esc_html__( 'Disable Sorting', 'lsx-search' ), |
|
420 | - 'id' => $section . '_search_disable_sorting', |
|
421 | - 'type' => 'checkbox', |
|
422 | - 'description' => __( 'Toggle the sorting drop down menu on your search results.', 'lsx-search' ), |
|
423 | - ) |
|
424 | - ); |
|
425 | - |
|
426 | - $cmb->add_field( |
|
427 | - array( |
|
428 | - 'name' => esc_html__( 'Disable the Date Sorting Option', 'lsx-search' ), |
|
429 | - 'id' => $section . '_search_disable_date', |
|
430 | - 'type' => 'checkbox', |
|
431 | - ) |
|
432 | - ); |
|
433 | - |
|
434 | - $cmb->add_field( |
|
435 | - array( |
|
436 | - 'name' => esc_html__( 'Display Clear Button', 'lsx-search' ), |
|
437 | - 'id' => $section . '_search_display_clear_button', |
|
438 | - 'type' => 'checkbox', |
|
439 | - 'description' => __( 'Check this to turn on a button that will clear your search results.', 'lsx-search' ), |
|
440 | - ) |
|
441 | - ); |
|
442 | - |
|
443 | - $cmb->add_field( |
|
444 | - array( |
|
445 | - 'name' => esc_html__( 'Display Result Count', 'lsx-search' ), |
|
446 | - 'id' => $section . '_search_display_result_count', |
|
447 | - 'type' => 'checkbox', |
|
448 | - ) |
|
449 | - ); |
|
450 | - if ( function_exists('is_plugin_active') && is_plugin_active( 'facetwp-alpha/index.php' ) ) { |
|
451 | - $cmb->add_field( |
|
452 | - array( |
|
453 | - 'name' => esc_html__( 'Alphabet Facet', 'lsx-search' ), |
|
454 | - 'description' => esc_html__( 'Select the alphabetical sorter facet.', 'lsx-search' ), |
|
455 | - 'id' => $section . '_search_az_pagination', |
|
456 | - 'type' => 'select', |
|
457 | - 'options' => $this->az_facets, |
|
458 | - ) |
|
459 | - ); |
|
460 | - } |
|
461 | - $cmb->add_field( |
|
462 | - array( |
|
463 | - 'name' => esc_html__( 'Facets', 'lsx-search' ), |
|
464 | - 'description' => esc_html__( 'Choose the filters to display in the sidebar. Edit FacetWP filters to change individual filters.', 'lsx-search' ), |
|
465 | - 'id' => $section . '_search_facets', |
|
466 | - 'type' => 'multicheck', |
|
467 | - 'options' => $this->facet_data, |
|
468 | - ) |
|
469 | - ); |
|
470 | - do_action( 'lsx_search_settings_section', $cmb, 'bottom' ); |
|
471 | - $cmb->add_field( |
|
472 | - array( |
|
473 | - 'id' => 'settings_' . $section . '_search_closing', |
|
474 | - 'type' => 'tab_closing', |
|
475 | - ) |
|
476 | - ); |
|
477 | - } |
|
478 | - |
|
479 | - /** |
|
480 | - * Handle body colours that might be change by LSX Customiser. |
|
481 | - */ |
|
482 | - public function customizer_body_colours_handler( $css, $colors ) { |
|
483 | - $css .= ' |
|
15 | + /** |
|
16 | + * Holds class instance |
|
17 | + * |
|
18 | + * @since 1.0.0 |
|
19 | + * |
|
20 | + * @var object \lsx\search\classes\Admin() |
|
21 | + */ |
|
22 | + protected static $instance = null; |
|
23 | + /** |
|
24 | + * Holds the options for the search. |
|
25 | + * |
|
26 | + * @var array() |
|
27 | + */ |
|
28 | + public $options = false; |
|
29 | + |
|
30 | + /** |
|
31 | + * Holds the facetwp data for use in the fields. |
|
32 | + * |
|
33 | + * @var array() |
|
34 | + */ |
|
35 | + public $facet_data = false; |
|
36 | + |
|
37 | + /** |
|
38 | + * Holds the Alpha betical facetwp data for use in the fields. |
|
39 | + * |
|
40 | + * @var array() |
|
41 | + */ |
|
42 | + public $az_facets = array(); |
|
43 | + |
|
44 | + /** |
|
45 | + * Holds the settings page theme functions |
|
46 | + * |
|
47 | + * @var object \lsx\search\classes\admin\Settings_Theme(); |
|
48 | + */ |
|
49 | + public $settings_theme; |
|
50 | + |
|
51 | + /** |
|
52 | + * Construct method. |
|
53 | + */ |
|
54 | + public function __construct() { |
|
55 | + $this->load_classes(); |
|
56 | + add_action( 'cmb2_admin_init', array( $this, 'register_settings_page' ) ); |
|
57 | + add_action( 'lsx_search_settings_page', array( $this, 'configure_settings_search_engine_fields' ), 15, 1 ); |
|
58 | + add_action( 'lsx_search_settings_page', array( $this, 'configure_settings_search_archive_fields' ), 15, 1 ); |
|
59 | + add_action( 'admin_enqueue_scripts', array( $this, 'assets' ) ); |
|
60 | + |
|
61 | + if ( is_admin() ) { |
|
62 | + add_filter( 'lsx_customizer_colour_selectors_body', array( $this, 'customizer_body_colours_handler' ), 15, 2 ); |
|
63 | + add_filter( 'lsx_customizer_colour_selectors_button', array( $this, 'customizer_button_colours' ), 10, 2 ); |
|
64 | + } |
|
65 | + } |
|
66 | + |
|
67 | + /** |
|
68 | + * Return an instance of this class. |
|
69 | + * |
|
70 | + * @since 1.0.0 |
|
71 | + * |
|
72 | + * @return object \lsx\member_directory\search\Admin() A single instance of this class. |
|
73 | + */ |
|
74 | + public static function get_instance() { |
|
75 | + // If the single instance hasn't been set, set it now. |
|
76 | + if ( null === self::$instance ) { |
|
77 | + self::$instance = new self(); |
|
78 | + } |
|
79 | + return self::$instance; |
|
80 | + } |
|
81 | + |
|
82 | + /** |
|
83 | + * Loads the variable classes and the static classes. |
|
84 | + */ |
|
85 | + private function load_classes() { |
|
86 | + require_once LSX_SEARCH_PATH . 'classes/admin/class-settings-theme.php'; |
|
87 | + $this->settings_theme = admin\Settings_Theme::get_instance(); |
|
88 | + } |
|
89 | + |
|
90 | + /** |
|
91 | + * Configure Business Directory custom fields for the Settings page. |
|
92 | + * |
|
93 | + * @return void |
|
94 | + */ |
|
95 | + public function register_settings_page() { |
|
96 | + $args = array( |
|
97 | + 'id' => 'lsx_search_settings', |
|
98 | + 'title' => '<h1>' . esc_html__( 'LSX Search Settings', 'lsx-search' ) . ' <span class="version">' . LSX_SEARCH_VER . '</span></h1>', |
|
99 | + 'menu_title' => esc_html__( 'LSX Search', 'search' ), // Falls back to 'title' (above). |
|
100 | + 'object_types' => array( 'options-page' ), |
|
101 | + 'option_key' => 'lsx-search-settings', // The option key and admin menu page slug. |
|
102 | + 'parent_slug' => 'options-general.php', |
|
103 | + 'capability' => 'manage_options', // Cap required to view options-page. |
|
104 | + ); |
|
105 | + $cmb = new_cmb2_box( $args ); |
|
106 | + do_action( 'lsx_search_settings_page', $cmb ); |
|
107 | + } |
|
108 | + |
|
109 | + /** |
|
110 | + * Sets post types with active search options. |
|
111 | + */ |
|
112 | + public function register_post_type_tabs( $post_types_plural ) { |
|
113 | + $post_types_plural = array( |
|
114 | + 'project' => 'projects', |
|
115 | + 'service' => 'services', |
|
116 | + 'team' => 'team', |
|
117 | + 'testimonial' => 'testimonials', |
|
118 | + 'video' => 'videos', |
|
119 | + 'product' => 'products', // WooCommerce |
|
120 | + 'post' => 'posts', |
|
121 | + ); |
|
122 | + return $post_types_plural; |
|
123 | + } |
|
124 | + |
|
125 | + /** |
|
126 | + * Gets the Tour Operator Post Types. |
|
127 | + * |
|
128 | + * @return array |
|
129 | + */ |
|
130 | + public function get_to_post_types() { |
|
131 | + $to_types = array( |
|
132 | + 'accommodation', |
|
133 | + 'tour', |
|
134 | + 'destination', |
|
135 | + 'review', |
|
136 | + 'activity', |
|
137 | + 'special', |
|
138 | + 'vehicle', |
|
139 | + ); |
|
140 | + return $to_types; |
|
141 | + } |
|
142 | + |
|
143 | + /** |
|
144 | + * Sets the FacetWP variables. |
|
145 | + * |
|
146 | + * @return void |
|
147 | + */ |
|
148 | + public function set_facetwp_vars() { |
|
149 | + if ( function_exists( '\FWP' ) ) { |
|
150 | + $facet_data = \FWP()->helper->get_facets(); |
|
151 | + } |
|
152 | + $this->facet_data = array(); |
|
153 | + $this->az_facets = array( |
|
154 | + '' => __( 'Do not show', 'lsx-search' ), |
|
155 | + ); |
|
156 | + if ( ! empty( $facet_data ) && is_array( $facet_data ) ) { |
|
157 | + foreach ( $facet_data as $facet ) { |
|
158 | + if ( 'alpha' === $facet['type'] ) { |
|
159 | + $this->az_facets[ $facet['name'] ] = $facet['label'] . '(' . $facet['name'] . ')'; |
|
160 | + } else { |
|
161 | + $this->facet_data[ $facet['name'] ] = $facet['label'] . '(' . $facet['name'] . ')'; |
|
162 | + } |
|
163 | + } |
|
164 | + } |
|
165 | + } |
|
166 | + |
|
167 | + /** |
|
168 | + * Enqueue JS and CSS. |
|
169 | + */ |
|
170 | + public function assets( $hook ) { |
|
171 | + wp_enqueue_script( 'lsx-search-admin', LSX_SEARCH_URL . 'assets/js/src/lsx-search-admin.js', array( 'jquery' ), LSX_SEARCH_VER, true ); |
|
172 | + wp_enqueue_style( 'lsx-search-admin', LSX_SEARCH_URL . 'assets/css/lsx-search-admin.css', array(), LSX_SEARCH_VER ); |
|
173 | + } |
|
174 | + |
|
175 | + /** |
|
176 | + * Enable Business Directory Search settings only if LSX Search plugin is enabled. |
|
177 | + * |
|
178 | + * @return void |
|
179 | + */ |
|
180 | + public function configure_settings_search_engine_fields( $cmb ) { |
|
181 | + $global_args = array( |
|
182 | + 'title' => __( 'Global', 'lsx-search' ), |
|
183 | + 'desc' => esc_html__( 'Control the filters which show on your WordPress search results page.', 'lsx-search' ), |
|
184 | + ); |
|
185 | + $this->search_fields( $cmb, 'engine', $global_args ); |
|
186 | + } |
|
187 | + |
|
188 | + /** |
|
189 | + * Enable Business Directory Search settings only if LSX Search plugin is enabled. |
|
190 | + * |
|
191 | + * @param object $cmb The CMB2() class. |
|
192 | + * @param string $position either top of bottom. |
|
193 | + * @return void |
|
194 | + */ |
|
195 | + public function configure_settings_search_archive_fields( $cmb ) { |
|
196 | + $archives = array(); |
|
197 | + $post_type_args = array( |
|
198 | + 'public' => true, |
|
199 | + ); |
|
200 | + $post_types = get_post_types( $post_type_args ); |
|
201 | + if ( ! empty( $post_types ) ) { |
|
202 | + foreach ( $post_types as $post_type_key => $post_type_value ) { |
|
203 | + switch ( $post_type_key ) { |
|
204 | + case 'post': |
|
205 | + $page_url = home_url(); |
|
206 | + $page_title = __( 'Home', 'lsx-search' ); |
|
207 | + $show_on_front = get_option( 'show_on_front' ); |
|
208 | + if ( 'page' === $show_on_front ) { |
|
209 | + $page_for_posts = get_option( 'page_for_posts' ); |
|
210 | + if ( '' !== $page_for_posts ) { |
|
211 | + $page_title = get_the_title( $page_for_posts ); |
|
212 | + $page_url = get_permalink( $page_for_posts ); |
|
213 | + } |
|
214 | + } |
|
215 | + $description = sprintf( |
|
216 | + /* translators: %s: The subscription info */ |
|
217 | + __( 'Control the filters which show on your <a target="_blank" href="%1$s">%2$s</a> page.', 'lsx-search' ), |
|
218 | + $page_url, |
|
219 | + $page_title |
|
220 | + ); |
|
221 | + $archives[ $post_type_key ] = array( |
|
222 | + 'title' => __( 'Blog', 'lsx-search' ), |
|
223 | + 'desc' => $description, |
|
224 | + ); |
|
225 | + break; |
|
226 | + |
|
227 | + case 'product': |
|
228 | + $page_url = home_url(); |
|
229 | + $page_title = __( 'Shop', 'lsx-search' ); |
|
230 | + if ( function_exists( 'wc_get_page_id' ) ) { |
|
231 | + $shop_page = wc_get_page_id( 'shop' ); |
|
232 | + $page_url = get_permalink( $shop_page ); |
|
233 | + $page_title = get_the_title( $shop_page ); |
|
234 | + } |
|
235 | + $description = sprintf( |
|
236 | + /* translators: %s: The subscription info */ |
|
237 | + __( 'Control the filters which show on your <a target="_blank" href="%1$s">%2$s</a> page.', 'lsx-search' ), |
|
238 | + $page_url, |
|
239 | + $page_title |
|
240 | + ); |
|
241 | + $archives[ $post_type_key ] = array( |
|
242 | + 'title' => __( 'Shop', 'lsx-search' ), |
|
243 | + 'desc' => $description, |
|
244 | + ); |
|
245 | + break; |
|
246 | + |
|
247 | + default: |
|
248 | + if ( ! in_array( $post_type_key, \lsx\search\includes\get_restricted_post_types() ) ) { |
|
249 | + $temp_post_type = get_post_type_object( $post_type_key ); |
|
250 | + if ( ! is_wp_error( $temp_post_type ) ) { |
|
251 | + $page_url = get_post_type_archive_link( $temp_post_type->name ); |
|
252 | + $description = sprintf( |
|
253 | + /* translators: %s: The subscription info */ |
|
254 | + __( 'Control the filters which show on your <a target="_blank" href="%1$s">%2$s</a> archive.', 'lsx-search' ), |
|
255 | + $page_url, |
|
256 | + $temp_post_type->label |
|
257 | + ); |
|
258 | + |
|
259 | + $archives[ $post_type_key ] = array( |
|
260 | + 'title' => $temp_post_type->label, |
|
261 | + 'desc' => $description, |
|
262 | + ); |
|
263 | + } |
|
264 | + } |
|
265 | + break; |
|
266 | + } |
|
267 | + } |
|
268 | + } |
|
269 | + if ( ! empty( $archives ) ) { |
|
270 | + foreach ( $archives as $archive_key => $archive_args ) { |
|
271 | + $this->search_fields( $cmb, $archive_key, $archive_args ); |
|
272 | + } |
|
273 | + } |
|
274 | + } |
|
275 | + |
|
276 | + /** |
|
277 | + * Enable Business Directory Search settings only if LSX Search plugin is enabled. |
|
278 | + * |
|
279 | + * @param object $cmb The CMB2() class. |
|
280 | + * @param string $section either engine,archive or single. |
|
281 | + * @return void |
|
282 | + */ |
|
283 | + public function search_fields( $cmb, $section, $args ) { |
|
284 | + $this->set_facetwp_vars(); |
|
285 | + $cmb->add_field( |
|
286 | + array( |
|
287 | + 'id' => 'settings_' . $section . '_search', |
|
288 | + 'type' => 'title', |
|
289 | + 'name' => $args['title'], |
|
290 | + 'default' => $args['title'], |
|
291 | + 'description' => $args['desc'], |
|
292 | + ) |
|
293 | + ); |
|
294 | + do_action( 'lsx_search_settings_section', $cmb, 'top' ); |
|
295 | + $cmb->add_field( |
|
296 | + array( |
|
297 | + 'name' => esc_html__( 'Enable Search Filters', 'lsx-search' ), |
|
298 | + 'id' => $section . '_search_enable', |
|
299 | + 'description' => esc_html__( 'Display FacetWP filters on your search results page.', 'lsx-search' ), |
|
300 | + 'type' => 'checkbox', |
|
301 | + ) |
|
302 | + ); |
|
303 | + |
|
304 | + $cmb->add_field( |
|
305 | + array( |
|
306 | + 'name' => esc_html__( 'Page Layout', 'lsx-search' ), |
|
307 | + 'id' => $section . '_search_layout', |
|
308 | + 'type' => 'select', |
|
309 | + 'options' => array( |
|
310 | + '' => esc_html__( 'Follow the theme layout', 'lsx-search' ), |
|
311 | + '2cr' => esc_html__( 'Sidebar on left', 'lsx-search' ), |
|
312 | + '2cl' => esc_html__( 'Sidebar on right', 'lsx-search' ), |
|
313 | + ), |
|
314 | + 'default' => '', |
|
315 | + ) |
|
316 | + ); |
|
317 | + |
|
318 | + if ( 'product' === $section ) { |
|
319 | + $cmb->add_field( |
|
320 | + array( |
|
321 | + 'name' => esc_html__( 'Results Layout', 'lsx-search' ), |
|
322 | + 'id' => $section . '_search_grid_list', |
|
323 | + 'type' => 'select', |
|
324 | + 'show_option_none' => false, |
|
325 | + 'description' => __( 'Set a default layout for the search results.', 'lsx-search' ), |
|
326 | + 'options' => array( |
|
327 | + 'grid' => esc_html__( 'Grid', 'lsx-search' ), |
|
328 | + 'list' => esc_html__( 'List', 'lsx-search' ), |
|
329 | + ), |
|
330 | + 'default' => 'grid', |
|
331 | + ) |
|
332 | + ); |
|
333 | + $cmb->add_field( |
|
334 | + array( |
|
335 | + 'name' => esc_html__( 'Layout Switcher', 'lsx-search' ), |
|
336 | + 'id' => $section . '_search_layout_switcher_enable', |
|
337 | + 'type' => 'checkbox', |
|
338 | + 'description' => __( 'Display the layout switcher to allow the user to toggle between the list and grid layouts.', 'lsx-search' ), |
|
339 | + ) |
|
340 | + ); |
|
341 | + } |
|
342 | + if ( 'engine' === $section && function_exists('is_plugin_active') && is_plugin_active( 'tour-operator/tour-operator.php' ) ) { |
|
343 | + $cmb->add_field( |
|
344 | + array( |
|
345 | + 'name' => esc_html__( 'List layout images', 'lsx-search' ), |
|
346 | + 'id' => $section . '_search_list_layout_image_style', |
|
347 | + 'type' => 'select', |
|
348 | + 'options' => array( |
|
349 | + '' => esc_html__( 'Full Height', 'lsx-search' ), |
|
350 | + 'max-height' => esc_html__( 'Max Height', 'lsx-search' ), |
|
351 | + ), |
|
352 | + 'default' => '', |
|
353 | + ) |
|
354 | + ); |
|
355 | + } |
|
356 | + if ( 'engine' === $section ) { |
|
357 | + $cmb->add_field( |
|
358 | + array( |
|
359 | + 'name' => esc_html__( 'Display Excerpt', 'lsx-search' ), |
|
360 | + 'id' => $section . '_excerpt_enable', |
|
361 | + 'type' => 'checkbox', |
|
362 | + 'description' => __( 'Display the excerpt of a listing.', 'lsx-search' ), |
|
363 | + ) |
|
364 | + ); |
|
365 | + $cmb->add_field( |
|
366 | + array( |
|
367 | + 'name' => esc_html__( 'Enable Post Type Label', 'lsx-search' ), |
|
368 | + 'id' => $section . '_search_enable_pt_label', |
|
369 | + 'type' => 'checkbox', |
|
370 | + 'description' => __( 'This enables the post type label from entries on search results page.', 'lsx-search' ), |
|
371 | + ) |
|
372 | + ); |
|
373 | + if ( function_exists('is_plugin_active') && is_plugin_active( 'tour-operator/tour-operator.php' ) ) { |
|
374 | + $cmb->add_field( |
|
375 | + array( |
|
376 | + 'name' => esc_html__( 'Enable Continent Filter', 'lsx-search' ), |
|
377 | + 'id' => $section . '_search_enable_continent_filter', |
|
378 | + 'type' => 'checkbox', |
|
379 | + 'description' => __( 'This enables the continent filter in FacetWP destinations filter.', 'lsx-search' ), |
|
380 | + ) |
|
381 | + ); |
|
382 | + $cmb->add_field( |
|
383 | + array( |
|
384 | + 'name' => esc_html__( 'Enable Continental Regions', 'lsx-search' ), |
|
385 | + 'id' => $section . '_search_enable_continental_regions', |
|
386 | + 'type' => 'checkbox', |
|
387 | + 'description' => __( 'This disable continents and enabled the sub regions.', 'lsx-search' ), |
|
388 | + ) |
|
389 | + ); |
|
390 | + } |
|
391 | + } |
|
392 | + |
|
393 | + if ( function_exists('is_plugin_active') && is_plugin_active( 'tour-operator/tour-operator.php' ) && 'accommodation' === $section ) { |
|
394 | + $cmb->add_field( |
|
395 | + array( |
|
396 | + 'name' => esc_html__( 'Results Layout - list vs map', 'lsx-search' ), |
|
397 | + 'id' => $section . '_search_results_layout', |
|
398 | + 'type' => 'select', |
|
399 | + 'options' => array( |
|
400 | + 'list_map' => esc_html__( 'List and Map', 'lsx-search' ), |
|
401 | + 'list' => esc_html__( 'List only', 'lsx-search' ), |
|
402 | + ), |
|
403 | + 'default' => '', |
|
404 | + ) |
|
405 | + ); |
|
406 | + } |
|
407 | + |
|
408 | + $cmb->add_field( |
|
409 | + array( |
|
410 | + 'name' => esc_html__( 'Enable Collapse', 'lsx-search' ), |
|
411 | + 'id' => $section . '_search_collapse', |
|
412 | + 'type' => 'checkbox', |
|
413 | + 'description' => __( 'Enable collapsible filters on search results.', 'lsx-search' ), |
|
414 | + ) |
|
415 | + ); |
|
416 | + |
|
417 | + $cmb->add_field( |
|
418 | + array( |
|
419 | + 'name' => esc_html__( 'Disable Sorting', 'lsx-search' ), |
|
420 | + 'id' => $section . '_search_disable_sorting', |
|
421 | + 'type' => 'checkbox', |
|
422 | + 'description' => __( 'Toggle the sorting drop down menu on your search results.', 'lsx-search' ), |
|
423 | + ) |
|
424 | + ); |
|
425 | + |
|
426 | + $cmb->add_field( |
|
427 | + array( |
|
428 | + 'name' => esc_html__( 'Disable the Date Sorting Option', 'lsx-search' ), |
|
429 | + 'id' => $section . '_search_disable_date', |
|
430 | + 'type' => 'checkbox', |
|
431 | + ) |
|
432 | + ); |
|
433 | + |
|
434 | + $cmb->add_field( |
|
435 | + array( |
|
436 | + 'name' => esc_html__( 'Display Clear Button', 'lsx-search' ), |
|
437 | + 'id' => $section . '_search_display_clear_button', |
|
438 | + 'type' => 'checkbox', |
|
439 | + 'description' => __( 'Check this to turn on a button that will clear your search results.', 'lsx-search' ), |
|
440 | + ) |
|
441 | + ); |
|
442 | + |
|
443 | + $cmb->add_field( |
|
444 | + array( |
|
445 | + 'name' => esc_html__( 'Display Result Count', 'lsx-search' ), |
|
446 | + 'id' => $section . '_search_display_result_count', |
|
447 | + 'type' => 'checkbox', |
|
448 | + ) |
|
449 | + ); |
|
450 | + if ( function_exists('is_plugin_active') && is_plugin_active( 'facetwp-alpha/index.php' ) ) { |
|
451 | + $cmb->add_field( |
|
452 | + array( |
|
453 | + 'name' => esc_html__( 'Alphabet Facet', 'lsx-search' ), |
|
454 | + 'description' => esc_html__( 'Select the alphabetical sorter facet.', 'lsx-search' ), |
|
455 | + 'id' => $section . '_search_az_pagination', |
|
456 | + 'type' => 'select', |
|
457 | + 'options' => $this->az_facets, |
|
458 | + ) |
|
459 | + ); |
|
460 | + } |
|
461 | + $cmb->add_field( |
|
462 | + array( |
|
463 | + 'name' => esc_html__( 'Facets', 'lsx-search' ), |
|
464 | + 'description' => esc_html__( 'Choose the filters to display in the sidebar. Edit FacetWP filters to change individual filters.', 'lsx-search' ), |
|
465 | + 'id' => $section . '_search_facets', |
|
466 | + 'type' => 'multicheck', |
|
467 | + 'options' => $this->facet_data, |
|
468 | + ) |
|
469 | + ); |
|
470 | + do_action( 'lsx_search_settings_section', $cmb, 'bottom' ); |
|
471 | + $cmb->add_field( |
|
472 | + array( |
|
473 | + 'id' => 'settings_' . $section . '_search_closing', |
|
474 | + 'type' => 'tab_closing', |
|
475 | + ) |
|
476 | + ); |
|
477 | + } |
|
478 | + |
|
479 | + /** |
|
480 | + * Handle body colours that might be change by LSX Customiser. |
|
481 | + */ |
|
482 | + public function customizer_body_colours_handler( $css, $colors ) { |
|
483 | + $css .= ' |
|
484 | 484 | @import "' . LSX_SEARCH_PATH . '/assets/css/scss/customizer-search-body-colours"; |
485 | 485 | |
486 | 486 | /** |
@@ -496,18 +496,18 @@ discard block |
||
496 | 496 | ); |
497 | 497 | '; |
498 | 498 | |
499 | - return $css; |
|
500 | - } |
|
501 | - |
|
502 | - /** |
|
503 | - * Adds the lsx search buttons to the customizer plugin. |
|
504 | - * |
|
505 | - * @param string $css |
|
506 | - * @param array $colours |
|
507 | - * @return string |
|
508 | - */ |
|
509 | - public function customizer_button_colours( $css, $colours ) { |
|
510 | - $css .= ' |
|
499 | + return $css; |
|
500 | + } |
|
501 | + |
|
502 | + /** |
|
503 | + * Adds the lsx search buttons to the customizer plugin. |
|
504 | + * |
|
505 | + * @param string $css |
|
506 | + * @param array $colours |
|
507 | + * @return string |
|
508 | + */ |
|
509 | + public function customizer_button_colours( $css, $colours ) { |
|
510 | + $css .= ' |
|
511 | 511 | #secondary.facetwp-sidebar { |
512 | 512 | .facetwp-item.facetwp-form { |
513 | 513 | .search-form { |
@@ -520,6 +520,6 @@ discard block |
||
520 | 520 | } |
521 | 521 | } |
522 | 522 | '; |
523 | - return $css; |
|
524 | - } |
|
523 | + return $css; |
|
524 | + } |
|
525 | 525 | } |
@@ -53,14 +53,14 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function __construct() { |
55 | 55 | $this->load_classes(); |
56 | - add_action( 'cmb2_admin_init', array( $this, 'register_settings_page' ) ); |
|
57 | - add_action( 'lsx_search_settings_page', array( $this, 'configure_settings_search_engine_fields' ), 15, 1 ); |
|
58 | - add_action( 'lsx_search_settings_page', array( $this, 'configure_settings_search_archive_fields' ), 15, 1 ); |
|
59 | - add_action( 'admin_enqueue_scripts', array( $this, 'assets' ) ); |
|
60 | - |
|
61 | - if ( is_admin() ) { |
|
62 | - add_filter( 'lsx_customizer_colour_selectors_body', array( $this, 'customizer_body_colours_handler' ), 15, 2 ); |
|
63 | - add_filter( 'lsx_customizer_colour_selectors_button', array( $this, 'customizer_button_colours' ), 10, 2 ); |
|
56 | + add_action('cmb2_admin_init', array($this, 'register_settings_page')); |
|
57 | + add_action('lsx_search_settings_page', array($this, 'configure_settings_search_engine_fields'), 15, 1); |
|
58 | + add_action('lsx_search_settings_page', array($this, 'configure_settings_search_archive_fields'), 15, 1); |
|
59 | + add_action('admin_enqueue_scripts', array($this, 'assets')); |
|
60 | + |
|
61 | + if (is_admin()) { |
|
62 | + add_filter('lsx_customizer_colour_selectors_body', array($this, 'customizer_body_colours_handler'), 15, 2); |
|
63 | + add_filter('lsx_customizer_colour_selectors_button', array($this, 'customizer_button_colours'), 10, 2); |
|
64 | 64 | } |
65 | 65 | } |
66 | 66 | |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public static function get_instance() { |
75 | 75 | // If the single instance hasn't been set, set it now. |
76 | - if ( null === self::$instance ) { |
|
76 | + if (null === self::$instance) { |
|
77 | 77 | self::$instance = new self(); |
78 | 78 | } |
79 | 79 | return self::$instance; |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | * Loads the variable classes and the static classes. |
84 | 84 | */ |
85 | 85 | private function load_classes() { |
86 | - require_once LSX_SEARCH_PATH . 'classes/admin/class-settings-theme.php'; |
|
86 | + require_once LSX_SEARCH_PATH.'classes/admin/class-settings-theme.php'; |
|
87 | 87 | $this->settings_theme = admin\Settings_Theme::get_instance(); |
88 | 88 | } |
89 | 89 | |
@@ -95,21 +95,21 @@ discard block |
||
95 | 95 | public function register_settings_page() { |
96 | 96 | $args = array( |
97 | 97 | 'id' => 'lsx_search_settings', |
98 | - 'title' => '<h1>' . esc_html__( 'LSX Search Settings', 'lsx-search' ) . ' <span class="version">' . LSX_SEARCH_VER . '</span></h1>', |
|
99 | - 'menu_title' => esc_html__( 'LSX Search', 'search' ), // Falls back to 'title' (above). |
|
100 | - 'object_types' => array( 'options-page' ), |
|
98 | + 'title' => '<h1>'.esc_html__('LSX Search Settings', 'lsx-search').' <span class="version">'.LSX_SEARCH_VER.'</span></h1>', |
|
99 | + 'menu_title' => esc_html__('LSX Search', 'search'), // Falls back to 'title' (above). |
|
100 | + 'object_types' => array('options-page'), |
|
101 | 101 | 'option_key' => 'lsx-search-settings', // The option key and admin menu page slug. |
102 | 102 | 'parent_slug' => 'options-general.php', |
103 | 103 | 'capability' => 'manage_options', // Cap required to view options-page. |
104 | 104 | ); |
105 | - $cmb = new_cmb2_box( $args ); |
|
106 | - do_action( 'lsx_search_settings_page', $cmb ); |
|
105 | + $cmb = new_cmb2_box($args); |
|
106 | + do_action('lsx_search_settings_page', $cmb); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
110 | 110 | * Sets post types with active search options. |
111 | 111 | */ |
112 | - public function register_post_type_tabs( $post_types_plural ) { |
|
112 | + public function register_post_type_tabs($post_types_plural) { |
|
113 | 113 | $post_types_plural = array( |
114 | 114 | 'project' => 'projects', |
115 | 115 | 'service' => 'services', |
@@ -146,19 +146,19 @@ discard block |
||
146 | 146 | * @return void |
147 | 147 | */ |
148 | 148 | public function set_facetwp_vars() { |
149 | - if ( function_exists( '\FWP' ) ) { |
|
149 | + if (function_exists('\FWP')) { |
|
150 | 150 | $facet_data = \FWP()->helper->get_facets(); |
151 | 151 | } |
152 | 152 | $this->facet_data = array(); |
153 | 153 | $this->az_facets = array( |
154 | - '' => __( 'Do not show', 'lsx-search' ), |
|
154 | + '' => __('Do not show', 'lsx-search'), |
|
155 | 155 | ); |
156 | - if ( ! empty( $facet_data ) && is_array( $facet_data ) ) { |
|
157 | - foreach ( $facet_data as $facet ) { |
|
158 | - if ( 'alpha' === $facet['type'] ) { |
|
159 | - $this->az_facets[ $facet['name'] ] = $facet['label'] . '(' . $facet['name'] . ')'; |
|
156 | + if (!empty($facet_data) && is_array($facet_data)) { |
|
157 | + foreach ($facet_data as $facet) { |
|
158 | + if ('alpha' === $facet['type']) { |
|
159 | + $this->az_facets[$facet['name']] = $facet['label'].'('.$facet['name'].')'; |
|
160 | 160 | } else { |
161 | - $this->facet_data[ $facet['name'] ] = $facet['label'] . '(' . $facet['name'] . ')'; |
|
161 | + $this->facet_data[$facet['name']] = $facet['label'].'('.$facet['name'].')'; |
|
162 | 162 | } |
163 | 163 | } |
164 | 164 | } |
@@ -167,9 +167,9 @@ discard block |
||
167 | 167 | /** |
168 | 168 | * Enqueue JS and CSS. |
169 | 169 | */ |
170 | - public function assets( $hook ) { |
|
171 | - wp_enqueue_script( 'lsx-search-admin', LSX_SEARCH_URL . 'assets/js/src/lsx-search-admin.js', array( 'jquery' ), LSX_SEARCH_VER, true ); |
|
172 | - wp_enqueue_style( 'lsx-search-admin', LSX_SEARCH_URL . 'assets/css/lsx-search-admin.css', array(), LSX_SEARCH_VER ); |
|
170 | + public function assets($hook) { |
|
171 | + wp_enqueue_script('lsx-search-admin', LSX_SEARCH_URL.'assets/js/src/lsx-search-admin.js', array('jquery'), LSX_SEARCH_VER, true); |
|
172 | + wp_enqueue_style('lsx-search-admin', LSX_SEARCH_URL.'assets/css/lsx-search-admin.css', array(), LSX_SEARCH_VER); |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | /** |
@@ -177,12 +177,12 @@ discard block |
||
177 | 177 | * |
178 | 178 | * @return void |
179 | 179 | */ |
180 | - public function configure_settings_search_engine_fields( $cmb ) { |
|
180 | + public function configure_settings_search_engine_fields($cmb) { |
|
181 | 181 | $global_args = array( |
182 | - 'title' => __( 'Global', 'lsx-search' ), |
|
183 | - 'desc' => esc_html__( 'Control the filters which show on your WordPress search results page.', 'lsx-search' ), |
|
182 | + 'title' => __('Global', 'lsx-search'), |
|
183 | + 'desc' => esc_html__('Control the filters which show on your WordPress search results page.', 'lsx-search'), |
|
184 | 184 | ); |
185 | - $this->search_fields( $cmb, 'engine', $global_args ); |
|
185 | + $this->search_fields($cmb, 'engine', $global_args); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | /** |
@@ -192,71 +192,71 @@ discard block |
||
192 | 192 | * @param string $position either top of bottom. |
193 | 193 | * @return void |
194 | 194 | */ |
195 | - public function configure_settings_search_archive_fields( $cmb ) { |
|
195 | + public function configure_settings_search_archive_fields($cmb) { |
|
196 | 196 | $archives = array(); |
197 | 197 | $post_type_args = array( |
198 | 198 | 'public' => true, |
199 | 199 | ); |
200 | - $post_types = get_post_types( $post_type_args ); |
|
201 | - if ( ! empty( $post_types ) ) { |
|
202 | - foreach ( $post_types as $post_type_key => $post_type_value ) { |
|
203 | - switch ( $post_type_key ) { |
|
200 | + $post_types = get_post_types($post_type_args); |
|
201 | + if (!empty($post_types)) { |
|
202 | + foreach ($post_types as $post_type_key => $post_type_value) { |
|
203 | + switch ($post_type_key) { |
|
204 | 204 | case 'post': |
205 | 205 | $page_url = home_url(); |
206 | - $page_title = __( 'Home', 'lsx-search' ); |
|
207 | - $show_on_front = get_option( 'show_on_front' ); |
|
208 | - if ( 'page' === $show_on_front ) { |
|
209 | - $page_for_posts = get_option( 'page_for_posts' ); |
|
210 | - if ( '' !== $page_for_posts ) { |
|
211 | - $page_title = get_the_title( $page_for_posts ); |
|
212 | - $page_url = get_permalink( $page_for_posts ); |
|
206 | + $page_title = __('Home', 'lsx-search'); |
|
207 | + $show_on_front = get_option('show_on_front'); |
|
208 | + if ('page' === $show_on_front) { |
|
209 | + $page_for_posts = get_option('page_for_posts'); |
|
210 | + if ('' !== $page_for_posts) { |
|
211 | + $page_title = get_the_title($page_for_posts); |
|
212 | + $page_url = get_permalink($page_for_posts); |
|
213 | 213 | } |
214 | 214 | } |
215 | 215 | $description = sprintf( |
216 | 216 | /* translators: %s: The subscription info */ |
217 | - __( 'Control the filters which show on your <a target="_blank" href="%1$s">%2$s</a> page.', 'lsx-search' ), |
|
217 | + __('Control the filters which show on your <a target="_blank" href="%1$s">%2$s</a> page.', 'lsx-search'), |
|
218 | 218 | $page_url, |
219 | 219 | $page_title |
220 | 220 | ); |
221 | - $archives[ $post_type_key ] = array( |
|
222 | - 'title' => __( 'Blog', 'lsx-search' ), |
|
221 | + $archives[$post_type_key] = array( |
|
222 | + 'title' => __('Blog', 'lsx-search'), |
|
223 | 223 | 'desc' => $description, |
224 | 224 | ); |
225 | 225 | break; |
226 | 226 | |
227 | 227 | case 'product': |
228 | 228 | $page_url = home_url(); |
229 | - $page_title = __( 'Shop', 'lsx-search' ); |
|
230 | - if ( function_exists( 'wc_get_page_id' ) ) { |
|
231 | - $shop_page = wc_get_page_id( 'shop' ); |
|
232 | - $page_url = get_permalink( $shop_page ); |
|
233 | - $page_title = get_the_title( $shop_page ); |
|
229 | + $page_title = __('Shop', 'lsx-search'); |
|
230 | + if (function_exists('wc_get_page_id')) { |
|
231 | + $shop_page = wc_get_page_id('shop'); |
|
232 | + $page_url = get_permalink($shop_page); |
|
233 | + $page_title = get_the_title($shop_page); |
|
234 | 234 | } |
235 | 235 | $description = sprintf( |
236 | 236 | /* translators: %s: The subscription info */ |
237 | - __( 'Control the filters which show on your <a target="_blank" href="%1$s">%2$s</a> page.', 'lsx-search' ), |
|
237 | + __('Control the filters which show on your <a target="_blank" href="%1$s">%2$s</a> page.', 'lsx-search'), |
|
238 | 238 | $page_url, |
239 | 239 | $page_title |
240 | 240 | ); |
241 | - $archives[ $post_type_key ] = array( |
|
242 | - 'title' => __( 'Shop', 'lsx-search' ), |
|
241 | + $archives[$post_type_key] = array( |
|
242 | + 'title' => __('Shop', 'lsx-search'), |
|
243 | 243 | 'desc' => $description, |
244 | 244 | ); |
245 | 245 | break; |
246 | 246 | |
247 | 247 | default: |
248 | - if ( ! in_array( $post_type_key, \lsx\search\includes\get_restricted_post_types() ) ) { |
|
249 | - $temp_post_type = get_post_type_object( $post_type_key ); |
|
250 | - if ( ! is_wp_error( $temp_post_type ) ) { |
|
251 | - $page_url = get_post_type_archive_link( $temp_post_type->name ); |
|
248 | + if (!in_array($post_type_key, \lsx\search\includes\get_restricted_post_types())) { |
|
249 | + $temp_post_type = get_post_type_object($post_type_key); |
|
250 | + if (!is_wp_error($temp_post_type)) { |
|
251 | + $page_url = get_post_type_archive_link($temp_post_type->name); |
|
252 | 252 | $description = sprintf( |
253 | 253 | /* translators: %s: The subscription info */ |
254 | - __( 'Control the filters which show on your <a target="_blank" href="%1$s">%2$s</a> archive.', 'lsx-search' ), |
|
254 | + __('Control the filters which show on your <a target="_blank" href="%1$s">%2$s</a> archive.', 'lsx-search'), |
|
255 | 255 | $page_url, |
256 | 256 | $temp_post_type->label |
257 | 257 | ); |
258 | 258 | |
259 | - $archives[ $post_type_key ] = array( |
|
259 | + $archives[$post_type_key] = array( |
|
260 | 260 | 'title' => $temp_post_type->label, |
261 | 261 | 'desc' => $description, |
262 | 262 | ); |
@@ -266,9 +266,9 @@ discard block |
||
266 | 266 | } |
267 | 267 | } |
268 | 268 | } |
269 | - if ( ! empty( $archives ) ) { |
|
270 | - foreach ( $archives as $archive_key => $archive_args ) { |
|
271 | - $this->search_fields( $cmb, $archive_key, $archive_args ); |
|
269 | + if (!empty($archives)) { |
|
270 | + foreach ($archives as $archive_key => $archive_args) { |
|
271 | + $this->search_fields($cmb, $archive_key, $archive_args); |
|
272 | 272 | } |
273 | 273 | } |
274 | 274 | } |
@@ -280,125 +280,125 @@ discard block |
||
280 | 280 | * @param string $section either engine,archive or single. |
281 | 281 | * @return void |
282 | 282 | */ |
283 | - public function search_fields( $cmb, $section, $args ) { |
|
283 | + public function search_fields($cmb, $section, $args) { |
|
284 | 284 | $this->set_facetwp_vars(); |
285 | 285 | $cmb->add_field( |
286 | 286 | array( |
287 | - 'id' => 'settings_' . $section . '_search', |
|
287 | + 'id' => 'settings_'.$section.'_search', |
|
288 | 288 | 'type' => 'title', |
289 | 289 | 'name' => $args['title'], |
290 | 290 | 'default' => $args['title'], |
291 | 291 | 'description' => $args['desc'], |
292 | 292 | ) |
293 | 293 | ); |
294 | - do_action( 'lsx_search_settings_section', $cmb, 'top' ); |
|
294 | + do_action('lsx_search_settings_section', $cmb, 'top'); |
|
295 | 295 | $cmb->add_field( |
296 | 296 | array( |
297 | - 'name' => esc_html__( 'Enable Search Filters', 'lsx-search' ), |
|
298 | - 'id' => $section . '_search_enable', |
|
299 | - 'description' => esc_html__( 'Display FacetWP filters on your search results page.', 'lsx-search' ), |
|
297 | + 'name' => esc_html__('Enable Search Filters', 'lsx-search'), |
|
298 | + 'id' => $section.'_search_enable', |
|
299 | + 'description' => esc_html__('Display FacetWP filters on your search results page.', 'lsx-search'), |
|
300 | 300 | 'type' => 'checkbox', |
301 | 301 | ) |
302 | 302 | ); |
303 | 303 | |
304 | 304 | $cmb->add_field( |
305 | 305 | array( |
306 | - 'name' => esc_html__( 'Page Layout', 'lsx-search' ), |
|
307 | - 'id' => $section . '_search_layout', |
|
306 | + 'name' => esc_html__('Page Layout', 'lsx-search'), |
|
307 | + 'id' => $section.'_search_layout', |
|
308 | 308 | 'type' => 'select', |
309 | 309 | 'options' => array( |
310 | - '' => esc_html__( 'Follow the theme layout', 'lsx-search' ), |
|
311 | - '2cr' => esc_html__( 'Sidebar on left', 'lsx-search' ), |
|
312 | - '2cl' => esc_html__( 'Sidebar on right', 'lsx-search' ), |
|
310 | + '' => esc_html__('Follow the theme layout', 'lsx-search'), |
|
311 | + '2cr' => esc_html__('Sidebar on left', 'lsx-search'), |
|
312 | + '2cl' => esc_html__('Sidebar on right', 'lsx-search'), |
|
313 | 313 | ), |
314 | 314 | 'default' => '', |
315 | 315 | ) |
316 | 316 | ); |
317 | 317 | |
318 | - if ( 'product' === $section ) { |
|
318 | + if ('product' === $section) { |
|
319 | 319 | $cmb->add_field( |
320 | 320 | array( |
321 | - 'name' => esc_html__( 'Results Layout', 'lsx-search' ), |
|
322 | - 'id' => $section . '_search_grid_list', |
|
321 | + 'name' => esc_html__('Results Layout', 'lsx-search'), |
|
322 | + 'id' => $section.'_search_grid_list', |
|
323 | 323 | 'type' => 'select', |
324 | 324 | 'show_option_none' => false, |
325 | - 'description' => __( 'Set a default layout for the search results.', 'lsx-search' ), |
|
325 | + 'description' => __('Set a default layout for the search results.', 'lsx-search'), |
|
326 | 326 | 'options' => array( |
327 | - 'grid' => esc_html__( 'Grid', 'lsx-search' ), |
|
328 | - 'list' => esc_html__( 'List', 'lsx-search' ), |
|
327 | + 'grid' => esc_html__('Grid', 'lsx-search'), |
|
328 | + 'list' => esc_html__('List', 'lsx-search'), |
|
329 | 329 | ), |
330 | 330 | 'default' => 'grid', |
331 | 331 | ) |
332 | 332 | ); |
333 | 333 | $cmb->add_field( |
334 | 334 | array( |
335 | - 'name' => esc_html__( 'Layout Switcher', 'lsx-search' ), |
|
336 | - 'id' => $section . '_search_layout_switcher_enable', |
|
335 | + 'name' => esc_html__('Layout Switcher', 'lsx-search'), |
|
336 | + 'id' => $section.'_search_layout_switcher_enable', |
|
337 | 337 | 'type' => 'checkbox', |
338 | - 'description' => __( 'Display the layout switcher to allow the user to toggle between the list and grid layouts.', 'lsx-search' ), |
|
338 | + 'description' => __('Display the layout switcher to allow the user to toggle between the list and grid layouts.', 'lsx-search'), |
|
339 | 339 | ) |
340 | 340 | ); |
341 | 341 | } |
342 | - if ( 'engine' === $section && function_exists('is_plugin_active') && is_plugin_active( 'tour-operator/tour-operator.php' ) ) { |
|
342 | + if ('engine' === $section && function_exists('is_plugin_active') && is_plugin_active('tour-operator/tour-operator.php')) { |
|
343 | 343 | $cmb->add_field( |
344 | 344 | array( |
345 | - 'name' => esc_html__( 'List layout images', 'lsx-search' ), |
|
346 | - 'id' => $section . '_search_list_layout_image_style', |
|
345 | + 'name' => esc_html__('List layout images', 'lsx-search'), |
|
346 | + 'id' => $section.'_search_list_layout_image_style', |
|
347 | 347 | 'type' => 'select', |
348 | 348 | 'options' => array( |
349 | - '' => esc_html__( 'Full Height', 'lsx-search' ), |
|
350 | - 'max-height' => esc_html__( 'Max Height', 'lsx-search' ), |
|
349 | + '' => esc_html__('Full Height', 'lsx-search'), |
|
350 | + 'max-height' => esc_html__('Max Height', 'lsx-search'), |
|
351 | 351 | ), |
352 | 352 | 'default' => '', |
353 | 353 | ) |
354 | 354 | ); |
355 | 355 | } |
356 | - if ( 'engine' === $section ) { |
|
356 | + if ('engine' === $section) { |
|
357 | 357 | $cmb->add_field( |
358 | 358 | array( |
359 | - 'name' => esc_html__( 'Display Excerpt', 'lsx-search' ), |
|
360 | - 'id' => $section . '_excerpt_enable', |
|
359 | + 'name' => esc_html__('Display Excerpt', 'lsx-search'), |
|
360 | + 'id' => $section.'_excerpt_enable', |
|
361 | 361 | 'type' => 'checkbox', |
362 | - 'description' => __( 'Display the excerpt of a listing.', 'lsx-search' ), |
|
362 | + 'description' => __('Display the excerpt of a listing.', 'lsx-search'), |
|
363 | 363 | ) |
364 | 364 | ); |
365 | 365 | $cmb->add_field( |
366 | 366 | array( |
367 | - 'name' => esc_html__( 'Enable Post Type Label', 'lsx-search' ), |
|
368 | - 'id' => $section . '_search_enable_pt_label', |
|
367 | + 'name' => esc_html__('Enable Post Type Label', 'lsx-search'), |
|
368 | + 'id' => $section.'_search_enable_pt_label', |
|
369 | 369 | 'type' => 'checkbox', |
370 | - 'description' => __( 'This enables the post type label from entries on search results page.', 'lsx-search' ), |
|
370 | + 'description' => __('This enables the post type label from entries on search results page.', 'lsx-search'), |
|
371 | 371 | ) |
372 | 372 | ); |
373 | - if ( function_exists('is_plugin_active') && is_plugin_active( 'tour-operator/tour-operator.php' ) ) { |
|
373 | + if (function_exists('is_plugin_active') && is_plugin_active('tour-operator/tour-operator.php')) { |
|
374 | 374 | $cmb->add_field( |
375 | 375 | array( |
376 | - 'name' => esc_html__( 'Enable Continent Filter', 'lsx-search' ), |
|
377 | - 'id' => $section . '_search_enable_continent_filter', |
|
376 | + 'name' => esc_html__('Enable Continent Filter', 'lsx-search'), |
|
377 | + 'id' => $section.'_search_enable_continent_filter', |
|
378 | 378 | 'type' => 'checkbox', |
379 | - 'description' => __( 'This enables the continent filter in FacetWP destinations filter.', 'lsx-search' ), |
|
379 | + 'description' => __('This enables the continent filter in FacetWP destinations filter.', 'lsx-search'), |
|
380 | 380 | ) |
381 | 381 | ); |
382 | 382 | $cmb->add_field( |
383 | 383 | array( |
384 | - 'name' => esc_html__( 'Enable Continental Regions', 'lsx-search' ), |
|
385 | - 'id' => $section . '_search_enable_continental_regions', |
|
384 | + 'name' => esc_html__('Enable Continental Regions', 'lsx-search'), |
|
385 | + 'id' => $section.'_search_enable_continental_regions', |
|
386 | 386 | 'type' => 'checkbox', |
387 | - 'description' => __( 'This disable continents and enabled the sub regions.', 'lsx-search' ), |
|
387 | + 'description' => __('This disable continents and enabled the sub regions.', 'lsx-search'), |
|
388 | 388 | ) |
389 | 389 | ); |
390 | 390 | } |
391 | 391 | } |
392 | 392 | |
393 | - if ( function_exists('is_plugin_active') && is_plugin_active( 'tour-operator/tour-operator.php' ) && 'accommodation' === $section ) { |
|
393 | + if (function_exists('is_plugin_active') && is_plugin_active('tour-operator/tour-operator.php') && 'accommodation' === $section) { |
|
394 | 394 | $cmb->add_field( |
395 | 395 | array( |
396 | - 'name' => esc_html__( 'Results Layout - list vs map', 'lsx-search' ), |
|
397 | - 'id' => $section . '_search_results_layout', |
|
396 | + 'name' => esc_html__('Results Layout - list vs map', 'lsx-search'), |
|
397 | + 'id' => $section.'_search_results_layout', |
|
398 | 398 | 'type' => 'select', |
399 | 399 | 'options' => array( |
400 | - 'list_map' => esc_html__( 'List and Map', 'lsx-search' ), |
|
401 | - 'list' => esc_html__( 'List only', 'lsx-search' ), |
|
400 | + 'list_map' => esc_html__('List and Map', 'lsx-search'), |
|
401 | + 'list' => esc_html__('List only', 'lsx-search'), |
|
402 | 402 | ), |
403 | 403 | 'default' => '', |
404 | 404 | ) |
@@ -407,52 +407,52 @@ discard block |
||
407 | 407 | |
408 | 408 | $cmb->add_field( |
409 | 409 | array( |
410 | - 'name' => esc_html__( 'Enable Collapse', 'lsx-search' ), |
|
411 | - 'id' => $section . '_search_collapse', |
|
410 | + 'name' => esc_html__('Enable Collapse', 'lsx-search'), |
|
411 | + 'id' => $section.'_search_collapse', |
|
412 | 412 | 'type' => 'checkbox', |
413 | - 'description' => __( 'Enable collapsible filters on search results.', 'lsx-search' ), |
|
413 | + 'description' => __('Enable collapsible filters on search results.', 'lsx-search'), |
|
414 | 414 | ) |
415 | 415 | ); |
416 | 416 | |
417 | 417 | $cmb->add_field( |
418 | 418 | array( |
419 | - 'name' => esc_html__( 'Disable Sorting', 'lsx-search' ), |
|
420 | - 'id' => $section . '_search_disable_sorting', |
|
419 | + 'name' => esc_html__('Disable Sorting', 'lsx-search'), |
|
420 | + 'id' => $section.'_search_disable_sorting', |
|
421 | 421 | 'type' => 'checkbox', |
422 | - 'description' => __( 'Toggle the sorting drop down menu on your search results.', 'lsx-search' ), |
|
422 | + 'description' => __('Toggle the sorting drop down menu on your search results.', 'lsx-search'), |
|
423 | 423 | ) |
424 | 424 | ); |
425 | 425 | |
426 | 426 | $cmb->add_field( |
427 | 427 | array( |
428 | - 'name' => esc_html__( 'Disable the Date Sorting Option', 'lsx-search' ), |
|
429 | - 'id' => $section . '_search_disable_date', |
|
428 | + 'name' => esc_html__('Disable the Date Sorting Option', 'lsx-search'), |
|
429 | + 'id' => $section.'_search_disable_date', |
|
430 | 430 | 'type' => 'checkbox', |
431 | 431 | ) |
432 | 432 | ); |
433 | 433 | |
434 | 434 | $cmb->add_field( |
435 | 435 | array( |
436 | - 'name' => esc_html__( 'Display Clear Button', 'lsx-search' ), |
|
437 | - 'id' => $section . '_search_display_clear_button', |
|
436 | + 'name' => esc_html__('Display Clear Button', 'lsx-search'), |
|
437 | + 'id' => $section.'_search_display_clear_button', |
|
438 | 438 | 'type' => 'checkbox', |
439 | - 'description' => __( 'Check this to turn on a button that will clear your search results.', 'lsx-search' ), |
|
439 | + 'description' => __('Check this to turn on a button that will clear your search results.', 'lsx-search'), |
|
440 | 440 | ) |
441 | 441 | ); |
442 | 442 | |
443 | 443 | $cmb->add_field( |
444 | 444 | array( |
445 | - 'name' => esc_html__( 'Display Result Count', 'lsx-search' ), |
|
446 | - 'id' => $section . '_search_display_result_count', |
|
445 | + 'name' => esc_html__('Display Result Count', 'lsx-search'), |
|
446 | + 'id' => $section.'_search_display_result_count', |
|
447 | 447 | 'type' => 'checkbox', |
448 | 448 | ) |
449 | 449 | ); |
450 | - if ( function_exists('is_plugin_active') && is_plugin_active( 'facetwp-alpha/index.php' ) ) { |
|
450 | + if (function_exists('is_plugin_active') && is_plugin_active('facetwp-alpha/index.php')) { |
|
451 | 451 | $cmb->add_field( |
452 | 452 | array( |
453 | - 'name' => esc_html__( 'Alphabet Facet', 'lsx-search' ), |
|
454 | - 'description' => esc_html__( 'Select the alphabetical sorter facet.', 'lsx-search' ), |
|
455 | - 'id' => $section . '_search_az_pagination', |
|
453 | + 'name' => esc_html__('Alphabet Facet', 'lsx-search'), |
|
454 | + 'description' => esc_html__('Select the alphabetical sorter facet.', 'lsx-search'), |
|
455 | + 'id' => $section.'_search_az_pagination', |
|
456 | 456 | 'type' => 'select', |
457 | 457 | 'options' => $this->az_facets, |
458 | 458 | ) |
@@ -460,17 +460,17 @@ discard block |
||
460 | 460 | } |
461 | 461 | $cmb->add_field( |
462 | 462 | array( |
463 | - 'name' => esc_html__( 'Facets', 'lsx-search' ), |
|
464 | - 'description' => esc_html__( 'Choose the filters to display in the sidebar. Edit FacetWP filters to change individual filters.', 'lsx-search' ), |
|
465 | - 'id' => $section . '_search_facets', |
|
463 | + 'name' => esc_html__('Facets', 'lsx-search'), |
|
464 | + 'description' => esc_html__('Choose the filters to display in the sidebar. Edit FacetWP filters to change individual filters.', 'lsx-search'), |
|
465 | + 'id' => $section.'_search_facets', |
|
466 | 466 | 'type' => 'multicheck', |
467 | 467 | 'options' => $this->facet_data, |
468 | 468 | ) |
469 | 469 | ); |
470 | - do_action( 'lsx_search_settings_section', $cmb, 'bottom' ); |
|
470 | + do_action('lsx_search_settings_section', $cmb, 'bottom'); |
|
471 | 471 | $cmb->add_field( |
472 | 472 | array( |
473 | - 'id' => 'settings_' . $section . '_search_closing', |
|
473 | + 'id' => 'settings_'.$section.'_search_closing', |
|
474 | 474 | 'type' => 'tab_closing', |
475 | 475 | ) |
476 | 476 | ); |
@@ -479,20 +479,20 @@ discard block |
||
479 | 479 | /** |
480 | 480 | * Handle body colours that might be change by LSX Customiser. |
481 | 481 | */ |
482 | - public function customizer_body_colours_handler( $css, $colors ) { |
|
482 | + public function customizer_body_colours_handler($css, $colors) { |
|
483 | 483 | $css .= ' |
484 | - @import "' . LSX_SEARCH_PATH . '/assets/css/scss/customizer-search-body-colours"; |
|
484 | + @import "' . LSX_SEARCH_PATH.'/assets/css/scss/customizer-search-body-colours"; |
|
485 | 485 | |
486 | 486 | /** |
487 | 487 | * LSX Customizer - Body (LSX Search) |
488 | 488 | */ |
489 | 489 | @include customizer-search-body-colours ( |
490 | - $bg: ' . $colors['background_color'] . ', |
|
491 | - $breaker: ' . $colors['body_line_color'] . ', |
|
492 | - $color: ' . $colors['body_text_color'] . ', |
|
493 | - $link: ' . $colors['body_link_color'] . ', |
|
494 | - $hover: ' . $colors['body_link_hover_color'] . ', |
|
495 | - $small: ' . $colors['body_text_small_color'] . ' |
|
490 | + $bg: ' . $colors['background_color'].', |
|
491 | + $breaker: ' . $colors['body_line_color'].', |
|
492 | + $color: ' . $colors['body_text_color'].', |
|
493 | + $link: ' . $colors['body_link_color'].', |
|
494 | + $hover: ' . $colors['body_link_hover_color'].', |
|
495 | + $small: ' . $colors['body_text_small_color'].' |
|
496 | 496 | ); |
497 | 497 | '; |
498 | 498 | |
@@ -506,14 +506,14 @@ discard block |
||
506 | 506 | * @param array $colours |
507 | 507 | * @return string |
508 | 508 | */ |
509 | - public function customizer_button_colours( $css, $colours ) { |
|
509 | + public function customizer_button_colours($css, $colours) { |
|
510 | 510 | $css .= ' |
511 | 511 | #secondary.facetwp-sidebar { |
512 | 512 | .facetwp-item.facetwp-form { |
513 | 513 | .search-form { |
514 | 514 | .btn { |
515 | 515 | &.search-submit { |
516 | - @include lsx-button-colour(' . $colours['button_text_color'] . ', ' . $colours['button_text_color_hover'] . ', ' . $colours['button_background_color'] . ', ' . $colours['button_background_hover_color'] . ', ' . $colours['button_shadow'] . '); |
|
516 | + @include lsx-button-colour(' . $colours['button_text_color'].', '.$colours['button_text_color_hover'].', '.$colours['button_background_color'].', '.$colours['button_background_hover_color'].', '.$colours['button_shadow'].'); |
|
517 | 517 | } |
518 | 518 | } |
519 | 519 | } |