Skip to content

Commit

Permalink
IMPROVE: Code formatting based on phpcs
Browse files Browse the repository at this point in the history
  • Loading branch information
nithinjohn22 authored and github-actions[bot] committed Mar 20, 2024
1 parent d017c4c commit bc4eadd
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 113 deletions.
94 changes: 47 additions & 47 deletions admin/class-awsm-job-openings-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -425,14 +425,14 @@ private function settings() {

public static function get_default_settings( $option_name = '' ) {
$options = array(
'awsm_permalink_slug' => 'jobs',
'awsm_default_msg' => esc_html__( 'We currently have no job openings', 'wp-job-openings' ),
'awsm_jobs_listing_view' => 'list-view',
'awsm_jobs_list_per_page' => 10,
'awsm_jobs_number_of_columns' => 3,
'awsm_current_appearance_subtab' => 'awsm-job-listing-nav-subtab',
'awsm_jobs_details_page_layout' => 'single',
'awsm_jobs_filter' => array(
'awsm_permalink_slug' => 'jobs',
'awsm_default_msg' => esc_html__( 'We currently have no job openings', 'wp-job-openings' ),
'awsm_jobs_listing_view' => 'list-view',
'awsm_jobs_list_per_page' => 10,
'awsm_jobs_number_of_columns' => 3,
'awsm_current_appearance_subtab' => 'awsm-job-listing-nav-subtab',
'awsm_jobs_details_page_layout' => 'single',
'awsm_jobs_filter' => array(
array(
'taxonomy' => 'job-category',
'filter' => esc_html__( 'Job Category', 'wp-job-openings' ),
Expand All @@ -447,21 +447,21 @@ public static function get_default_settings( $option_name = '' ) {
'filter' => esc_html__( 'Job Location', 'wp-job-openings' ),
),
),
'awsm_enable_job_filter_listing' => 'enabled',
'awsm_jobs_listing_available_filters' => array( 'job-category', 'job-type', 'job-location' ),
'awsm_jobs_listing_specs' => array( 'job-category', 'job-location' ),
'awsm_jobs_admin_upload_file_ext' => array( 'pdf', 'doc', 'docx' ),
'awsm_enable_gdpr_cb' => 'true',
'awsm_gdpr_cb_text' => esc_html__( 'By using this form you agree with the storage and handling of your data by this website.', 'wp-job-openings' ),
'awsm_jobs_acknowledgement' => 'acknowledgement',
'awsm_jobs_notification_subject' => 'Thanks for submitting your application for a job at {company}',
'awsm_jobs_notification_content' => "Dear {applicant},\n\nThis is to let you know that we have received your application.We appreciate your interest in {company} and the position of {job-title} for which you applied. If you are selected for an interview, you can expect a phone call from our Human Resources staff shortly.\n\n Thank you, again, for your interest in our company. We do appreciate the time that you invested in this application.\n\nSincerely\n\nHR Manager\n{company}",
'awsm_jobs_enable_admin_notification' => 'enable',
'awsm_jobs_admin_notification_subject' => 'New application received for the position {job-title} [{job-id}]',
'awsm_jobs_admin_notification_content' => "Job Opening: {job-title} [{job-id}]\nName: {applicant}\nEmail: {applicant-email}\nPhone: {applicant-phone}\nResume: {applicant-resume}\nCover letter: {applicant-cover}\n\nPowered by WP Job Openings Plugin",
'awsm_jobs_enable_expiry_notification' => 'enable',
'awsm_jobs_author_notification_subject' => 'Job Listing Expired',
'awsm_jobs_author_notification_content' => "This email is to notify you that your job listing for [{job-title}] has just expired. As a result, applicants will no longer be able to apply for this position.\n\nIf you would like to extend the expiration date or remove the listing, please log in to the dashboard and take the necessary steps.\n\nPowered by WP Job Openings Plugin",
'awsm_enable_job_filter_listing' => 'enabled',
'awsm_jobs_listing_available_filters' => array( 'job-category', 'job-type', 'job-location' ),
'awsm_jobs_listing_specs' => array( 'job-category', 'job-location' ),
'awsm_jobs_admin_upload_file_ext' => array( 'pdf', 'doc', 'docx' ),
'awsm_enable_gdpr_cb' => 'true',
'awsm_gdpr_cb_text' => esc_html__( 'By using this form you agree with the storage and handling of your data by this website.', 'wp-job-openings' ),
'awsm_jobs_acknowledgement' => 'acknowledgement',
'awsm_jobs_notification_subject' => 'Thanks for submitting your application for a job at {company}',
'awsm_jobs_notification_content' => "Dear {applicant},\n\nThis is to let you know that we have received your application.We appreciate your interest in {company} and the position of {job-title} for which you applied. If you are selected for an interview, you can expect a phone call from our Human Resources staff shortly.\n\n Thank you, again, for your interest in our company. We do appreciate the time that you invested in this application.\n\nSincerely\n\nHR Manager\n{company}",
'awsm_jobs_enable_admin_notification' => 'enable',
'awsm_jobs_admin_notification_subject' => 'New application received for the position {job-title} [{job-id}]',
'awsm_jobs_admin_notification_content' => "Job Opening: {job-title} [{job-id}]\nName: {applicant}\nEmail: {applicant-email}\nPhone: {applicant-phone}\nResume: {applicant-resume}\nCover letter: {applicant-cover}\n\nPowered by WP Job Openings Plugin",
'awsm_jobs_enable_expiry_notification' => 'enable',
'awsm_jobs_author_notification_subject' => 'Job Listing Expired',
'awsm_jobs_author_notification_content' => "This email is to notify you that your job listing for [{job-title}] has just expired. As a result, applicants will no longer be able to apply for this position.\n\nIf you would like to extend the expiration date or remove the listing, please log in to the dashboard and take the necessary steps.\n\nPowered by WP Job Openings Plugin",
);
if ( ! empty( $option_name ) ) {
if ( isset( $options[ $option_name ] ) ) {
Expand Down Expand Up @@ -584,7 +584,7 @@ public function validate_from_email_id( $email ) {
if ( preg_match( '/^[0-9.]+$/', $site_domain ) ) {
return $email;
}

if ( trim( $email ) === '{default-from-email}' ) {
return $email;
}
Expand All @@ -608,9 +608,9 @@ public function validate_from_email_id( $email ) {

public function sanitize_from_email_id( $email ) {
if ( empty( $email ) ) {
$email = $this->awsm_from_email(true);
$email = $this->awsm_from_email( true );
}
return sanitize_text_field($email);
return sanitize_text_field( $email );
}

public function sanitize_list_per_page( $input ) {
Expand Down Expand Up @@ -985,7 +985,7 @@ public function display_settings_fields( $settings_fields, $container = 'table',
'span' => array(),
'strong' => array(),
'small' => array(),
'p'=> array('class'=> true),
'p' => array( 'class' => true ),
);
foreach ( $settings_fields as $field_details ) {
if ( isset( $field_details['visible'] ) && $field_details['visible'] === false ) {
Expand Down Expand Up @@ -1261,23 +1261,23 @@ public function get_template_tags() {
$template_tags = apply_filters(
'awsm_job_template_tags',
array(
'{applicant}' => __( 'Applicant Name:', 'wp-job-openings' ),
'{application-id}' => __( 'Application ID:', 'wp-job-openings' ),
'{applicant-email}' => __( 'Applicant Email:', 'wp-job-openings' ),
'{applicant-phone}' => __( 'Applicant Phone:', 'wp-job-openings' ),
'{applicant-resume}' => __( 'Applicant Resume:', 'wp-job-openings' ),
'{applicant-cover}' => __( 'Cover letter:', 'wp-job-openings' ),
'{job-title}' => __( 'Job Title:', 'wp-job-openings' ),
'{job-id}' => __( 'Job ID:', 'wp-job-openings' ),
'{job-expiry}' => __( 'Job Expiry Date:', 'wp-job-openings' ),
'{site-title}' => __( 'Site Title:', 'wp-job-openings' ),
'{site-tagline}' => __( 'Site Tagline:', 'wp-job-openings' ),
'{site-url}' => __( 'Site URL:', 'wp-job-openings' ),
'{admin-email}' => __( 'Site admin email:', 'wp-job-openings' ),
'{hr-email}' => __( 'HR Email:', 'wp-job-openings' ),
'{company}' => __( 'Company Name:', 'wp-job-openings' ),
'{author-email}' => __( 'Author Email:', 'wp-job-openings' ),
'{default-from-email}' => __( 'Default from email:', 'wp-job-openings' ),
'{applicant}' => __( 'Applicant Name:', 'wp-job-openings' ),
'{application-id}' => __( 'Application ID:', 'wp-job-openings' ),
'{applicant-email}' => __( 'Applicant Email:', 'wp-job-openings' ),
'{applicant-phone}' => __( 'Applicant Phone:', 'wp-job-openings' ),
'{applicant-resume}' => __( 'Applicant Resume:', 'wp-job-openings' ),
'{applicant-cover}' => __( 'Cover letter:', 'wp-job-openings' ),
'{job-title}' => __( 'Job Title:', 'wp-job-openings' ),
'{job-id}' => __( 'Job ID:', 'wp-job-openings' ),
'{job-expiry}' => __( 'Job Expiry Date:', 'wp-job-openings' ),
'{site-title}' => __( 'Site Title:', 'wp-job-openings' ),
'{site-tagline}' => __( 'Site Tagline:', 'wp-job-openings' ),
'{site-url}' => __( 'Site URL:', 'wp-job-openings' ),
'{admin-email}' => __( 'Site admin email:', 'wp-job-openings' ),
'{hr-email}' => __( 'HR Email:', 'wp-job-openings' ),
'{company}' => __( 'Company Name:', 'wp-job-openings' ),
'{author-email}' => __( 'Author Email:', 'wp-job-openings' ),
'{default-from-email}' => __( 'Default from email:', 'wp-job-openings' ),

)
);
Expand All @@ -1296,11 +1296,11 @@ public static function awsm_from_email( $set_as_empty = false ) {
$sitename = substr( $sitename, 4 );
}
$from_email = 'noreply@' . $sitename;
if(! $set_as_empty) {
if ( ! $set_as_empty ) {
$get_default_from_email = get_option( 'awsm_jobs_notification_customizer' );

$from_email = isset( $get_default_from_email['from_email'] ) ? $get_default_from_email['from_email'] : '';

if ( $from_email ) {
return $from_email;
}
Expand Down
8 changes: 4 additions & 4 deletions admin/templates/notification.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,9 @@
<?php
$customizer_settings = AWSM_Job_Openings_Mail_Customizer::get_settings();
$validation_msg = '';
if ( $this->validate_from_email_id( $customizer_settings['from_email'] ) === false ) {
$validation_msg = $from_email_error_msg;
}
if ( $this->validate_from_email_id( $customizer_settings['from_email'] ) === false ) {
$validation_msg = $from_email_error_msg;
}
/**
* Filters the notification customizer fields.
*
Expand Down Expand Up @@ -223,7 +223,7 @@
'type' => 'email',
'label' => __( 'Default "From" Email Address: ', 'wp-job-openings' ),
'value' => $customizer_settings['from_email'],
'description' => $validation_msg ? '<p class="description awsm-jobs-invalid">'. $validation_msg.'</p>' : '',
'description' => $validation_msg ? '<p class="description awsm-jobs-invalid">' . $validation_msg . '</p>' : '',
),
array(
'id' => 'awsm_jobs_notification_customizer_base_color',
Expand Down
46 changes: 23 additions & 23 deletions inc/class-awsm-job-openings-form.php
Original file line number Diff line number Diff line change
Expand Up @@ -707,16 +707,16 @@ public static function get_expired_notification_content() {
* @return array
*/
public static function get_notification_options( $type ) {
$options = array();
$admin_email = get_option( 'admin_email' );
$hr_email = get_option( 'awsm_hr_email_address' );
$expired_options = self::get_expired_notification_content();
$options = array();
$admin_email = get_option( 'admin_email' );
$hr_email = get_option( 'awsm_hr_email_address' );
$expired_options = self::get_expired_notification_content();
$default_from_email = AWSM_Job_Openings_Settings::awsm_from_email();

if ( $type === 'applicant' ) {
$options = array(
'acknowledgement' => get_option( 'awsm_jobs_acknowledgement' ),
'from' => get_option( 'awsm_jobs_from_email_notification', '{default-from-email}' ),
'from' => get_option( 'awsm_jobs_from_email_notification', '{default-from-email}' ),
'reply_to' => get_option( 'awsm_jobs_reply_to_notification' ),
'cc' => get_option( 'awsm_jobs_hr_notification', $hr_email ),
'subject' => get_option( 'awsm_jobs_notification_subject', '' ),
Expand All @@ -726,7 +726,7 @@ public static function get_notification_options( $type ) {
} elseif ( $type === 'admin' ) {
$options = array(
'enable' => get_option( 'awsm_jobs_enable_admin_notification' ),
'from' => get_option( 'awsm_jobs_admin_from_email_notification', '{default-from-email}' ),
'from' => get_option( 'awsm_jobs_admin_from_email_notification', '{default-from-email}' ),
'reply_to' => get_option( 'awsm_jobs_admin_reply_to_notification', '{applicant-email}' ),
'to' => get_option( 'awsm_jobs_admin_to_notification', $hr_email ),
'cc' => get_option( 'awsm_jobs_admin_hr_notification' ),
Expand All @@ -737,8 +737,8 @@ public static function get_notification_options( $type ) {
} elseif ( $type === 'author' ) {
$options = array(
'enable' => get_option( 'awsm_jobs_enable_expiry_notification', $expired_options['enable'] ),
'from' => get_option( 'awsm_jobs_author_from_email_notification', '{default-from-email}' ),
'reply_to' => get_option( 'awsm_jobs_author_reply_to_notification', get_option( 'awsm_jobs_reply_to_notification') ),
'from' => get_option( 'awsm_jobs_author_from_email_notification', '{default-from-email}' ),
'reply_to' => get_option( 'awsm_jobs_author_reply_to_notification', get_option( 'awsm_jobs_reply_to_notification' ) ),
'to' => get_option( 'awsm_jobs_author_to_notification', '{author-email}' ),
'cc' => get_option( 'awsm_jobs_author_hr_notification' ),
'subject' => get_option( 'awsm_jobs_author_notification_subject', $expired_options['subject'] ),
Expand Down Expand Up @@ -788,34 +788,34 @@ protected function notification_email( $applicant_details, $data = array() ) {
}

if ( $enable ) {
$admin_email = get_option( 'admin_email' );
$hr_mail = get_option( 'awsm_hr_email_address' );
$applicant_email = $applicant_details['awsm_applicant_email'];
$company_name = get_option( 'awsm_job_company_name' );
$from = ( ! empty( $company_name ) ) ? $company_name : get_option( 'blogname' );
$author_id = get_post_field( 'post_author', $applicant_details['awsm_job_id'] );
$author_email = get_the_author_meta( 'user_email', intval( $author_id ) );
$admin_email = get_option( 'admin_email' );
$hr_mail = get_option( 'awsm_hr_email_address' );
$applicant_email = $applicant_details['awsm_applicant_email'];
$company_name = get_option( 'awsm_job_company_name' );
$from = ( ! empty( $company_name ) ) ? $company_name : get_option( 'blogname' );
$author_id = get_post_field( 'post_author', $applicant_details['awsm_job_id'] );
$author_email = get_the_author_meta( 'user_email', intval( $author_id ) );
$default_from_email = AWSM_Job_Openings_Settings::awsm_from_email();

$tags = $this->get_mail_template_tags(
$applicant_details,
array(
'admin_email' => $admin_email,
'hr_email' => $hr_mail,
'company_name' => $company_name,
'admin_email' => $admin_email,
'hr_email' => $hr_mail,
'company_name' => $company_name,
'default_from_email' => $default_from_email,
)
);
$tag_names = array_keys( $tags );
$tag_values = array_values( $tags );
$email_tag_names = array( '{admin-email}', '{hr-email}', '{applicant-email}', '{author-email}', '{default-from-email}' );
$email_tag_values = array( $admin_email, $hr_mail, $applicant_email, $author_email, $default_from_email );
$email_tag_values = array( $admin_email, $hr_mail, $applicant_email, $author_email, $default_from_email );

if ( ! empty( $options['subject'] ) && ! empty( $options['content'] ) ) {
$subject = str_replace( $tag_names, $tag_values, $options['subject'] );
$from_email = str_replace( $tag_names, $tag_values, $options['from'] );
$reply_to = str_replace( $email_tag_names, $email_tag_values, $options['reply_to'] );
$cc = str_replace( $email_tag_names, $email_tag_values, $options['cc'] );
$subject = str_replace( $tag_names, $tag_values, $options['subject'] );
$from_email = str_replace( $tag_names, $tag_values, $options['from'] );
$reply_to = str_replace( $email_tag_names, $email_tag_values, $options['reply_to'] );
$cc = str_replace( $email_tag_names, $email_tag_values, $options['cc'] );

/**
* Filters the applicant or admin notification mail headers.
Expand Down
2 changes: 1 addition & 1 deletion inc/class-awsm-job-openings-mail-customizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public static function sanitize_content( $content ) {
}

public static function get_settings() {
$default_from_email = AWSM_Job_Openings_Settings::awsm_from_email(true);
$default_from_email = AWSM_Job_Openings_Settings::awsm_from_email( true );
/**
* Filters the notification customizer default values.
*
Expand Down
Loading

0 comments on commit bc4eadd

Please sign in to comment.