Skip to content

Commit

Permalink
Allow iframe in job description content
Browse files Browse the repository at this point in the history
Allows for YouTube embeds
  • Loading branch information
jom committed Apr 24, 2019
1 parent 1cb112a commit fb8d890
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 2 deletions.
48 changes: 47 additions & 1 deletion includes/class-wp-job-manager-post-types.php
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,52 @@ public function admin_head() {
}
}

/**
* Filter the post content of job listings.
*
* @since 1.33.0
* @param string $post_content Post content to filter.
*/
public static function output_kses_post( $post_content ) {
echo wp_kses( $post_content, self::kses_allowed_html() );
}

/**
* Returns the expanded set of tags allowed in job listing content.
*
* @since 1.33.0
* @return string
*/
private static function kses_allowed_html() {
/**
* Change the allowed tags in job listing content.
*
* @since 1.33.0
*
* @param array $allowed_html Tags allowed in job listing posts.
*/
return apply_filters(
'job_manager_kses_allowed_html',
array_replace_recursive( // phpcs:ignore PHPCompatibility.FunctionUse.NewFunctions.array_replace_recursiveFound
wp_kses_allowed_html( 'post' ),
array(
'iframe' => array(
'src' => true,
'width' => true,
'height' => true,
'frameborder' => true,
'marginwidth' => true,
'marginheight' => true,
'scrolling' => true,
'title' => true,
'allow' => true,
'allowfullscreen' => true,
),
)
)
);
}

/**
* Sanitize job type meta box input data from WP admin.
*
Expand Down Expand Up @@ -824,7 +870,7 @@ public static function get_permalink_structure() {
update_option( self::PERMALINK_OPTION_NAME, wp_json_encode( $permalink_settings ) );
}

$permalinks = wp_parse_args(
$permalinks = wp_parse_args(
$permalink_settings,
array(
'job_base' => '',
Expand Down
2 changes: 1 addition & 1 deletion wp-job-manager-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ function wpjm_get_the_job_title( $post = null ) {
function wpjm_the_job_description( $post = null ) {
$job_description = wpjm_get_the_job_description( $post );
if ( $job_description ) {
echo wp_kses_post( $job_description );
WP_Job_Manager_Post_Types::output_kses_post( $job_description );
}
}

Expand Down

0 comments on commit fb8d890

Please sign in to comment.