public function _render($data) { if ($data['builder_type'] !== 'page-builder') { return; } if (version_compare(fw_ext('builder')->manifest->get_version(), '1.1.14', '<')) { // some important changes were added in Builder v1.1.14 return; } $html = ''; foreach ($this->get_templates($data['builder_type']) as $template_id => $template) { if (isset($template['type']) && $template['type'] === 'predefined') { $delete_btn = ''; } else { $delete_btn = '<a href="#" onclick="return false;" data-delete-template="' . fw_htmlspecialchars($template_id) . '"' . ' class="template-delete dashicons fw-x"></a>'; } $html .= '<li>' . $delete_btn . '<a href="#" onclick="return false;" data-load-template="' . fw_htmlspecialchars($template_id) . '"' . ' class="template-title">' . fw_htmlspecialchars($template['title']) . '</a>' . '</li>'; } if (empty($html)) { $html = '<div class="fw-text-muted">' . __('No Templates Saved', 'fw') . '</div>'; } else { $html = '<p class="fw-text-muted load-template-title">' . __('Load Template', 'fw') . ':</p>' . '<ul class="std">' . $html . '</ul>'; } return $html; }
/** * @internal */ protected function _render($id, $option, $data) { // this js contains custom changes wp_enqueue_script('fw-option-' . $this->get_type() . '-image-picker', fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/js/image-picker/image-picker.js'), array(), fw()->manifest->get_version(), true); wp_enqueue_style('fw-option-' . $this->get_type(), fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/css/styles.css'), array('qtip'), fw()->manifest->get_version()); wp_enqueue_script('fw-option-' . $this->get_type(), fw_get_framework_directory_uri('/includes/option-types/' . $this->get_type() . '/static/js/scripts.js'), array('fw-events', 'qtip'), fw()->manifest->get_version(), true); $wrapper_attr = array('id' => $option['attr']['id'], 'class' => $option['attr']['class']); foreach ($wrapper_attr as $attr_name => $attr_val) { unset($option['attr'][$attr_name]); } $option['value'] = (string) $data['value']; unset($option['attr']['multiple']); /** * pre loads images on page load * * fixes glitch with preview: * * hover first time - show wrong because image not loaded and has no height/width and cannot detect correctly popup position * * hover second time - show correctly */ $pre_load_images_html = ''; $html = ''; $html .= '<select ' . fw_attr_to_html($option['attr']) . '>'; if (!empty($option['blank']) and $option['blank'] === true) { $html .= '<option value=""></option>'; } foreach ($option['choices'] as $key => $choice) { $attr = array('value' => $key); if ($option['value'] == $key) { $attr['selected'] = 'selected'; } if (is_string($choice)) { // is 'http://.../small.png' $choice = array('small' => array('src' => $choice)); } if (is_string($choice['small'])) { // is 'http://.../small.png' $choice['small'] = array('src' => $choice['small']); } $attr['data-small-img-attr'] = json_encode($choice['small']); // required by image-picker plugin $attr['data-img-src'] = $choice['small']['src']; if (!empty($choice['large'])) { if (is_string($choice['large'])) { // is 'http://.../large.png' $choice['large'] = array('src' => $choice['large']); } $attr['data-large-img-attr'] = json_encode($choice['large']); $pre_load_images_html .= fw_html_tag('img', array('src' => $choice['large']['src'])); } if (!empty($choice['data'])) { // used in js events $attr['data-extra-data'] = json_encode($choice['data']); } $html .= fw_html_tag('option', $attr, fw_htmlspecialchars(isset($choice['label']) ? $choice['label'] : '')); } $html .= '</select>'; return fw_html_tag('div', $wrapper_attr, $html . '<div class="pre-loaded-images"><br/><br/>' . $pre_load_images_html . '</div>'); }
/** * @internal */ protected function _render($id, $option, $data) { $wrapper_attr = array('id' => $option['attr']['id'], 'class' => $option['attr']['class']); foreach ($wrapper_attr as $attr_name => $attr_val) { unset($option['attr'][$attr_name]); } $option['value'] = (string) $data['value']; unset($option['attr']['multiple']); /** * pre loads images on page load * * fixes glitch with preview: * * hover first time - show wrong because image not loaded and has no height/width and cannot detect correctly popup position * * hover second time - show correctly */ $pre_load_images_html = ''; $html = ''; $html .= '<select ' . fw_attr_to_html($option['attr']) . '>'; if ($option['blank'] === true) { $html .= '<option value=""></option>'; } foreach ($option['choices'] as $key => $choice) { $attr = array('value' => $key); if ($option['value'] == $key) { $attr['selected'] = 'selected'; } if (is_string($choice)) { // is 'http://.../small.png' $choice = array('small' => array('src' => $choice)); } if (is_string($choice['small'])) { // is 'http://.../small.png' $choice['small'] = array('src' => $choice['small']); } $attr['data-small-img-attr'] = json_encode($choice['small']); $attr['data-img-src'] = $choice['small']['src']; // required by image-picker plugin if (!empty($choice['large'])) { if (is_string($choice['large'])) { // is 'http://.../large.png' $choice['large'] = array('src' => $choice['large']); } $attr['data-large-img-attr'] = json_encode($choice['large']); $pre_load_images_html .= fw_html_tag('img', array('src' => $choice['large']['src'])); } if (!empty($choice['data'])) { // used in js events $attr['data-extra-data'] = json_encode($choice['data']); } if (!empty($choice['attr'])) { $attr = array_merge($choice['attr'], $attr); } $html .= fw_html_tag('option', $attr, fw_htmlspecialchars(isset($choice['label']) ? $choice['label'] : '')); } $html .= '</select>'; return fw_html_tag('div', $wrapper_attr, $html . '<div class="pre-loaded-images"><br/><br/>' . $pre_load_images_html . '</div>'); }
public function _render($data) { $html = ''; foreach ($this->get_templates($data['builder_type']) as $template_id => $template) { $html .= '<li>' . '<a href="#" onclick="return false;" data-delete-template="' . fw_htmlspecialchars($template_id) . '"' . ' class="template-delete dashicons fw-x"></a>' . '<a href="#" onclick="return false;" data-load-template="' . fw_htmlspecialchars($template_id) . '"' . ' class="template-title">' . fw_htmlspecialchars($template['title']) . '</a>' . '</li>'; } if (empty($html)) { $html = '<div class="fw-text-muted no-full-templates">' . __('No Templates Saved', 'fw') . '</div>'; } else { $html = '<p class="fw-text-muted load-template-title">' . __('Load Template', 'fw') . ':</p>' . '<ul class="std">' . $html . '</ul>'; } $html = '<div class="save-template-wrapper">' . '<a href="#" onclick="return false;" class="save-template button button-primary">' . __('Save Full Template', 'fw') . '</a>' . '</div>' . $html; return $html; }
public function prepare_items() { if ($this->total_items !== null) { return; } $this->total_items = count($this->_extensions); $this->set_pagination_args(array('total_items' => $this->total_items, 'per_page' => $this->items_pre_page)); $page_num = $this->get_pagenum(); $offset = ($page_num - 1) * $this->items_pre_page; /** * Prepare items for output */ foreach ($this->_extensions as $ext_name => $ext_update) { $extension = fw()->extensions->get($ext_name); if (is_wp_error($ext_update)) { $this->items[] = array('cb' => '<input type="checkbox" disabled />', 'details' => '<p>' . '<strong>' . fw_htmlspecialchars($extension->manifest->get_name()) . '</strong>' . '<br/>' . '<span class="wp-ui-text-notification">' . $ext_update->get_error_message() . '</span>' . '</p>'); } else { $this->items[] = array('cb' => '<input type="checkbox" name="extensions[' . esc_attr($ext_name) . ']" />', 'details' => '<p>' . '<strong>' . fw_htmlspecialchars($extension->manifest->get_name()) . '</strong>' . '<br/>' . 'You have version ' . $extension->manifest->get_version() . ' installed. ' . 'Update to ' . fw_htmlspecialchars($ext_update['fixed_latest_version']) . '.' . '</p>'); } } }
public function _render($data) { $html = ''; $templates = $this->get_templates($data['builder_type']); $this->fake_created_value = 0; $templates = array_map(array($this, 'array_map_add_fake_created_key'), $templates); uasort($templates, array($this, 'sort_templates')); foreach ($templates as $template_id => $template) { if (isset($template['type']) && $template['type'] === 'predefined') { $delete_btn = ''; } else { $delete_btn = '<a href="#" onclick="return false;" data-delete-template="' . fw_htmlspecialchars($template_id) . '"' . ' class="template-delete dashicons fw-x"></a>'; } $html .= '<li>' . $delete_btn . '<a href="#" onclick="return false;" data-load-template="' . fw_htmlspecialchars($template_id) . '"' . ' class="template-title">' . fw_htmlspecialchars($template['title']) . '</a>' . '</li>'; } if (empty($html)) { $html = '<div class="fw-text-muted no-' . $this->get_type() . '-templates">' . __('No Templates Saved', 'fw') . '</div>'; } else { $html = '<p class="fw-text-muted load-template-title">' . __('Load Template', 'fw') . ':</p>' . '<ul class="std">' . $html . '</ul>'; } $html = '<div class="save-template-wrapper">' . '<a href="#" onclick="return false;" class="save-template button button-primary">' . __('Save Full Template', 'fw') . '</a>' . '</div>' . $html; return $html; }
* @var string $type * @var array $attr * @var int $max_width */ $options = $item['options']; $choice_options = $item['options']['wrong-answers']; $choice_options = array_merge($choice_options, $item['options']['correct-answers']); shuffle($choice_options); ?> <div class="<?php echo esc_attr(fw_ext_builder_get_item_width('quiz-builder', $item['width'] . '/frontend_class')); ?> "> <div class="field-checkbox input-styled"> <label><?php echo $item['number'] . ') ' . fw_htmlspecialchars($item['options']['question']); ?> </label> <div class="custom-checkbox"> <?php $counter = 1; foreach ($choice_options as $option) { ?> <div class="options"> <input type="checkbox" value="<?php echo esc_attr($option); ?> " id="<?php echo esc_attr($attr['id']) . $counter;
<tr class="<?php echo esc_attr($classes['option']); ?> " id="fw-backend-option-<?php echo esc_attr($data['id_prefix']) . esc_attr($id); ?> "> <th scope="row" valign="top" class="<?php echo esc_attr($classes['label']); ?> "> <label for="<?php echo esc_attr($data['id_prefix']) . esc_attr($id); ?> "><?php echo fw_htmlspecialchars($option['label']); ?> </label> <?php if ($help) { ?> <div class="fw-option-help fw-option-help-in-label fw-visible-xs-block <?php echo esc_attr($help['class']); ?> " title="<?php echo esc_attr($help['html']); ?> "></div><?php } ?> </th>
* when this option will be used inside another option template */ /** * This is a reference. * Unset before replacing with new value * to prevent changing value to what it refers */ unset($values); $values = array(); // must contain characters that will remain the same after htmlspecialchars() $increment_template = '###-addable-option-increment-###'; echo fw_htmlspecialchars('<tr class="fw-option-type-addable-option-option"> <td class="td-move"> <img src="' . $move_img_src . '" width="7" /> </td> <td class="td-option fw-force-xs">' . fw()->backend->option_type($option['option']['type'])->render($increment_template, $option['option'], array('id_prefix' => $data['id_prefix'] . $id . '--option-', 'name_prefix' => $data['name_prefix'] . '[' . $id . ']')) . '</td> <td class="td-remove"> <a href="#" onclick="return false;" class="dashicons fw-x fw-option-type-addable-option-remove"></a> </td> </tr>'); ?> "> <div> <button type="button" class="button fw-option-type-addable-option-add" onclick="return false;" data-increment="<?php echo $i; ?> "><?php _e('Add', 'fw'); ?> </button> </div>
private function display_extension_settings_page($extension_name, $data) { if (!fw()->extensions->get($extension_name)) { return sprintf(__('Extension "%s" does not exist or is not active.', 'fw'), fw_htmlspecialchars($extension_name)); } $extension = fw()->extensions->get($extension_name); if (!$extension->get_settings_options()) { return sprintf(__('%s extension does not have settings.', 'fw'), $extension->manifest->get_name()); } echo '<div id="fw-extension-settings">'; echo $this->extension_settings_form->render(array('extension' => $extension)); echo '</div>'; }
echo $is_empty ? $l10n['button_add'] : $l10n['button_edit']; ?> </a></p> <br class="thumb-template-empty fw-hidden" data-template="<?php ob_start(); ?> <div class="thumb no-image"> <img src="<?php echo fw_get_framework_directory_uri('/static/img/no-image.png'); ?> " class="no-image-img" alt="<?php esc_attr_e('No image', 'fw'); ?> "/> </div> <?php echo fw_htmlspecialchars(ob_get_clean()); ?> "> <br class="thumb-template-not-empty fw-hidden" data-template="<?php ob_start(); ?> <div class="thumb" data-attid="<%= data.id %>" data-origsrc="<%= data.originalSrc %>"> <img src="<%= data.src %>" alt="<%= data.alt %>"/> <a href="#" class="dashicons fw-x clear-uploads-thumb"></a> </div> <?php echo fw_htmlspecialchars(ob_get_clean()); ?> "> </div>
$requirements[] = sprintf(__('The %s extension is not installed: %s', 'fw'), $ext_title, fw_html_tag('a', array('href' => $link . '&sub-page=install&extension=' . $req_ext), sprintf(__('Install %s', 'fw'), $ext_title))); } else { $requirements[] = sprintf(__('The %s extension is not installed', 'fw'), $ext_title); } } } } break; default: trigger_error('Invalid requirement: ' . $req_name, E_USER_WARNING); continue; } } ?> <a onclick="return false;" href="#" class="fw-extension-tip" title="<?php echo fw_htmlspecialchars('<div class="fw-extension-tip-content">' . '<ul class="fw-extension-requirements"><li>- ' . implode('</li><li>- ', $requirements) . '</li></ul>' . '</div>'); unset($requirements); ?> "><?php _e('View Requirements', 'fw'); ?> </a> <p class="fw-visible-xs-block"></p><?php if ($can_install) { ?> <a href="<?php echo esc_attr($link); ?> &sub-page=delete&extension=<?php echo esc_attr($name); ?>
if (empty($choices)) { ?> <!-- select not displayed: no choices --> <?php } else { ?> <div class="<?php echo esc_attr(fw_ext_builder_get_item_width('form-builder', $item['width'] . '/frontend_class')); ?> "> <div class="field-select select-styled"> <label for="<?php echo esc_attr($attr['id']); ?> "><?php echo fw_htmlspecialchars($item['options']['label']); ?> <?php if ($options['required']) { ?> <sup>*</sup><?php } ?> </label> <select <?php echo fw_attr_to_html($attr); ?> > <?php foreach ($choices as $choice) { ?>
?> <a href="<?php echo esc_attr($link_extension); ?> &extension=<?php echo esc_attr($extension_name); ?> " class="button-primary"><?php _e('Settings', 'fw'); ?> </a><?php break; } ?> </span> <?php switch ($tab) { case 'settings': echo sprintf(__('%s Settings', 'fw'), $extension_title); break; case 'docs': echo sprintf(__('%s Install Instructions', 'fw'), $extension_title); break; default: echo __('Unknown tab:', 'fw') . ' ' . fw_htmlspecialchars($tab); } ?> </h2> <br/>
<?php if (in_array($value['multimedia']['selected'], $multimedia_type)) { ?> <?php $options = fw()->backend->render_options($slides_options, $value, array('id_prefix' => $data['id_prefix'] . $id . '-' . $key . '-', 'name_prefix' => $data['name_prefix'] . '[' . $id . '][' . $key . ']')); ?> <div class="fw-slide slide-<?php echo $key; ?> " data-order="<?php echo $key; ?> " data-default-html="<?php echo fw_htmlspecialchars($options); ?> "> <?php echo $options; ?> </div> <?php } ?> <?php } ?> <?php } ?>
?> "> <img src="<?php echo esc_attr($attachment_thumb_url); ?> " alt="<?php echo esc_attr($attachment_filename); ?> "/> <a href="#" class="dashicons fw-x clear-uploads-thumb"></a> </div> <?php } ?> <?php } ?> </div> <p><a href="#"><?php echo $is_empty ? $l10n['button_add'] : $l10n['button_edit']; ?> </a></p> <br class="thumb-template-empty fw-hidden" data-template="<?php echo fw_htmlspecialchars('<div class="thumb no-image">' . '<img src="' . fw_get_framework_directory_uri('/static/img/no-image.png') . '" class="no-image-img" alt="' . esc_attr__('No image', 'fw') . '"/>' . '</div>'); ?> "> <br class="thumb-template-not-empty fw-hidden" data-template="<?php echo fw_htmlspecialchars('<div class="thumb" data-attid="<%= data.id %>" data-origsrc="<%- data.originalSrc %>">' . '<img src="<%- data.src %>" alt="<%- data.alt %>"/>' . '<a href="#" class="dashicons fw-x clear-uploads-thumb"></a>' . '</div>'); ?> "> </div>
} else { ?> <?php foreach ($fonts['google'][$data['value']['family']]['variants'] as $variant) { ?> <option value="<?php echo esc_attr($variant); ?> " <?php if ($data['value']['style'] === $variant) { ?> selected="selected"<?php } ?> ><?php echo fw_htmlspecialchars(ucfirst($variant)); ?> </option> <?php } ?> <?php } ?> </select> </div> <div class="fw-option-typography-option fw-option-typography-option-color fw-border-box-sizing fw-col-sm-2" data-type="color" style="display: <?php echo !isset($option['components']['color']) || $option['components']['color'] != false ? 'block' : 'none'; ?> ;">
/** * Nice displayed print_r alternative * * @param mixed $value Value to debug * @param bool $die Stop script after print */ function fw_print($value, $die = false) { static $first_time = true; if ($first_time) { ob_start(); echo '<style type="text/css"> div.fw_print_r { max-height: 500px; overflow-y: scroll; background: #111; margin: 10px 30px; padding: 0; border: 1px solid #F5F5F5; } div.fw_print_r pre { color: #47EE47; background: #111; text-shadow: 1px 1px 0 #000; font-family: Consolas, monospace; font-size: 12px; margin: 0; padding: 5px; display: block; line-height: 16px; text-align: left; } </style>'; echo str_replace(array(' ', "\n"), '', ob_get_clean()); } echo '<div class="fw_print_r"><pre>'; echo fw_htmlspecialchars(FW_Dumper::dump($value)); echo '</pre></div>'; $first_time = false; if ($die) { die; } }
<h2 class="title-panel"><?php echo $description; ?> </h2> <ul class="list-style" data-blocks='<?php echo json_encode($options['blocks']); ?> '> <?php foreach ($options['predefined'] as $key => $style) { ?> <li><a data-key="<?php echo esc_attr($key); ?> " data-settings="<?php echo fw_htmlspecialchars(json_encode($style)); ?> " href="#"><?php echo $style['name']; ?> </a></li> <?php } ?> </ul> <a href="#" class="open-close-panel"><i class="fa-sliders"></i></a> </div> <script type="text/javascript"> (function ($) { $('.wrap-style-panel.close ul.list-style li a').each(function () {
/** * Render hidden under editor for storing shortcodes settings, which user entered */ public function _action_admin_render_hidden() { global $post; if (!$this->is_supported_post($post)) { return; } $value = get_post_meta($post->ID, $this->meta_key, true); echo '<input id="' . $this->meta_key . '" type="hidden" name="' . $this->meta_key . '" value="' . fw_htmlspecialchars($value) . '">'; }
<?php } ?> </div> <br class="default-box-template fw-hidden" data-template="<?php /** * Place template in attribute to prevent it to be treated as html * when this option will be used inside another option template */ /** * This is a reference. * Unset before replacing with new value * to prevent changing value to what it refers */ unset($values); $values = array(); // must contain characters that will remain the same after htmlspecialchars() $increment_template = '###-addable-box-increment-###'; echo fw_htmlspecialchars('<div class="fw-option-box">' . fw()->backend->render_box($data['id_prefix'] . $id . '-' . $increment_template . '-box', '͏ ', '<div class="fw-option-box-options fw-force-xs">' . fw()->backend->render_options($box_options, $values, array('id_prefix' => $data['id_prefix'] . $id . '-' . $increment_template . '-', 'name_prefix' => $data['name_prefix'] . '[' . $id . '][' . $increment_template . ']')) . '</div>', array('html_after_title' => $controls_html)) . '</div>'); ?> "> <div class="fw-option-boxes-controls"> <button type="button" onclick="return false" class="button fw-option-boxes-add-button" data-increment="<?php echo ++$i; ?> "><?php _e('Add', 'fw'); ?> </button> </div> </div>
$background_image_option = $option['predefined'][$data['value']['predefined']]['blocks'][$block_id]['background']['background-image']; } else { $background_image_option = $option['value'][$block_id]['background']['background-image']; } ?> <input type="hidden" class="background-image-data" id="<?php echo esc_attr($data['name_prefix'] . '-' . $id . '-' . $block_id . '-background-image-data'); ?> " name="<?php echo esc_attr($data['name_prefix'] . '[' . $id . ']' . '[' . $block_id . '][background][background-image][data]'); ?> " value="<?php echo fw_htmlspecialchars(json_encode($background_image_option)); ?> "> <?php $tmp_options = array('background-image' => array_merge($background_image_option, array('label' => ' ', 'type' => 'background-image'))); $tmp_values = array('background-image' => !empty($data['value']['blocks'][$block_id]['background']['background-image']) ? $data['value']['blocks'][$block_id]['background']['background-image'] : $option['value'][$block_id]['background']['background-image']); echo fw()->backend->render_options($tmp_options, $tmp_values, array('id_prefix' => $data['id_prefix'] . $id . '-' . $block_id . '-', 'name_prefix' => $data['name_prefix'] . '[' . $id . ']' . '[' . $block_id . '][background]')); unset($tmp_options, $tmp_values); ?> </div> <?php } // Render after options if (!empty($block['after'])) { $after_block_values = isset($data['value']['blocks'][$block_id]['after']) ? $data['value']['blocks'][$block_id]['after'] : array(); echo fw()->backend->render_options($block['after'], $after_block_values, array('id_prefix' => $data['id_prefix'] . $id . '-' . $block_id . '-styling-option-after-', 'name_prefix' => $data['name_prefix'] . '[' . $id . ']' . '[' . $block_id . '][after]'));
<?php if ($google_font) { foreach ($google_font->variants as $variant) { ?> <option value="<?php echo esc_attr($variant); ?> " <?php if ($data['value']['variation'] === $variant) { ?> selected="selected"<?php } ?> ><?php echo fw_htmlspecialchars($variant); ?> </option> <?php } } ?> </select> <div class="fw-inner"><?php _e('Style', 'fw'); ?> </div> </div> <?php }
echo esc_attr($attachment_thumb_url); ?> " alt="<?php echo esc_attr($attachment_filename); ?> "/> <a href="#" class="dashicons fw-x clear-uploads-thumb"></a> </div> <?php } ?> <p><a href="#"><?php echo $is_empty ? $l10n['button_add'] : $l10n['button_edit']; ?> </a></p> <br class="thumb-template-empty fw-hidden" data-template="<?php echo fw_htmlspecialchars('<img src="' . fw_get_framework_directory_uri('/static/img/no-image.png') . '" class="no-image-img" alt="' . esc_attr__('No image', 'fw') . '"/>'); ?> "> <br class="thumb-template-not-empty fw-hidden" data-template="<?php echo fw_htmlspecialchars('<img src="<%- data.src %>" alt="<%- data.alt %>"/>' . '<a href="#" class="dashicons fw-x clear-uploads-thumb"></a>'); ?> "> <!-- fixes https://github.com/ThemeFuse/Unyson/issues/1309 --> <?php echo fw_html_tag('input', array('type' => 'hidden', 'name' => '_fake[url]', 'value' => intval($input_attr['value']) ? wp_get_attachment_url($input_attr['value']) : '', 'class' => 'fw-option-type-upload-image-url')); ?> </div>
* Run on timeout to prevent too often trigger (and cpu load) when a bunch of changes will happen at once */ timeoutId = setTimeout(function () { $form.trigger('fw:settings-form:delayed-change'); }, 333); }); }); </script> <?php if ($ajax_submit) { ?> <!-- ajax submit --> <div id="fw-settings-form-ajax-save-extra-message" data-html="<?php echo fw_htmlspecialchars(apply_filters('fw_settings_form_ajax_save_loading_extra_message', '')); ?> "></div> <script type="text/javascript"> jQuery(function ($) { function isReset($submitButton) { return $submitButton.length && $submitButton.attr('name') == '<?php echo esc_js($reset_input_name); ?> '; } var formSelector = 'form[data-fw-form-id="fw_settings"]', loadingExtraMessage = $('#fw-settings-form-ajax-save-extra-message').attr('data-html'); $(formSelector).addClass('prevent-all-tabs-init'); // fixes https://github.com/ThemeFuse/Unyson/issues/1491
<div class="content"></div> <a href="#" class="dashicons fw-x delete-item"></a> </div> <?php foreach ($data['value'] as $key => $value) { ?> <div class="item"> <div class="input-wrapper"> <?php echo fw()->backend->option_type('hidden')->render('', array('value' => json_encode($value)), array('id_prefix' => $data['id_prefix'] . $id . '-' . $key . '-', 'name_prefix' => $data['name_prefix'] . '[' . $id . ']')); ?> </div> <img src="<?php echo $sortable_image; ?> " class="sort-item"/> <div class="content"><!-- will be populated from js --></div> <a href="#" class="dashicons fw-x delete-item"></a> </div> <?php } ?> </div> <!--<div class="dashicons dashicons-plus add-new-item"></div>--> <?php echo fw_html_tag('button', array('type' => 'button', 'class' => 'button add-new-item', 'onclick' => 'return false;', 'data-increment-placeholder' => $increment_placeholder), fw_htmlspecialchars($option['add-button-text'])); ?> </div>
/** * Generate attributes string for html tag * @param array $attr_array array('href' => '/', 'title' => 'Test') * @return string 'href="/" title="Test"' */ function fw_attr_to_html(array $attr_array) { $html_attr = ''; foreach ($attr_array as $attr_name => $attr_val) { if ($attr_val === false) { continue; } $html_attr .= $attr_name . '="' . fw_htmlspecialchars($attr_val) . '" '; } return $html_attr; }
echo esc_attr($attr['id']); ?> "><?php echo fw_htmlspecialchars($item['options']['label']); ?> <?php if ($options['required']) { ?> <sup>*</sup><?php } ?> </label> <textarea <?php echo fw_attr_to_html($attr); ?> ><?php echo fw_htmlspecialchars($value); ?> </textarea> <?php if ($options['info']) { ?> <p><em><?php echo $options['info']; ?> </em></p> <?php } ?> </div> </div>
} $bg_color = ''; if (!empty($atts['background_color'])) { $bg_color = 'background-color:' . $atts['background_color'] . ';'; } $bg_image = ''; if (!empty($atts['background_image']) && !empty($atts['background_image']['data']['icon'])) { $bg_image = 'background-image:url(' . $atts['background_image']['data']['icon'] . ');'; } $bg_video_data_attr = ''; $section_extra_classes = ''; if (!empty($atts['video'])) { $filetype = wp_check_filetype($atts['video']); $filetypes = array('mp4' => 'mp4', 'ogv' => 'ogg', 'webm' => 'webm', 'jpg' => 'poster'); $filetype = array_key_exists((string) $filetype['ext'], $filetypes) ? $filetypes[$filetype['ext']] : 'video'; $bg_video_data_attr = 'data-wallpaper-options="' . fw_htmlspecialchars(json_encode(array('source' => array($filetype => $atts['video'])))) . '"'; $section_extra_classes .= ' background-video'; } $section_style = $bg_color || $bg_image ? 'style="' . esc_attr($bg_color . $bg_image) . '"' : ''; $container_class = isset($atts['is_fullwidth']) && $atts['is_fullwidth'] ? 'fw-container-fluid' : 'fw-container'; $custom_class = isset($atts['customclass']) && $atts['customclass'] ? ' ' . $atts['customclass'] . '' : ''; $custom_id = isset($atts['customid']) && $atts['customid'] ? ' id="' . $atts['customid'] . '"' : ''; ?> <section<?php echo $custom_id; ?> class="fw-main-row <?php echo $custom_class; ?> <?php echo esc_attr($section_extra_classes);
<div class="fw-option-box-options fw-force-xs"> <?php echo fw()->backend->render_options($box_options, $values, array('id_prefix' => $data['id_prefix'] . $id . '-' . $i . '-', 'name_prefix' => $data['name_prefix'] . '[' . $id . '][' . $i . ']')); ?> </div> <?php echo fw()->backend->render_box($data['id_prefix'] . $id . '-' . $i . '-box', ' ', ob_get_clean(), array('html_after_title' => $controls_html, 'attr' => array('class' => 'fw-option-type-addable-box-pending-title-update'))); ?> </div> <?php } unset($values); ?> </div> <br class="default-box-template fw-hidden" data-template="<?php /** * Place template in attribute to prevent it to be treated as html * when this option will be used inside another option template */ $values = array(); // must contain characters that will remain the same after htmlspecialchars() $increment_placeholder = '###-addable-box-increment-' . fw_rand_md5() . '-###'; echo fw_htmlspecialchars('<div class="fw-option-box" data-name-prefix="' . fw_htmlspecialchars($data['name_prefix'] . '[' . $id . '][' . $increment_placeholder . ']') . '">' . fw()->backend->render_box($data['id_prefix'] . $id . '-' . $increment_placeholder . '-box', ' ', '<div class="fw-option-box-options fw-force-xs">' . fw()->backend->render_options($box_options, $values, array('id_prefix' => $data['id_prefix'] . $id . '-' . $increment_placeholder . '-', 'name_prefix' => $data['name_prefix'] . '[' . $id . '][' . $increment_placeholder . ']')) . '</div>', array('html_after_title' => $controls_html)) . '</div>'); ?> "> <div class="fw-option-boxes-controls"> <?php echo fw_html_tag('button', array('type' => 'button', 'onclick' => 'return false;', 'class' => 'button fw-option-boxes-add-button', 'data-increment' => ++$i, 'data-increment-placeholder' => $increment_placeholder, 'data-limit' => intval($option['limit'])), fw_htmlspecialchars($option['add-button-text'])); ?> </div> </div>