/**
  * Magic __construct
  * @since 0.1.0
  */
 public function __construct()
 {
     Pootle_Page_Builder_Render_Layout::$instance = $this;
     /* Main content filter */
     add_filter('the_content', array($this, 'content_filter'));
     //Row custom styles
     require_once POOTLEPB_DIR . 'inc/class-custom-styles.php';
     /* Puts stuff in row */
     add_action('pootlepb_before_row', array($this, 'row_accordion'));
     add_action('pootlepb_before_cells', array($this, 'row_embed_css'), 10, 2);
     add_filter('pootlepb_row_cell_attributes', array($this, 'row_animation'), 10, 4);
     /* Embed styles */
     add_action('pootlepb_row_embed_style', array($this, 'row_col_gutter'), 10, 3);
     add_action('pootlepb_row_embed_style', array($this, 'row_overlay'), 10, 3);
 }
/**
 * Makes page builder content visible to WP SEO
 *
 * @param string $content Post content
 * @param object $post Post object
 *
 * @return string Post content
 * @since 0.1.0
 */
function pootlepb_text_content($content, $post = null)
{
    if (empty($post)) {
        global $post;
    }
    $post_id = empty($post->ID) ? $post->ID : false;
    if (!apply_filters('pootlepb_dump_ppb_content', (bool) $post_id, $post_id)) {
        return $content;
    }
    if ('content' == get_option('pootlepb-content-deactivation')) {
        $ppb_output = pootlepb_get_text_content($post->ID);
    } else {
        $ppb_output = Pootle_Page_Builder_Render_Layout::render($post->ID);
    }
    if ($ppb_output) {
        return $ppb_output;
    } else {
        return $content;
    }
}
 /**
  * Saves setting from front end via ajax
  * @since 1.1.0
  */
 public function sync()
 {
     if ($this->init_live_editing()) {
         $id = $_POST['post'];
         if (!empty($_POST['data'])) {
             foreach ($_POST['data']['widgets'] as $i => $wid) {
                 if (!empty($wid['info']['style'])) {
                     $_POST['data']['widgets'][$i]['info']['style'] = wp_unslash($wid['info']['style']);
                     $_POST['data']['widgets'][$i]['text'] = wp_unslash($wid['text']);
                 }
             }
         }
         if (filter_input(INPUT_POST, 'publish')) {
             // Update post
             $live_page_post = array('ID' => $id);
             if ('Publish' == filter_input(INPUT_POST, 'publish')) {
                 $live_page_post['post_status'] = 'publish';
             }
             $live_page_post = $this->savePostMeta($live_page_post);
             /**
              * Fired before saving pootle page builder post meta
              * @param array $ppb_data Page builder data
              * @param Int $post_id Post ID
              * @param WP_Post $post Post object
              */
             do_action('pootlepb_save_post', $_POST['data'], $id, get_post($id));
             foreach ($_POST['data']['widgets'] as $i => $wid) {
                 if (!empty($wid['info']['style'])) {
                     $_POST['data']['widgets'][$i]['info']['style'] = wp_slash($wid['info']['style']);
                     $_POST['data']['widgets'][$i]['text'] = wp_slash($wid['text']);
                 }
             }
             // Update PPB data
             update_post_meta($id, 'panels_data', $_POST['data']);
             // Generate post content
             $post_content = pootlepb_text_content('', (object) $live_page_post);
             if ($post_content) {
                 $live_page_post['post_content'] = $post_content;
             }
             // Update post
             wp_update_post($live_page_post, true);
             echo get_permalink($id);
         } else {
             $the_query = new WP_Query(array('post_type' => 'any', 'post__in' => array($id), 'ignore_sticky_posts' => 1));
             if ($the_query->have_posts()) {
                 while ($the_query->have_posts()) {
                     $the_query->the_post();
                     $live_page_post = $this->savePostMeta(array('ID' => $id));
                     // Update post
                     wp_update_post($live_page_post, true);
                     echo Pootle_Page_Builder_Render_Layout::render($id, $_POST['data']);
                 }
             }
         }
     }
     die;
 }
예제 #4
0
                     * @param array $widget_info - Info for this block - backwards compatible with widgets
                     * @param int   $gi          - Grid Index
                     * @param int   $ci          - Cell Index
                     * @param int   $pi          - Panel/Content Block Index
                     * @param int   $blocks_num  - Total number of Blocks in cell
                     * @param int   $post_id     - The current post ID
                     */
                    do_action('ppb_panels_render_content_block', $widget_info, $gi, $ci, $pi, count($widgets), $post_id);
                }
                if (empty($widgets)) {
                    echo ' ';
                }
                echo '</div>';
            }
            echo "</div>";
            echo '</div>';
            if (!empty($style_attributes)) {
                echo '</div>';
            }
            // This allows other themes and plugins to add html after the row
            echo apply_filters('siteorigin_panels_after_row', '', $panels_data['grids'][$gi]);
        }
        $html = ob_get_clean();
        // Reset the current post
        $siteorigin_panels_current_post = $old_current_post;
        return apply_filters('siteorigin_panels_render', $html, $post_id, null);
    }
}
//Instantiating Pootle_Page_Builder_Render_Layout class
Pootle_Page_Builder_Render_Layout::instance();