function block_callback($instance)
 {
     $instance = is_array($instance) ? wp_parse_args($instance, $this->block_options) : $this->block_options;
     extract($instance);
     $col_order = $order;
     $col_size = 6;
     //column block header
     if (isset($template_id)) {
         $this->before_block($instance);
         //define vars
         $overgrid = 0;
         $span = 0;
         $first = false;
         //check if column has blocks inside it
         $blocks = aq_get_blocks($template_id);
         //outputs the blocks
         if ($blocks) {
             foreach ($blocks as $key => $child) {
                 global $aq_registered_blocks;
                 extract($child);
                 if (class_exists($id_base)) {
                     //get the block object
                     $block = $aq_registered_blocks[$id_base];
                     //insert template_id into $child
                     $child['template_id'] = $template_id;
                     //display the block
                     if ($parent == $col_order) {
                         $child_col_size = absint(preg_replace("/[^0-9]/", '', $size));
                         $overgrid = $span + $child_col_size;
                         if ($overgrid > $col_size || $span == $col_size || $span == 0) {
                             $span = 0;
                             $first = true;
                         }
                         if ($first == true) {
                             $child['first'] = true;
                         }
                         $block->block_callback($child);
                         $span = $span + $child_col_size;
                         $overgrid = 0;
                         //reset $overgrid
                         $first = false;
                         //reset $first
                     }
                 }
             }
         }
         $this->after_block($instance);
     } else {
         //show nothing
     }
 }
Exemple #2
0
    function block_callback($instance)
    {
        $instance = is_array($instance) ? wp_parse_args($instance, $this->block_options) : $this->block_options;
        extract($instance);
        $col_order = $order;
        $col_size = absint(preg_replace("/[^0-9]/", '', $size));
        //column block header
        if (isset($template_id)) {
            if ('1' == $thin_column) {
                $before_thin_column = '<div class="col-md-8 col-md-offset-2 col-sm-10 col-sm-offset-1">';
                $after_thin_column = '</div>';
            } else {
                $before_thin_column = $after_thin_column = false;
            }
            echo '<a href="#" id="' . ebor_sanitize_title($title) . '" class="in-page-link"></a>';
            if ($type == 'image') {
                echo '<section class="aq-block image-divider overlay">
					      <div class="background-image-holder parallax-background">
					          <img class="background-image" alt="Background Image" src="' . $image . '">
					      </div>
					      
					      <div class="container">
					          <div class="row">';
            } elseif ($type == 'image-left') {
                echo '<section class="side-image text-heavy clearfix dark-wrapper">
					<div class="image-container col-md-5 col-sm-3 pull-left">
						<div class="background-image-holder">
							<img class="background-image" alt="Background Image" src="' . $image . '">
						</div>
					</div>
					
					<div class="container">
						<div class="row">
						    <div class="col-md-6 col-md-offset-6 col-sm-8 col-sm-offset-4 content clearfix">
						    	<div class="row">';
            } elseif ($type == 'image-right') {
                echo '<section class="side-image text-heavy clearfix dark-wrapper">
					<div class="image-container col-md-5 col-sm-3 pull-right">
						<div class="background-image-holder">
							<img class="background-image" alt="Background Image" src="' . $image . '">
						</div>
					</div>
					
					  <div class="container">
						  <div class="row">
						      <div class="col-md-6 content col-sm-8 clearfix">
						    	  <div class="row">';
            } else {
                echo '<section class="aq-block ' . $type . '"><div class="container"><div class="row">';
            }
            echo $before_thin_column;
            //define vars
            $overgrid = 0;
            $span = 0;
            $first = false;
            $next_block_size = 0;
            $next_overgrid = 0;
            $blocks = aq_get_blocks($template_id);
            $block_count = count($blocks);
            // Add block counts to help detect last block
            //outputs the blocks
            if ($blocks) {
                foreach ($blocks as $key => $child) {
                    global $aq_registered_blocks;
                    extract($child);
                    if (class_exists($id_base)) {
                        //get the block object
                        $block = $aq_registered_blocks[$id_base];
                        //insert template_id into $child
                        $child['template_id'] = $template_id;
                        //display the block
                        if ($parent == $col_order) {
                            $col_size = absint(preg_replace("/[^0-9]/", '', $size));
                            $overgrid = $span + $col_size;
                            if ($overgrid > 12 || $span == 12 || $span == 0) {
                                $span = 0;
                                $first = true;
                            }
                            if ($first == true) {
                                $child['first'] = true;
                            }
                            $span = $span + $col_size;
                            // Move here
                            if (isset($blocks['aq_block_' . ($number + 1)])) {
                                $next_block_size = $blocks['aq_block_' . ($number + 1)]['size'];
                                // Get next block size
                                $next_block_size = absint(preg_replace("/[^0-9]/", '', $next_block_size));
                                //Convert to int
                                $next_overgrid = $span + $next_block_size;
                                // Workout over grid for next block
                                if ($next_overgrid > 12 || $span == 12 || $number == $block_count) {
                                    $child['last'] = true;
                                }
                            } else {
                                $child['last'] = true;
                            }
                            $block->block_callback($child);
                            $next_block_size = 0;
                            // Reset $next_block_size;
                            $next_overgrid = 0;
                            //$next_overgrid
                            $overgrid = 0;
                            //reset $overgrid
                            $first = false;
                            //reset $first
                        }
                    }
                }
            }
            echo $after_thin_column;
            if ('image-left' == $type || 'image-right' == $type) {
                echo '</div></div></div></div></section>';
            } else {
                echo '</div></div></section>';
            }
        } else {
            //show nothin_columng
        }
    }
        /**
         * Preview template
         *
         * Theme authors should attempt to make the preview
         * layout to be consistent with their themes by using
         * the filter provided in the function
         *
         * @since	1.0.0
         */
        function preview_template()
        {
            global $wp_query, $aq_page_builder;
            $post_type = $wp_query->query_vars['post_type'];
            if ($post_type == 'template') {
                get_header();
                ?>
					<div id="main" class="cf">
						<div id="content" class="cf">
							<?php 
                $this->display_template(get_the_ID());
                ?>
							<?php 
                if ($this->args['debug'] == true) {
                    print_r(aq_get_blocks(get_the_ID()));
                }
                ?>
						</div>
					</div>
				<?php 
                get_footer();
                exit;
            }
        }
