private function __init()
 {
     $post_object = get_post($this->post_id);
     $this->post_type =& $post_object->post_type;
     $this->post_title =& $post_object->post_title;
     // if we are in forbidden post types edit page don't do anything
     if (ddl_has_feature('warn-missing-post-loop-cell') === false || in_array($this->post_type, self::$WHITE_LIST)) {
         return;
     }
     if ($this->post_type == 'page' && self::page_templates_have_layout() === false) {
         return;
     } else {
         if ($this->post_type !== 'page' && self::post_type_template_have_layout($this->post_type) === false) {
             return;
         }
     }
     $this->show_hide_content_editor_in_post_edit_page();
     $this->add_create_layout_support($post_object);
 }
<?php

/*
 * Slider cell type.
 * Displays set of images using Bootstrap's carousel component
 *
 */
if (ddl_has_feature('slider-cell') === false) {
    return;
}
if (!function_exists('register_slider_cell_init')) {
    function register_slider_cell_init()
    {
        if (function_exists('register_dd_layout_cell_type')) {
            register_dd_layout_cell_type('slider-cell', array('name' => __('Slider', 'ddl-layouts'), 'cell-image-url' => DDL_ICONS_SVG_REL_PATH . 'layouts-slider-cell.svg', 'description' => __('Display an image slider, built using the Bootstrap Carousel component.', 'ddl-layouts'), 'category' => __('Text and media', 'ddl-layouts'), 'button-text' => __('Assign slider cell', 'ddl-layouts'), 'dialog-title-create' => __('Create a new slider cell', 'ddl-layouts'), 'dialog-title-edit' => __('Edit slider cell', 'ddl-layouts'), 'dialog-template-callback' => 'slider_cell_dialog_template_callback', 'cell-content-callback' => 'slider_cell_content_callback', 'cell-template-callback' => 'slider_cell_template_callback', 'cell-class' => '', 'has_settings' => true, 'preview-image-url' => DDL_ICONS_PNG_REL_PATH . 'slider_expand-image.png', 'translatable_fields' => array('slider[slide_url]' => array('title' => 'Slide URL', 'type' => 'LINE'), 'slider[slide_title]' => array('title' => 'Slide title', 'type' => 'LINE'), 'slider[slide_text]' => array('title' => 'Slide description', 'type' => 'AREA')), 'register-scripts' => array(array('ddl-slider-cell-script', WPDDL_GUI_RELPATH . 'editor/js/ddl-slider-cell-script.js', array('jquery'), WPDDL_VERSION, true))));
        }
    }
    add_action('init', 'register_slider_cell_init');
    function slider_cell_dialog_template_callback()
    {
        ob_start();
        ?>
 
		<div class="ddl-form">
			<p>
				<label for="<?php 
        the_ddl_name_attr('slider_height');
        ?>
"><?php 
        _e('Slider height', 'ddl-layouts');
        ?>
<?php

if (ddl_has_feature('post-loop-views-cell') === false) {
    return;
}
class WPDD_layout_loop_views_cell extends WPDD_layout_cell
{
    function __construct($name, $width, $css_class_name = '', $content = null, $css_id, $tag)
    {
        parent::__construct($name, $width, $css_class_name, 'post-loop-views-cell', $content, $css_id, $tag);
        $this->set_cell_type('post-loop-views-cell');
    }
    function frontend_render_cell_content($target)
    {
        global $ddl_fields_api;
        $ddl_fields_api->set_current_cell_content($this->get_content());
        if (function_exists('render_view')) {
            global $WPV_view_archive_loop, $wp_query;
            $WPV_view_archive_loop->query = clone $wp_query;
            $WPV_view_archive_loop->in_the_loop = true;
            $target->cell_content_callback(render_view(array('id' => get_ddl_field('ddl_layout_view_id'))), $this);
            $WPV_view_archive_loop->in_the_loop = false;
        } else {
            $target->cell_content_callback(WPDDL_Messages::views_missing_message(), $this);
        }
    }
}
class WPDD_layout_loop_views_cell_factory extends WPDD_layout_cell_factory
{
    public function build($name, $width, $css_class_name = '', $content = null, $css_id, $tag)
    {
<?php

if (ddl_has_feature('child-layout') === false) {
    return;
}
class WPDD_layout_cell_child_layout extends WPDD_layout_cell
{
    function __construct($name, $width, $css_class_name = '', $content = null, $css_id, $tag)
    {
        parent::__construct($name, $width, $css_class_name, 'child-layout', $content, $css_id, $tag);
        $this->set_cell_type('child-layout');
    }
    function frontend_render_cell_content($target)
    {
        global $wpddlayout;
        if ($target->has_child_renderer()) {
            $target->cell_content_callback($target->render_child(), $this);
        } else {
            $layout_id = $wpddlayout->get_rendered_layout_id();
            $layout = $wpddlayout->get_layout_from_id($layout_id);
            $children = $layout->get_children();
            ob_start();
            ?>
				<div class="toolset-alert toolset-alert-error">
					<p><strong><?php 
            _e('A child layout should display here', 'ddl-layouts');
            ?>
</strong></p>
					<?php 
            if (count($children)) {
                ?>
<?php

/*
 * YouTube video cell type.
 * Displays YouTube video
 *
 */
if (ddl_has_feature('video-cell') === false) {
    return;
}
if (!function_exists('register_video_cell_init')) {
    function register_video_cell_init()
    {
        if (function_exists('register_dd_layout_cell_type')) {
            register_dd_layout_cell_type('video-cell', array('name' => __('YouTube video', 'ddl-layouts'), 'description' => __('Display a video from YouTube.', 'ddl-layouts'), 'category' => __('Text and media', 'ddl-layouts'), 'cell-image-url' => DDL_ICONS_SVG_REL_PATH . 'layouts-video-cell.svg', 'button-text' => __('Assign YouTube video cell', 'ddl-layouts'), 'dialog-title-create' => __('Create a new YouTube video cell', 'ddl-layouts'), 'dialog-title-edit' => __('Edit YouTube video cell', 'ddl-layouts'), 'dialog-template-callback' => 'video_cell_dialog_template_callback', 'cell-content-callback' => 'video_cell_content_callback', 'cell-template-callback' => 'video_cell_template_callback', 'has_settings' => true, 'cell-class' => '', 'preview-image-url' => DDL_ICONS_PNG_REL_PATH . 'youtube_expand-image.png', 'register-scripts' => array(array('ddl-video-cell-script', WPDDL_GUI_RELPATH . 'editor/js/ddl-video-cell-script.js', array('jquery'), WPDDL_VERSION, true))));
        }
    }
    add_action('init', 'register_video_cell_init');
    function video_cell_dialog_template_callback()
    {
        ob_start();
        ?>

		<div class="ddl-form">
			<p>
				<label for="<?php 
        the_ddl_name_attr('video_url');
        ?>
"><?php 
        _e('Video URL', 'ddl-layouts');
        ?>
<?php

if (ddl_has_feature('cell-widget-area') === false) {
    return;
}
class WPDD_layout_cell_widget_area extends WPDD_layout_cell
{
    function __construct($name, $width, $css_class_name = '', $content = null, $css_id, $tag)
    {
        parent::__construct($name, $width, $css_class_name, 'cell-widget-area-template', $content, $css_id, $tag);
        $this->set_cell_type('cell-widget-area');
    }
    function frontend_render_cell_content($target)
    {
        ob_start();
        $widget_area = $this->get('widget_area');
        if ($widget_area != '') {
            dynamic_sidebar($widget_area);
        }
        $content = ob_get_clean();
        $target->cell_content_callback($content, $this);
    }
}
class WPDD_layout_cell_widget_area_factory extends WPDD_layout_cell_factory
{
    public function build($name, $width, $css_class_name = '', $content = null, $css_id, $tag)
    {
        return new WPDD_layout_cell_widget_area($name, $width, $css_class_name, $content, $css_id, $tag);
    }
    public function get_cell_info($template)
    {
<?php

if (ddl_has_feature('cell-text') === false) {
    return;
}
class WPDD_layout_cell_text extends WPDD_layout_cell
{
    function __construct($name, $width, $css_class_name = '', $content = null, $css_id, $tag, $unique_id)
    {
        parent::__construct($name, $width, $css_class_name, 'cell-text-template', $content, $css_id, $tag, $unique_id);
        $this->set_cell_type('cell-text');
    }
    function frontend_render_cell_content($target)
    {
        $content = $this->get('content');
        $content = apply_filters('wpml_translate_string', $content, $this->get_unique_id() . '_content', $target->get_context());
        if ($this->get('responsive_images')) {
            // stript hieght="xx" and width="xx" from images.
            $regex = '/<img[^>]*?(width="[^"]*")/siU';
            if (preg_match_all($regex, $content, $matches, PREG_SET_ORDER)) {
                foreach ($matches as $val) {
                    $found = str_replace($val[1], '', $val[0]);
                    $content = str_replace($val[0], $found, $content);
                }
            }
            $regex = '/<img[^>]*?(height="[^"]*")/siU';
            if (preg_match_all($regex, $content, $matches, PREG_SET_ORDER)) {
                foreach ($matches as $val) {
                    $found = str_replace($val[1], '', $val[0]);
                    $content = str_replace($val[0], $found, $content);
                }
<?php

/*
 * Comments cell type.
 * Displays form and coments
 *
 */
if (ddl_has_feature('comments-cell') === false) {
    return;
}
if (!function_exists('register_comments_cell_init')) {
    function register_comments_cell_init()
    {
        if (function_exists('register_dd_layout_cell_type')) {
            register_dd_layout_cell_type('comments-cell', array('name' => __('Comments', 'ddl-layouts'), 'description' => __('Display the comments section. This cell is typically used in layouts for blog posts and pages that need comments enable.', 'ddl-layouts'), 'category' => __('Site elements', 'ddl-layouts'), 'cell-image-url' => DDL_ICONS_SVG_REL_PATH . 'layouts-comments-cell.svg', 'button-text' => __('Assign comments cell', 'ddl-layouts'), 'dialog-title-create' => __('Create a new comments cell', 'ddl-layouts'), 'dialog-title-edit' => __('Edit comments cell', 'ddl-layouts'), 'dialog-template-callback' => 'comments_cell_dialog_template_callback', 'cell-content-callback' => 'comments_cell_content_callback', 'cell-template-callback' => 'comments_cell_template_callback', 'has_settings' => true, 'cell-class' => '', 'preview-image-url' => DDL_ICONS_PNG_REL_PATH . 'comments_expand-image.png', 'allow-multiple' => false, 'register-scripts' => array(array('ddl-comments-cell-script', WPDDL_GUI_RELPATH . 'editor/js/ddl-comments-cell-script.js', array('jquery'), WPDDL_VERSION, true)), 'translatable_fields' => array('title_one_comment' => array('title' => 'One comment text', 'type' => 'LINE'), 'title_multi_comments' => array('title' => 'Multiple comments text', 'type' => 'LINE'), 'ddl_prev_link_text' => array('title' => 'Older Comments text', 'type' => 'LINE'), 'ddl_next_link_text' => array('title' => 'Newer Comments text', 'type' => 'LINE'), 'comments_closed_text' => array('title' => 'Comments are closed text', 'type' => 'LINE'), 'reply_text' => array('title' => 'Reply text', 'type' => 'LINE'), 'password_text' => array('title' => 'Password protected post text', 'type' => 'LINE'))));
            add_action('wp_ajax_ddl_load_comments_page_content', 'ddl_load_comments_page_content');
            add_action('wp_ajax_nopriv_ddl_load_comments_page_content', 'ddl_load_comments_page_content');
        }
    }
    add_action('init', 'register_comments_cell_init');
    function comments_cell_dialog_template_callback()
    {
        ob_start();
        ?>
		<h3 class="ddl-section-title">
			<?php 
        _e('Comments list', 'ddl-layouts');
        ?>
		</h3>
		<div class="ddl-form">
			<p>
<?php

/*
 * CRED cell type.
 * Displays CRED Post Form
 *
 */
if (ddl_has_feature('cred-cell') === false) {
    return;
}
if (!class_exists('CRED_Cell')) {
    class CRED_Cell
    {
        private $cell_type = 'cred-cell';
        function __construct()
        {
            add_action('init', array(&$this, 'register_cred_cell_init'), 12);
            add_action('wp_ajax_ddl_get_option_for_cred_form', array(&$this, 'ddl_get_option_for_cred_form_callback'));
            add_action('wp_ajax_ddl_delete_cred_forms', array(&$this, 'ddl_delete_cred_forms'));
            add_action('wp_ajax_ddl_create_cred_form', array(&$this, 'ddl_create_cred_form'));
        }
        function register_cred_cell_init()
        {
            if (function_exists('register_dd_layout_cell_type')) {
                register_dd_layout_cell_type($this->cell_type, array('name' => __('CRED Post Form', 'ddl-layouts'), 'description' => __('Display a CRED Post Form which allows users to create and edit Posts, Pages and Custom content from the front-end.', 'ddl-layouts'), 'category' => __('Forms', 'ddl-layouts'), 'cell-image-url' => DDL_ICONS_SVG_REL_PATH . 'cred-form.svg', 'button-text' => __('Assign CRED Post Form cell', 'ddl-layouts'), 'dialog-title-create' => __('Create a new CRED Post Form cell', 'ddl-layouts'), 'dialog-title-edit' => __('Edit CRED Post Form cell', 'ddl-layouts'), 'dialog-template-callback' => array(&$this, 'cred_cell_dialog_template_callback'), 'cell-content-callback' => array(&$this, 'cred_cell_content_callback'), 'cell-template-callback' => array(&$this, 'cred_cell_template_callback'), 'cell-class' => '', 'has_settings' => false, 'preview-image-url' => DDL_ICONS_PNG_REL_PATH . 'CRED-form_expand-image.png', 'register-scripts' => array(array('ddl-cred-cell-script', WPDDL_RELPATH . '/inc/gui/dialogs/js/cred-cell.js', array('jquery'), WPDDL_VERSION, true))));
            }
        }
        function cred_cell_dialog_template_callback()
        {
            ob_start();
            ?>
<?php

/*
 * Theme Views content grid cell type.
 * Displays current theme basic footer with two credits area.
 *
 */
if (ddl_has_feature('views-content-grid-cell') === false) {
    return;
}
/*
 * Render preview for view
 */
add_action('wp_ajax_ddl_views_content_grid_preview', 'ddl_views_content_grid_preview');
function ddl_views_content_grid_preview()
{
    if (WPDD_Utils::user_not_admin()) {
        die(__("You don't have permission to perform this action!", 'ddl-layouts'));
    }
    if (!isset($_POST['wpnonce']) || !wp_verify_nonce($_POST['wpnonce'], 'ddl_layout_view_nonce')) {
        die('verification failed');
    }
    global $wpdb;
    if (isset($_POST['view_id'])) {
        $view_id = $_POST['view_id'];
    } else {
        return __('View not set', 'ddl-layouts');
    }
    $layout_style = array('unformatted' => __('Unformatted', 'ddl-layouts'), 'bootstrap-grid' => __('Unformatted', 'ddl-layouts'), 'table' => __('Table-based grid', 'ddl-layouts'), 'table_of_fields' => __('Table', 'ddl-layouts'), 'un_ordered_list' => __('Unordered list', 'ddl-layouts'), 'ordered_list' => __('Ordered list', 'ddl-layouts'));
    $view = $wpdb->get_results($wpdb->prepare("SELECT ID, post_title FROM {$wpdb->posts} WHERE ID = %d AND post_type='view'", $view_id));
    if (isset($view[0])) {
<?php

if (ddl_has_feature('cell-content-template') === false) {
    return;
}
class WPDD_layout_cell_post_content_views extends WPDD_layout_cell
{
    function __construct($name, $width, $css_class_name = '', $content = null, $css_id = '')
    {
        parent::__construct($name, $width, $css_class_name, 'cell-content-template', $content, $css_id);
        $this->set_cell_type('cell-content-template');
    }
    function frontend_render_cell_content($target)
    {
        global $WPV_templates;
        $content = '';
        $cell_content = $this->get_content();
        if ($cell_content['page'] == 'current_page') {
            do_action('ddl-layouts-render-start-post-content');
        }
        if (isset($WPV_templates) && isset($cell_content['ddl_view_template_id']) && $cell_content['ddl_view_template_id'] != 'None') {
            $content_template_id = $cell_content['ddl_view_template_id'];
            if ($cell_content['page'] == 'current_page') {
                global $post;
                $content = render_view_template($content_template_id, $post);
            } elseif ($cell_content['page'] == 'this_page') {
                $get_post_query = new WP_Query(array('p' => $cell_content['selected_post'], 'post_type' => 'any'));
                while ($get_post_query->have_posts()) {
                    $get_post_query->the_post();
                    $content = render_view_template($content_template_id);
                }
<?php

/*
 * Image-box cell type.
 * Bootstrap thumbnail component that displays box with image, header and text. Suitable for callout boxes, key features, services showcase etc.
 *
 */
if (ddl_has_feature('imagebox-cell') === false) {
    return;
}
if (!function_exists('register_imagebox_cell_init')) {
    function register_imagebox_cell_init()
    {
        if (function_exists('register_dd_layout_cell_type')) {
            register_dd_layout_cell_type('imagebox-cell', array('name' => __('Image box', 'ddl-layouts'), 'cell-image-url' => DDL_ICONS_SVG_REL_PATH . 'layouts-imagebox-cell.svg', 'description' => __('Display an image with a header and text. Suitable for callout boxes, key features, services showcase etc. Use the Visual Editor cell if you need more flexibility.', 'ddl-layouts'), 'category' => __('Text and media', 'ddl-layouts'), 'button-text' => __('Assign imagebox cell', 'ddl-layouts'), 'dialog-title-create' => __('Create a new imagebox cell', 'ddl-layouts'), 'dialog-title-edit' => __('Edit imagebox cell', 'ddl-layouts'), 'dialog-template-callback' => 'imagebox_cell_dialog_template_callback', 'cell-content-callback' => 'imagebox_cell_content_callback', 'cell-template-callback' => 'imagebox_cell_template_callback', 'has_settings' => true, 'preview-image-url' => DDL_ICONS_PNG_REL_PATH . 'image-box_expand-image.png', 'translatable_fields' => array('box_title' => array('title' => 'Image Box Title', 'type' => 'LINE'), 'box_content' => array('title' => 'Image Box Content', 'type' => 'AREA'))));
        }
    }
    add_action('init', 'register_imagebox_cell_init');
    function imagebox_cell_dialog_template_callback()
    {
        ob_start();
        ?>

		<ul class="ddl-form">
			<li class="js-ddl-media-field">
				<label for="<?php 
        the_ddl_name_attr('box_image');
        ?>
"><?php 
        _e('Image URL', 'ddl-layouts');
        ?>
<?php

if (ddl_has_feature('widget-cell') === false) {
    return;
}
function register_widget_cell_init()
{
    $widget_scripts = array(array('widget_cell_js', WPDDL_RELPATH . '/inc/gui/editor/js/widget-cell.js', array('jquery'), WPDDL_VERSION, true));
    $widget_scripts = apply_filters('wpdll_cell_widget_scripts', $widget_scripts);
    register_dd_layout_cell_type('widget-cell', array('name' => __('Single widget', 'ddl-layouts'), 'cell-image-url' => DDL_ICONS_SVG_REL_PATH . 'single-widget.svg', 'description' => __('Display a single WordPress Widget. You will be able to choose which widget to display, without having to create new widgets areas.', 'ddl-layouts'), 'button-text' => __('Assign Widget cell', 'ddl-layouts'), 'dialog-title-create' => __('Create a Widget cell', 'ddl-layouts'), 'dialog-title-edit' => __('Edit Widget cell', 'ddl-layouts'), 'dialog-template-callback' => 'widget_cell_dialog_template_callback', 'cell-content-callback' => 'widget_cell_content_callback', 'cell-template-callback' => 'widget_cell_template_callback', 'cell-class' => 'widget-cell', 'has_settings' => true, 'preview-image-url' => DDL_ICONS_PNG_REL_PATH . 'widget_expand-image.png', 'register-scripts' => $widget_scripts, 'category' => __('Site elements', 'ddl-layouts')));
}
add_action('init', 'register_widget_cell_init');
/*
 * Callback function that returns the user interface for the cell dialog.
 * Notice that we are using 'text_data' for the input element name.
 * This can then be accessed during frontend render using
 * $cell_settings['text_data']
 */
function widget_cell_dialog_template_callback()
{
    if (!empty($GLOBALS['wp_widget_factory'])) {
        $widgets = $GLOBALS['wp_widget_factory']->widgets;
    } else {
        $widgets = array();
    }
    add_action('wp_ajax_get_widget_controls', 'widget_cell_get_controls');
    ob_start();
    ?>

		<?php 
    /*
<?php

/*
 * Menu cell.
 * Displays Bootstrap theme navigation menu.
 *
 */
if (ddl_has_feature('menu-cell') === false) {
    return;
}
if (!function_exists('register_menu_cell_init')) {
    function register_menu_cell_init()
    {
        if (function_exists('register_dd_layout_cell_type')) {
            register_dd_layout_cell_type('menu-cell', array('name' => __('Menu', 'ddl-layouts'), 'cell-image-url' => DDL_ICONS_SVG_REL_PATH . 'layouts-menu-cell.svg', 'description' => __('Display one of the WordPress menus that exist in your site.', 'ddl-layouts'), 'category' => __('Site elements', 'ddl-layouts'), 'button-text' => __('Assign menu cell', 'ddl-layouts'), 'dialog-title-create' => __('Create a new menu cell', 'ddl-layouts'), 'dialog-title-edit' => __('Edit menu cell', 'ddl-layouts'), 'dialog-template-callback' => 'menu_cell_dialog_template_callback', 'cell-content-callback' => 'menu_cell_content_callback', 'cell-template-callback' => 'menu_cell_template_callback', 'has_settings' => true, 'preview-image-url' => DDL_ICONS_PNG_REL_PATH . 'menu_expand-image.png'));
        }
    }
    add_action('init', 'register_menu_cell_init');
    function menu_cell_dialog_template_callback()
    {
        ob_start();
        ?>

		<div class="ddl-form">
			<p>
				<label for="<?php 
        the_ddl_name_attr('menu_name');
        ?>
"><?php 
        _e('Select menu', 'ddl-layouts');
        ?>