PluginProbe
WP Job Manager / 1.32.1
WP Job Manager v1.32.1
2.4.7 2.4.6 2.4.5 2.4.4 2.4.3 2.4.2 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.1.0 1.1.1 1.1.2 1.1.3 1.10.0 1.11.0 1.11.1 1.12.0 1.12.1 1.13.0 1.14.0 1.15.0 All 154 releases
wp-job-manager / wp-job-manager.php
wp-job-manager.php
531 lines 19.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: WP Job Manager
4 * Plugin URI: https://wpjobmanager.com/
5 * Description: Manage job listings from the WordPress admin panel, and allow users to post jobs directly to your site.
6 * Version: 1.32.1
7 * Author: Automattic
8 * Author URI: https://wpjobmanager.com/
9 * Requires at least: 4.7.0
10 * Tested up to: 5.0
11 * Text Domain: wp-job-manager
12 * Domain Path: /languages/
13 * License: GPL2+
14 *
15 * @package wp-job-manager
16 */
17
18 if ( ! defined( 'ABSPATH' ) ) {
19 exit;
20 }
21
22 /**
23 * Handles core plugin hooks and action setup.
24 *
25 * @package wp-job-manager
26 * @since 1.0.0
27 */
28 class WP_Job_Manager {
29 /**
30 * The single instance of the class.
31 *
32 * @var self
33 * @since 1.26.0
34 */
35 private static $_instance = null;
36
37 /**
38 * REST API instance.
39 *
40 * @var WP_Job_Manager_REST_API
41 */
42 private $rest_api = null;
43
44 /**
45 * Main WP Job Manager Instance.
46 *
47 * Ensures only one instance of WP Job Manager is loaded or can be loaded.
48 *
49 * @since 1.26.0
50 * @static
51 * @see WPJM()
52 * @return self Main instance.
53 */
54 public static function instance() {
55 if ( is_null( self::$_instance ) ) {
56 self::$_instance = new self();
57 }
58 return self::$_instance;
59 }
60
61 /**
62 * Constructor.
63 */
64 public function __construct() {
65 // Define constants.
66 define( 'JOB_MANAGER_VERSION', '1.32.1' );
67 define( 'JOB_MANAGER_MINIMUM_WP_VERSION', '4.7.0' );
68 define( 'JOB_MANAGER_PLUGIN_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
69 define( 'JOB_MANAGER_PLUGIN_URL', untrailingslashit( plugins_url( basename( plugin_dir_path( __FILE__ ) ), basename( __FILE__ ) ) ) );
70 define( 'JOB_MANAGER_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
71
72 // Includes.
73 include_once JOB_MANAGER_PLUGIN_DIR . '/includes/class-wp-job-manager-install.php';
74 include_once JOB_MANAGER_PLUGIN_DIR . '/includes/class-wp-job-manager-post-types.php';
75 include_once JOB_MANAGER_PLUGIN_DIR . '/includes/class-wp-job-manager-ajax.php';
76 include_once JOB_MANAGER_PLUGIN_DIR . '/includes/class-wp-job-manager-shortcodes.php';
77 include_once JOB_MANAGER_PLUGIN_DIR . '/includes/class-wp-job-manager-api.php';
78 include_once JOB_MANAGER_PLUGIN_DIR . '/includes/class-wp-job-manager-forms.php';
79 include_once JOB_MANAGER_PLUGIN_DIR . '/includes/class-wp-job-manager-geocode.php';
80 include_once JOB_MANAGER_PLUGIN_DIR . '/includes/class-wp-job-manager-blocks.php';
81 include_once JOB_MANAGER_PLUGIN_DIR . '/includes/class-wp-job-manager-cache-helper.php';
82 include_once JOB_MANAGER_PLUGIN_DIR . '/includes/helper/class-wp-job-manager-helper.php';
83 include_once JOB_MANAGER_PLUGIN_DIR . '/includes/abstracts/abstract-wp-job-manager-email.php';
84 include_once JOB_MANAGER_PLUGIN_DIR . '/includes/abstracts/abstract-wp-job-manager-email-template.php';
85 include_once JOB_MANAGER_PLUGIN_DIR . '/includes/class-wp-job-manager-email-notifications.php';
86 include_once JOB_MANAGER_PLUGIN_DIR . '/includes/class-wp-job-manager-data-exporter.php';
87
88 /**
89 * This custom REST API implementation is deprecated and will be removed in 1.33.0.
90 *
91 * @see WP_Job_Manager::rest_api()
92 * @see https://github.com/Automattic/WP-Job-Manager/issues/1625
93 */
94 if ( defined( 'WPJM_REST_API_ENABLED' ) && WPJM_REST_API_ENABLED ) {
95 trigger_error( esc_html__( 'Constant `WPJM_REST_API_ENABLED` and custom REST API implementation is deprecated and will be removed in 1.33.0. Please use standard WP Core\'s implementation.', 'wp-job-manager' ) );
96 add_action( 'rest_api_init', array( $this, 'rest_api' ) );
97 }
98
99 if ( is_admin() ) {
100 include_once JOB_MANAGER_PLUGIN_DIR . '/includes/admin/class-wp-job-manager-admin.php';
101 }
102
103 // Load 3rd party customizations.
104 include_once JOB_MANAGER_PLUGIN_DIR . '/includes/3rd-party/3rd-party.php';
105
106 // Init classes.
107 $this->forms = WP_Job_Manager_Forms::instance();
108 $this->post_types = WP_Job_Manager_Post_Types::instance();
109
110 // Schedule cron jobs.
111 self::maybe_schedule_cron_jobs();
112
113 // Activation - works with symlinks.
114 register_activation_hook( basename( dirname( __FILE__ ) ) . '/' . basename( __FILE__ ), array( $this, 'activate' ) );
115
116 // Switch theme.
117 add_action( 'after_switch_theme', array( 'WP_Job_Manager_Ajax', 'add_endpoint' ), 10 );
118 add_action( 'after_switch_theme', array( $this->post_types, 'register_post_types' ), 11 );
119 add_action( 'after_switch_theme', 'flush_rewrite_rules', 15 );
120
121 // Actions.
122 add_action( 'after_setup_theme', array( $this, 'load_plugin_textdomain' ) );
123 add_action( 'after_setup_theme', array( $this, 'include_template_functions' ), 11 );
124 add_action( 'widgets_init', array( $this, 'widgets_init' ) );
125 add_action( 'wp_loaded', array( $this, 'register_shared_assets' ) );
126 add_action( 'wp_enqueue_scripts', array( $this, 'frontend_scripts' ) );
127 add_action( 'admin_init', array( $this, 'updater' ) );
128 add_action( 'admin_init', array( $this, 'add_privacy_policy_content' ) );
129 add_action( 'wp_logout', array( $this, 'cleanup_job_posting_cookies' ) );
130 add_action( 'init', array( 'WP_Job_Manager_Email_Notifications', 'init' ) );
131
132 // Filters.
133 add_filter( 'wp_privacy_personal_data_exporters', array( 'WP_Job_Manager_Data_Exporter', 'register_wpjm_user_data_exporter' ) );
134
135 add_action( 'init', array( $this, 'usage_tracking_init' ) );
136 register_deactivation_hook( __FILE__, array( $this, 'usage_tracking_cleanup' ) );
137
138 // Other cleanup.
139 register_deactivation_hook( __FILE__, array( $this, 'unschedule_cron_jobs' ) );
140
141 // Defaults for WPJM core actions.
142 add_action( 'wpjm_notify_new_user', 'wp_job_manager_notify_new_user', 10, 2 );
143 }
144
145 /**
146 * Performs plugin activation steps.
147 */
148 public function activate() {
149 WP_Job_Manager_Ajax::add_endpoint();
150 unregister_post_type( 'job_listing' );
151 add_filter( 'pre_option_job_manager_enable_types', '__return_true' );
152 $this->post_types->register_post_types();
153 remove_filter( 'pre_option_job_manager_enable_types', '__return_true' );
154 WP_Job_Manager_Install::install();
155 flush_rewrite_rules();
156 }
157
158 /**
159 * Handles tasks after plugin is updated.
160 */
161 public function updater() {
162 if ( version_compare( JOB_MANAGER_VERSION, get_option( 'wp_job_manager_version' ), '>' ) ) {
163 WP_Job_Manager_Install::install();
164 flush_rewrite_rules();
165 }
166 }
167
168 /**
169 * Adds Privacy Policy suggested content.
170 */
171 public function add_privacy_policy_content() {
172 if ( ! function_exists( 'wp_add_privacy_policy_content' ) ) {
173 return;
174 }
175
176 $content = sprintf(
177 // translators: Placeholders %1$s and %2$s are the names of the two cookies used in WP Job Manager.
178 __( 'This site adds the following cookies to help users resume job submissions that they
179 have started but have not completed: %1$s and %2$s', 'wp-job-manager'
180 ),
181 '<code>wp-job-manager-submitting-job-id</code>', '<code>wp-job-manager-submitting-job-key</code>'
182 );
183
184 wp_add_privacy_policy_content(
185 'WP Job Manager',
186 wp_kses_post( wpautop( $content, false ) )
187 );
188 }
189
190 /**
191 * Loads textdomain for plugin.
192 */
193 public function load_plugin_textdomain() {
194 load_textdomain( 'wp-job-manager', WP_LANG_DIR . '/wp-job-manager/wp-job-manager-' . apply_filters( 'plugin_locale', get_locale(), 'wp-job-manager' ) . '.mo' );
195 load_plugin_textdomain( 'wp-job-manager', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
196 }
197
198 /**
199 * Initialize our REST API.
200 *
201 * NOTE: This custom, unsupported REST API implementation be removed in 1.33.0 and the constant `WPJM_REST_API_ENABLED`
202 * will have no effect.
203 *
204 * @see https://developer.wordpress.org/rest-api/
205 * @see https://github.com/Automattic/WP-Job-Manager/issues/1625
206 *
207 * @deprecated 1.32.0 Please use standard WP core REST API.
208 * @return WP_Job_Manager_REST_API|WP_Error
209 */
210 public function rest_api() {
211 _deprecated_function(
212 __CLASS__ . ':' . __FUNCTION__ . '()',
213 '1.32.0',
214 esc_html__( 'Standard REST API implementation from WP core', 'wp-job-manager' )
215 );
216 if ( null === $this->rest_api ) {
217 include_once JOB_MANAGER_PLUGIN_DIR . '/includes/rest-api/class-wp-job-manager-rest-api.php';
218 $this->rest_api = new WP_Job_Manager_REST_API( dirname( __FILE__ ) );
219 }
220 return $this->rest_api;
221 }
222
223 /**
224 * Loads plugin's core helper template functions.
225 */
226 public function include_template_functions() {
227 include_once JOB_MANAGER_PLUGIN_DIR . '/wp-job-manager-deprecated.php';
228 include_once JOB_MANAGER_PLUGIN_DIR . '/wp-job-manager-functions.php';
229 include_once JOB_MANAGER_PLUGIN_DIR . '/wp-job-manager-template.php';
230 }
231
232 /**
233 * Loads plugin's widgets.
234 */
235 public function widgets_init() {
236 include_once JOB_MANAGER_PLUGIN_DIR . '/includes/class-wp-job-manager-widget.php';
237 include_once JOB_MANAGER_PLUGIN_DIR . '/includes/widgets/class-wp-job-manager-widget-recent-jobs.php';
238 include_once JOB_MANAGER_PLUGIN_DIR . '/includes/widgets/class-wp-job-manager-widget-featured-jobs.php';
239 }
240
241 /**
242 * Initialize the Usage Tracking system.
243 */
244 public function usage_tracking_init() {
245 include_once JOB_MANAGER_PLUGIN_DIR . '/includes/class-wp-job-manager-usage-tracking.php';
246 include_once JOB_MANAGER_PLUGIN_DIR . '/includes/class-wp-job-manager-usage-tracking-data.php';
247
248 WP_Job_Manager_Usage_Tracking::get_instance()->set_callback(
249 array( 'WP_Job_Manager_Usage_Tracking_Data', 'get_usage_data' )
250 );
251 WP_Job_Manager_Usage_Tracking::get_instance()->schedule_tracking_task();
252 }
253
254 /**
255 * Cleanup the Usage Tracking system for plugin deactivation.
256 */
257 public function usage_tracking_cleanup() {
258 WP_Job_Manager_Usage_Tracking::get_instance()->unschedule_tracking_task();
259 }
260
261 /**
262 * Schedule cron jobs for WPJM events.
263 */
264 public static function maybe_schedule_cron_jobs() {
265 if ( ! wp_next_scheduled( 'job_manager_check_for_expired_jobs' ) ) {
266 wp_schedule_event( time(), 'hourly', 'job_manager_check_for_expired_jobs' );
267 }
268 if ( ! wp_next_scheduled( 'job_manager_delete_old_previews' ) ) {
269 wp_schedule_event( time(), 'daily', 'job_manager_delete_old_previews' );
270 }
271 if ( ! wp_next_scheduled( 'job_manager_clear_expired_transients' ) ) {
272 wp_schedule_event( time(), 'twicedaily', 'job_manager_clear_expired_transients' );
273 }
274 if ( ! wp_next_scheduled( 'job_manager_email_daily_notices' ) ) {
275 wp_schedule_event( time(), 'daily', 'job_manager_email_daily_notices' );
276 }
277 }
278
279 /**
280 * Unschedule cron jobs. This is run on plugin deactivation.
281 */
282 public static function unschedule_cron_jobs() {
283 wp_clear_scheduled_hook( 'job_manager_check_for_expired_jobs' );
284 wp_clear_scheduled_hook( 'job_manager_delete_old_previews' );
285 wp_clear_scheduled_hook( 'job_manager_clear_expired_transients' );
286 wp_clear_scheduled_hook( 'job_manager_email_daily_notices' );
287 }
288
289 /**
290 * Cleanup job posting cookies.
291 */
292 public function cleanup_job_posting_cookies() {
293 if ( isset( $_COOKIE['wp-job-manager-submitting-job-id'] ) ) {
294 setcookie( 'wp-job-manager-submitting-job-id', '', 0, COOKIEPATH, COOKIE_DOMAIN, false );
295 }
296 if ( isset( $_COOKIE['wp-job-manager-submitting-job-key'] ) ) {
297 setcookie( 'wp-job-manager-submitting-job-key', '', 0, COOKIEPATH, COOKIE_DOMAIN, false );
298 }
299 }
300
301 /**
302 * Registers assets used in both the frontend and WP admin.
303 */
304 public function register_shared_assets() {
305 global $wp_scripts;
306
307 $jquery_version = isset( $wp_scripts->registered['jquery-ui-core']->ver ) ? $wp_scripts->registered['jquery-ui-core']->ver : '1.9.2';
308 wp_register_style( 'jquery-ui', '//code.jquery.com/ui/' . $jquery_version . '/themes/smoothness/jquery-ui.css', array(), $jquery_version );
309 }
310
311 /**
312 * Registers select2 assets when needed.
313 */
314 public static function register_select2_assets() {
315 wp_register_script( 'select2', JOB_MANAGER_PLUGIN_URL . '/assets/js/select2/select2.full.min.js', array( 'jquery' ), '4.0.5' );
316 wp_register_style( 'select2', JOB_MANAGER_PLUGIN_URL . '/assets/js/select2/select2.min.css', array(), '4.0.5' );
317 }
318
319 /**
320 * Registers and enqueues scripts and CSS.
321 *
322 * Note: For enhanced select, 1.32.0 moved to Select2. Chosen is currently packaged but will be removed in an
323 * upcoming release.
324 */
325 public function frontend_scripts() {
326 $ajax_url = WP_Job_Manager_Ajax::get_endpoint();
327 $ajax_filter_deps = array( 'jquery', 'jquery-deserialize' );
328 $ajax_data = array(
329 'ajax_url' => $ajax_url,
330 'is_rtl' => is_rtl() ? 1 : 0,
331 'i18n_load_prev_listings' => __( 'Load previous listings', 'wp-job-manager' ),
332 );
333
334 /**
335 * Retrieves the current language for use when caching requests.
336 *
337 * @since 1.26.0
338 *
339 * @param string|null $lang
340 */
341 $ajax_data['lang'] = apply_filters( 'wpjm_lang', null );
342
343 $enhanced_select_shortcodes = array( 'submit_job_form', 'job_dashboard', 'jobs' );
344 $enhanced_select_used_on_page = has_wpjm_shortcode( null, $enhanced_select_shortcodes );
345
346 /**
347 * Set the constant `JOB_MANAGER_DISABLE_CHOSEN_LEGACY_COMPAT` to true to test for future behavior once
348 * this legacy code is removed and `chosen` is no longer packaged with the plugin.
349 */
350 if ( ! defined( 'JOB_MANAGER_DISABLE_CHOSEN_LEGACY_COMPAT' ) || ! JOB_MANAGER_DISABLE_CHOSEN_LEGACY_COMPAT ) {
351 if ( is_wpjm_taxonomy() || is_wpjm_job_listing() || is_wpjm_page() ) {
352 $enhanced_select_used_on_page = true;
353 }
354
355 // Register the script for dependencies that still require it.
356 if ( ! wp_script_is( 'chosen', 'registered' ) ) {
357 wp_register_script( 'chosen', JOB_MANAGER_PLUGIN_URL . '/assets/js/jquery-chosen/chosen.jquery.min.js', array( 'jquery' ), '1.1.0', true );
358 wp_register_style( 'chosen', JOB_MANAGER_PLUGIN_URL . '/assets/css/chosen.css', array(), '1.1.0' );
359 }
360
361 // Backwards compatibility for third-party themes/plugins while they transition to Select2.
362 wp_localize_script(
363 'chosen', 'job_manager_chosen_multiselect_args',
364 apply_filters(
365 'job_manager_chosen_multiselect_args', array(
366 'search_contains' => true,
367 )
368 )
369 );
370
371 /**
372 * Filter the use of the deprecated chosen library. Themes and plugins should migrate to Select2. This will be
373 * removed in an upcoming major release.
374 *
375 * @since 1.19.0
376 * @deprecated 1.32.0 Migrate to job_manager_select2_enabled and enable only on pages that need it.
377 *
378 * @param bool $chosen_used_on_page
379 */
380 if ( apply_filters( 'job_manager_chosen_enabled', false ) ) {
381 _deprecated_hook( 'job_manager_chosen_enabled', '1.32.0', 'job_manager_select2_enabled' );
382
383 // Assume if this filter returns true that the current page should have the multi-select scripts.
384 $enhanced_select_used_on_page = true;
385
386 wp_enqueue_script( 'chosen' );
387 wp_enqueue_style( 'chosen' );
388 }
389 }
390
391 /**
392 * Filter the use of the enhanced select.
393 *
394 * Note: Don't depend on `select2` being registered/enqueued in customizations.
395 *
396 * @since 1.32.0
397 *
398 * @param bool $enhanced_select_used_on_page Defaults to only when there are known shortcodes on the page.
399 */
400 if ( apply_filters( 'job_manager_enhanced_select_enabled', $enhanced_select_used_on_page ) ) {
401 self::register_select2_assets();
402 wp_register_script( 'wp-job-manager-term-multiselect', JOB_MANAGER_PLUGIN_URL . '/assets/js/term-multiselect.min.js', array( 'jquery', 'select2' ), JOB_MANAGER_VERSION, true );
403 wp_register_script( 'wp-job-manager-multiselect', JOB_MANAGER_PLUGIN_URL . '/assets/js/multiselect.min.js', array( 'jquery', 'select2' ), JOB_MANAGER_VERSION, true );
404 wp_enqueue_style( 'select2' );
405
406 $ajax_filter_deps[] = 'select2';
407
408 $select2_args = array();
409 if ( is_rtl() ) {
410 $select2_args['dir'] = 'rtl';
411 }
412
413 $select2_args['width'] = '100%';
414
415 wp_localize_script(
416 'select2', 'job_manager_select2_args',
417 apply_filters( 'job_manager_select2_args', $select2_args )
418 );
419 }
420
421 if ( job_manager_user_can_upload_file_via_ajax() ) {
422 wp_register_script( 'jquery-iframe-transport', JOB_MANAGER_PLUGIN_URL . '/assets/js/jquery-fileupload/jquery.iframe-transport.js', array( 'jquery' ), '1.8.3', true );
423 wp_register_script( 'jquery-fileupload', JOB_MANAGER_PLUGIN_URL . '/assets/js/jquery-fileupload/jquery.fileupload.js', array( 'jquery', 'jquery-iframe-transport', 'jquery-ui-widget' ), '9.11.2', true );
424 wp_register_script( 'wp-job-manager-ajax-file-upload', JOB_MANAGER_PLUGIN_URL . '/assets/js/ajax-file-upload.min.js', array( 'jquery', 'jquery-fileupload' ), JOB_MANAGER_VERSION, true );
425
426 ob_start();
427 get_job_manager_template(
428 'form-fields/uploaded-file-html.php',
429 array(
430 'name' => '',
431 'value' => '',
432 'extension' => 'jpg',
433 )
434 );
435 $js_field_html_img = ob_get_clean();
436
437 ob_start();
438 get_job_manager_template(
439 'form-fields/uploaded-file-html.php',
440 array(
441 'name' => '',
442 'value' => '',
443 'extension' => 'zip',
444 )
445 );
446 $js_field_html = ob_get_clean();
447
448 wp_localize_script(
449 'wp-job-manager-ajax-file-upload',
450 'job_manager_ajax_file_upload',
451 array(
452 'ajax_url' => $ajax_url,
453 'js_field_html_img' => esc_js( str_replace( "\n", '', $js_field_html_img ) ),
454 'js_field_html' => esc_js( str_replace( "\n", '', $js_field_html ) ),
455 'i18n_invalid_file_type' => __( 'Invalid file type. Accepted types:', 'wp-job-manager' ),
456 )
457 );
458 }
459
460 wp_register_script( 'jquery-deserialize', JOB_MANAGER_PLUGIN_URL . '/assets/js/jquery-deserialize/jquery.deserialize.js', array( 'jquery' ), '1.2.1', true );
461 wp_register_script( 'wp-job-manager-ajax-filters', JOB_MANAGER_PLUGIN_URL . '/assets/js/ajax-filters.min.js', $ajax_filter_deps, JOB_MANAGER_VERSION, true );
462 wp_register_script( 'wp-job-manager-job-dashboard', JOB_MANAGER_PLUGIN_URL . '/assets/js/job-dashboard.min.js', array( 'jquery' ), JOB_MANAGER_VERSION, true );
463 wp_register_script( 'wp-job-manager-job-application', JOB_MANAGER_PLUGIN_URL . '/assets/js/job-application.min.js', array( 'jquery' ), JOB_MANAGER_VERSION, true );
464 wp_register_script( 'wp-job-manager-job-submission', JOB_MANAGER_PLUGIN_URL . '/assets/js/job-submission.min.js', array( 'jquery' ), JOB_MANAGER_VERSION, true );
465 wp_localize_script( 'wp-job-manager-ajax-filters', 'job_manager_ajax_filters', $ajax_data );
466 wp_localize_script(
467 'wp-job-manager-job-dashboard',
468 'job_manager_job_dashboard',
469 array(
470 'i18n_confirm_delete' => __( 'Are you sure you want to delete this listing?', 'wp-job-manager' ),
471 )
472 );
473
474 /**
475 * Filter whether to enqueue WPJM core's frontend scripts. By default, they will only be enqueued on WPJM related
476 * pages.
477 *
478 * If your theme or plugin depend on `frontend.css` from WPJM core, you can use the
479 * `job_manager_enqueue_frontend_style` filter.
480 *
481 * Example code for a custom shortcode that depends on the frontend style:
482 *
483 * add_filter( 'job_manager_enqueue_frontend_style', function( $frontend_used_on_page ) {
484 * global $post;
485 * if ( is_singular()
486 * && is_a( $post, 'WP_Post' )
487 * && has_shortcode( $post->post_content, 'resumes' )
488 * ) {
489 * $frontend_used_on_page = true;
490 * }
491 * return $frontend_used_on_page;
492 * } );
493 *
494 * @since 1.30.0
495 *
496 * @param bool $is_frontend_style_enabled
497 */
498 if ( apply_filters( 'job_manager_enqueue_frontend_style', is_wpjm() ) ) {
499 wp_enqueue_style( 'wp-job-manager-frontend', JOB_MANAGER_PLUGIN_URL . '/assets/css/frontend.css', array(), JOB_MANAGER_VERSION );
500 } else {
501 wp_register_style( 'wp-job-manager-job-listings', JOB_MANAGER_PLUGIN_URL . '/assets/css/job-listings.css', array(), JOB_MANAGER_VERSION );
502 }
503 }
504 }
505
506 /**
507 * Add post type for Job Manager.
508 *
509 * @param array $types
510 * @return array
511 */
512 function job_manager_add_post_types( $types ) {
513 $types[] = 'job_listing';
514 return $types;
515 }
516 add_filter( 'post_types_to_delete_with_user', 'job_manager_add_post_types', 10 );
517
518 /**
519 * Main instance of WP Job Manager.
520 *
521 * Returns the main instance of WP Job Manager to prevent the need to use globals.
522 *
523 * @since 1.26
524 * @return WP_Job_Manager
525 */
526 function WPJM() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName
527 return WP_Job_Manager::instance();
528 }
529
530 $GLOBALS['job_manager'] = WPJM();
531