layers_backup_builder_pages

The Layers layers backup builder pages function.

Description

layers_backup_builder_pages(); 

Usage

  1. if ( !function_exists( 'layers_backup_builder_pages' ) ) { 
  2. require_once '/core/helpers/post.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = layers_backup_builder_pages(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/core/helpers/post.php  
  1. function layers_backup_builder_pages() { 
  2.  
  3. if( !check_ajax_referer( 'layers-backup-pages', 'layers_backup_pages_nonce', false ) ) die( 'You threw a Nonce exception' ); // Nonce 
  4.  
  5. if( !isset( $_POST[ 'pageid' ] ) ) wp_die( __( 'You shall not pass' , 'layerswp' ) ); 
  6.  
  7. // Get the post data 
  8. $page_id = $_POST[ 'pageid' ]; 
  9. $page = get_post( $page_id ); 
  10.  
  11. // Start the output buffer 
  12. ob_start(); 
  13. dynamic_sidebar( 'obox-layers-builder-' . $page->ID ); 
  14.  
  15. $page_content = trim( ob_get_clean() ); 
  16. $page_content = preg_replace('#<script(.*?)>(.*?)</script>#is', '', $page_content); 
  17. $page_content = strip_tags( $page_content , '<p><b><i><strong><em><quote><a><h1><h2><h3><h4><h5><img><script>' ); 
  18. $page_content = $page_content; 
  19.  
  20. $page_meta_key = 'layers_page_content_' . date( 'YmdHi' ); 
  21.  
  22. update_post_meta( $page_id , $page_meta_key, $page_content ); 
  23.  
  24. // Flush the output buffer 
  25. ob_flush();