Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions .psalm/psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="5.13.1@086b94371304750d1c673315321a55d15fc59015">
<file src="includes/3rd-party/all-in-one-seo-pack.php">
<ParadoxicalCondition>
<code><![CDATA[! defined( 'ABSPATH' )]]></code>
</ParadoxicalCondition>
</file>
<file src="includes/3rd-party/wp-all-import.php">
<ParadoxicalCondition>
<code><![CDATA[! defined( 'ABSPATH' )]]></code>
</ParadoxicalCondition>
</file>
<file src="includes/3rd-party/wpcom.php">
<InvalidReturnStatement>
<code>$result</code>
Expand All @@ -11,6 +21,11 @@
<code>false|void</code>
</InvalidReturnType>
</file>
<file src="includes/3rd-party/wpml.php">
<ParadoxicalCondition>
<code><![CDATA[! defined( 'ABSPATH' )]]></code>
</ParadoxicalCondition>
</file>
<file src="includes/3rd-party/yoast.php">
<InvalidReturnStatement>
<code>$url</code>
Expand Down Expand Up @@ -260,12 +275,6 @@
<code><![CDATA[$term->term_id]]></code>
</UndefinedPropertyFetch>
</file>
<file src="includes/class-wp-job-manager-usage-tracking-data.php">
<InvalidArgument>
<code>\WP_Job_Manager_Post_Types::TAX_LISTING_CATEGORY</code>
<code>\WP_Job_Manager_Post_Types::TAX_LISTING_TYPE</code>
</InvalidArgument>
</file>
<file src="includes/class-wp-job-manager-usage-tracking.php">
<TypeDoesNotContainType>
<code>false</code>
Expand Down
2 changes: 1 addition & 1 deletion assets/lib/jquery-chosen/chosen.css
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ This file is generated by `grunt build`, do not edit it by hand.
.chosen-container-multi .chosen-choices .search-choice .search-choice-close,
.chosen-container .chosen-results-scroll-down span,
.chosen-container .chosen-results-scroll-up span {
background-image: url('./images/chosen-sprite@2x.png') !important;
background-image: url('./images/chosen-sprite-2x.png') !important;
background-size: 52px 37px !important;
background-repeat: no-repeat !important;
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions assets/lib/jquery-ui/jquery-ui.min.css

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions includes/3rd-party/3rd-party.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
* @package wp-job-manager
*/

if ( ! defined( 'ABSPATH' ) ) {
exit;
}

// Require files for each 3rd-party plugin.
require_once JOB_MANAGER_PLUGIN_DIR . '/includes/3rd-party/jetpack.php';
require_once JOB_MANAGER_PLUGIN_DIR . '/includes/3rd-party/wpml.php';
Expand Down
4 changes: 4 additions & 0 deletions includes/3rd-party/all-in-one-seo-pack.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
* @package wp-job-manager
*/

if ( ! defined( 'ABSPATH' ) ) {
exit;
}

/**
* Skip filled job listings.
*
Expand Down
4 changes: 4 additions & 0 deletions includes/3rd-party/jetpack.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
* @package wp-job-manager
*/

if ( ! defined( 'ABSPATH' ) ) {
exit;
}

/**
* Skip filled job listings.
*
Expand Down
4 changes: 4 additions & 0 deletions includes/3rd-party/polylang.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
* @package wp-job-manager
*/

if ( ! defined( 'ABSPATH' ) ) {
exit;
}

/**
* Load routines only if Polylang is loaded.
*
Expand Down
4 changes: 4 additions & 0 deletions includes/3rd-party/rp4wp.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
* @package wp-job-manager
*/

if ( ! defined( 'ABSPATH' ) ) {
exit;
}

add_filter( 'rp4wp_get_template', 'wpjm_rp4wp_template', 10, 3 );
add_filter( 'rp4wp_related_meta_fields', 'wpjm_rp4wp_related_meta_fields', 10, 3 );
add_filter( 'rp4wp_related_meta_fields_weight', 'wpjm_rp4wp_related_meta_fields_weight', 10, 3 );
Expand Down
4 changes: 4 additions & 0 deletions includes/3rd-party/wp-all-import.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
* @package wp-job-manager
*/

if ( ! defined( 'ABSPATH' ) ) {
exit;
}

add_action( 'pmxi_saved_post', 'wpjm_pmxi_saved_post', 10, 1 );

/**
Expand Down
4 changes: 4 additions & 0 deletions includes/3rd-party/wpcom.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
* @package wp-job-manager
*/

if ( ! defined( 'ABSPATH' ) ) {
exit;
}

/**
* Configure license configuration for WP Job Manager when purchased from WP.com Marketplace.
*
Expand Down
4 changes: 4 additions & 0 deletions includes/3rd-party/wpml.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
* @package wp-job-manager
*/

if ( ! defined( 'ABSPATH' ) ) {
exit;
}

/**
* Load routines only if WPML is loaded.
*
Expand Down
4 changes: 4 additions & 0 deletions includes/3rd-party/yoast.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
* @package wp-job-manager
*/

if ( ! defined( 'ABSPATH' ) ) {
exit;
}

/**
* Skip filled job listings.
*
Expand Down
8 changes: 6 additions & 2 deletions includes/class-job-dashboard-shortcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ public static function the_expiration_date( $job ) {
if ( 'publish' === $job->post_status && ! empty( $expiration ) ) {

// translators: Placeholder is the expiration date of the job listing.
echo '<div class="job-expires"><small>' . UI_Elements::rel_time( $expiration, __( 'Expires in %s', 'wp-job-manager' ) ) . '</small></div>';
echo '<div class="job-expires"><small>' . UI_Elements::rel_time( $expiration, __( 'Expires in %s', 'wp-job-manager' ) ) . '</small></div>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Rendered by UI_Elements::rel_time(), which escapes its own input.
}
}

Expand Down Expand Up @@ -576,7 +576,10 @@ public static function the_location( $job ) {

?>
<div class="jm-ui-row">
<?php echo UI_Elements::icon( 'location' ); ?>
<?php
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Rendered by UI_Elements::icon(), which sanitizes its own input.
echo UI_Elements::icon( 'location' );
?>
<?php echo esc_html( $location ); ?>
</div>
<?php
Expand Down Expand Up @@ -620,6 +623,7 @@ public static function the_primary_action( $job, $actions ) {
return;
}

// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Rendered by UI_Elements::button(), which escapes its own input.
echo UI_Elements::button(
[
'label' => $action['label'],
Expand Down
4 changes: 4 additions & 0 deletions includes/class-stats-dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@

namespace WP_Job_Manager;

if ( ! defined( 'ABSPATH' ) ) {
exit;
}

/**
* Job listing stats for the jobs dashboard.
*
Expand Down
6 changes: 1 addition & 5 deletions includes/class-wp-job-manager-post-types.php
Original file line number Diff line number Diff line change
Expand Up @@ -1563,11 +1563,7 @@ public function noindex_expired_filled_job_listings() {
return;
}

if ( function_exists( 'wp_robots_no_robots' ) ) {
add_filter( 'wp_robots', 'wp_robots_no_robots' );
} else {
wp_no_robots();
}
add_filter( 'wp_robots', 'wp_robots_no_robots' );
}

/**
Expand Down
14 changes: 12 additions & 2 deletions includes/class-wp-job-manager-usage-tracking-data.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,24 @@ public static function get_usage_data() {
$count_posts = wp_count_posts( \WP_Job_Manager_Post_Types::PT_LISTING );

if ( taxonomy_exists( \WP_Job_Manager_Post_Types::TAX_LISTING_CATEGORY ) ) {
$categories = wp_count_terms( \WP_Job_Manager_Post_Types::TAX_LISTING_CATEGORY, [ 'hide_empty' => false ] );
$categories = wp_count_terms(
[
'taxonomy' => \WP_Job_Manager_Post_Types::TAX_LISTING_CATEGORY,
'hide_empty' => false,
]
);
}

$usage_data = [
'employers' => self::get_employer_count(),
'job_categories' => $categories,
'job_categories_desc' => self::get_job_category_has_description_count(),
'job_types' => wp_count_terms( \WP_Job_Manager_Post_Types::TAX_LISTING_TYPE, [ 'hide_empty' => false ] ),
'job_types' => wp_count_terms(
[
'taxonomy' => \WP_Job_Manager_Post_Types::TAX_LISTING_TYPE,
'hide_empty' => false,
]
),
'job_types_desc' => self::get_job_type_has_description_count(),
'job_types_emp_type' => self::get_job_type_has_employment_type_count(),
'jobs_type' => self::get_job_type_count(),
Expand Down
22 changes: 15 additions & 7 deletions includes/class-wp-job-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public function __construct() {
add_action( 'after_switch_theme', 'flush_rewrite_rules', 15 );

// Actions.
add_action( 'after_setup_theme', [ $this, 'load_plugin_textdomain' ] );
add_action( 'init', [ $this, 'load_legacy_textdomain' ] );
add_action( 'after_setup_theme', [ $this, 'include_template_functions' ], 11 );
add_action( 'widgets_init', [ $this, 'widgets_init' ] );
add_action( 'wp_loaded', [ $this, 'register_shared_assets' ] );
Expand Down Expand Up @@ -208,11 +208,20 @@ public function add_privacy_policy_content() {
}

/**
* Loads textdomain for plugin.
* Loads translations from the legacy `WP_LANG_DIR/wp-job-manager/` path.
*
* WordPress auto-loads translations from `WP_LANG_DIR/plugins/` for
* .org-distributed plugins, so a general `load_plugin_textdomain()` call
* isn't needed. This keeps the old custom path working for sites that
* already place `.mo` files there.
*/
public function load_plugin_textdomain() {
load_textdomain( 'wp-job-manager', WP_LANG_DIR . '/wp-job-manager/wp-job-manager-' . apply_filters( 'plugin_locale', get_locale(), 'wp-job-manager' ) . '.mo' );
load_plugin_textdomain( 'wp-job-manager', false, JOB_MANAGER_PLUGIN_DIR . '/languages/' );
public function load_legacy_textdomain() {
$locale = apply_filters( 'plugin_locale', determine_locale(), 'wp-job-manager' );
$mofile = WP_LANG_DIR . '/wp-job-manager/wp-job-manager-' . $locale . '.mo';

if ( is_readable( $mofile ) ) {
load_textdomain( 'wp-job-manager', $mofile );
}
}

/**
Expand Down Expand Up @@ -312,8 +321,7 @@ public function register_shared_assets() {
global $wp_scripts;

$jquery_version = isset( $wp_scripts->registered['jquery-ui-core']->ver ) ? $wp_scripts->registered['jquery-ui-core']->ver : '1.9.2';
$jquery_version = preg_replace( '/-wp/', '', $jquery_version );
wp_register_style( 'jquery-ui', '//code.jquery.com/ui/' . $jquery_version . '/themes/smoothness/jquery-ui.min.css', [], $jquery_version );
wp_register_style( 'jquery-ui', JOB_MANAGER_PLUGIN_URL . '/assets/lib/jquery-ui/jquery-ui.min.css', [], $jquery_version );

// Register datepicker JS. It will be enqueued if needed when a date field is used.
self::register_script( 'wp-job-manager-datepicker', 'js/datepicker.js', [ 'jquery', 'jquery-ui-datepicker' ], true );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
* @package wp-job-manager
*/

if ( ! defined( 'ABSPATH' ) ) {
exit;
}

/**
* Handles functionality related to the Promoted Jobs REST API.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
* @package wp-job-manager
*/

if ( ! defined( 'ABSPATH' ) ) {
exit;
}

/**
* Handles functionality related to the Promoted Jobs Status Update.
*
Expand Down
24 changes: 11 additions & 13 deletions includes/ui/class-modal-dialog.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,19 +83,17 @@ public function render( $content ) {
$style = esc_attr( $this->options['style'] ?? '' );
$content = str_replace( '{close}', $id . '.close(); event.preventDefault();', $content );

return <<<HTML
<dialog class="jm-dialog" id="{$id}">
<div class="jm-dialog-open">
<div class="jm-dialog-backdrop" onclick="{$id}.close()"></div>
<div class="jm-dialog-modal {$class}" style="{$style}">
<div class="jm-dialog-modal-container">
<div class="jm-dialog-modal-content">{$content}</div>
<a href="#" role="button" class="jm-ui-button--icon jm-dialog-close" onclick="{$id}.close(); event.preventDefault();" aria-label="{$close_label}"><span class="jm-ui-button__icon"></span></a>
</div>
</div>
</div>
</dialog>
HTML;
return '<dialog class="jm-dialog" id="' . $id . '">'
. '<div class="jm-dialog-open">'
. '<div class="jm-dialog-backdrop" onclick="' . $id . '.close()"></div>'
. '<div class="jm-dialog-modal ' . $class . '" style="' . $style . '">'
. '<div class="jm-dialog-modal-container">'
. '<div class="jm-dialog-modal-content">' . $content . '</div>'
. '<a href="#" role="button" class="jm-ui-button--icon jm-dialog-close" onclick="' . $id . '.close(); event.preventDefault();" aria-label="' . $close_label . '"><span class="jm-ui-button__icon"></span></a>'
. '</div>'
. '</div>'
. '</div>'
. '</dialog>';

}

Expand Down
13 changes: 5 additions & 8 deletions includes/ui/class-redirect-message.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,11 @@ private static function get_transient_message( $key, $delete = true ) {
*/
private static function add_inline_script( $query_var ) {
$query_var = esc_js( $query_var );
return <<<HTML
<script>
const url = new URL( location.href );
url.searchParams.delete('{$query_var}');
history.replaceState(null, '', url)

</script>
HTML;
return '<script>'
. 'const url = new URL( location.href );'
. "url.searchParams.delete('" . $query_var . "');"
. "history.replaceState(null, '', url)"
. '</script>';
}

}
20 changes: 9 additions & 11 deletions includes/ui/class-ui-elements.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,17 +158,15 @@ public static function actions_menu( $content ) {

$close = esc_attr( 'event.currentTarget.contains(event.relatedTarget) || setTimeout(() => this.open = false, 100 )' );

return <<<HTML
<details class="jm-ui-actions-menu" onfocusout="{$close}">
<summary tabindex="0" class="jm-ui-action-menu__open-button jm-ui-button--icon"
aria-label="{$label}">
<span class="jm-ui-button__icon"></span>
</summary>
<div class="jm-ui-action-menu__content">
{$content}
</div>
</details>
HTML;
return '<details class="jm-ui-actions-menu" onfocusout="' . $close . '">'
. '<summary tabindex="0" class="jm-ui-action-menu__open-button jm-ui-button--icon"'
. ' aria-label="' . $label . '">'
. '<span class="jm-ui-button__icon"></span>'
. '</summary>'
. '<div class="jm-ui-action-menu__content">'
. $content
. '</div>'
. '</details>';

}

Expand Down
Loading
Loading