Ejemplo n.º 1
0
/**
 * Ajax handler to get the HTML representation of the request.
 */
function siteorigin_panels_content_save_pre_get()
{
    if (empty($_POST['grids']) || empty($_POST['grid_cells']) || empty($_POST['widgets']) || empty($_POST['panel_order'])) {
        exit;
    }
    if (empty($_POST['_signature'])) {
        exit;
    }
    $sig = $_POST['_signature'];
    $data = array('grids' => $_POST['grids'], 'grid_cells' => $_POST['grid_cells'], 'widgets' => array_map('stripslashes_deep', $_POST['widgets']), 'panel_order' => $_POST['panel_order'], 'action' => $_POST['action'], 'post_id' => $_POST['post_id']);
    // Use the signature to secure the request.
    if ($sig != sha1(NONCE_SALT . serialize($data))) {
        exit;
    }
    // This can cause a fatal error, so handle in a separate request.
    $panels_data = siteorigin_panels_get_panels_data_from_post($_POST);
    $content = '';
    if (!empty($panels_data['widgets'])) {
        // Save the panels data into post_content for SEO and search plugins
        $content = siteorigin_panels_render($_POST['post_id'], false, $panels_data);
        $content = preg_replace(array('@<head[^>]*?>.*?</head>@siu', '@<style[^>]*?>.*?</style>@siu', '@<script[^>]*?.*?</script>@siu', '@<object[^>]*?.*?</object>@siu', '@<embed[^>]*?.*?</embed>@siu', '@<applet[^>]*?.*?</applet>@siu', '@<noframes[^>]*?.*?</noframes>@siu', '@<noscript[^>]*?.*?</noscript>@siu', '@<noembed[^>]*?.*?</noembed>@siu'), array(' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '), $content);
        $content = strip_tags($content, '<img><h1><h2><h3><h4><h5><h6><a><p><em><strong>');
        $content = explode("\n", $content);
        $content = array_map('trim', $content);
        $content = implode("\n", $content);
        $content = preg_replace("/[\n]{2,}/", "\n\n", $content);
        $content = trim($content);
    }
    echo $content;
    exit;
}
Ejemplo n.º 2
0
 /**
  * Process the content.
  *
  * @param $content
  * @param $frame
  *
  * @return string
  */
 function process_content($content, $frame)
 {
     if (function_exists('siteorigin_panels_render')) {
         $content_builder_id = substr(md5(json_encode($content)), 0, 8);
         echo siteorigin_panels_render('w' . $content_builder_id, true, $content);
     } else {
         echo __('This widget requires Page Builder.', 'so-widgets-bundle');
     }
 }
Ejemplo n.º 3
0
/**
 * Display the Page Builder content for the revision.
 *
 * @param $value
 * @param $field
 * @param $revision
 * @return string
 */
function siteorigin_panels_revisions_field($value, $field, $revision)
{
    $parent_id = wp_is_post_revision($revision->ID);
    $panels_data = get_metadata('post', $revision->ID, 'panels_data', true);
    if (empty($panels_data)) {
        return '';
    }
    return siteorigin_panels_render($parent_id, false, $panels_data);
}
 /**
  * Puts page builder stuff in post content for unsupported post types
  *
  * @since 3.0.0
  */
 private function put_page_builder_stuff_in_content()
 {
     return;
     global $ppb_panels_inline_css;
     foreach ($this->unsupported_page_builder_posts as $id) {
         $panel_content = siteorigin_panels_render($id);
         $panel_style = '<style>' . $ppb_panels_inline_css . '</style>';
         $updated_post = array('ID' => $id, 'post_content' => $panel_style . $panel_content);
         wp_update_post($updated_post);
         $notices = array();
         $notices['settings-updated'] = array('type' => 'update-nag', 'message' => __("Now we only support page post types, however for your convenience we have put all your existing page builder using posts layout in the content.", 'woothemes'));
         update_option('pootle_page_admin_notices', $notices);
     }
 }
Ejemplo n.º 5
0
/**
 * Get builder content based on the submitted panels_data.
 */
