Skip to content

Commit

Permalink
Define date format fallback in constant
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeyarce committed Mar 14, 2024
1 parent eaf7fe6 commit 5b318b1
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion includes/admin/class-wp-job-manager-cpt.php
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ public function enter_title_here( $text, $post ) {
*/
public function post_updated_messages( $messages ) {
global $post, $post_ID, $wp_post_types;
$wp_date_format = get_option( 'date_format' ) ?: 'F j, Y';
$wp_date_format = get_option( 'date_format' ) ?: JOB_MANAGER_DATE_FORMAT_FALLBACK;

// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- No changes based on input.
$revision_title = isset( $_GET['revision'] ) ? wp_post_revision_title( (int) $_GET['revision'], false ) : false;
Expand Down
2 changes: 1 addition & 1 deletion includes/admin/class-wp-job-manager-writepanels.php
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ public function job_listing_data( $post ) {
global $post, $thepostid, $wp_post_types;

$thepostid = $post->ID;
$wp_date_format = get_option( 'date_format' ) ?: 'F j, Y';
$wp_date_format = get_option( 'date_format' ) ?: JOB_MANAGER_DATE_FORMAT_FALLBACK;
echo '<div class="wp_job_manager_meta_data">';

wp_nonce_field( 'save_meta_data', 'job_manager_nonce' );
Expand Down
2 changes: 1 addition & 1 deletion includes/class-wp-job-manager-email-notifications.php
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ private static function get_job_detail_fields( WP_Post $job, $sent_to_admin, $pl
}

$job_expires = WP_Job_Manager_Post_Types::instance()->get_job_expiration( $job );
$wp_date_format = get_option( 'date_format' ) ?: 'F j, Y';
$wp_date_format = get_option( 'date_format' ) ?: JOB_MANAGER_DATE_FORMAT_FALLBACK;
if ( ! empty( $job_expires ) ) {
$job_expires_str = wp_date( $wp_date_format, $job_expires->getTimestamp() );
$fields['job_expires'] = [
Expand Down
4 changes: 2 additions & 2 deletions wp-job-manager-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@ function wpjm_get_registration_fields() {
*/
function the_job_publish_date( $post = null ) {
$date_format = get_option( 'job_manager_date_format' );
$wp_date_format = get_option( 'date_format' ) ?: 'F j, Y';
$wp_date_format = get_option( 'date_format' ) ?: JOB_MANAGER_DATE_FORMAT_FALLBACK;

if ( 'default' === $date_format ) {
$display_date = esc_html__( 'Posted on ', 'wp-job-manager' ) . wp_date( $wp_date_format, get_post_timestamp( $post ) );
Expand Down Expand Up @@ -788,7 +788,7 @@ function the_job_publish_date( $post = null ) {
*/
function get_the_job_publish_date( $post = null ) {
$date_format = get_option( 'job_manager_date_format' );
$wp_date_format = get_option( 'date_format' ) ?: 'F j, Y';
$wp_date_format = get_option( 'date_format' ) ?: JOB_MANAGER_DATE_FORMAT_FALLBACK;

if ( 'default' === $date_format ) {
return wp_date( $wp_date_format, get_post_datetime()->getTimestamp() );
Expand Down
1 change: 1 addition & 0 deletions wp-job-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
define( 'JOB_MANAGER_PLUGIN_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
define( 'JOB_MANAGER_PLUGIN_URL', untrailingslashit( plugins_url( basename( plugin_dir_path( __FILE__ ) ), basename( __FILE__ ) ) ) );
define( 'JOB_MANAGER_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
define( 'JOB_MANAGER_DATE_FORMAT_FALLBACK', 'F j, Y' );

require_once dirname( __FILE__ ) . '/wp-job-manager-autoload.php';
WP_Job_Manager_Autoload::init();
Expand Down

0 comments on commit 5b318b1

Please sign in to comment.