public static function showActivationMessages()
 {
     $requirements_met = PdfLightViewer_Plugin::requirements(true);
     $plugin_title = PdfLightViewer_Plugin::getData('Title');
     if ($requirements_met) {
         self::showMessage($plugin_title . ': ' . __('requirements are met, happy using!', PDF_LIGHT_VIEWER_PLUGIN));
     } else {
         self::showMessage($plugin_title . ': ' . sprintf(__('requirements not met, please check <a href="%s">plugin settings page</a> for more information.', PDF_LIGHT_VIEWER_PLUGIN), PdfLightViewer_Plugin::getSettingsUrl()), true);
     }
 }
 public static function save_post($post_id)
 {
     if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE || !$_POST) {
         return;
     }
     if (current_user_can('edit_posts')) {
         $form_data = $_REQUEST;
         $pdf_file_id = isset($form_data['pdf_file_id']) ? $form_data['pdf_file_id'] : PdfLightViewer_Model::getPDFFileId($post_id);
         $pdf_file_path = get_attached_file($pdf_file_id);
         if ((isset($form_data['enable_pdf_import']) && $form_data['enable_pdf_import'] == 'on' || isset($form_data['enable_pdf_import']) && (isset($form_data['enable_pdf_import']['cmb-field-0']) || $form_data['enable_pdf_import']['cmb-field-0'])) && $pdf_file_id) {
             do_action(PDF_LIGHT_VIEWER_PLUGIN . ':before_import_scheduled', $pdf_file_path);
             $jpeg_compression_quality = isset($form_data['jpeg_compression_quality']) ? $form_data['jpeg_compression_quality'] : get_post_meta($post_id, 'jpeg_compression_quality', true);
             $jpeg_resolution = isset($form_data['jpeg_resolution']) ? $form_data['jpeg_resolution'] : get_post_meta($post_id, 'jpeg_resolution', true);
             $pdf_upload_dir = PdfLightViewer_Plugin::createUploadDirectory($post_id);
             // delete all files
             self::delete_pages_by_pdf_id($post_id, $pdf_upload_dir);
             if (class_exists('Imagick')) {
                 $im = new Imagick();
                 $im->readImage($pdf_file_path);
                 $pages_number = $im->getNumberImages();
                 foreach ($im as $_img) {
                     $geometry = $_img->getImageGeometry();
                     $width = $geometry['width'];
                     $height = $geometry['height'];
                     break;
                 }
                 $im->destroy();
                 update_post_meta($post_id, '_pdf-light-viewer-import-status', static::STATUS_SCHEDULED);
                 update_post_meta($post_id, '_pdf-light-viewer-import-progress', 0);
                 update_post_meta($post_id, '_pdf-light-viewer-import-current-page', 1);
                 update_post_meta($post_id, 'pdf-pages-number', $pages_number);
                 update_post_meta($post_id, 'pdf-page-width', $width);
                 update_post_meta($post_id, 'pdf-page-height', $height);
                 PdfLightViewer_AdminController::showMessage(sprintf(__('PDF import scheduled.', PDF_LIGHT_VIEWER_PLUGIN), PdfLightViewer_Plugin::getSettingsUrl()), false);
             } else {
                 PdfLightViewer_AdminController::showMessage(sprintf(__('Imagick not found, please check other requirements on <a href="%s">plugin settings page</a> for more information.', PDF_LIGHT_VIEWER_PLUGIN), PdfLightViewer_Plugin::getSettingsUrl()), true);
             }
         }
     }
     unset($_REQUEST['enable_pdf_import']);
     unset($_POST['enable_pdf_import']);
 }