WP Job Manager - Version 1.25.2

Version Description

  • Fix - The date format of the expiry date picker was incorrect in translations so we added a comment to clarify, and fixed translations. (https://github.com/Automattic/WP-Job-Manager/issues/697)
  • Fix - Changing the date of an expired job would forget the date, even though the job would become active. (https://github.com/Automattic/WP-Job-Manager/issues/653)
  • Fix - Site owner can allow jobs to have only one or more than one types. (https://github.com/Automattic/WP-Job-Manager/issues/549)
  • Fix - Show expired jobs if that setting is enabled. (https://github.com/Automattic/WP-Job-Manager/issues/703)
  • Fix - Simplify the search message on the jobs page to avoid translation problems. (https://github.com/Automattic/WP-Job-Manager/issues/647)
  • Fix - The uploader would ignore WordPress created image sizes. (https://github.com/Automattic/WP-Job-Manager/issues/706)
  • Fix - setup.css was loaded on all admin pages. (https://github.com/Automattic/WP-Job-Manager/issues/728)
  • Fix - The preview of a listing could be edited or viewed by anyone. Props @tripflex (https://github.com/Automattic/WP-Job-Manager/issues/690)
  • Fix - When users were deleted their jobs weren't. (https://github.com/Automattic/WP-Job-Manager/issues/675)
  • Fix - OrderBy Rand wasn't working. (https://github.com/Automattic/WP-Job-Manager/issues/714)
  • Dev - Add upload filters and update PHPDocs, props @tripflex (https://github.com/Automattic/WP-Job-Manager/pull/747)
  • Fix - Stop using jQuery.live, props @tripflex (https://github.com/Automattic/WP-Job-Manager/pull/664)

See additional changelog items in changelog.txt

=

Download this release

Release Info

Developer donncha
Plugin Icon 128x128 WP Job Manager
Version 1.25.2
Comparing to
See all releases

Code changes from version 1.25.1 to 1.25.2

.github/ISSUE_TEMPLATE.md ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!--
2
+ Thanks for contributing to WP Job Manager! Enter a clear title (e.g. "Search error when using plus sign") and proceed.
3
+ -->
4
+
5
+ #### What I Expected To Happen
6
+
7
+ #### What Happened Instead
8
+
9
+ #### Steps to Reproduce the Bug
10
+
11
+ <!--
12
+ PLEASE NOTE:
13
+ - These comments won't show up when you submit the issue.
14
+ - Try to add as much detail as possible. Be specific!
15
+ - GitHub issues aren't for support! If you have questions, use this form: https://wpjobmanager.com/support/
16
+ - If you're requesting a new feature, explain why you'd like it to be added.
17
+ -->
assets/js/admin.js CHANGED
@@ -98,3 +98,12 @@ jQuery(document).ready(function($) {
98
  file_frame.open();
99
  });
100
  });
 
 
 
 
 
 
 
 
 
98
  file_frame.open();
99
  });
100
  });
101
+
102
+ jQuery(document).ready(function($) {
103
+ var taxonomy = 'job_listing_type';
104
+ $('#' + taxonomy + 'checklist li :radio, #' + taxonomy + 'checklist-pop :radio').live( 'click', function(){
105
+ var t = $(this), c = t.is(':checked'), id = t.val();
106
+ $('#' + taxonomy + 'checklist li :radio, #' + taxonomy + 'checklist-pop :radio').prop('checked',false);
107
+ $('#in-' + taxonomy + '-' + id + ', #in-popular-' + taxonomy + '-' + id).prop( 'checked', c );
108
+ });
109
+ });
assets/js/admin.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(a){a(".tips, .help_tip").tipTip({attribute:"data-tip",fadeIn:50,fadeOut:50,delay:200}),a("p.form-field-author").on("click","a.change-author",function(){return a(this).closest("p").find(".current-author").hide(),a(this).closest("p").find(".change-author").show(),!1}),a("input.job-manager-datepicker, input#_job_expires").datepicker({altFormat:"yy-mm-dd",dateFormat:job_manager_admin.date_format,minDate:0}),a("input.job-manager-datepicker, input#_job_expires").each(function(){if(a(this).val()){var b=new Date(a(this).val());a(this).datepicker("setDate",b)}});var b,c,d;a(document).on("click",".wp_job_manager_add_another_file_button",function(b){b.preventDefault();var c=a(this).data("field_name"),d=a(this).data("field_placeholder"),e=a(this).data("uploader_button_text"),f=a(this).data("uploader_button"),g=a(this).data("view_button");a(this).before('<span class="file_url"><input type="text" name="'+c+'[]" placeholder="'+d+'" /><button class="button button-small wp_job_manager_upload_file_button" data-uploader_button_text="'+e+'">'+f+'</button><button class="button button-small wp_job_manager_view_file_button">'+g+"</button></span>")}),a(document).on("click",".wp_job_manager_view_file_button",function(b){b.preventDefault(),d=a(this).closest(".file_url"),c=d.find("input");var e=c.val();e.indexOf("://")>-1?window.open(e,"_blank"):(c.addClass("file_no_url"),setTimeout(function(){c.removeClass("file_no_url")},1e3))}),a(document).on("click",".wp_job_manager_upload_file_button",function(e){return e.preventDefault(),d=a(this).closest(".file_url"),c=d.find("input"),b?void b.open():(b=wp.media.frames.file_frame=wp.media({title:a(this).data("uploader_title"),button:{text:a(this).data("uploader_button_text")},multiple:!1}),b.on("select",function(){var d=b.state().get("selection").first().toJSON();a(c).val(d.url)}),void b.open())})});
1
+ jQuery(document).ready(function(a){a(".tips, .help_tip").tipTip({attribute:"data-tip",fadeIn:50,fadeOut:50,delay:200}),a("p.form-field-author").on("click","a.change-author",function(){return a(this).closest("p").find(".current-author").hide(),a(this).closest("p").find(".change-author").show(),!1}),a("input.job-manager-datepicker, input#_job_expires").datepicker({altFormat:"yy-mm-dd",dateFormat:job_manager_admin.date_format,minDate:0}),a("input.job-manager-datepicker, input#_job_expires").each(function(){if(a(this).val()){var b=new Date(a(this).val());a(this).datepicker("setDate",b)}});var b,c,d;a(document).on("click",".wp_job_manager_add_another_file_button",function(b){b.preventDefault();var c=a(this).data("field_name"),d=a(this).data("field_placeholder"),e=a(this).data("uploader_button_text"),f=a(this).data("uploader_button"),g=a(this).data("view_button");a(this).before('<span class="file_url"><input type="text" name="'+c+'[]" placeholder="'+d+'" /><button class="button button-small wp_job_manager_upload_file_button" data-uploader_button_text="'+e+'">'+f+'</button><button class="button button-small wp_job_manager_view_file_button">'+g+"</button></span>")}),a(document).on("click",".wp_job_manager_view_file_button",function(b){b.preventDefault(),d=a(this).closest(".file_url"),c=d.find("input");var e=c.val();e.indexOf("://")>-1?window.open(e,"_blank"):(c.addClass("file_no_url"),setTimeout(function(){c.removeClass("file_no_url")},1e3))}),a(document).on("click",".wp_job_manager_upload_file_button",function(e){return e.preventDefault(),d=a(this).closest(".file_url"),c=d.find("input"),b?void b.open():(b=wp.media.frames.file_frame=wp.media({title:a(this).data("uploader_title"),button:{text:a(this).data("uploader_button_text")},multiple:!1}),b.on("select",function(){var d=b.state().get("selection").first().toJSON();a(c).val(d.url)}),void b.open())})}),jQuery(document).ready(function(a){var b="job_listing_type";a("#"+b+"checklist li :radio, #"+b+"checklist-pop :radio").live("click",function(){var c=a(this),d=c.is(":checked"),e=c.val();a("#"+b+"checklist li :radio, #"+b+"checklist-pop :radio").prop("checked",!1),a("#in-"+b+"-"+e+", #in-popular-"+b+"-"+e).prop("checked",d)})});
changelog.txt CHANGED
@@ -1,3 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  = 1.25.1 =
2
  * Feature - Adds a view button to the Admin UI for easy access to submitted files or URLs. Props tripflex (https://github.com/Automattic/WP-Job-Manager/pull/650)
3
  * Fix - Add hardening to file uploads to prevent accepting unexpected file times. Previously, other WP-allowed types were sometimes accepted.
@@ -528,4 +542,4 @@
528
  * 'attributes' argument for admin settings.
529
 
530
  = 1.0.0 =
531
- * First stable release.
1
+ = 1.25.2 =
2
+ * Fix - The date format of the expiry date picker was incorrect in translations so we added a comment to clarify, and fixed translations. (https://github.com/Automattic/WP-Job-Manager/issues/697)
3
+ * Fix - Changing the date of an expired job would forget the date, even though the job would become active. (https://github.com/Automattic/WP-Job-Manager/issues/653)
4
+ * Fix - Site owner can allow jobs to have only one or more than one types. (https://github.com/Automattic/WP-Job-Manager/issues/549)
5
+ * Fix - Show expired jobs if that setting is enabled. (https://github.com/Automattic/WP-Job-Manager/issues/703)
6
+ * Fix - Simplify the search message on the jobs page to avoid translation problems. (https://github.com/Automattic/WP-Job-Manager/issues/647)
7
+ * Fix - The uploader would ignore WordPress created image sizes. (https://github.com/Automattic/WP-Job-Manager/issues/706)
8
+ * Fix - setup.css was loaded on all admin pages. (https://github.com/Automattic/WP-Job-Manager/issues/728)
9
+ * Fix - The preview of a listing could be edited or viewed by anyone. Props @tripflex (https://github.com/Automattic/WP-Job-Manager/issues/690)
10
+ * Fix - When users were deleted their jobs weren't. (https://github.com/Automattic/WP-Job-Manager/issues/675)
11
+ * Fix - OrderBy Rand wasn't working. (https://github.com/Automattic/WP-Job-Manager/issues/714)
12
+ * Dev - Add upload filters and update PHPDocs, props @tripflex (https://github.com/Automattic/WP-Job-Manager/pull/747)
13
+ * Fix - Stop using jQuery.live, props @tripflex (https://github.com/Automattic/WP-Job-Manager/pull/664)
14
+
15
  = 1.25.1 =
16
  * Feature - Adds a view button to the Admin UI for easy access to submitted files or URLs. Props tripflex (https://github.com/Automattic/WP-Job-Manager/pull/650)
17
  * Fix - Add hardening to file uploads to prevent accepting unexpected file times. Previously, other WP-allowed types were sometimes accepted.
542
  * 'attributes' argument for admin settings.
543
 
544
  = 1.0.0 =
545
+ * First stable release.
includes/admin/class-wp-job-manager-admin.php CHANGED
@@ -45,7 +45,8 @@ class WP_Job_Manager_Admin {
45
  wp_enqueue_script( 'job_manager_admin_js', JOB_MANAGER_PLUGIN_URL. '/assets/js/admin.min.js', array( 'jquery', 'jquery-tiptip', 'jquery-ui-datepicker' ), JOB_MANAGER_VERSION, true );
46
 
47
  wp_localize_script( 'job_manager_admin_js', 'job_manager_admin', array(
48
- 'date_format' => _x( 'yy-mm-dd', 'Date format for jQuery datepicker', 'wp-job-manager' )
 
49
  ) );
50
  }
51
 
45
  wp_enqueue_script( 'job_manager_admin_js', JOB_MANAGER_PLUGIN_URL. '/assets/js/admin.min.js', array( 'jquery', 'jquery-tiptip', 'jquery-ui-datepicker' ), JOB_MANAGER_VERSION, true );
46
 
47
  wp_localize_script( 'job_manager_admin_js', 'job_manager_admin', array(
48
+ /* translators: jQuery date format, see http://api.jqueryui.com/datepicker/#utility-formatDate */
49
+ 'date_format' => _x( 'yy-mm-dd', 'Date format for jQuery datepicker.', 'wp-job-manager' )
50
  ) );
51
  }
52
 
includes/admin/class-wp-job-manager-settings.php CHANGED
@@ -96,6 +96,15 @@ class WP_Job_Manager_Settings {
96
  'all' => __( 'Jobs will be shown if within ALL selected categories', 'wp-job-manager' ),
97
  )
98
  ),
 
 
 
 
 
 
 
 
 
99
  ),
100
  ),
101
  'job_submission' => array(
@@ -172,7 +181,7 @@ class WP_Job_Manager_Settings {
172
  'email' => __( 'Email addresses only', 'wp-job-manager' ),
173
  'url' => __( 'Website URLs only', 'wp-job-manager' ),
174
  )
175
- )
176
  )
177
  ),
178
  'job_pages' => array(
96
  'all' => __( 'Jobs will be shown if within ALL selected categories', 'wp-job-manager' ),
97
  )
98
  ),
99
+ array(
100
+ 'name' => 'job_manager_multi_job_type',
101
+ 'std' => '0',
102
+ 'label' => __( 'Multi-select Listing Types', 'wp-job-manager' ),
103
+ 'cb_label' => __( 'Enable multiple types for listings', 'wp-job-manager' ),
104
+ 'desc' => __( 'If enabled each job can have more than one type. The metabox on the post editor and the select box on the frontend job submission form are changed by this.', 'wp-job-manager' ),
105
+ 'type' => 'checkbox',
106
+ 'attributes' => array()
107
+ ),
108
  ),
109
  ),
110
  'job_submission' => array(
181
  'email' => __( 'Email addresses only', 'wp-job-manager' ),
182
  'url' => __( 'Website URLs only', 'wp-job-manager' ),
183
  )
184
+ ),
185
  )
186
  ),
187
  'job_pages' => array(
includes/admin/class-wp-job-manager-setup.php CHANGED
@@ -18,7 +18,8 @@ class WP_Job_Manager_Setup {
18
  add_action( 'admin_menu', array( $this, 'admin_menu' ), 12 );
19
  add_action( 'admin_head', array( $this, 'admin_head' ) );
20
  add_action( 'admin_init', array( $this, 'redirect' ) );
21
- add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ), 12 );
 
22
  }
23
 
24
  /**
@@ -251,4 +252,4 @@ class WP_Job_Manager_Setup {
251
  }
252
  }
253
 
254
- new WP_Job_Manager_Setup();
18
  add_action( 'admin_menu', array( $this, 'admin_menu' ), 12 );
19
  add_action( 'admin_head', array( $this, 'admin_head' ) );
20
  add_action( 'admin_init', array( $this, 'redirect' ) );
21
+ if ( isset( $_GET[ 'page' ] ) && $_GET[ 'page' ] == 'job-manager-setup' )
22
+ add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ), 12 );
23
  }
24
 
25
  /**
252
  }
253
  }
254
 
255
+ new WP_Job_Manager_Setup();
includes/admin/class-wp-job-manager-writepanels.php CHANGED
@@ -84,7 +84,8 @@ class WP_Job_Manager_Writepanels {
84
  'label' => __( 'Listing Expiry Date', 'wp-job-manager' ),
85
  'priority' => 11,
86
  'classes' => array( 'job-manager-datepicker' ),
87
- 'placeholder' => _x( 'yyyy-mm-dd', 'Date format placeholder', 'wp-job-manager' ),
 
88
  'value' => metadata_exists( 'post', $post->ID, '_job_expires' ) ? get_post_meta( $post->ID, '_job_expires', true ) : calculate_job_expiry( $post->ID ),
89
  );
90
  }
@@ -123,6 +124,66 @@ class WP_Job_Manager_Writepanels {
123
  global $wp_post_types;
124
 
125
  add_meta_box( 'job_listing_data', sprintf( __( '%s Data', 'wp-job-manager' ), $wp_post_types['job_listing']->labels->singular_name ), array( $this, 'job_listing_data' ), 'job_listing', 'normal', 'high' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
  }
127
 
128
  /**
84
  'label' => __( 'Listing Expiry Date', 'wp-job-manager' ),
85
  'priority' => 11,
86
  'classes' => array( 'job-manager-datepicker' ),
87
+ /* translators: date format placeholder, see https://secure.php.net/date */
88
+ 'placeholder' => _x( 'yyyy-mm-dd', 'Date format placeholder.', 'wp-job-manager' ),
89
  'value' => metadata_exists( 'post', $post->ID, '_job_expires' ) ? get_post_meta( $post->ID, '_job_expires', true ) : calculate_job_expiry( $post->ID ),
90
  );
91
  }
