Example #1
0
 /**
  * PRINT Muffin Builder
  * 
  * @param int $post_id
  * @param bool $content_field
  */
 function mfn_builder_print($post_id, $content_field = false)
 {
     // Sizes for Items
     $classes = array('divider' => 'divider', '1/6' => 'one-sixth', '1/5' => 'one-fifth', '1/4' => 'one-fourth', '1/3' => 'one-third', '2/5' => 'two-fifth', '1/2' => 'one-second', '3/5' => 'three-fifth', '2/3' => 'two-third', '3/4' => 'three-fourth', '4/5' => 'four-fifth', '5/6' => 'five-sixth', '1/1' => 'one');
     // Sidebars list
     $sidebars = mfn_opts_get('sidebars');
     // $mfn_items | Wraps with Items => Sections ------------------------------------
     $mfn_items = get_post_meta($post_id, 'mfn-page-items', true);
     // FIX | Muffin Builder 2.0 Compatibility
     if ($mfn_items && !is_array($mfn_items)) {
         $mfn_items = unserialize(base64_decode($mfn_items));
     }
     // WordPress Editor Content ---------------------------------
     if (mfn_opts_get('display-order') == 1) {
         mfn_builder_print_content($post_id, $content_field);
     }
     // Content Builder -------------------------------------
     if (post_password_required()) {
         // prevents duplication of the password form
         if (get_post_meta($post_id, 'mfn-post-hide-content', true)) {
             echo '<div class="section the_content">';
             echo '<div class="section_wrapper">';
             echo '<div class="the_content_wrapper">';
             echo get_the_password_form();
             echo '</div>';
             echo '</div>';
             echo '</div>';
         }
     } elseif (is_array($mfn_items)) {
         // Sections
         foreach ($mfn_items as $section) {
             // 				print_r($section['attr']);
             // Hide
             if ($_GET && key_exists('mfn-show', $_GET)) {
                 // do nothing
             } elseif (key_exists('hide', $section['attr']) && $section['attr']['hide']) {
                 continue;
             }
             // section attributes -----------------------------------
             // classes ------------------------
             $section_class = array();
             $section_class[] = $section['attr']['style'];
             $section_class[] = $section['attr']['class'];
             if (key_exists('visibility', $section['attr'])) {
                 $section_class[] = $section['attr']['visibility'];
             }
             if (key_exists('bg_video_mp4', $section['attr']) && $section['attr']['bg_video_mp4']) {
                 $section_class[] = 'has-video';
             }
             if (key_exists('navigation', $section['attr']) && $section['attr']['navigation']) {
                 $section_class[] = 'has-navi';
             }
             $section_class = implode(' ', $section_class);
             // styles -----------------------------------------------------
             $section_style = $section_bg = array();
             $section_style[] = 'padding-top:' . intval($section['attr']['padding_top']) . 'px';
             $section_style[] = 'padding-bottom:' . intval($section['attr']['padding_bottom']) . 'px';
             $section_style[] = 'background-color:' . $section['attr']['bg_color'];
             // background image attributes ------------
             if ($section['attr']['bg_image']) {
                 $section_bg_attr = explode(';', $section['attr']['bg_position']);
                 $section_bg['image'] = 'background-image:url(' . $section['attr']['bg_image'] . ')';
                 $section_bg['repeat'] = 'background-repeat:' . $section_bg_attr[0];
                 $section_bg['position'] = 'background-position:' . $section_bg_attr[1];
                 $section_bg['attachment'] = 'background-attachment:' . $section_bg_attr[2];
                 $section_bg['size'] = 'background-size:' . $section_bg_attr[3];
                 $section_bg['webkit-size'] = '-webkit-background-size:' . $section_bg_attr[3];
             }
             // parallax -------------------------------
             $parallax = false;
             if ($section['attr']['bg_image'] && $section_bg_attr[2] == 'fixed') {
                 if (!key_exists(4, $section_bg_attr) || $section_bg_attr[4] != 'still') {
                     $parallax = mfn_parallax_data();
                     if (mfn_parallax_plugin() == 'translate3d') {
                         if (wp_is_mobile()) {
                             $section_bg['attachment'] = 'background-attachment:scroll';
                         } else {
                             $section_bg = array();
                         }
                     }
                 }
             }
             $section_style = array_merge($section_style, $section_bg);
             $section_style = implode('; ', $section_style);
             // IDs --------------------------------------------------------
             if (key_exists('section_id', $section['attr']) && $section['attr']['section_id']) {
                 $section_id = 'id="' . $section['attr']['section_id'] . '"';
             } else {
                 $section_id = false;
             }
             // print ------------------------------------------------
             echo '<div class="section mcb-section ' . $section_class . '" ' . $section_id . ' style="' . $section_style . '" ' . $parallax . '>';
             // 100%
             // parallax | translate3d -------
             if (!wp_is_mobile() && $parallax && mfn_parallax_plugin() == 'translate3d') {
                 echo '<img class="mfn-parallax" src="' . $section['attr']['bg_image'] . '" alt="' . __('parallax background', 'betheme') . '"/>';
             }
             // video ----------
             if (key_exists('bg_video_mp4', $section['attr']) && ($mp4 = $section['attr']['bg_video_mp4'])) {
                 echo '<div class="section_video">';
                 echo '<div class="mask"></div>';
                 $poster = $section['attr']['bg_image'];
                 echo '<video poster="' . $poster . '" controls="controls" muted="muted" preload="auto" loop="true" autoplay="true">';
                 echo '<source type="video/mp4" src="' . $mp4 . '" />';
                 if (key_exists('bg_video_ogv', $section['attr']) && ($ogv = $section['attr']['bg_video_ogv'])) {
                     echo '<source type="video/ogg" src="' . $ogv . '" />';
                 }
                 echo '<object width="1900" height="1060" type="application/x-shockwave-flash" data="' . THEME_URI . '/js/flashmediaelement.swf">';
                 echo '<param name="movie" value="' . THEME_URI . '/js/flashmediaelement.swf" />';
                 echo '<param name="flashvars" value="controls=true&file=' . $mp4 . '" />';
                 echo '<img src="' . $poster . '" title="No video playback capabilities" />';
                 echo '</object>';
                 echo '</video>';
                 echo '</div>';
             }
             // Separator ------------------------
             if (key_exists('divider', $section['attr']) && ($divider = $section['attr']['divider'])) {
                 echo '<div class="section-divider ' . $divider . '"></div>';
             }
             // Navigation ------------------------
             if (key_exists('navigation', $section['attr']) && ($divider = $section['attr']['navigation'])) {
                 echo '<div class="section-nav prev"><i class="icon-up-open"></i></div>';
                 echo '<div class="section-nav next"><i class="icon-down-open"></i></div>';
             }
             echo '<div class="section_wrapper mcb-section-inner">';
             // WIDTH + margin: 0 auto
             // Wraps --------------------------------------------------------
             // FIX | Muffin Builder 2.0 Compatibility
             if (!key_exists('wraps', $section) && is_array($section['items'])) {
                 $fix_wrap = array('size' => '1/1', 'items' => $section['items']);
                 $section['wraps'] = array($fix_wrap);
             }
             if (key_exists('wraps', $section) && is_array($section['wraps'])) {
                 foreach ($section['wraps'] as $wrap) {
                     $wrap_class = array();
                     // size of wrap
                     $wrap_class[] = $classes[$wrap['size']];
                     // Wrap | Attributes --------------------------
                     // Wrap | Classes -------------------
                     if (key_exists('attr', $wrap)) {
                         $wrap_class[] = $wrap['attr']['class'];
                         if ($wrap['attr']['column_margin']) {
                             $wrap_class[] = 'column-margin-' . $wrap['attr']['column_margin'];
                         }
                     }
                     $wrap_class = implode(' ', $wrap_class);
                     // Wrap | Styles -------------------
                     $wrap_style = $wrap_bg = array();
                     if (key_exists('attr', $wrap)) {
                         $wrap_style[] = 'padding:' . $wrap['attr']['padding'];
                         $wrap_style[] = 'background-color:' . $wrap['attr']['bg_color'];
                         // background image attributes
                         if ($wrap['attr']['bg_image']) {
                             $wrap_bg_attr = explode(';', $wrap['attr']['bg_position']);
                             $wrap_bg[] = 'background-image:url(' . $wrap['attr']['bg_image'] . ')';
                             $wrap_bg[] = 'background-repeat:' . $wrap_bg_attr[0];
                             $wrap_bg[] = 'background-position:' . $wrap_bg_attr[1];
                             $wrap_bg[] = 'background-attachment:' . $wrap_bg_attr[2];
                             $wrap_bg[] = 'background-size:' . $wrap_bg_attr[3];
                             $wrap_bg[] = '-webkit-background-size:' . $wrap_bg_attr[3];
                         }
                         // parallax -------------------------
                         $parallax = false;
                         if ($wrap['attr']['bg_image'] && $wrap_bg_attr[2] == 'fixed') {
                             if (!key_exists(4, $wrap_bg_attr) || $wrap_bg_attr[4] != 'still') {
                                 $parallax = mfn_parallax_data();
                                 if (mfn_parallax_plugin() == 'translate3d') {
                                     if (wp_is_mobile()) {
                                         $wrap_bg['attachment'] = 'background-attachment:scroll';
                                     } else {
                                         $wrap_bg = array();
                                     }
                                 }
                             }
                         }
                     }
                     $wrap_style = array_merge($wrap_style, $wrap_bg);
                     $wrap_style = implode('; ', $wrap_style);
                     // Wrap | Print -------------------------------
                     echo '<div class="wrap mcb-wrap ' . $wrap_class . ' clearfix" style="' . $wrap_style . '" ' . $parallax . '>';
                     // parallax | translate3d -------
                     if (!wp_is_mobile() && $parallax && mfn_parallax_plugin() == 'translate3d') {
                         echo '<img class="mfn-parallax" src="' . $section['attr']['bg_image'] . '" alt="' . __('parallax background', 'betheme') . '"/>';
                     }
                     // Items --------------------------------------------
                     if (is_array($wrap['items'])) {
                         foreach ($wrap['items'] as $item) {
                             if (function_exists('mfn_print_' . $item['type'])) {
                                 // Item | Size
                                 $class = $classes[$item['size']];
                                 // Item | Type
                                 $class .= ' column_' . $item['type'];
                                 // Item | Custom Classes
                                 if (isset($item['fields']['classes'])) {
                                     $class .= ' ' . $item['fields']['classes'];
                                 }
                                 // Column | Margin Bottom
                                 if ($item['type'] == 'column' && isset($item['fields']['margin_bottom'])) {
                                     $class .= ' column-margin-' . $item['fields']['margin_bottom'];
                                 }
                                 // Print
                                 echo '<div class="column mcb-column ' . $class . '">';
                                 call_user_func('mfn_print_' . $item['type'], $item);
                                 echo '</div>';
                             }
                         }
                     }
                     echo '</div>';
                 }
             }
             echo '</div>';
             echo '</div>';
         }
     }
     // WordPress Editor Content -------------------------------------
     if (mfn_opts_get('display-order') == 0) {
         mfn_builder_print_content($post_id, $content_field);
     }
 }
 function mfn_parallax_data()
 {
     $parallax = mfn_parallax_plugin();
     if ($parallax == 'translate3d') {
         $parallax = 'data-parallax="3d"';
     } elseif ($parallax == 'stellar') {
         $parallax = 'data-stellar-background-ratio="0.5"';
     } else {
         $parallax = 'data-enllax-ratio="-0.3"';
     }
     return $parallax;
 }