function siteorigin_panels_ajax_builder_content()
{
    header('content-type: text/html');
    if (!current_user_can('edit_post', $_POST['post_id'])) {
        wp_die();
    }
    if (empty($_POST['post_id']) || empty($_POST['panels_data'])) {
        echo '';
        wp_die();
    }
    // echo the content
    echo siteorigin_panels_render(intval($_POST['post_id']), false, json_decode(wp_unslash($_POST['panels_data']), true));
    wp_die();
}
Ejemplo n.º 6
0
/**
 * Get builder content based on the submitted panels_data.
 */
function siteorigin_panels_ajax_builder_content()
{
    header('content-type: text/html');
    $request = filter_input_array(INPUT_POST, array('post_id' => FILTER_VALIDATE_INT, 'panels_data' => FILTER_DEFAULT));
    if (!current_user_can('edit_post', $request['post_id'])) {
        wp_die();
    }
    if (empty($request['post_id']) || empty($request['panels_data'])) {
        echo '';
        wp_die();
    }
    // echo the content
    echo siteorigin_panels_render($request['post_id'], false, json_decode($request['panels_data'], true));
    wp_die();
}
Ejemplo n.º 7
0
/**
 * Get builder content based on the submitted panels_data.
 */
function siteorigin_panels_ajax_builder_content()
{
    header('content-type: text/html');
    if (!current_user_can('edit_post', $_POST['post_id'])) {
        wp_die();
    }
    if (empty($_POST['post_id']) || empty($_POST['panels_data'])) {
        echo '';
        wp_die();
    }
    // echo the content
    $panels_data = json_decode(wp_unslash($_POST['panels_data']), true);
    $panels_data['widgets'] = siteorigin_panels_process_raw_widgets($panels_data['widgets']);
    $panels_data = siteorigin_panels_styles_sanitize_all($panels_data);
    echo siteorigin_panels_render(intval($_POST['post_id']), false, $panels_data);
    wp_die();
}
Ejemplo n.º 8
0
 function widget($args, $instance)
 {
     if (empty($instance['panels_data'])) {
         return;
     }
     if (is_string($instance['panels_data'])) {
         $instance['panels_data'] = json_decode($instance['panels_data'], true);
     }
     if (empty($instance['panels_data']['widgets'])) {
         return;
     }
     if (empty($instance['builder_id'])) {
         $instance['builder_id'] = uniqid();
     }
     echo $args['before_widget'];
     echo siteorigin_panels_render('w' . $instance['builder_id'], true, $instance['panels_data']);
     echo $args['after_widget'];
 }
Ejemplo n.º 9
0
/**
 * Filter the content of the panel, adding all the widgets.
 *
 * @param $content
 * @return string
 *
 * @filter the_content
 */
function siteorigin_panels_filter_content($content)
{
    global $post;
    if (empty($post)) {
        return $content;
    }
    if (!apply_filters('siteorigin_panels_filter_content_enabled', true)) {
        return $content;
    }
    // Check if this post has panels_data
    $panels_data = get_post_meta($post->ID, 'panels_data', true);
    if (!empty($panels_data)) {
        $panel_content = siteorigin_panels_render($post->ID);
        if (!empty($panel_content)) {
            $content = $panel_content;
        }
    }
    return $content;
}
Ejemplo n.º 10
0
/**
 * Filter the content of the panel, adding all the widgets.
 *
 * @param $content
 * @return string
 *
 * @filter the_content
 */
function siteorigin_panels_filter_content($content)
{
    global $post;
    if (empty($post)) {
        return $content;
    }
    if (!apply_filters('siteorigin_panels_filter_content_enabled', true)) {
        return $content;
    }
    if (in_array($post->post_type, siteorigin_panels_setting('post-types'))) {
        $panel_content = siteorigin_panels_render($post->ID);
        if (!empty($panel_content)) {
            $content = $panel_content;
        }
    }
    return $content;
}
Ejemplo n.º 11
0
bloginfo('pingback_url');
?>
">
	<?php 
wp_head();
?>
</head>

<body <?php 
body_class();
?>
>
	<div id="content" class="site-content">
		<div class="entry-content">
			<?php 
if (!empty($_POST['live_editor_panels_data'])) {
    $data = json_decode(wp_unslash($_POST['live_editor_panels_data']), true);
    if (!empty($data['widgets']) && (!class_exists('SiteOrigin_Widget_Field_Class_Loader') || method_exists('SiteOrigin_Widget_Field_Class_Loader', 'extend'))) {
        $data['widgets'] = siteorigin_panels_process_raw_widgets($data['widgets']);
    }
    echo siteorigin_panels_render('l' . md5(serialize($data)), true, $data);
}
?>
		</div><!-- .entry-content -->
	</div>
	<?php 
