/** * Template to display a link in Links module, also used when creating a link. * @param array $data * @return string * @since 1.2.7 */ function themify_add_link_template($fid, $data = array(), $ajax = false, $type = 'image-icon') { $pre = 'setting-link_'; $type_name = $pre . 'type_' . $fid; if ($ajax) { $type_val = $type; } else { $type_val = isset($data[$type_name]) ? $data[$type_name] : 'image-icon'; } $title_name = $pre . 'title_' . $fid; $title_val = isset($data[$title_name]) ? $data[$title_name] : ''; $link_name = $pre . 'link_' . $fid; $link_val = isset($data[$link_name]) ? $data[$link_name] : ''; $img_name = $pre . 'img_' . $fid; $img_val = !isset($data[$img_name]) || '' == $data[$img_name] ? '' : $data[$img_name]; $ficon_name = $pre . 'ficon_' . $fid; $ficon_val = trim(isset($data[$ficon_name]) ? $data[$ficon_name] : ''); $ficolor_name = $pre . 'ficolor_' . $fid; $ficolor_val = isset($data[$ficolor_name]) ? $data[$ficolor_name] : ''; $fibgcolor_name = $pre . 'fibgcolor_' . $fid; $fibgcolor_val = isset($data[$fibgcolor_name]) ? $data[$fibgcolor_name] : ''; /** * TODO: Add appearance checkboxes */ $out = '<li id="' . esc_attr($fid) . '" class="social-link-item ' . esc_attr($type_val) . '">'; $out .= '<div class="social-drag">' . __('Drag to Sort ↕', 'themify') . '</div>'; $out .= '<input type="hidden" name="' . $type_name . '" value="' . trim($type_val) . '">'; $out .= '<div class="row"> <span class="label">' . __('Title', 'themify') . '</span> <input type="text" name="' . $title_name . '" class="width6" value="' . trim($title_val) . '"> </div> <!-- /row -->'; $out .= '<div class="row"> <span class="label">' . __('Link', 'themify') . '</span> <input type="text" name="' . $link_name . '" class="width10" value="' . trim($link_val) . '"> </div> <!-- /row -->'; if ('font-icon' == $type_val) { $out .= '<div class="row"> <span class="label">' . __('Icon', 'themify') . '</span>'; $out .= sprintf('<input type="text" id="%s" name="%s" value="%s" size="55" class="themify_input_field themify_fa %s" /> <a class="button button-secondary hide-if-no-js themify_fa_toggle" href="#" data-target="#%s">%s</a>', $ficon_name, $ficon_name, $ficon_val, 'small', $ficon_name, __('Insert Icon', 'themify')); $out .= '</div> <!-- /row -->'; $out .= '<div class="icon-preview font-icon-preview"> <i class="fa ' . $ficon_val . '"></i> </div> <!-- /icon-preview -->'; $out .= '<div class="themify_field_row"> <span class="label">' . __('Icon Color', 'themify') . '</span> <div class="themify_field-color"> <span class="colorSelect" style="background:#' . $ficolor_val . ';"> <span></span> </span> <input type="text" class="colorSelectInput width4" value="' . $ficolor_val . '" name="' . $ficolor_name . '" /> </div> </div>'; $out .= '<div class="themify_field_row"> <span class="label">' . __('Background', 'themify') . '</span> <div class="themify_field-color"> <span class="colorSelect" style="background:#' . $fibgcolor_val . ';"> <span></span> </span> <input type="text" class="colorSelectInput width4" value="' . $fibgcolor_val . '" name="' . $fibgcolor_name . '" /> </div> </div>'; } else { $out .= '<div class="row"> <span class="label">' . __('Image', 'themify') . '</span> <div class="uploader-fields image"> <input type="text" id="' . $img_name . '" name="' . $img_name . '" class="width10" value="' . $img_val . '"> <div class="clear image">' . themify_get_uploader($img_name, array('tomedia' => true, 'preview' => true)) . '</div> </div> </div> <!-- /row -->'; $out .= '<div class="icon-preview"> <img id="' . $img_name . '-preview" src="' . $img_val . '" /> </div> <!-- /icon-preview -->'; } $out .= '<a href="#" class="remove-item" data-removelink="' . $fid . '"><i class="ti ti-close"></i></a> </li> <!-- /social-links-item -->'; return $out; }
/** * Echoes a PLUPLOAD uploader * * @uses themify_get_uploader * * @param string $id * @param array $args * */ function themify_uploader($id = '', $args = array()) { echo themify_get_uploader($id, $args); }
/** * Template to display a link in Links module, also used when creating a link. * @param array $data * @return string * @since 1.2.7 */ function themify_add_link_template($fid, $data = array(), $ajax = false) { $pre = 'setting-link_'; $title_name = $pre . 'title_' . $fid; $title_val = isset($data[$title_name]) ? $data[$title_name] : ''; $link_name = $pre . 'link_' . $fid; $link_val = isset($data[$link_name]) ? $data[$link_name] : ''; $img_name = $pre . 'img_' . $fid; $img_val = '' == $data[$img_name] || !isset($data[$img_name]) ? '' : $data[$img_name]; if ($ajax) { $hide = ''; } else { $hide = ''; } $field = '<li id="%s" class="social-link-item" %s> <div class="row"> <span class="label">%s</span> <input type="text" name="%s" class="width6" value="%s"> </div> <!-- /row --> <div class="row"> <span class="label">%s</span> <input type="text" name="%s" class="width10" value="%s"> </div> <!-- /row --> <div class="row"> <span class="label">%s</span> <div class="uploader-fields image"> <input type="text" id="%s" name="%s" class="width10" value="%s"> <div class="clear image">%s</div> </div> </div> <!-- /row --> <div class="icon-preview"> <img id="%s" src="%s" /> </div> <!-- /icon-preview --> <a href="#" class="remove-item" data-removelink="%s">%s</a> </li> <!-- /social-links-item -->'; $out = sprintf($field, $fid, $hide, __('Title', 'themify'), $title_name, $title_val, __('Link', 'themify'), $link_name, $link_val, __('Image', 'themify'), $img_name, $img_name, $img_val, themify_get_uploader($img_name, array('tomedia' => true, 'preview' => true)), $img_name . '-preview', $img_val, $fid, __('Remove', 'themify')); return $out; }
function themify_footer_logo($data = array()) { if ($data['attr']['target'] != '') { $target = "<span class='hide target'>" . $data['attr']['target'] . "</span>"; } $data = themify_get_data(); if ($data['setting-footer_logo'] == "image") { $image = "checked='checked'"; $image_display = "style='display:block;'"; $text_display = ""; } else { $text = "checked='checked'"; $text_display = ""; $image_display = "style='display:none;'"; } return '<div class="themify_field_row"> <p> <span class="label">' . __('Display', 'themify') . '</span> <input name="setting-footer_logo" type="radio" value="text" ' . $text . ' /> ' . __('Site Title', 'themify') . ' <input name="setting-footer_logo" type="radio" value="image" ' . $image . ' /> ' . __('Image', 'themify') . ' </p> ' . $target . ' <div class="uploader-fields pushlabel image" ' . $image_display . '> <input type="text" class="width10" id="setting-footer_logo_image_value" name="setting-footer_logo_image_value" value="' . $data['setting-footer_logo_image_value'] . '" /> <br /> <div style="display:block;">' . themify_get_uploader('setting-footer_logo_image_value', array('tomedia' => true)) . '</div> </div> <p class="pushlabel image" ' . $image_display . '> <input type="text" name="setting-footer_logo_width" class="width2" value="' . $data['setting-footer_logo_width'] . '" /> ' . __('width', 'themify') . ' <input type="text" name="setting-footer_logo_height" class="width2" value="' . $data['setting-footer_logo_height'] . '" /> ' . __('height', 'themify') . ' </p> </div>'; }
function themify_header_slider($data = array()) { $data = themify_get_data(); /** Slider values @var array */ $slider_ops = array(__('On', 'themify') => 'on', __('Off', 'themify') => 'off'); /** Slider status */ $enabled_display = ''; $display_posts = ''; $display_images = ''; $display_posts_display = ''; $display_images_display = ''; if ('' == themify_get('setting-header_slider_enabled') || 'on' == themify_get('setting-header_slider_enabled')) { $enabled_checked = "selected='selected'"; } else { $enabled_display = "style='display:none;'"; } if (!isset($data['setting-header_slider_visible']) || '' == $data['setting-header_slider_visible']) { $data['setting-header_slider_visible'] = "4"; } if ('images' == themify_get('setting-header_slider_display')) { $display_images = "checked='checked'"; $display_posts_display = "style='display:none;'"; } else { $display_posts = "checked='checked'"; $display_images_display = "style='display:none;'"; } $title_options = array('' => '', __('Yes', 'themify') => 'yes', __('No', 'themify') => 'no'); $auto_options = array(0, 1, 2, 3, 4, 5, 6, 7); $scroll_options = array(1, 2, 3, 4, 5, 6, 7); $display_options = array('none', 'excerpt', 'content'); $speed_options = array(__('Fast', 'themify') => '.5', __('Normal', 'themify') => '1', __('Slow', 'themify') => '4'); $wrap_options = array("no", "yes"); $image_options = array("one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten"); /** * HTML for settings panel * @var string */ $output = '<p><span class="label">' . __('Enable Slider', 'themify') . '</span> <select name="setting-header_slider_enabled" class="feature_box_enabled_check">'; /** Iterate through slider options */ foreach ($slider_ops as $key => $val) { $output .= '<option value="' . $val . '" ' . selected(themify_get('setting-header_slider_enabled'), $val, false) . '>' . $key . '</option>'; } $output .= '</select>' . '</p> <div class="feature_box_enabled_display" ' . $enabled_display . '> <p><span class="label">' . __('Display', 'themify') . '</span> <input type="radio" class="feature-box-display" name="setting-header_slider_display" value="posts" ' . $display_posts . ' /> ' . __('Posts', 'themify') . ' <input type="radio" class="feature-box-display" name="setting-header_slider_display" value="images" ' . $display_images . ' /> ' . __('Images', 'themify') . '</p> <p class="pushlabel feature_box_posts" ' . $display_posts_display . '>'; $output .= wp_dropdown_categories(array("show_option_all" => __('All Categories', 'themify'), "hide_empty" => 0, "echo" => 0, "name" => "setting-header_slider_posts_category", "selected" => themify_get('setting-header_slider_posts_category'))); $output .= ' <input type="text" name="setting-header_slider_posts_slides" value="' . themify_get('setting-header_slider_posts_slides') . '" class="width2" /> ' . __('number of posts to be queried', 'themify') . ' </p> <p class="feature_box_posts" ' . $display_posts_display . '> <span class="label">' . __('Content Display', 'themify') . ' </span> <select name="setting-header_slider_default_display"> '; foreach ($display_options as $option) { if ($option == themify_get('setting-header_slider_default_display')) { $output .= '<option value="' . $option . '" selected="selected">' . $option . '</option>'; } else { $output .= '<option value="' . $option . '">' . $option . '</option>'; } } $output .= ' </select> </p>'; $output .= '<p class="feature_box_posts" ' . $display_posts_display . '> <span class="label">' . __('Hide Title', 'themify') . '</span> <select name="setting-header_slider_hide_title"> '; foreach ($title_options as $name => $option) { if (isset($data['setting-slider_hide_title']) && $option == $data['setting-slider_hide_title']) { $output .= '<option value="' . $option . '" selected="selected">' . $name . '</option>'; } else { $output .= '<option value="' . $option . '">' . $name . '</option>'; } } $output .= ' </select> </p>'; $output .= '<div class="feature_box_images" ' . $display_images_display . '>'; $x = 0; foreach ($image_options as $option) { $x++; $output .= ' <div class="uploader-fields"> <span class="label">' . __('Title', 'themify') . ' ' . $x . '</span> <input type="text" class="width10" name="setting-header_slider_images_' . $option . '_title" value="' . themify_get('setting-header_slider_images_' . $option . '_title') . '" /> <span class="label">' . __('Link', 'themify') . ' ' . $x . '</span> <input type="text" class="width10" name="setting-header_slider_images_' . $option . '_link" value="' . themify_get('setting-header_slider_images_' . $option . '_link') . '" /> <span class="label">' . __('Image', 'themify') . ' ' . $x . '</span> <input type="text" class="width10 feature_box_img" id="setting-header_slider_images_' . $option . '_image" name="setting-header_slider_images_' . $option . '_image" value="' . themify_get('setting-header_slider_images_' . $option . '_image') . '" /> <div class="pushlabel" style="display:block;">' . themify_get_uploader('setting-header_slider_images_' . $option . '_image', array('tomedia' => true)) . '</div> </div>'; } $output .= '</div> <hr /> <p> <span class="label">' . __('Visible', 'themify') . '</span> <select name="setting-header_slider_visible">'; for ($x = 1; $x <= 7; $x++) { if ($data['setting-header_slider_visible'] == $x) { $output .= '<option value="' . $x . '" selected="selected">' . $x . '</option>'; } else { $output .= '<option value="' . $x . '">' . $x . '</option>'; } } $output .= '</select> <small>' . __('(# of slides visible at the same time)', 'themify') . '</small> </p> <p> <span class="label">' . __('Auto Play', 'themify') . '</span> <select name="setting-header_slider_auto"> '; foreach ($auto_options as $option) { if (isset($data['setting-header_slider_auto']) && $option == $data['setting-header_slider_auto']) { $output .= '<option value="' . $option . '" selected="selected">' . $option . '</option>'; } else { $output .= '<option value="' . $option . '">' . $option . '</option>'; } } $output .= ' </select> <small>' . __('(auto advance slider, 0 = off)', 'themify') . '</small> </p> <p> <span class="label">' . __('Scroll', 'themify') . '</span> <select name="setting-header_slider_scroll"> '; foreach ($scroll_options as $option) { if (isset($data['setting-header_slider_scroll']) && $option == $data['setting-header_slider_scroll']) { $output .= '<option value="' . $option . '" selected="selected">' . $option . '</option>'; } else { $output .= '<option value="' . $option . '">' . $option . '</option>'; } } $output .= ' </select> </p> <p> <span class="label">' . __('Speed', 'themify') . '</span> <select name="setting-header_slider_speed">'; foreach ($speed_options as $name => $val) { if (isset($data['setting-header_slider_speed']) && $data['setting-header_slider_speed'] == $val) { $output .= '<option value="' . $val . '" selected="selected">' . $name . '</option>'; } else { $output .= '<option value="' . $val . '">' . $name . '</option>'; } } $output .= '</select> </p> <p> <span class="label">' . __('Wrap Slides', 'themify') . '</span> <select name="setting-header_slider_wrap">'; foreach ($wrap_options as $name) { if (isset($data['setting-header_slider_wrap']) && $data['setting-header_slider_wrap'] == $name) { $output .= '<option value="' . $name . '" selected="selected">' . $name . '</option>'; } else { $output .= '<option value="' . $name . '">' . $name . '</option>'; } } $output .= '</select> </p> <hr /> <p> <span class="label">' . __('Feature Image Size', 'themify') . '</span> <input type="text" name="setting-header_slider_width" class="width2" value="' . themify_get('setting-header_slider_width') . '" /> ' . __('width', 'themify') . ' <small>(in px)</small> <input type="text" name="setting-header_slider_height" class="width2" value="' . themify_get('setting-header_slider_height') . '" /> ' . __('height', 'themify') . ' <small>(in px)</small> </p> </div>'; return $output; }