コード例 #1
0
 function shortcode_jw_sh_column_item($atts, $content)
 {
     extract(shortcode_atts(array('column_size' => '1 / 3', 'item_animation' => 'none', 'item_animation_offset' => 'bottom-in-view'), $atts));
     if (isMobile() && !jw_option('moblile_animation')) {
         $atts['item_animation'] = 'none';
     }
     $class = '';
     $animated = false;
     if (isset($atts['item_animation']) && $atts['item_animation'] !== 'none') {
         $animated = true;
         $class .= ' jw-animate-gen';
         $atts['item_animation_offset'] = isset($atts['item_animation_offset']) ? str_replace(' ', '', $atts['item_animation_offset']) : '';
         $atts['item_animation_offset'] = empty($atts['item_animation_offset']) ? 'bottom-in-view' : $atts['item_animation_offset'];
     }
     $output = '<div class="' . pbTextToFoundation($column_size) . ' ' . $class . '"' . ($animated ? ' data-gen="' . $atts['item_animation'] . '" data-gen-offset="' . $atts['item_animation_offset'] . '" style="opacity:0;"' : '') . '>';
     $output .= do_shortcode($content);
     $output .= '</div>';
     return $output;
 }
コード例 #2
0
 function pbGetContentBuilder()
 {
     global $post, $jw_startPrinted, $jw_pbItems;
     $endPrint = false;
     ob_start();
     $_pb_row_array = json_decode(rawUrlDecode(get_post_meta($post->ID, '_pb_content', true)), true);
     if (empty($_pb_row_array)) {
         return false;
     } else {
         $layoutsEcho = '';
         $prllx = false;
         foreach ($_pb_row_array as $_pb_row) {
             $rowContrast = isset($_pb_row['row_width']) ? ' ' . $_pb_row['row_width'] : '';
             $rowwidth = $_pb_row['row_width'] == 'inside' ? ' ' . $_pb_row['row_width'] : '100%';
             $containerTitle = isset($_pb_row['row_container_title']) ? ' ' . $_pb_row['row_container_title'] : '';
             $containerDesc = isset($_pb_row['row_container_desc']) ? ' ' . $_pb_row['row_container_desc'] : '';
             if (!empty($_pb_row['row_container_title'])) {
                 $ContainerTitleDivider = '<div class="bottomdivider clearfix"></div>';
                 $containerTitle = '<div class="container_title"><h1>' . $containerTitle . '</h1>' . $ContainerTitleDivider . '<p>' . $containerDesc . '</p></div>';
             } else {
                 $containerTitle = '';
             }
             $rowParallax = isset($_pb_row['background_prllx']) ? $_pb_row['background_prllx'] == 'true' ? ' bg-parallax' : '' : '';
             $rowCustomClass = !empty($_pb_row['row_custom_class']) ? $_pb_row['row_custom_class'] : '';
             $bgAttachment = !empty($rowParallax) ? 'fixed' : (isset($_pb_row['background_attachment']) ? $_pb_row['background_attachment'] : 'scroll');
             if (!$prllx) {
                 $prllx = !empty($rowParallax) ? true : false;
             }
             $class = $rowContrast . $rowParallax . ' ' . $rowCustomClass;
             $_pb_row['background_color'] = isset($_pb_row['background_color']) ? str_replace(' ', '', $_pb_row['background_color']) : '';
             $style = 'background-attachment:' . $bgAttachment . ';';
             $style .= empty($_pb_row['background_color']) ? '' : 'background-color:' . $_pb_row['background_color'] . ';';
             $style .= empty($_pb_row['background_image']) ? '' : 'background-image:url(' . $_pb_row['background_image'] . ');';
             $style .= empty($_pb_row['background_repeat']) ? '' : 'background-repeat:' . $_pb_row['background_repeat'] . ';';
             $style .= empty($_pb_row['background_position']) ? '' : 'background-position:' . $_pb_row['background_position'] . ';';
             $layoutsEcho .= '<div class="row-container' . $class . '" ' . (!empty($rowCustomClass) ? ' id="' . $rowCustomClass . '"' : '') . ' style="' . $style . '"><div class="container" style="width:' . $rowwidth . '">' . $containerTitle . '<div class="row">';
             foreach ($_pb_row['layouts'] as $_pb_layout) {
                 if ($_pb_layout['size'] !== 'size-0-0') {
                     global $jw_layoutSize;
                     $jw_layoutSize = $_pb_layout['size'];
                     $layoutsEcho .= '[jw_layout size="' . pbTextToFoundation($_pb_layout['size']) . '" layout_custom_class="' . (isset($_pb_layout['layout_custom_class']) ? $_pb_layout['layout_custom_class'] : '') . '"]';
                     $jw_startPrinted = false;
                     $colCounter = 0;
                     $start = 'true';
                     foreach ($_pb_layout['items'] as $item_array) {
                         list($colCounter, $start) = rowStart($colCounter, pbTextToFoundation($_pb_layout['size']) === 'span3' ? 12 : pbTextToInt($item_array['size']));
                         $endPrint = true;
                         $rowClass = $item_array['row-type'] = !empty($jw_pbItems[$item_array['slug']]['row-type']) ? $jw_pbItems[$item_array['slug']]['row-type'] : 'row-fluid';
                         if ($start === "true") {
                             if ($jw_startPrinted) {
                                 $layoutsEcho .= '</div>';
                             }
                             $jw_startPrinted = true;
                             $layoutsEcho .= '<div class="' . $rowClass . '">';
                         }
                         $layoutsEcho .= pbGetContentBuilderItem($item_array);
                     }
                     if ($jw_startPrinted) {
                         $layoutsEcho .= '</div>';
                     }
                     $layoutsEcho .= '[/jw_layout]';
                 }
             }
             $layoutsEcho .= '</div></div></div>';
         }
         if ($prllx) {
             add_action('wp_footer', 'jw_parallax_script');
         }
         if ($endPrint) {
             echo $layoutsEcho;
         } else {
             return false;
         }
     }
     $output = ob_get_clean();
     return $output;
 }