wp_footer();
?>
</body>
</html>
 /**
  * Render home page
  *
  * @since    1.0.0
  */
 public function render_home()
 {
     if (function_exists('siteorigin_panels_render')) {
         echo siteorigin_panels_render('home');
     } else {
         genesis_do_loop();
     }
 }
/**
 * Filter the content of the panel, adding all the widgets.
 *
 * @param $content
 * @return string
 *
 * @filter the_content
 */
function siteorigin_panels_filter_content($content, $type = '')
{
    global $post;
    if ($type != 'bunyad_main_content') {
        return $content;
    }
    if (empty($post)) {
        return $content;
    }
    if (in_array($post->post_type, siteorigin_panels_setting('post-types'))) {
        $panel_content = siteorigin_panels_render($post->ID);
        if (!empty($panel_content)) {
            $content = $panel_content;
        }
    }
    return $content;
}
Ejemplo n.º 14
0
				</div>
				<div class="blur-header-lines"></div>
				<?php 
    $id = $page->ID;
} else {
    ?>
				<h3 class="alert-danger">Please create a post called "Foundation"</h3>
				<?php 
}
?>
	</section>

	<section class="wrapper wrapper-child">
		<div class="container">
			<?php 
$args = array('post_parent' => $id, 'post_type' => 'page', 'post_status' => 'publish');
$children = get_posts($args);
foreach ($children as $child) {
    if (siteorigin_panels_render($child->ID) != null) {
        echo siteorigin_panels_render($child->ID);
    } else {
        echo $child->post_content;
    }
}
?>
		</div>
	</section>

</div>
<?php 
get_footer();
        /**
         * Front-end display of widget.
         *
         * @see WP_Widget::widget()
         *
         * @param array $args
         * @param array $instance
         */
        public function widget($args, $instance)
        {
            $instance['widget_title'] = empty($instance['widget_title']) ? '' : $args['before_title'] . apply_filters('widget_title', $instance['widget_title'], $instance) . $args['after_title'];
            $items = isset($instance['items']) ? array_values($instance['items']) : array();
            // Prepare items data.
            foreach ($items as $key => $item) {
                $items[$key]['builder_id'] = empty($item['builder_id']) ? uniqid() : $item['builder_id'];
                $items[$key]['tab_id'] = $this->format_id_from_name($item['title']);
            }
            // Should we use the older Twitter Bootstrap tabs layout?
            $older_bootstrap_layout = apply_filters('pt-tabs/use_older_bootstrap_layout', false);
            echo $args['before_widget'];
            ?>
			<div class="pt-tabs">
				<?php 
            if (!empty($instance['widget_title'])) {
                ?>
					<?php 
                echo wp_kses_post($instance['widget_title']);
                ?>
				<?php 
            }
            ?>

				<?php 
            if (!empty($items)) {
                $items[0]['active'] = true;
                // First tab should be active.
                ?>
					<ul class="pt-tabs__navigation  nav  nav-tabs" role="tablist">
						<?php 
                foreach ($items as $item) {
                    ?>
							<li class="nav-item<?php 
                    echo !empty($item['active']) && $older_bootstrap_layout ? '  active' : '';
                    ?>
">
								<a class="nav-link<?php 
                    echo !empty($item['active']) && !$older_bootstrap_layout ? '  active' : '';
                    ?>
" data-toggle="tab" href="#tab-<?php 
                    echo esc_attr($item['tab_id']);
                    ?>
" role="tab"><?php 
                    echo wp_kses_post($item['title']);
                    ?>
</a>
							</li>
						<?php 
                }
                ?>
					</ul>

					<div class="pt-tabs__content  tab-content">
					<?php 
                foreach ($items as $item) {
                    ?>
						<div class="tab-pane  fade<?php 
                    echo empty($item['active']) ? '' : '  in  active';
                    ?>
" id="tab-<?php 
                    echo esc_attr($item['tab_id']);
                    ?>
" role="tabpanel">
							<?php 
                    echo siteorigin_panels_render('w' . $item['builder_id'], true, $item['panels_data']);
                    ?>
						</div>
					<?php 
                }
                ?>
					</div>
				<?php 
            }
            ?>
			</div>

			<?php 
            echo $args['after_widget'];
        }