124
  global $wp_post_types;
125
 
126
  add_meta_box( 'job_listing_data', sprintf( __( '%s Data', 'wp-job-manager' ), $wp_post_types['job_listing']->labels->singular_name ), array( $this, 'job_listing_data' ), 'job_listing', 'normal', 'high' );
127
+ if ( false == job_manager_multi_job_type() ) {
128
+ remove_meta_box( 'job_listing_typediv', 'job_listing', 'side');
129
+ add_meta_box( 'job_listing_type', __( 'Job Listings', 'wp-job-manager' ), array( $this, 'job_listing_metabox' ),'job_listing' ,'side','core');
130
+ }
131
+ }
132
+
133
+ function job_listing_metabox( $post ) {
134
+ //Set up the taxonomy object and get terms
135
+ $taxonomy = 'job_listing_type';
136
+ $tax = get_taxonomy( $taxonomy );//This is the taxonomy object
137
+
138
+ //The name of the form
139
+ $name = 'tax_input[' . $taxonomy . ']';
140
+
141
+ //Get all the terms for this taxonomy
142
+ $terms = get_terms( $taxonomy, array( 'hide_empty' => 0 ) );
143
+ $postterms = get_the_terms( $post->ID, $taxonomy );
144
+ $current = ( $postterms ? array_pop( $postterms ) : false );
145
+ $current = ( $current ? $current->term_id : 0 );
146
+ //Get current and popular terms
147
+ $popular = get_terms( $taxonomy, array( 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false ) );
148
+ $postterms = get_the_terms( $post->ID,$taxonomy );
149
+ $current = ($postterms ? array_pop($postterms) : false);
150
+ $current = ($current ? $current->term_id : 0);
151
+ ?>
152
+
153
+ <div id="taxonomy-<?php echo $taxonomy; ?>" class="categorydiv">
154
+
155
+ <!-- Display tabs-->
156
+ <ul id="<?php echo $taxonomy; ?>-tabs" class="category-tabs">
157
+ <li class="tabs"><a href="#<?php echo $taxonomy; ?>-all" tabindex="3"><?php echo $tax->labels->all_items; ?></a></li>
158
+ <li class="hide-if-no-js"><a href="#<?php echo $taxonomy; ?>-pop" tabindex="3"><?php _e( 'Most Used' ); ?></a></li>
159
+ </ul>
160
+
161
+ <!-- Display taxonomy terms -->
162
+ <div id="<?php echo $taxonomy; ?>-all" class="tabs-panel">
163
+ <ul id="<?php echo $taxonomy; ?>checklist" class="list:<?php echo $taxonomy?> categorychecklist form-no-clear">
164
+ <?php foreach($terms as $term){
165
+ $id = $taxonomy.'-'.$term->term_id;
166
+ echo "<li id='$id'><label class='selectit'>";
167
+ echo "<input type='radio' id='in-$id' name='{$name}'".checked($current,$term->term_id,false)."value='$term->term_id' />$term->name<br />";
168
+ echo "</label></li>";
169
+ }?>
170
+ </ul>
171
+ </div>
172
+
173
+ <!-- Display popular taxonomy terms -->
174
+ <div id="<?php echo $taxonomy; ?>-pop" class="tabs-panel" style="display: none;">
175
+ <ul id="<?php echo $taxonomy; ?>checklist-pop" class="categorychecklist form-no-clear" >
176
+ <?php foreach($popular as $term){
177
+ $id = 'popular-'.$taxonomy.'-'.$term->term_id;
178
+ echo "<li id='$id'><label class='selectit'>";
179
+ echo "<input type='radio' id='in-$id'".checked($current,$term->term_id,false)."value='$term->term_id' />$term->name<br />";
180
+ echo "</label></li>";
181
+ }?>
182
+ </ul>
183
+ </div>
184
+
185
+ </div>
186
+ <?php
187
  }
