/** * {@inheritdoc} */ public function frontend_render(array $item, $input_value) { $options = $item['options']; $attr = array('name' => $item['shortcode'], 'placeholder' => $options['placeholder'], 'id' => 'id-' . fw_unique_increment()); if ($options['required']) { $attr['required'] = 'required'; } if (!empty($options['constraints']['constraint'])) { $constraint = $options['constraints']['constraint']; $constraint_data = $options['constraints'][$constraint]; switch ($constraint) { case 'characters': case 'words': if ($constraint_data['min'] || $constraint_data['max']) { $attr['data-constraint'] = json_encode(array('type' => $constraint, 'data' => $constraint_data)); } if ($constraint == 'characters' && $constraint_data['max']) { $attr['maxlength'] = $constraint_data['max']; } break; default: trigger_error('Unknown constraint: ' . $constraint, E_USER_WARNING); } } return fw_render_view($this->locate_path('/views/view.php', dirname(__FILE__) . '/view.php'), array('item' => $item, 'attr' => $attr, 'value' => is_null($input_value) ? $options['default_value'] : $input_value)); }
/** * {@inheritdoc} */ public function frontend_render(array $item, $input_value) { $options = $item['options']; $attr = array('type' => 'text', 'name' => $item['shortcode'], 'placeholder' => $options['placeholder'], 'value' => is_null($input_value) ? '' : $input_value, 'id' => 'id-' . fw_unique_increment()); if ($options['required']) { $attr['required'] = 'required'; } return fw_render_view($this->locate_path('/views/view.php', dirname(__FILE__) . '/view.php'), array('item' => $item, 'attr' => $attr)); }
/** * {@inheritdoc} */ public function frontend_render(array $item, $input_value) { $options = $item['options']; $value = (string) $input_value; $choices = array(); foreach ($options['choices'] as $choice) { $attr = array('value' => $choice); if ($choice === $value) { $attr['selected'] = 'selected'; } $choices[] = $attr; } if ($options['randomize']) { shuffle($choices); } return fw_render_view($this->locate_path('/views/view.php', dirname(__FILE__) . '/view.php'), array('item' => $item, 'choices' => $choices, 'value' => $value, 'attr' => array('type' => 'select', 'name' => $item['shortcode'], 'id' => 'id-' . fw_unique_increment()))); }
/** * Render a meta box * * @param string $id * @param string $title * @param string $content HTML * @param array $other Optional elements * * @return string Generated meta box html */ public function render_box($id, $title, $content, $other = array()) { if (!function_exists('add_meta_box')) { trigger_error('Try call this method later (\'admin_init\' action), add_meta_box() function does not exists yet.', E_USER_WARNING); return ''; } $other = array_merge(array('html_before_title' => false, 'html_after_title' => false, 'attr' => array()), $other); $placeholders = array('id' => '{{meta_box_id}}', 'title' => '{{meta_box_title}}', 'content' => '{{meta_box_content}}'); $placeholders['html_before_title'] = '{{meta_box_html_before_title}}'; $placeholders['html_after_title'] = '{{meta_box_html_after_title}}'; $placeholders['attr'] = '{{meta_box_attr}}'; $placeholders['attr_class'] = '{{meta_box_attr_class}}'; $cache_key = 'fw_meta_box_template'; try { $meta_box_template = FW_Cache::get($cache_key); } catch (FW_Cache_Not_Found_Exception $e) { $temp_screen_id = 'fw-temp-meta-box-screen-id-' . fw_unique_increment(); $context = 'normal'; add_meta_box($placeholders['id'], $placeholders['title'], $this->print_meta_box_content_callback, $temp_screen_id, $context, 'default', $placeholders['content']); ob_start(); do_meta_boxes($temp_screen_id, $context, null); $meta_box_template = ob_get_clean(); remove_meta_box($id, $temp_screen_id, $context); $meta_box_template = str_replace('<div id="' . $context . '-sortables" class="meta-box-sortables">', '', $meta_box_template); $meta_box_template = explode('</div>', $meta_box_template); array_pop($meta_box_template); $meta_box_template = implode('</div>', $meta_box_template); // add 'fw-postbox' class and some attr related placeholders $meta_box_template = str_replace('class="postbox', $placeholders['attr'] . ' class="postbox fw-postbox' . $placeholders['attr_class'], $meta_box_template); $meta_box_template = str_replace('<span>' . $placeholders['title'] . '</span>', '<small class="fw-html-before-title">' . $placeholders['html_before_title'] . '</small>' . '<span>' . $placeholders['title'] . '</span>' . '<small class="fw-html-after-title">' . $placeholders['html_after_title'] . '</small>', $meta_box_template); FW_Cache::set($cache_key, $meta_box_template); } $attr_class = ''; if (isset($other['attr']['class'])) { $attr_class = ' ' . $other['attr']['class']; unset($other['attr']['class']); } unset($other['attr']['id']); // replace placeholders with data/content return str_replace(array($placeholders['id'], $placeholders['title'], $placeholders['content'], $placeholders['html_before_title'], $placeholders['html_after_title'], $placeholders['attr'], $placeholders['attr_class']), array(esc_attr($id), $title, $content, $other['html_before_title'], $other['html_after_title'], fw_attr_to_html($other['attr']), esc_attr($attr_class)), $meta_box_template); }
<?php if (!defined('FW')) { die('Forbidden'); } $tabs_options = array(); foreach ($thumbnails as $thumbnails_tab_title => &$thumbnails_tab_thumbnails) { $tabs_options['random-' . fw_unique_increment()] = array('type' => 'tab', 'title' => $thumbnails_tab_title, 'attr' => array('class' => 'fw-option-type-builder-thumbnails-tab'), 'options' => array('random-' . fw_unique_increment() => array('type' => 'html', 'label' => false, 'desc' => false, 'html' => implode("\n", $thumbnails_tab_thumbnails)))); } $div_attr = $option['attr']; unset($div_attr['value'], $div_attr['name']); $div_attr['class'] .= ' fw-option-type-builder-tabs-count-' . count($tabs_options); ?> <div <?php echo fw_attr_to_html($div_attr); ?> > <?php echo fw()->backend->option_type('hidden')->render($id, array(), array('value' => $data['value']['json'], 'id_prefix' => $data['id_prefix'] . 'input--', 'name_prefix' => $data['name_prefix'])); ?> <div class="builder-items-types fw-clearfix"> <?php echo fw()->backend->render_options($tabs_options); ?> </div> <div class="builder-root-items"></div> </div> <?php // do action once to add one backdrop for all builders in page if ($option['fullscreen']) {
/** * @Slick Slider v4 * @return {HTML} * */ public function prepare_slider_version_v4($id = '') { $margin_top = fw_get_db_post_option($id, 'margin_top', true); $margin_bottom = fw_get_db_post_option($id, 'margin_bottom', true); $pagination = fw_get_db_post_option($id, 'pagination', true); $auto = fw_get_db_post_option($id, 'auto', true); $slider_speed = fw_get_db_post_option($id, 'slider_speed', true); $slider_type = fw_get_db_post_option($id, 'slider_type', true); $flag = fw_unique_increment(); law_firm_enqueue_slick_library(); //fw_print($slider_type); $autoPlay = 'true'; if (isset($auto) && $auto == 'disable') { $autoPlay = 'false'; } $navigation = 'true'; if (isset($pagination) && $pagination == 'disable') { $navigation = 'false'; } $css = array(); if (isset($margin_top) && !empty($margin_top)) { $css[] = 'margin-top:' . $margin_top . 'px;'; } if (isset($margin_bottom) && !empty($margin_bottom)) { $css[] = 'margin-bottom:' . $margin_bottom . 'px;'; } if (isset($slider_type['slider_v4']['slides']) && is_array($slider_type['slider_v4']['slides']) && !empty($slider_type['slider_v4']['slides'])) { $slides = $slider_type['slider_v4']['slides']; ?> <div class="system-slider" style="<?php echo implode(' ', $css); ?> "> <div class="fadeslider-home" id="main-slider-<?php echo esc_js($flag); ?> "> <?php foreach ($slides as $key => $slide) { $button_link = $slide['button_link']; $button_link_title = $slide['button_link_title']; $slider_title = $slide['slider_title']; $slider_description = $slide['slider_description']; $slider_subheading = $slide['slider_subheading']; if (isset($slide['slider_bg_image']['url']) && !empty($slide['slider_bg_image']['url'])) { ?> <div style="background-image: url(<?php echo esc_url($slide['slider_bg_image']['url']); ?> );"> <?php if (!empty($slider_title) || !empty($slider_subheading) || !empty($slider_description) || !empty($button_link_title)) { ?> <div class="slide-inner"> <div class="container"> <div class="row"> <div class="col-xs-12 col-xs-offset-0 col-sm-10 col-sm-offset-1 col-lg-8 col-lg-offset-2"> <?php if (!empty($slider_title)) { ?> <h1 class="slidetop"><?php echo esc_attr($slider_title); ?> </h1> <?php } ?> <?php if (!empty($slider_subheading)) { ?> <h2 class="slidebottom"><?php echo esc_attr($slider_subheading); ?> </h2> <?php } ?> <?php if (!empty($slider_description)) { ?> <p class="slidebottom"><i style="text-transform: lowercase;"><?php echo esc_attr($slider_description); ?> </i></p> <?php } ?> <?php if (isset($button_link_title) && !empty($button_link_title)) { ?> <div class="shortcode-buttons add2 slidebottom"> <a href="<?php echo esc_url($button_link); ?> " class="btn btn-default"><?php echo esc_attr($button_link_title); ?> </a> </div> <?php } ?> </div> </div> </div> </div> <?php } ?> </div> <?php } } ?> </div> <script> jQuery(document).ready(function(e) { jQuery('#main-slider-<?php echo esc_js($flag); ?> ').slick({ autoplay:<?php echo esc_js($autoPlay); ?> , autoplaySpeed: <?php echo esc_js($slider_speed); ?> , dots: <?php echo esc_js($navigation); ?> , infinite: true, speed: 300, fade: true, arrow: false, adaptiveHeight: true, cssEase: 'linear' }); }); </script> </div> <?php } }
<label><?php echo fw_htmlspecialchars($item['options']['label']); ?> <?php if ($options['required']) { ?> <sup>*</sup><?php } ?> </label> <div class="custom-radio"> <?php foreach ($choices as $choice) { ?> <?php $choice['id'] = 'rand-' . fw_unique_increment(); ?> <div class="options"> <input <?php echo fw_attr_to_html($choice); ?> /> <label for="<?php echo esc_attr($choice['id']); ?> "><?php echo $choice['value']; ?> </label> </div> <?php