Version Description
Download this release
Release Info
Developer | adampickering |
Plugin | Regions for WP Job Manager |
Version | 1.9.0 |
Comparing to | |
See all releases |
Code changes from version 1.8.0 to 1.9.0
- assets/js/main.js +71 -69
- includes/class-taxonomy.php +1 -1
- readme.txt +12 -1
- uninstall.php +12 -0
- wp-job-manager-locations.php +233 -207
assets/js/main.js
CHANGED
@@ -1,72 +1,74 @@
|
|
1 |
(function($) {
|
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 |
})(jQuery);
|
72 |
-
|
1 |
(function($) {
|
2 |
+
'use strict';
|
3 |
+
|
4 |
+
var jobRegions = {
|
5 |
+
cache: {
|
6 |
+
$document: $(document),
|
7 |
+
$window: $(window),
|
8 |
+
},
|
9 |
+
|
10 |
+
init: function() {
|
11 |
+
this.bindEvents();
|
12 |
+
},
|
13 |
+
|
14 |
+
bindEvents: function() {
|
15 |
+
var self = this;
|
16 |
+
|
17 |
+
this.cache.$document.on( 'ready', function() {
|
18 |
+
self.$forms = $( '.search_jobs' );
|
19 |
+
|
20 |
+
self.addSubmission();
|
21 |
+
self.addRegions();
|
22 |
+
self.updateResults();
|
23 |
+
self.resetResults();
|
24 |
+
});
|
25 |
+
},
|
26 |
+
|
27 |
+
addSubmission: function() {
|
28 |
+
$( '#job_region' ).chosen();
|
29 |
+
},
|
30 |
+
|
31 |
+
addRegions: function() {
|
32 |
+
this.$forms.each(function(i, el) {
|
33 |
+
var $regions = $(el).find( 'select.search_region' );
|
34 |
+
|
35 |
+
if ( ! $regions.length ) {
|
36 |
+
return;
|
37 |
+
}
|
38 |
+
|
39 |
+
var location = $(el).find( '.search_location' );
|
40 |
+
location.html( '' );
|
41 |
+
location.removeClass( 'search_location' ).addClass( 'search_region' );
|
42 |
+
|
43 |
+
$regions.detach().appendTo(location);
|
44 |
+
$regions.chosen();
|
45 |
+
});
|
46 |
+
},
|
47 |
+
|
48 |
+
updateResults: function() {
|
49 |
+
this.$forms.each(function(i, el) {
|
50 |
+
var region = $(this).find( '.search_region' );
|
51 |
+
|
52 |
+
region.on( 'change', function() {
|
53 |
+
var target = $(this).closest( 'div.job_listings' );
|
54 |
+
|
55 |
+
target.trigger( 'update_results', [ 1, false ] );
|
56 |
+
});
|
57 |
+
});
|
58 |
+
},
|
59 |
+
|
60 |
+
resetResults: function() {
|
61 |
+
var self = this;
|
62 |
+
|
63 |
+
$( '.job_listings' ).on( 'reset', function() {
|
64 |
+
self.$forms.each(function(i, el) {
|
65 |
+
var $regions = $(el).find( 'select.search_region' );
|
66 |
+
$regions.val(0).trigger( 'change' ).trigger( 'chosen:updated' );
|
67 |
+
});
|
68 |
+
});
|
69 |
+
}
|
70 |
+
};
|
71 |
+
|
72 |
+
jobRegions.init();
|
73 |
|
74 |
})(jQuery);
|
|
includes/class-taxonomy.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
class Astoundify_Job_Manager_Regions_Taxonomy extends Astoundify_Job_Manager_Regions {
|
4 |
|
5 |
public function __construct() {
|
6 |
-
add_action( 'init', array( $this, 'register_taxonomy' ),
|
7 |
}
|
8 |
|
9 |
/**
|
3 |
class Astoundify_Job_Manager_Regions_Taxonomy extends Astoundify_Job_Manager_Regions {
|
4 |
|
5 |
public function __construct() {
|
6 |
+
add_action( 'init', array( $this, 'register_taxonomy' ), 0 );
|
7 |
}
|
8 |
|
9 |
/**
|
readme.txt
CHANGED
@@ -7,7 +7,7 @@ Contributors: Astoundify
|
|
7 |
Tags: job, job listing, job region
|
8 |
Requires at least: 4.1
|
9 |
Tested up to: 4.3.0
|
10 |
-
Stable Tag: 1.
|
11 |
License: GPLv3
|
12 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
13 |
|
@@ -32,6 +32,17 @@ Astoundify has released two themes that are fully integrated with the WP Job Man
|
|
32 |
|
33 |
== Changelog ==
|
34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
= 1.8.0: August 12, 2015 =
|
36 |
|
37 |
* Fix: Listify 1.0.6 compatibility.
|
7 |
Tags: job, job listing, job region
|
8 |
Requires at least: 4.1
|
9 |
Tested up to: 4.3.0
|
10 |
+
Stable Tag: 1.9.0
|
11 |
License: GPLv3
|
12 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
13 |
|
32 |
|
33 |
== Changelog ==
|
34 |
|
35 |
+
= 1.9.0: September 1, 2015 =
|
36 |
+
|
37 |
+
* Fix: WP Job Manager - Alerts support
|
38 |
+
* Fix: Reset
|
39 |
+
* Fix: uninstall.php
|
40 |
+
* Fix: RSS Feeds
|
41 |
+
|
42 |
+
= 1.8.1: August 31, 2015 =
|
43 |
+
|
44 |
+
* Fix: Taxonomy registration priority to be used with widgets.
|
45 |
+
|
46 |
= 1.8.0: August 12, 2015 =
|
47 |
|
48 |
* Fix: Listify 1.0.6 compatibility.
|
uninstall.php
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
|
3 |
+
exit();
|
4 |
+
}
|
5 |
+
|
6 |
+
$options = array(
|
7 |
+
'job_manager_regions_filter'
|
8 |
+
);
|
9 |
+
|
10 |
+
foreach ( $options as $option ) {
|
11 |
+
delete_option( $option );
|
12 |
+
}
|
wp-job-manager-locations.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* Description: Create predefined regions/locations that job submissions can associate themselves with.
|
6 |
* Author: Astoundify
|
7 |
* Author URI: http://astoundify.com
|
8 |
-
* Version: 1.
|
9 |
* Text Domain: wp-job-manager-locations
|
10 |
*/
|
11 |
|
@@ -14,226 +14,252 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
|
14 |
|
15 |
class Astoundify_Job_Manager_Regions {
|
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 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
add_filter( 'job_manager_get_listings_custom_filter_text', array( $this, 'custom_filter_text' ) );
|
145 |
-
add_filter( 'job_manager_get_listings_custom_filter_rss_args', array( $this, 'custom_filter_rss' ) );
|
146 |
-
}
|
147 |
-
|
148 |
-
} elseif ( isset( $_GET[ 'selected_region' ] ) ) {
|
149 |
-
|
150 |
-
$region = $_GET[ 'selected_region' ];
|
151 |
-
|
152 |
-
if ( is_int( $region ) ) {
|
153 |
-
$region = array( $region );
|
154 |
-
}
|
155 |
-
|
156 |
-
$args[ 'tax_query' ][] = array(
|
157 |
-
'taxonomy' => 'job_listing_region',
|
158 |
-
'field' => 'id',
|
159 |
-
'terms' => $region,
|
160 |
-
'operator' => 'IN'
|
161 |
-
);
|
162 |
-
|
163 |
-
} elseif( isset( $args['search_region'] ) ) { // WPJM Alerts support
|
164 |
-
|
165 |
-
if ( is_int( $args['search_region'] ) ) {
|
166 |
-
$region = array( $args['search_region'] );
|
167 |
-
}
|
168 |
-
|
169 |
-
$args[ 'tax_query' ][] = array(
|
170 |
-
'taxonomy' => 'job_listing_region',
|
171 |
-
'field' => 'id',
|
172 |
-
'terms' => $region,
|
173 |
-
'operator' => 'IN'
|
174 |
-
);
|
175 |
-
|
176 |
-
}
|
177 |
-
|
178 |
-
return $args;
|
179 |
-
}
|
180 |
-
|
181 |
-
/**
|
182 |
-
* Filter the AJAX request to set the search location to null if a region
|
183 |
-
* is being passed as well.
|
184 |
-
*/
|
185 |
-
public function job_manager_get_listings_args( $args ) {
|
186 |
-
$params = array();
|
187 |
|
188 |
-
|
|
|
|
|
|
|
189 |
|
190 |
-
|
191 |
|
192 |
-
|
193 |
-
$args[ 'search_location' ] = null;
|
194 |
-
}
|
195 |
|
196 |
-
|
|
|
|
|
197 |
|
198 |
-
|
199 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
200 |
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
|
|
|
|
|
|
206 |
|
207 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
208 |
|
209 |
-
|
210 |
|
211 |
-
|
212 |
|
213 |
-
|
214 |
-
|
|
|
215 |
|
216 |
-
|
217 |
-
* Filter the AJAX request to update the RSS feed URL.
|
218 |
-
*/
|
219 |
-
public function custom_filter_rss( $args ) {
|
220 |
-
$params = array();
|
221 |
|
222 |
-
|
|
|
223 |
|
224 |
-
|
|
|
|
|
|
|
|
|
225 |
|
226 |
-
|
227 |
-
}
|
228 |
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
237 |
}
|
238 |
|
239 |
/**
|
@@ -246,7 +272,7 @@ class Astoundify_Job_Manager_Regions {
|
|
246 |
* @since 1.0.0
|
247 |
*/
|
248 |
function wp_job_manager_regions() {
|
249 |
-
|
250 |
}
|
251 |
|
252 |
wp_job_manager_regions();
|
5 |
* Description: Create predefined regions/locations that job submissions can associate themselves with.
|
6 |
* Author: Astoundify
|
7 |
* Author URI: http://astoundify.com
|
8 |
+
* Version: 1.9.0
|
9 |
* Text Domain: wp-job-manager-locations
|
10 |
*/
|
11 |
|
14 |
|
15 |
class Astoundify_Job_Manager_Regions {
|
16 |
|
17 |
+
/**
|
18 |
+
* @var $instance
|
19 |
+
*/
|
20 |
+
private static $instance;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Make sure only one instance is only running.
|
24 |
+
*/
|
25 |
+
public static function instance() {
|
26 |
+
if ( ! isset ( self::$instance ) ) {
|
27 |
+
self::$instance = new self;
|
28 |
+
}
|
29 |
+
|
30 |
+
return self::$instance;
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Start things up.
|
35 |
+
*
|
36 |
+
* @since 1.0.0
|
37 |
+
*/
|
38 |
+
public function __construct() {
|
39 |
+
$this->file = __FILE__;
|
40 |
+
$this->basename = plugin_basename( $this->file );
|
41 |
+
$this->plugin_dir = plugin_dir_path( $this->file );
|
42 |
+
$this->plugin_url = plugin_dir_url ( $this->file );
|
43 |
+
$this->lang_dir = trailingslashit( $this->plugin_dir . 'languages' );
|
44 |
+
$this->domain = 'wp-job-manager-locations';
|
45 |
+
|
46 |
+
$files = array(
|
47 |
+
'includes/class-taxonomy.php',
|
48 |
+
'includes/class-template.php',
|
49 |
+
'includes/class-widgets.php'
|
50 |
+
);
|
51 |
+
|
52 |
+
foreach ( $files as $file ) {
|
53 |
+
include_once( $this->plugin_dir . '/' . $file );
|
54 |
+
}
|
55 |
+
|
56 |
+
$this->taxonomy = new Astoundify_Job_Manager_Regions_Taxonomy;
|
57 |
+
$this->template = new Astoundify_Job_Manager_Regions_Template;
|
58 |
+
|
59 |
+
$this->setup_actions();
|
60 |
+
}
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Setup the default hooks and actions
|
64 |
+
*
|
65 |
+
* @since 1.0.0
|
66 |
+
*
|
67 |
+
* @return void
|
68 |
+
*/
|
69 |
+
private function setup_actions() {
|
70 |
+
add_action( 'plugins_loaded', array( $this, 'load_textdomain' ) );
|
71 |
+
|
72 |
+
add_filter( 'job_manager_settings', array( $this, 'job_manager_settings' ) );
|
73 |
+
|
74 |
+
add_filter( 'job_manager_output_jobs_defaults', array( $this, 'job_manager_output_jobs_defaults' ) );
|
75 |
+
add_filter( 'job_manager_get_listings', array( $this, 'job_manager_get_listings' ), 10, 2 );
|
76 |
+
add_filter( 'job_manager_get_listings_args', array( $this, 'job_manager_get_listings_args' ) );
|
77 |
+
|
78 |
+
add_filter( 'job_feed_args', array( $this, 'job_feed_args' ) );
|
79 |
+
}
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Add settings fields to select the appropriate form for each listing type.
|
83 |
+
*
|
84 |
+
* @since WP Job Manager - Predefiend Regions 1.4.1
|
85 |
+
*
|
86 |
+
* @return void
|
87 |
+
*/
|
88 |
+
public function job_manager_settings($settings) {
|
89 |
+
$settings[ 'job_listings' ][1][] = array(
|
90 |
+
'name' => 'job_manager_regions_filter',
|
91 |
+
'std' => '0',
|
92 |
+
'label' => __( 'Job Regions', 'wp-job-manager-locations' ),
|
93 |
+
'cb_label' => __( 'Filter by Region', 'wp-job-manager-locations' ),
|
94 |
+
'desc' => __( 'Use a dropdown instead of a text input.', 'wp-job-manager-locations' ),
|
95 |
+
'type' => 'checkbox'
|
96 |
+
);
|
97 |
+
|
98 |
+
return $settings;
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Modify the default shortcode attributes for displaying listings.
|
103 |
+
*
|
104 |
+
* If we are on a listing region term archive set the selected_region so
|
105 |
+
* we can preselect the dropdown value. This is needed when filtering by region.
|
106 |
+
*/
|
107 |
+
public function job_manager_output_jobs_defaults( $defaults ) {
|
108 |
+
$defaults[ 'selected_region' ] = '';
|
109 |
+
|
110 |
+
if ( is_tax( 'job_listing_region' ) ) {
|
111 |
+
$type = get_queried_object();
|
112 |
+
|
113 |
+
if ( ! $type ) {
|
114 |
+
return $defaults;
|
115 |
+
}
|
116 |
+
|
117 |
+
$defaults[ 'show_categories' ] = true;
|
118 |
+
$defaults[ 'selected_region' ] = $type->term_id;
|
119 |
+
}
|
120 |
+
|
121 |
+
return $defaults;
|
122 |
+
}
|
123 |
+
|
124 |
+
public function job_manager_get_listings( $query_args, $args ) {
|
125 |
+
$params = array();
|
126 |
+
|
127 |
+
if ( isset( $_REQUEST[ 'form_data' ] ) ) {
|
128 |
+
|
129 |
+
parse_str( $_REQUEST[ 'form_data' ], $params );
|
130 |
+
|
131 |
+
if ( isset( $params[ 'search_region' ] ) && 0 != $params[ 'search_region' ] ) {
|
132 |
+
$region = $params[ 'search_region' ];
|
133 |
+
|
134 |
+
if ( is_int( $region ) ) {
|
135 |
+
$region = array( $region );
|
136 |
+
}
|
137 |
+
|
138 |
+
$query_args[ 'tax_query' ][] = array(
|
139 |
+
'taxonomy' => 'job_listing_region',
|
140 |
+
'field' => 'id',
|
141 |
+
'terms' => $region,
|
142 |
+
'operator' => 'IN'
|
143 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
|
145 |
+
add_filter( 'job_manager_get_listings_custom_filter', '__return_true' );
|
146 |
+
add_filter( 'job_manager_get_listings_custom_filter_text', array( $this, 'custom_filter_text' ) );
|
147 |
+
add_filter( 'job_manager_get_listings_custom_filter_rss_args', array( $this, 'custom_filter_rss' ) );
|
148 |
+
}
|
149 |
|
150 |
+
} elseif ( isset( $_GET[ 'selected_region' ] ) ) {
|
151 |
|
152 |
+
$region = $_GET[ 'selected_region' ];
|
|
|
|
|
153 |
|
154 |
+
if ( is_int( $region ) ) {
|
155 |
+
$region = array( $region );
|
156 |
+
}
|
157 |
|
158 |
+
$query_args[ 'tax_query' ][] = array(
|
159 |
+
'taxonomy' => 'job_listing_region',
|
160 |
+
'field' => 'id',
|
161 |
+
'terms' => $region,
|
162 |
+
'operator' => 'IN'
|
163 |
+
);
|
164 |
+
|
165 |
+
} elseif( isset( $args['search_region'] ) ) { // WPJM Alerts support
|
166 |
+
$region = $args[ 'search_region' ];
|
167 |
+
|
168 |
+
if ( is_int( $args['search_region'] ) ) {
|
169 |
+
$region = array( $args['search_region'] );
|
170 |
+
}
|
171 |
|
172 |
+
$query_args[ 'tax_query' ][] = array(
|
173 |
+
'taxonomy' => 'job_listing_region',
|
174 |
+
'field' => 'id',
|
175 |
+
'terms' => $region,
|
176 |
+
'operator' => 'IN'
|
177 |
+
);
|
178 |
+
|
179 |
+
}
|
180 |
|
181 |
+
return $query_args;
|
182 |
+
}
|
183 |
+
|
184 |
+
/**
|
185 |
+
* Filter the AJAX request to set the search location to null if a region
|
186 |
+
* is being passed as well.
|
187 |
+
*/
|
188 |
+
public function job_manager_get_listings_args( $args ) {
|
189 |
+
$params = array();
|
190 |
|
191 |
+
if ( isset( $_REQUEST[ 'form_data' ] ) ) {
|
192 |
|
193 |
+
parse_str( $_REQUEST[ 'form_data' ], $params );
|
194 |
|
195 |
+
if ( isset( $params[ 'search_region' ] ) && 0 != $params[ 'search_region' ] ) {
|
196 |
+
$args[ 'search_location' ] = null;
|
197 |
+
}
|
198 |
|
199 |
+
}
|
|
|
|
|
|
|
|
|
200 |
|
201 |
+
return $args;
|
202 |
+
}
|
203 |
|
204 |
+
/**
|
205 |
+
* Filter the AJAX to update the "showing" text.
|
206 |
+
*/
|
207 |
+
public function custom_filter_text( $text ) {
|
208 |
+
$params = array();
|
209 |
|
210 |
+
parse_str( $_REQUEST[ 'form_data' ], $params );
|
|
|
211 |
|
212 |
+
$term = get_term( $params[ 'search_region' ], 'job_listing_region' );
|
213 |
+
|
214 |
+
$text .= sprintf( ' ' . __( 'in %s', 'wp-job-manager-locations' ) . ' ', $term->name );
|
215 |
+
|
216 |
+
return $text;
|
217 |
+
}
|
218 |
+
|
219 |
+
/**
|
220 |
+
* Filter the AJAX request to update the RSS feed URL.
|
221 |
+
*/
|
222 |
+
public function custom_filter_rss( $args ) {
|
223 |
+
$params = array();
|
224 |
+
|
225 |
+
parse_str( $_REQUEST[ 'form_data' ], $params );
|
226 |
+
|
227 |
+
$args[ 'job_region' ] = $params[ 'search_region' ];
|
228 |
+
|
229 |
+
return $args;
|
230 |
+
}
|
231 |
+
|
232 |
+
public function job_feed_args( $query_args ) {
|
233 |
+
$region = isset( $_GET[ 'job_region' ] ) ? $_GET[ 'job_region' ] : false;
|
234 |
+
|
235 |
+
if ( ! $region ) {
|
236 |
+
return $query_args;
|
237 |
+
}
|
238 |
+
|
239 |
+
$region = esc_attr( $region );
|
240 |
+
|
241 |
+
if ( is_int( $region ) ) {
|
242 |
+
$region = array( absint( $region ) );
|
243 |
+
}
|
244 |
+
|
245 |
+
$query_args[ 'tax_query' ][] = array(
|
246 |
+
'taxonomy' => 'job_listing_region',
|
247 |
+
'field' => 'id',
|
248 |
+
'terms' => $region,
|
249 |
+
'operator' => 'IN'
|
250 |
+
);
|
251 |
+
|
252 |
+
return $query_args;
|
253 |
+
}
|
254 |
+
|
255 |
+
/**
|
256 |
+
* Loads the plugin language files
|
257 |
+
*/
|
258 |
+
public function load_textdomain() {
|
259 |
+
$locale = apply_filters( 'plugin_locale', get_locale(), 'wp-job-manager-locations' );
|
260 |
+
load_textdomain( 'wp-job-manager-locations', WP_LANG_DIR . "/wp-job-manager-locations/wp-job-manager-locations-$locale.mo" );
|
261 |
+
load_plugin_textdomain( 'wp-job-manager-locations', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
262 |
+
}
|
263 |
}
|
264 |
|
265 |
/**
|
272 |
* @since 1.0.0
|
273 |
*/
|
274 |
function wp_job_manager_regions() {
|
275 |
+
return Astoundify_Job_Manager_Regions::instance();
|
276 |
}
|
277 |
|
278 |
wp_job_manager_regions();
|