Skip to content

Commit

Permalink
Merge changes with dev-hiresuit
Browse files Browse the repository at this point in the history
  • Loading branch information
nithinjohn22 committed Jan 6, 2025
2 parents 0b31fca + 65cbf00 commit e7548e7
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 72 deletions.
2 changes: 1 addition & 1 deletion admin/class-awsm-job-openings-meta.php
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ public function application_delete_action( $application_id ) {
public function awsm_job_application_row_actions_label( $actions, $post ) {
if ( $post->post_type === 'awsm_job_application' ) {
if ( isset( $actions['edit'] ) ) {
$actions['edit'] = str_replace( __( 'Edit' ), __( 'View' ), $actions['edit'] );
$actions['edit'] = str_replace( __( 'Edit', 'wp-job-openings' ), __( 'View', 'wp-job-openings' ), $actions['edit'] );
}
}
return $actions;
Expand Down
4 changes: 3 additions & 1 deletion admin/class-awsm-job-openings-overview.php
Original file line number Diff line number Diff line change
Expand Up @@ -265,10 +265,11 @@ public static function get_jobs_by_author( $numberjobs = 7 ) {

public static function get_applications_analytics_data( $date_query = array(), $key_format = 'n', $label_format = 'M' ) {
$analytics_data = array();
error_log( 'User can edit applications: ' . ( current_user_can( 'edit_applications' ) ? 'yes' : 'no' ) );
if ( ! current_user_can( 'edit_applications' ) ) {
return $analytics_data;
}
$analytics_option = get_option( 'awsm_jobs_analytics_data' );

if ( empty( $date_query ) ) {
$date_query = array(
array(
Expand Down Expand Up @@ -301,4 +302,5 @@ public static function get_applications_analytics_data( $date_query = array(), $
return $analytics_data;
}


}
87 changes: 23 additions & 64 deletions admin/templates/meta/resume-preview.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,77 +10,36 @@
do_action( 'awsm_resume_preview_mb_init', $post->ID );
?>
<div class="awsm-resume-preview">
<?php
<?php
$awsm_attachment_id = get_post_meta( $post->ID, 'awsm_attachment_id', true );
$attachment_url = wp_get_attachment_url( intval( $awsm_attachment_id ) );
if ( $attachment_url ) :
$file_extension = strtolower( pathinfo( $attachment_url, PATHINFO_EXTENSION ) );

// Supported office formats
$supported_office_formats = array(
'doc',
'docx', // Word documents
'ppt',
'pptx', // PowerPoint presentations
'xls',
'xlsx', // Excel spreadsheets
);

// Formats supported by Google Docs Viewer
$google_docs_formats = array(
'csv', // CSV files
'odt',
'ods',
'odp', // OpenDocument formats
);

// Supported image formats
$supported_image_formats = array(
'jpg',
'jpeg',
'png',
'gif',
'bmp',
'webp', // Common image formats
);

?>
if ( $attachment_url ) :
$file_extension = strtolower( pathinfo( $attachment_url, PATHINFO_EXTENSION ) );
?>
<div class="awsm-document-preview">
<?php if ( $file_extension === 'pdf' ) : ?>
<iframe
src="<?php echo esc_url( $attachment_url ); ?>"
style="width: 100%; height: 400px; border: none;"
frameborder="0">
</iframe>
<?php elseif ( in_array( $file_extension, $supported_office_formats ) ) : ?>
<iframe
src="<?php echo esc_url( 'https://view.officeapps.live.com/op/embed.aspx?src=' . urlencode( $attachment_url ) ); ?>"
style="width: 100%; height: 400px; border: none;"
frameborder="0">
</iframe>
<?php elseif ( in_array( $file_extension, $google_docs_formats ) ) : ?>
<iframe
src="https://docs.google.com/viewer?embedded=true&url=<?php echo urlencode( $attachment_url ); ?>"
style="width: 100%; height: 400px; border: none;"
frameborder="0">
</iframe>
<?php elseif ( in_array( $file_extension, $supported_image_formats ) ) : ?>
<img
src="<?php echo esc_url( $attachment_url ); ?>"
style="width: 100%; height: auto; border: none;"
alt="<?php echo esc_attr( basename( $attachment_url ) ); ?>">
<?php else : ?>
<div class="awsm-preview-unsupported">
<h2><strong><?php esc_html_e( 'This file type cannot be previewed. Please download the file to view it.', 'wp-job-openings' ); ?></strong></h2>
</div>
<?php endif; ?>
<?php if ( $file_extension === 'pdf' ) : ?>
<iframe
src="<?php echo esc_url( $attachment_url ); ?>"
style="width: 100%; height: 400px; border: none;"
frameborder="0">
</iframe>
<?php elseif ( in_array( $file_extension, array( 'doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx' ) ) ) : ?>
<iframe
src="<?php echo esc_url( 'https://view.officeapps.live.com/op/embed.aspx?src=' . urlencode( $attachment_url ) ); ?>"
style="width: 100%; height: 400px; border: none;"
frameborder="0">
</iframe>
<?php else : ?>
<div class="awsm-preview-unsupported">
<h2><strong><?php esc_html_e( 'This file type cannot be previewed. Please download the file to view it.', 'docs-viewer-add-on-for-wp-job-openings' ); ?></strong></h2>
</div>
<?php endif; ?>
</div>
<?php else : ?>
<div class="awsm-resume-none">
<h2><strong><?php esc_html_e( 'No resume to preview. File not found!', 'wp-job-openings' ); ?></strong></h2>
<h2><strong><?php esc_html_e( 'No resume to preview. File not found!', 'docs-viewer-add-on-for-wp-job-openings' ); ?></strong></h2>
</div>
<?php
endif;
endif;
?>

</div>
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<?php



$analytics_data = AWSM_Job_Openings_Overview::get_applications_analytics_data();

if ( ! empty( $analytics_data ) ) :
Expand Down
2 changes: 1 addition & 1 deletion assets/css/admin.min.css.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions assets/css/admin/admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -2383,3 +2383,4 @@ textarea.awsm-form-control {
line-height: 1;
align-items: center;
}

2 changes: 1 addition & 1 deletion assets/js/admin-overview.min.js.map

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion assets/js/admin-overview/overview.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jQuery(document).ready(function($) {

// Applications analytics chart
var ctx = $('#awsm-jobs-overview-applications-analytics-chart');
ctx[0].height = 250;
ctx[0].height = 250;
var data = {
labels: awsmJobsAdminOverview.analytics_data.labels,
datasets: [ {
Expand Down Expand Up @@ -167,4 +167,5 @@ jQuery(document).ready(function($) {
awsmJobsOverview.renderAnalyticsChart(true);
});
}

});
2 changes: 1 addition & 1 deletion assets/js/admin.min.js.map

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion assets/js/admin/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -540,5 +540,6 @@ jQuery(document).ready(function($) {
$(target).addClass('active');
});




});
6 changes: 5 additions & 1 deletion wp-job-openings.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,11 @@ public function pro_version_admin_notice() {
<div class="notice notice-error">
<p>
<?php
echo esc_html__( 'The Pro version of the plugin is outdated. Please update it to version 4.0 or higher to work with the Free version.', 'awsm-job-openings' );
$req_plugin = sprintf( '<strong>%s</strong>', esc_html__( 'WP Job Openings', 'wp-job-openings' ) );
$plugin = sprintf( '<strong>%s</strong>', esc_html__( 'Pro Pack', 'wp-job-openings' ) );

/* translators: %1$s: main plugin, %2$s: current plugin, %3$s: minimum required version of the main plugin, %4$s: plugin update link */
printf( esc_html__( 'Update required: The %2$s of the plugin must be updated to version 4.0 or higher to function with the Free version of %1$s.', 'wp-job-openings' ), $req_plugin, $plugin ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
?>
</p>
</div>
Expand Down

0 comments on commit e7548e7

Please sign in to comment.