188
 
189
  /**
includes/class-wp-job-manager-ajax.php CHANGED
@@ -185,7 +185,13 @@ class WP_Job_Manager_Ajax {
185
  $result['showing_all'] = true;
186
  }
187
 
188
- $result['showing'] = apply_filters( 'job_manager_get_listings_custom_filter_text', sprintf( __( 'Showing all %s', 'wp-job-manager' ), implode( ' ', $result['showing'] ) ) );
 
 
 
 
 
 
189
 
190
  // Generate RSS link
191
  $result['showing_links'] = job_manager_get_filtered_links( array(
185
  $result['showing_all'] = true;
186
  }
187
 
188
+ if ( $jobs->post_count && ( $search_location || $search_keywords || $search_categories ) ) {
189
+ $message = sprintf( _n( 'Search completed. Found %d matching record.', 'Search completed. Found %d matching records.', $jobs->post_count, 'wp-job-manager' ), $jobs->post_count );
190
+ $result['showing_all'] = true;
191
+ } else {
192
+ $message = "";
193
+ }
194
+ $result['showing'] = apply_filters( 'job_manager_get_listings_custom_filter_text', $message );
195
 
196
  // Generate RSS link
197
  $result['showing_links'] = job_manager_get_filtered_links( array(
includes/class-wp-job-manager-post-types.php CHANGED
@@ -486,18 +486,15 @@ class WP_Job_Manager_Post_Types {
486
  $expires = get_post_meta( $post->ID, '_job_expires', true );
487
  if ( $expires && strtotime( $expires ) < current_time( 'timestamp' ) ) {
488
  update_post_meta( $post->ID, '_job_expires', '' );
489
- $_POST[ '_job_expires' ] = '';
490
  }
491
- return;
492
  }
493
 
494
- // No metadata set so we can generate an expiry date
495
  // See if the user has set the expiry manually:
496
  if ( ! empty( $_POST[ '_job_expires' ] ) ) {
497
  update_post_meta( $post->ID, '_job_expires', date( 'Y-m-d', strtotime( sanitize_text_field( $_POST[ '_job_expires' ] ) ) ) );
498
 
499
- // No manual setting? Lets generate a date
500
- } else {
501
  $expires = calculate_job_expiry( $post->ID );
502
  update_post_meta( $post->ID, '_job_expires', $expires );
503
 
486
  $expires = get_post_meta( $post->ID, '_job_expires', true );
487
  if ( $expires && strtotime( $expires ) < current_time( 'timestamp' ) ) {
488
  update_post_meta( $post->ID, '_job_expires', '' );
 
489
  }
 
490
  }
491
 
 
492
  // See if the user has set the expiry manually:
493
  if ( ! empty( $_POST[ '_job_expires' ] ) ) {
494
  update_post_meta( $post->ID, '_job_expires', date( 'Y-m-d', strtotime( sanitize_text_field( $_POST[ '_job_expires' ] ) ) ) );
495
 
496
+ // No manual setting? Lets generate a date if there isn't already one
497
+ } elseif ( false == isset( $expires ) ) {
498
  $expires = calculate_job_expiry( $post->ID );
499
  update_post_meta( $post->ID, '_job_expires', $expires );
500
 
includes/forms/class-wp-job-manager-form-submit-job.php CHANGED
@@ -82,7 +82,11 @@ class WP_Job_Manager_Form_Submit_Job extends WP_Job_Manager_Form {
82
  $this->step = is_numeric( $_GET['step'] ) ? max( absint( $_GET['step'] ), 0 ) : array_search( $_GET['step'], array_keys( $this->steps ) );
83
  }
84
 
85
- $this->job_id = ! empty( $_REQUEST['job_id'] ) ? absint( $_REQUEST[ 'job_id' ] ) : 0;
 
 
 
 
86
 
87
  // Allow resuming from cookie.
88
  if ( ! $this->job_id && ! empty( $_COOKIE['wp-job-manager-submitting-job-id'] ) && ! empty( $_COOKIE['wp-job-manager-submitting-job-key'] ) ) {
@@ -141,6 +145,11 @@ class WP_Job_Manager_Form_Submit_Job extends WP_Job_Manager_Form {
141
  break;
142
  }
143
 
 
 
 
 
 
144
  $this->fields = apply_filters( 'submit_job_form_fields', array(
145
  'job' => array(
146
  'job_title' => array(
@@ -160,7 +169,7 @@ class WP_Job_Manager_Form_Submit_Job extends WP_Job_Manager_Form {
160
  ),
161
  'job_type' => array(
162
  'label' => __( 'Job type', 'wp-job-manager' ),
163
- 'type' => 'term-select',
164
  'required' => true,
165
  'placeholder' => '',
166
  'priority' => 3,
82
  $this->step = is_numeric( $_GET['step'] ) ? max( absint( $_GET['step'] ), 0 ) : array_search( $_GET['step'], array_keys( $this->steps ) );
83
  }
84
 
85
+ $this->job_id = ! empty( $_REQUEST[ 'job_id' ] ) ? absint( $_REQUEST[ 'job_id' ] ) : 0;
86
+
87
+ if ( ! job_manager_user_can_edit_job( $this->job_id ) ) {
88
+ $this->job_id = 0;
89
+ }
90
 
91
  // Allow resuming from cookie.
92
  if ( ! $this->job_id && ! empty( $_COOKIE['wp-job-manager-submitting-job-id'] ) && ! empty( $_COOKIE['wp-job-manager-submitting-job-key'] ) ) {
145
  break;
146
  }
147
 
148
+ if ( job_manager_multi_job_type() ) {
149
+ $job_type = 'term-multiselect';
150
+ } else {
151
+ $job_type = 'term-select';
152
+ }
153
  $this->fields = apply_filters( 'submit_job_form_fields', array(
154
  'job' => array(
155
  'job_title' => array(
169
  ),
170
  'job_type' => array(
171
  'label' => __( 'Job type', 'wp-job-manager' ),
172
+ 'type' => $job_type,
173
  'required' => true,
174
  'placeholder' => '',
175
  'priority' => 3,
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: mikejolley, automattic, adamkheckler, annezazu, artemitos, bikedorkjon, cena, chaselivingston, csonnek, davor.altman, drawmyface, erania-pinnera, jacobshere, jeherve, jenhooks, jgs, kraftbj, lamdayap, lschuyler, macmanx, nancythanki, orangesareorange, rachelsquirrel, ryancowles, richardmtl, scarstocea
3
  Tags: job manager, job listing, job board, job management, job lists, job list, job, jobs, company, hiring, employment, employer, employees, candidate, freelance, internship, job listings, positions, board, application, hiring, listing, manager, recruiting, recruitment, talent
4
  Requires at least: 4.1
5
- Tested up to: 4.6
6
- Stable tag: 1.25.1
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
@@ -141,135 +141,23 @@ You can view (and contribute) translations via the [translate.wordpress.org](htt
141
 
142
  == Changelog ==
143
 
144
- = 1.25.1 =
145
- * Feature - Adds a view button to the Admin UI for easy access to submitted files or URLs. Props tripflex (https://github.com/Automattic/WP-Job-Manager/pull/650)
146
- * Fix - Add hardening to file uploads to prevent accepting unexpected file times. Previously, other WP-allowed types were sometimes accepted.
147
- * Fix - Job post form categories are now properly cached and displayed per language when using WPML or Polylang. (https://github.com/Automattic/WP-Job-Manager/issues/692)
148
- * Fix - Refactored WPML workaround, which was causing no job listings on non-default languages. (https://github.com/Automattic/WP-Job-Manager/issues/617)
149
- * Fix - Allow employers to edit job listings when a listing is pending payment. (https://github.com/Automattic/WP-Job-Manager/pull/664)
150
- * Fix - No longer display Job Taxonomies in the WordPress tag cloud. (https://github.com/Automattic/WP-Job-Manager/pull/658)
151
- * Fix - Migrate away from jQuery.live, which is no longer supported. ( https://github.com/Automattic/WP-Job-Manager/pull/664 )
152
- * Tweak - Updated incorrect settings description. (https://github.com/Automattic/WP-Job-Manager/pull/632)
153
- * Dev - Adds hook to add items in a job's RSS feed item. (https://github.com/Automattic/WP-Job-Manager/pull/636)
154
- * Dev - Adds filter to disable Job Listings cache (https://github.com/Automattic/WP-Job-Manager/pull/684)
155
- * Dev - Inline docs and coding standards improvements.
156
-
157
- = 1.25.0 =
158
- * Feature - Ability to duplicate listings from job dashboard.
159
- * Fix - Support WP_EMBED in job descriptions.
160
- * Fix - Ensure logo is displayed on edit, before submission.
161
- * Fix - Attachment URLs on multisite.
162
- * Fix - Refactored WPML workaround, which was causing no job listings on non-default languages. (https://github.com/Automattic/WP-Job-Manager/issues/617)
163
- * Fix - No need to decode URLs anymore https://core.trac.wordpress.org/ticket/23605.
164
- * Dev - submit_job_form_end/submit_job_form_start actions.
165
- * Dev - job-manager-datepicker class for backend date fields.
166
-
167
- = 1.24.0 =
168
- * Feature - Use featured images to store company logos.
169
- * Feature - Search term names for keywords.
170
- * Feature - Search custom fields in backend job listing search.
171
- * Tweak - Allow job expiry field to be localised.
172
- * Fix - The above change avoids creation of duplicate images in media library.
173
- * Dev - Added methods to WP_Job_Manager_Form; get_steps, get_step_key, set_step.
174
- * Dev - Made WP_Job_Manager_Form call the next 'handler' if no view is defined for the next step.
175
- * Dev - Added template to control job preview form.
176
-
177
- = 1.23.13 =
178
- * Fix - Conflict between the_job_location() and the regions plugin.
179
- * Tweak - Allow some HTML in the_job_location - uses wp_kses_post.
180
-
181
- = 1.23.12 =
182
- * Fix - Transient clear query.
183
- * Tweak - New user notification pluggable function.
184
- * Tweak - Use subquery in keyword search to avoid long queries.
185
- * Tweak - Only search for keywords of 2 or more characters.
186
- * Tweak - job_manager_get_listings_keyword_length_threshold filter.
187
- * Tweak - PolyLang compatibility functions.
188
- * Tweak - Unattach company logo when a new attachment is uploaded.
189
-
190
- = 1.23.11 =
191
- * Fix - Author check in job_manager_user_can_edit_job().
192
- * Tweak - Before deleting a job, delete its attachments.
193
- * Tweak - Show previews in backend if needed.
194
-
195
- = 1.23.10 =
196
- * Fix - Handle WP 4.3 signup notification.
197
- * Fix - Map mime types to those that WordPress knows.
198
- * Fix - Alert text color.
199
- * Fix - Searches containing special chars.
200
- * Tweak - Improved uploader error handling and updated library.
201
- * Tweak - Improve job_manager_user_can_post_job and job_manager_user_can_edit_job capability handling in job-submit.php
202
- * Tweak - Clear transients in batches of 500.
203
- * Tweak - Removed transifex and translations - translation will take place on https://translate.wordpress.org/projects/wp-plugins/wp-job-manager
204
-
205
- = 1.23.9 =
206
- * Fixed editing content with wp_editor. Can no longer be passed to function already escaped.
207
-
208
- = 1.23.8 =
209
- * Fix - Security: XSS issue in account signin.
210
- * Tweak - Update new account email text.
211
-
212
- = 1.23.7 =
213
- * Fix - 4.3 issue showing "Description is a required field" due to editor field.
214
- * Tweak - Default job_manager_delete_expired_jobs to false. Set to true to have expired jobs deleted automatically. More sensible default.
215
- * Tweak - job_manager_term_select_field_wp_dropdown_categories_args filter.
216
- * Tweak - Ajax WPML handling.
217
-
218
- = 1.23.6 =
219
- * Fix - job_manager_ajax_filters -> job_manager_ajax_file_upload in file upload script.
220
-
221
- = 1.23.5 =
222
- * Feature - Allow [job_summary] to output multiple listings via 'limit' parameter.
223
- * Feature - Added flowplayer support.
224
- * Fix - Special chars in feeds.
225
- * Fix - Permalinks with index.php inside.
226
- * Fix - Notice when saving job form.
227
- * Fix - PHP4 widget constructors (https://gist.github.com/chriscct7/d7d077afb01011b1839d).
228
- * Tweak - Allow translation of job_manager_dropdown_categories.
229
- * Tweak - Added handling for .job-manager-filter class.
230
- * Tweak - Added trailing slashes to ajax endpoints.
231
- * Tweak - Made videos responsive.
232
- * Tweak - job_manager_attach_uploaded_files filter.
233
-
234
- = 1.23.4 =
235
- * Tweak - In 1.21.0 we switched to GET ajax requests to leverage caching, however, due to the length of some queries this was causing 414 request URI too long errors in many environments. Reverted to POST to avoid this.
236
- * Tweak - flush_rewrite_rules after updates to ensure ajax endpoint exists.
237
- * Tweak - Use relative path for ajax endpoint to work around https/http.
238
-
239
- = 1.23.3 =
240
- * Fix - WPML integration with lang.
241
- * Tweak - Improved plugin activation code.
242
- * Tweak - Improved theme switch code.
243
- * Tweak - Search the entire meta field, not just from the start.
244
- * Tweak - Added some debugging code to ajax-filters to display in console.
245
-
246
- = 1.23.2 =
247
- * Fix - Send entire form data (listify workaround).
248
- * Fix - Set is_home false on ajax endpoint (listify workaround).
249
-
250
- = 1.23.1 =
251
- * Fix - Orderby featured should be "menu order, date", not "manu order, title".
252
- * Tweak - Remove duplicate data from form_data in filters JS.
253
- * Tweak - If index is -1 in filters JS, abort.
254
-
255
- = 1.23.0 =
256
- * Feature - Custom AJAX endpoints to reduce overhead of loading admin.
257
- * Feature - Support radio fields.
258
- * Fix - Video max width.
259
- * Tweak - Admin remove overflow hidden from data box.
260
- * Tweak - Update notice styling.
261
- * Tweak - Improve orderby. https://make.wordpress.org/core/2014/08/29/a-more-powerful-order-by-in-wordpress-4-0/
262
- * Tweak - nofollow apply links.
263
- * Tweak - Rename 'title' to 'job title' for clarity.
264
- * Tweak - submit_job_form_prefix_post_name_with_company filter.
265
- * Tweak - submit_job_form_prefix_post_name_with_location filter.
266
- * Tweak - submit_job_form_prefix_post_name_with_job_type filter.
267
- * Tweak - Improved job_feed searching.
268
- * Tweak - Improved transient cleaning.
269
 
270
  See additional changelog items in changelog.txt
271
 
272
  == Upgrade Notice ==
273
 
274
- = 1.25.1 =
275
- This release includes many bugs and fixes including some security improvements. Upgrade today!
2
  Contributors: mikejolley, automattic, adamkheckler, annezazu, artemitos, bikedorkjon, cena, chaselivingston, csonnek, davor.altman, drawmyface, erania-pinnera, jacobshere, jeherve, jenhooks, jgs, kraftbj, lamdayap, lschuyler, macmanx, nancythanki, orangesareorange, rachelsquirrel, ryancowles, richardmtl, scarstocea
3
  Tags: job manager, job listing, job board, job management, job lists, job list, job, jobs, company, hiring, employment, employer, employees, candidate, freelance, internship, job listings, positions, board, application, hiring, listing, manager, recruiting, recruitment, talent
4
  Requires at least: 4.1
5
+ Tested up to: 4.6.1
6
+ Stable tag: 1.25.2
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
141
 
142
  == Changelog ==
143
 
144
+ = 1.25.2 =
145
+ * Fix - The date format of the expiry date picker was incorrect in translations so we added a comment to clarify, and fixed translations. (https://github.com/Automattic/WP-Job-Manager/issues/697)
146
+ * Fix - Changing the date of an expired job would forget the date, even though the job would become active. (https://github.com/Automattic/WP-Job-Manager/issues/653)
147
+ * Fix - Site owner can allow jobs to have only one or more than one types. (https://github.com/Automattic/WP-Job-Manager/issues/549)
148
+ * Fix - Show expired jobs if that setting is enabled. (https://github.com/Automattic/WP-Job-Manager/issues/703)
149
+ * Fix - Simplify the search message on the jobs page to avoid translation problems. (https://github.com/Automattic/WP-Job-Manager/issues/647)
150
+ * Fix - The uploader would ignore WordPress created image sizes. (https://github.com/Automattic/WP-Job-Manager/issues/706)
151
+ * Fix - setup.css was loaded on all admin pages. (https://github.com/Automattic/WP-Job-Manager/issues/728)
152
+ * Fix - The preview of a listing could be edited or viewed by anyone. Props @tripflex (https://github.com/Automattic/WP-Job-Manager/issues/690)
153
+ * Fix - When users were deleted their jobs weren't. (https://github.com/Automattic/WP-Job-Manager/issues/675)
154
+ * Fix - OrderBy Rand wasn't working. (https://github.com/Automattic/WP-Job-Manager/issues/714)
155
+ * Dev - Add upload filters and update PHPDocs, props @tripflex (https://github.com/Automattic/WP-Job-Manager/pull/747)
156
+ * Fix - Stop using jQuery.live, props @tripflex (https://github.com/Automattic/WP-Job-Manager/pull/664)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
157
 
158
  See additional changelog items in changelog.txt
159
 
160
  == Upgrade Notice ==
161
 
162
+ = 1.25.2 =
163
+ Lots of bugs fixed.
wp-job-manager-functions.php CHANGED
@@ -23,9 +23,15 @@ function get_job_listings( $args = array() ) {
23
  'fields' => 'all'
24
  ) );
25
 
 
 
 
 
 
 
26
  $query_args = array(
27
  'post_type' => 'job_listing',
28
- 'post_status' => 'publish',
29
  'ignore_sticky_posts' => 1,
30
  'offset' => absint( $args['offset'] ),
31
  'posts_per_page' => intval( $args['posts_per_page'] ),
@@ -143,6 +149,11 @@ function get_job_listings( $args = array() ) {
143
  set_transient( $query_args_hash, $result, DAY_IN_SECONDS * 30 );
144
  }
145
 
 
 
 
 
 
146
  }
147
  else {
148
  $result = new WP_Query( $query_args );
@@ -484,6 +495,15 @@ function job_manager_user_can_edit_job( $job_id ) {
484
  return apply_filters( 'job_manager_user_can_edit_job', $can_edit, $job_id );
485
  }
486
 
 
 
 
 
 
 
 
 
 
487
  /**
488
  * True if registration is enabled.
489
  *
@@ -693,14 +713,14 @@ function job_manager_prepare_uploaded_files( $file_data ) {
693
  $files_to_upload[] = $file_data;
694
  }
695
 
696
- return $files_to_upload;
697
  }
698
 
699
  /**
700
  * Upload a file using WordPress file API.
701
  * @param array $file_data Array of $_FILE data to upload.
702
  * @param array $args Optional arguments
703
- * @return array|WP_Error Array of objects containing either file information or an error
704
  */