Exemple #4
0
    function block_callback($instance)
    {
        $instance = is_array($instance) ? wp_parse_args($instance, $this->block_options) : $this->block_options;
        extract($instance);
        if (!isset($mb)) {
            $mb = '58';
        }
        if ($mb == '') {
            $mb = '58';
        }
        $col_order = $order;
        $col_size = absint(preg_replace("/[^0-9]/", '', $size));
        global $post;
        $post_id = $post->ID;
        $cb4_post_blocks = get_post_meta($post_id, 'blocks');
        //column block header
        if (isset($template_id)) {
            $rando = rand();
            if (!isset($tint)) {
                $tint = '';
            }
            if (!isset($fixed_back_img)) {
                $fixed_back_img = '';
            }
            if (!isset($onepage)) {
                $onepage = '';
            }
            if (!isset($stretch_back_img)) {
                $stretch_back_img = '';
            }
            if (!isset($mt)) {
                $mt = '';
            }
            if (!isset($color)) {
                $color = '';
            }
            if (!isset($image)) {
                $image = '';
            }
            if (!isset($h)) {
                $h = '';
            }
            if (!isset($css)) {
                $css = '';
            }
            if (!isset($pt)) {
                $pt = '88';
            }
            if (!isset($pb)) {
                $pb = '38';
            }
            if ($pt == '') {
                $pt = '88';
            }
            if ($pb == '') {
                $pb = '38';
            }
            if ($h != '') {
                $wys = 'height:' . $h . 'px;';
            } else {
                $wys = '';
            }
            if ($h != '') {
                $hc_pos = 'position:static;';
                $hc_abs = 'style="position:absolute;left:0;"';
            } else {
                $hc_pos = '';
                $hc_abs = '';
            }
            $img = '';
            $stretch = '';
            if ($h != '') {
                $tint_h = 'style="height:' . $h . 'px;"';
            } else {
                $tint_h = '';
            }
            if ($tint != 'no' && $tint != '') {
                $tinty = '<div class="fullbg_tint tint_' . $tint . '" ' . $tint_h . '></div>';
            } else {
                $tinty = '';
            }
            if ($tint != 'no' && $tint != '') {
                $tints = 'fullbg_tints';
            } else {
                $tints = '';
            }
            $isimg = '';
            if ($fixed_back_img == 'yes') {
                $fixy = 'background-attachment:fixed;';
            }
            if ($onepage != '') {
                $onepage = '<div id="' . $onepage . '" class="onepage"></div>';
            }
            if ($show_back_img == 'yes') {
                $isimg = 'haveimage ';
            }
            if ($mt == '') {
                $mt = '0';
            }
            if ($stretch_back_img == 'yes') {
                $stretch = 'background-image:url(\'' . $image . '\')!important;background-size:100%; ' . $fixy . ' background-position:center top!important;';
            }
            $fullbgspacer = '<div class="fullbgspacer ' . $isimg . $tints . ' fullbg-' . $color . '" style="' . $wys . $stretch . '" ></div>';
            echo '<div class="cl"></div>' . $onepage . '<div class="aq-block aq-block-ful ' . $css . '" style="' . $wys . 'margin-bottom:' . $mb . 'px;margin-top:' . $mt . 'px;' . $hc_pos . '">' . $fullbgspacer . '<div class="fullwimage fullbg ' . $tints . ' fullbg-' . $color . '" id="fullwbimage-' . $rando . '" ' . $hc_abs . '><div class="cl"></div><div class="wrapper_p"><div class="fbgin" style="padding-top:' . $pt . 'px;padding-bottom:' . $pb . 'px;">';
            if ($image != '' && $show_back_img == 'yes' && $stretch == '') {
                echo '
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery("#fullwbimage-' . $rando . '").backstretch("' . $image . '");
});
</script>';
            }
            $this->before_block($instance);
            //define vars
            $overgrid = 0;
            $span = 0;
            $first = false;
            //check if column has blocks inside it
            if ($template_id != 0) {
                $blocks = aq_get_blocks($template_id);
            } else {
                $blocks = $cb4_post_blocks[0];
            }
            //outputs the blocks
            if ($blocks) {
                foreach ($blocks as $key => $child) {
                    global $aq_registered_blocks;
                    extract($child);
                    if (class_exists($id_base)) {
                        //get the block object
                        $block = $aq_registered_blocks[$id_base];
                        //insert template_id into $child
                        $child['template_id'] = $template_id;
                        //display the block
                        if ($parent == $col_order) {
                            $child_col_size = absint(preg_replace("/[^0-9]/", '', $size));
                            $overgrid = $span + $child_col_size;
                            if ($overgrid > $col_size || $span == $col_size || $span == 0) {
                                $span = 0;
                                $first = true;
                            }
                            if ($first == true) {
                                $child['first'] = true;
                            }
                            $block->block_callback($child);
                            $span = $span + $child_col_size;
                            $overgrid = 0;
                            //reset $overgrid
                            $first = false;
                            //reset $first
                        }
                    }
                }
            }
            $this->after_block($instance);
            echo $tinty . '</div></div></div>';
            echo '<div class="cl" style="' . $wys . '"></div></div>';
        } else {
            //show nothing
        }
    }