Ejemplo n.º 16
0
/**
 * Filter the content of the panel, adding all the widgets.
 *
 * @param $content
 * @return string
 *
 * @filter the_content
 */
function siteorigin_panels_filter_content($content)
{
    global $post;
    if (empty($post)) {
        return $content;
    }
    if (!apply_filters('siteorigin_panels_filter_content_enabled', true)) {
        return $content;
    }
    // Check if this post has panels_data
    $panels_data = get_post_meta($post->ID, 'panels_data', true);
    if (!empty($panels_data)) {
        $panel_content = siteorigin_panels_render($post->ID);
        if (!empty($panel_content)) {
            $content = $panel_content;
            if (!is_singular()) {
                // This is an archive page, so try strip out anything after the more text
                if (preg_match('/<!--more(.*?)?-->/', $content, $matches)) {
                    $content = explode($matches[0], $content, 2);
                    $content = $content[0];
                    $content = force_balance_tags($content);
                    if (!empty($matches[1]) && !empty($more_link_text)) {
                        $more_link_text = strip_tags(wp_kses_no_null(trim($matches[1])));
                    } else {
                        $more_link_text = __('Read More', 'siteorigin-panels');
                    }
                    $more_link = apply_filters('the_content_more_link', ' <a href="' . get_permalink() . "#more-{$post->ID}\" class=\"more-link\">{$more_link_text}</a>", $more_link_text);
                    $content .= '<p>' . $more_link . '</p>';
                }
            }
        }
    }
    return $content;
}
Ejemplo n.º 17
0
 *
 * @package ultra
 * @since ultra 0.9
 * @see https://siteorigin.com/page-builder/
 * @license GPL 2.0
 */
get_header();
?>

	<div class="container">

		<div id="primary" class="content-area">
			<main id="main" class="site-main" role="main">

				<div class="entry-content">
					<?php 
if (is_page()) {
    the_post();
    the_content();
} elseif (function_exists('siteorigin_panels_render')) {
    echo siteorigin_panels_render('home');
} else {
    echo siteorigin_panels_lite_home_render();
}
?>
				</div>
			</main><!-- #main .site-main -->
		</div><!-- #primary .content-area -->

<?php 
get_footer();
Ejemplo n.º 18
0
/**
 * Filter the content of the panel, adding all the widgets.
 *
 * @param $content
 * @return string
 *
 * @filter the_content
 */
function siteorigin_panels_filter_content($content)
{
    $isWooCommerceInstalled = function_exists('is_shop') && function_exists('wc_get_page_id');
    if ($isWooCommerceInstalled) {
        // prevent Page Builder overwrite taxonomy description with widget content
        if (is_tax(array('product_cat', 'product_tag')) && get_query_var('paged') == 0) {
            return $content;
        }
        if (is_post_type_archive() && !is_shop()) {
            return $content;
        }
        if (is_shop()) {
            $postID = wc_get_page_id('shop');
        } else {
            $postID = get_the_ID();
        }
    } else {
        if (is_post_type_archive()) {
            return $content;
        }
        $postID = get_the_ID();
    }
    //If product done once set $postID to Tabs Post ID
    if (isset($GLOBALS['canvasPB_ProductDoneOnce'])) {
        global $wpdb;
        $results = $wpdb->get_results("SELECT ID FROM " . $wpdb->posts . " WHERE " . "post_content LIKE '" . esc_sql($content) . "'" . " AND post_type LIKE 'wc_product_tab'" . " AND post_status LIKE 'publish'");
        foreach ($results as $id) {
            $postID = $id->ID;
        }
    }
    //If its product set canvasPB_ProductDoneOnce to skip this for TAB
    if (function_exists('is_product')) {
        if (is_single() && is_product()) {
            $GLOBALS['canvasPB_ProductDoneOnce'] = TRUE;
        }
    }
    $post = get_post($postID);
    if (empty($post)) {
        return $content;
    }
    if (in_array($post->post_type, siteorigin_panels_setting('post-types'))) {
        $panel_content = siteorigin_panels_render($post->ID);
        if (!empty($panel_content)) {
            $content = $panel_content;
        }
    }
    return $content;
}