PublishProcessing.php 811 B

123456789101112131415161718192021222324252627
  1. <?php if ( ! defined( 'ABSPATH' ) ) exit;
  2. require_once Ninja_Forms::$dir . 'includes/Libraries/BackgroundProcessing/wp-background-processing.php';
  3. final class NF_Database_PublishProcessing extends WP_Background_Process
  4. {
  5. protected $action = 'ninja-forms-publish';
  6. protected function task( $item )
  7. {
  8. if( ! isset( $item[ 'id' ] ) ) return false;
  9. if( ! isset( $item[ 'type' ] ) ) return false;
  10. if( ! isset( $item[ 'settings' ] ) ) return false;
  11. switch ( $item[ 'type' ] ){
  12. case 'field':
  13. $object = Ninja_Forms()->form()->get_field( $item[ 'id' ] );
  14. break;
  15. default:
  16. return false;
  17. }
  18. $object->update_settings( $item[ 'settings' ] )->save();
  19. return false;
  20. }
  21. }