Exemple #5
0
 function block_callback($instance)
 {
     $instance = is_array($instance) ? wp_parse_args($instance, $this->block_options) : $this->block_options;
     extract($instance);
     $col_order = $order;
     $col_size = absint(preg_replace("/[^0-9]/", '', $size));
     //column block header
     if (isset($template_id)) {
         if ($type == 'image') {
             echo '<div id="' . ebor_sanitize_title($title) . '" class="parallax" style="background-image: url(' . $image . ');"><div class="container inner"><div class="row">';
         } else {
             echo '<div id="' . ebor_sanitize_title($title) . '" class="' . $type . '"><div class="container inner"><div class="row">';
         }
         //define vars
         $overgrid = 0;
         $span = 0;
         $first = false;
         //check if column has blocks inside it
         $blocks = aq_get_blocks($template_id);
         //outputs the blocks
         if ($blocks) {
             foreach ($blocks as $key => $child) {
                 global $aq_registered_blocks;
                 extract($child);
                 if (class_exists($id_base)) {
                     //get the block object
                     $block = $aq_registered_blocks[$id_base];
                     //insert template_id into $child
                     $child['template_id'] = $template_id;
                     //display the block
                     if ($parent == $col_order) {
                         $child_col_size = absint(preg_replace("/[^0-9]/", '', $size));
                         $overgrid = $span + $child_col_size;
                         if ($overgrid > $col_size || $span == $col_size || $span == 0) {
                             $span = 0;
                             $first = true;
                         }
                         if ($first == true) {
                             $child['first'] = true;
                         }
                         $block->block_callback($child);
                         $span = $span + $child_col_size;
                         $overgrid = 0;
                         //reset $overgrid
                         $first = false;
                         //reset $first
                     }
                 }
             }
         }
         echo '</div></div></div>';
     } else {
         //show nothing
     }
 }
Exemple #6
0
 function block_callback($instance)
 {
     $instance = is_array($instance) ? wp_parse_args($instance, $this->block_options) : $this->block_options;
     extract($instance);
     $col_order = $order;
     $col_size = absint(preg_replace("/[^0-9]/", '', $size));
     //column block header
     if (isset($template_id)) {
         $column_class = $first ? 'aq-first' : '';
         $userclass = !empty($userclass) ? ' ' . esc_attr($userclass) . '"' : '';
         $style = !empty($style) ? ' style="' . esc_attr($style) . '"' : '';
         echo '<div id="aq-block-' . $number . '" class="aq-block aq-block-' . $id_base . ' ' . $size . ' ' . $column_class . ' well cf' . $userclass . '"' . $style . '>';
         //define vars
         $overgrid = 0;
         $span = 0;
         $first = false;
         //check if column has blocks inside it
         $blocks = aq_get_blocks($template_id);
         //outputs the blocks
         if ($blocks) {
             foreach ($blocks as $key => $child) {
                 global $aq_registered_blocks;
                 extract($child);
                 if (class_exists($id_base)) {
                     //get the block object
                     $block = $aq_registered_blocks[$id_base];
                     //insert template_id into $child
                     $child['template_id'] = $template_id;
                     //display the block
                     if ($parent == $col_order) {
                         $child_col_size = absint(preg_replace("/[^0-9]/", '', $size));
                         $overgrid = $span + $child_col_size;
                         if ($overgrid > $col_size || $span == $col_size || $span == 0) {
                             $span = 0;
                             $first = true;
                         }
                         if ($first == true) {
                             $child['first'] = true;
                         }
                         $block->block_callback($child);
                         $span = $span + $child_col_size;
                         $overgrid = 0;
                         //reset $overgrid
                         $first = false;
                         //reset $first
                     }
                 }
             }
         }
         $this->after_block($instance);
     } else {
         //show nothing
     }
 }