function output($section_name, $config, $options, $return = false) { $styles = $this->_get_styles($section_name, $config); $type = op_get_var($options, 'type'); $before = op_get_var($config, 'before'); $after = op_get_var($config, 'after'); //If featured area contains load video/audio related JS. switch ($options['type']) { case 'video_optin': case 'video_content': op_video_player_script(); break; } if (!empty($type) && isset($styles[$type]) && isset($options[$type])) { $style = $styles[$type]; if (isset($style['config'])) { extract($style['config']); } $options = $options[$type]; $content_done = $button_done = false; $content_options = array(); array_push($section_name, $type); $feature_content = array(); $used_content = $used_button = ''; foreach ($style['options'] as $option_name => $option) { $tmp_content = ''; if (isset($option['display_action'])) { $tmp_content = call_user_func_array($option['display_action'], array($section_name, $config)); } elseif (isset($option['module'])) { $mod_config = op_get_var($option, 'mod_options', array()); $mod_options = op_get_var($options, $option_name, array()); if (isset($option['use_content']) && isset($style['options'][$option['use_content']])) { $used_content = $option['use_content']; $content_config = op_get_var($style['options'][$option['use_content']], 'mod_options', array()); $content_opts = op_get_var($options, $option['use_content'], array()); $content_options = op_mod('content_fields')->output(array($section_name, $option['use_content']), $content_config, $content_opts, true); $mod_config['content_fields'] = op_get_var($content_config, 'fields', array()); if (isset($mod_config['disable'])) { $mod_config['disable'] = str_replace('content', '', $mod_config['disable']); } $content_done = true; $mod_options['content'] = $content_options; } if (isset($option['use_button']) && isset($style['options'][$option['use_button']])) { $used_button = $option['use_button']; $button_opts = op_get_var($options, $used_button, array()); $button_done = true; $mod_options['submit_button'] = op_mod('submit_button')->output(array($section_name, $used_button), array(), $button_opts, true); } if (!($option_name == $used_content && $content_done === true) && !($option_name == $used_button && $button_done === true)) { $tmp_content = op_mod($option['module'])->output(array($section_name, $option_name), $mod_config, $mod_options, true); $content = ''; if (is_array($tmp_content)) { if (count($tmp_content) > 0) { if ($option['module'] == 'content_fields') { $tmp_content = array('content' => $tmp_content); } if (isset($option['template'])) { if (is_array($option['template'])) { if (is_object($option['template'][0])) { if (is_callable($option['template'])) { $content = call_user_func_array($option['template'], array($tmp_content)); } } else { $content = op_tpl($option['template'][0], $tmp_content, $option['template'][1]); } } else { if (is_callable($option['template'])) { $content = call_user_func_array($option['template'], array($tmp_content)); } else { $content = $this->load_tpl('output/' . $option['template'], $tmp_content); } } } else { $content = $this->load_tpl('output/' . $option['module'], $tmp_content); } } } else { $content = $tmp_content; } $feature_content[] = $content; } } } $out = $before . implode('', $feature_content) . $after; if ($return) { return $out; } echo $out; } }
static function _print_front_scripts($return = false) { $keys = array_keys(self::$used_items); $js = array(); foreach ($keys as $asset) { if ($asset == 'content_toggle') { $js[] = "\$('.toggle-panel > .toggle-panel-toggle-text').click(function(e){\n \$(this).parent().find('.toggle-panel-toggle').trigger('click');\n e.preventDefault();\n});\n\$('.toggle-panel-toggle').click(function(e){\n var \$t = \$(this), p = \$t.parent(), content = p.find('> .toggle-panel-content'), f1 = 'addClass', f2 = 'removeClass', f3 = 'show', f4 = 'hide', t = '-';\n \$(window).trigger('content-toggle', p);\n if(content.is(':visible')){\n f1 = 'removeClass';\n f2 = 'addClass';\n f3 = 'hide';\n f4 = 'show';\n t = '+';\n }\n p[f1]('panel-open')[f2]('panel-closed').find('.toggle-hide')[f3]().end().find('.toggle-show')[f4]().end().find('.toggle-panel-toggle').html('<span>'+t+'</span>').parent().find('.toggle-panel-content')[f3]();\n e.preventDefault();\n});"; } elseif ($asset == 'tabs') { $js[] = "\$('.tabbed-panel .tabs li a').click(function(e){\n var li = \$(this).parent(), ul = li.parent(), idx = ul.find('li').index(li), panel = ul.parent();\n panel.find('> .tab-content-container').find('> .tab-content').hide().end().find('> .tab-content:eq('+idx+')').show();\n ul.find('.selected').removeClass('selected');\n li.addClass('selected');\n e.preventDefault();\n});" . (defined('OP_AJAX_SHORTCODE') ? "\nop_cur_html.find(" : "\$(") . "'.tabbed-panel .tabs li:first-child a').click();"; } elseif ($asset == 'terms_conditions' && !defined('OP_LIVEEDITOR')) { $js[] = "\$('.terms_conditions :checkbox').change(function(){\n var opac = 1, func = 'hide', p = \$(this).closest('.terms_conditions'), el = p.find('.terms_overlay'), c = p.find('.terms_content *:not(.terms_overlay)');\n if(!\$(this).is(':checked')){\n opac = 0.3;\n func = 'show';\n }\n el[func]();\n c.animate({opacity:opac},500);\n}).trigger('change');"; } } if (count(self::$delayed_timers) > 0) { $str = ''; foreach (self::$delayed_timers as $id => $time) { $str .= "setTimeout(function(){\$('#" . $id . "').animate({opacity: 1.0});}," . $time . ");\$('#" . $id . "').css({opacity: 0.0, visibility: 'visible'});"; } $js[] = $str; } //if(isset(self::$element_count['delayed_content']) && self::$element_count $out = ''; if (!defined('OP_LIVEEDITOR')) { if (self::$add_pretty_photo === true) { op_video_player_script(); wp_enqueue_script(OP_SN . '-prettyphoto', OP_JS . 'prettyphoto/jquery.prettyPhoto' . OP_SCRIPT_DEBUG . '.js', array(OP_SN . 'flowplayerhtml5'), OP_VERSION); wp_enqueue_style(OP_SN . '-prettyphoto', OP_JS . 'prettyphoto/prettyPhoto' . OP_SCRIPT_DEBUG . '.css', false, OP_VERSION); } } $js = apply_filters('op_asset_js', $js); if (count($js) > 0) { $out .= ' <script type="text/javascript"> ;(function($){ ' . implode("\n", $js) . ' })(opjq); </script> '; } if ($return) { return $out; } echo $out; }