705
  function job_manager_upload_file( $file, $args = array() ) {
706
  global $job_manager_upload, $job_manager_uploading_file;
@@ -723,6 +743,24 @@ function job_manager_upload_file( $file, $args = array() ) {
723
  $allowed_mime_types = $args['allowed_mime_types'];
724
  }
725
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
726
  if ( ! in_array( $file['type'], $allowed_mime_types ) ) {
727
  if ( $args['file_label'] ) {
728
  return new WP_Error( 'upload', sprintf( __( '"%s" (filetype %s) needs to be one of the following file types: %s', 'wp-job-manager' ), $args['file_label'], $file['type'], implode( ', ', array_keys( $allowed_mime_types ) ) ) );
23
  'fields' => 'all'
24
  ) );
25
 
26
+ if ( false == get_option( 'job_manager_hide_expired_content', 1 ) ) {
27
+ $post_status = array( 'publish', 'expired' );
28
+ } else {
29
+ $post_status = 'publish';
30
+ }
31
+
32
  $query_args = array(
33
  'post_type' => 'job_listing',
34
+ 'post_status' => $post_status,
35
  'ignore_sticky_posts' => 1,
36
  'offset' => absint( $args['offset'] ),
37
  'posts_per_page' => intval( $args['posts_per_page'] ),
149
  set_transient( $query_args_hash, $result, DAY_IN_SECONDS * 30 );
150
  }
151
 
152
+ // random order is cached so shuffle them
153
+ if ( $query_args[ 'orderby' ] == 'rand' ) {
154
+ shuffle( $result->posts );
155
+ }
156
+
157
  }