Example #3
0
 function mfn_scripts_config()
 {
     echo '<!-- script | dynamic -->' . "\n";
     echo '<script id="mfn-dnmc-config-js">' . "\n";
     echo '//<![CDATA[' . "\n";
     // ajax
     echo 'window.mfn_ajax = "' . admin_url('admin-ajax.php') . '";' . "\n";
     // mobile menu initial width
     echo 'window.mfn_mobile_init = ' . mfn_opts_get('mobile-menu-initial', 1240) . ';' . "\n";
     // nice scroll
     echo 'window.mfn_nicescroll = ' . mfn_opts_get('nice-scroll-speed', 40) . ';' . "\n";
     // parallax
     echo 'window.mfn_parallax = "' . mfn_parallax_plugin() . '";' . "\n";
     // prettyphoto
     $aPrettyOptions = mfn_opts_get('prettyphoto-options');
     echo 'window.mfn_prettyphoto = {';
     if (is_array($aPrettyOptions) && isset($aPrettyOptions['disable'])) {
         echo 'disable:true, ';
     }
     if (is_array($aPrettyOptions) && isset($aPrettyOptions['disable-mobile'])) {
         echo 'disableMobile:true, ';
     }
     if (is_array($aPrettyOptions) && isset($aPrettyOptions['title'])) {
         echo 'title:true, ';
     }
     echo 'style:"' . mfn_opts_get('prettyphoto', 'pp_default') . '", ';
     echo 'width:' . intval(mfn_opts_get('prettyphoto-width', 0)) . ', ';
     echo 'height:' . intval(mfn_opts_get('prettyphoto-height', 0));
     echo '};' . "\n";
     // sliders
     echo 'window.mfn_sliders = {';
     echo 'blog:' . intval(mfn_opts_get('slider-blog-timeout', 0)) . ', ';
     echo 'clients:' . intval(mfn_opts_get('slider-clients-timeout', 0)) . ', ';
     echo 'offer:' . intval(mfn_opts_get('slider-offer-timeout', 0)) . ', ';
     echo 'portfolio:' . intval(mfn_opts_get('slider-portfolio-timeout', 0)) . ', ';
     echo 'shop:' . intval(mfn_opts_get('slider-shop-timeout', 0)) . ', ';
     echo 'slider:' . intval(mfn_opts_get('slider-slider-timeout', 0)) . ', ';
     echo 'testimonials:' . intval(mfn_opts_get('slider-testimonials-timeout', 0));
     echo '};' . "\n";
     // retina.js
     echo 'window.mfn_retina_disable = ' . intval(mfn_opts_get('retina-js-disable', 0)) . ';' . "\n";
     echo '//]]>' . "\n";
     echo '</script>' . "\n";
 }