コード例 #1
0
 public static function ajax_deploy()
 {
     /* check nonce and permission */
     if (!wp_verify_nonce($_POST['nonce'], 'fppdfe_nonce') || !current_user_can('frm_edit_forms')) {
         print json_encode(array('error' => 'Access denied. Failed to initialise fonts.'));
     }
     $results = FPPDF_InstallUpdater::pdf_extended_activate();
     /*
      * Capture the notices generated if there is an error and display it to the user
      */
     if ($results !== true) {
         ob_start();
         do_action('fppdfe_notices');
         $message = ob_get_contents();
         ob_end_clean();
         print json_encode(array('error' => $message));
     } else {
         print json_encode(array('message' => self::pdf_deploy_success()));
     }
     exit;
 }