158
  else {
159
  $result = new WP_Query( $query_args );
495
  return apply_filters( 'job_manager_user_can_edit_job', $can_edit, $job_id );
496
  }
497
 
498
+ /**
499
+ * True if only one type allowed per job
500
+ *
501
+ * @return bool
502
+ */
503
+ function job_manager_multi_job_type() {
504
+ return apply_filters( 'job_manager_multi_job_type', get_option( 'job_manager_multi_job_type' ) == 1 ? true : false );
505
+ }
506
+
507
  /**
508
  * True if registration is enabled.
509
  *
713
  $files_to_upload[] = $file_data;
714
  }
715
 
716
+ return apply_filters( 'job_manager_prepare_uploaded_files', $files_to_upload );
717
  }
718
 
719
  /**
720
  * Upload a file using WordPress file API.
721
  * @param array $file_data Array of $_FILE data to upload.
722
  * @param array $args Optional arguments
723
+ * @return stdClass|WP_Error Object containing file information, or error
724
  */
725
  function job_manager_upload_file( $file, $args = array() ) {
726
  global $job_manager_upload, $job_manager_uploading_file;
743
  $allowed_mime_types = $args['allowed_mime_types'];
744
  }
745
 
746
+ /**
747
+ * Filter file configuration before upload
748
+ *
749
+ * This filter can be used to modify the file arguments before being uploaded, or return a WP_Error
750
+ * object to prevent the file from being uploaded, and return the error.
751
+ *
752
+ * @since 1.25.2
753
+ *
754
+ * @param array $file Array of $_FILE data to upload.
755
+ * @param array $args Optional file arguments
756
+ * @param array $allowed_mime_types Array of allowed mime types from field config or defaults
757
+ */
758
+ $file = apply_filters( 'job_manager_upload_file_pre_upload', $file, $args, $allowed_mime_types );
759
+
760
+ if ( is_wp_error( $file ) ) {
761
+ return $file;
762
+ }
763
+
764
  if ( ! in_array( $file['type'], $allowed_mime_types ) ) {
765
  if ( $args['file_label'] ) {
766
  return new WP_Error( 'upload', sprintf( __( '"%s" (filetype %s) needs to be one of the following file types: %s', 'wp-job-manager' ), $args['file_label'], $file['type'], implode( ', ', array_keys( $allowed_mime_types ) ) ) );
wp-job-manager-template.php CHANGED
@@ -375,7 +375,8 @@ function job_manager_get_resized_image( $logo, $size ) {
375
  $upload_dir = wp_upload_dir();
376
  $logo_path = str_replace( array( $upload_dir['baseurl'], $upload_dir['url'], WP_CONTENT_URL ), array( $upload_dir['basedir'], $upload_dir['path'], WP_CONTENT_DIR ), $logo );
377
  $path_parts = pathinfo( $logo_path );
378
- $resized_logo_path = str_replace( '.' . $path_parts['extension'], '-' . $size . '.' . $path_parts['extension'], $logo_path );
 
379
 
380
  if ( strstr( $resized_logo_path, 'http:' ) || strstr( $resized_logo_path, 'https:' ) ) {
381
  return $logo;
375
  $upload_dir = wp_upload_dir();
376
  $logo_path = str_replace( array( $upload_dir['baseurl'], $upload_dir['url'], WP_CONTENT_URL ), array( $upload_dir['basedir'], $upload_dir['path'], WP_CONTENT_DIR ), $logo );
377
  $path_parts = pathinfo( $logo_path );
378
+ $dims = $img_width . 'x' . $img_height;
379
+ $resized_logo_path = str_replace( '.' . $path_parts['extension'], '-' . $dims . '.' . $path_parts['extension'], $logo_path );
380
 
381
  if ( strstr( $resized_logo_path, 'http:' ) || strstr( $resized_logo_path, 'https:' ) ) {
382
  return $logo;
wp-job-manager.php CHANGED
@@ -3,11 +3,11 @@
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.25.1
7
  * Author: Automattic
8
  * Author URI: https://wpjobmanager.com/
9
  * Requires at least: 4.1
10
- * Tested up to: 4.6
11
  * Text Domain: wp-job-manager
12
  * Domain Path: /languages/
13
  * License: GPL2+
@@ -171,4 +171,10 @@ class WP_Job_Manager {
171
  }
172
  }
173
 
 
 
 
 
 
 
174
  $GLOBALS['job_manager'] = new WP_Job_Manager();
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.25.2
7
  * Author: Automattic
8
  * Author URI: https://wpjobmanager.com/
9
  * Requires at least: 4.1
10
+ * Tested up to: 4.6.1
11
  * Text Domain: wp-job-manager
12
  * Domain Path: /languages/
13
  * License: GPL2+
171
  }
172
  }
173
 
174
+ function job_manager_add_post_types( $types, $id ) {
175
+ $types[] = 'job_listing';
176
+ return $types;
177
+ }
178
+ add_filter( 'post_types_to_delete_with_user', 'job_manager_add_post_types' );
179
+
180
  $GLOBALS['job_manager'] = new WP_Job_Manager();