function render_box($post) { $layout_data = apply_filters('it_storage_load_layout_settings', array()); $layouts = array('' => ''); foreach ((array) $layout_data['layouts'] as $layout => $layout_data) { $layouts[$layout] = $layout_data['description']; } if (!empty($GLOBALS['post_type']) && is_callable('get_post_type_object')) { $post_type = get_post_type_object($GLOBALS['post_type']); $type = $post_type->labels->singular_name; } else { $type = preg_match('|page[^/]+$|', $_SERVER['REQUEST_URI']) ? 'page' : 'post'; } $data = array(); if (isset($post->ID)) { $data['custom_layout'] = get_post_meta($post->ID, '_custom_layout', true); } $form = new ITForm($data, array('prefix' => $this->_var)); ?> <p><strong><?php _e('Select a Layout:', 'it-l10n-Builder-Paige'); ?> </strong></p> <p><?php $form->add_drop_down('custom_layout', $layouts); ?> </p> <p><?php printf(__('Choosing a Custom Builder Layout causes the chosen Layout to be used when viewing this %1$s. It will override any custom Views you have configured in the <a href="%2$s">Views Editor</a>.', 'it-l10n-Builder-Paige'), $type, admin_url('admin.php?page=layout-editor&editor_tab=views')); ?> </p> <?php $form->add_hidden('nonce', wp_create_nonce($this->_var)); }
function _show_layouts_and_views_options() { $options = array('child_theme_type' => 'parent', 'theme_layouts' => 'ignore', 'theme_activation' => !empty($_REQUEST['theme_activation']) ? 1 : '', 'fresh_install' => !empty($_REQUEST['fresh_install']) ? 1 : '', 'step' => 'finish'); $logo_url = ITUtility::get_url_from_file(dirname(__FILE__) . '/images/builder-logo.png'); $old_theme = isset($GLOBALS['builder_old_theme']) ? $GLOBALS['builder_old_theme'] : false; $current_theme = wp_get_theme(); if ($old_theme && $old_theme->get_template() != $current_theme->get_template()) { $template_switch = true; } else { $template_switch = false; } $form = new ITForm($options); $this->_form =& $form; ?> <div class="wrap"> <?php $form->start_form(array('id' => 'it-builder-setup')); ?> <?php if (empty($_REQUEST['theme_activation'])) { ?> <?php ITUtility::screen_icon(); ?> <?php $this->_print_editor_tabs(); ?> <?php } ?> <div class="it-brochure-box"> <img class="it-logo" src="<?php echo $logo_url; ?> " alt="Builder Logo" /> <h1>Builder Setup</h1> <?php if ($template_switch) { ?> <p><?php _e('You are switching from a different Builder theme. Would you like to continue to use your current Layouts and Views? Or do you want to use the Layouts and Views included with this new theme?', 'it-l10n-Builder-Paige'); ?> </p> <div class="it-shrink-wrap-box"> <label><?php printf(__('%1$s Keep the site\'s current Layouts and Views', 'it-l10n-Builder-Paige'), $form->add_radio('theme_layouts', array('value' => 'ignore', 'class' => 'show-hide-toggle'))); ?> </label> <br /> <label><?php printf(__('%1$s Use the Layouts and Views included with the new theme', 'it-l10n-Builder-Paige'), $form->add_radio('theme_layouts', array('value' => 'use', 'class' => 'show-hide-toggle'))); ?> </label> <div class="it-options-theme_layouts it-options-theme_layouts-use"> <p class="description"><?php _e('Important: This option will replace your current Layouts and Views with the Layouts and Views provided by the theme.', 'it-l10n-Builder-Paige'); ?> </p> </div> <!-- <div class="it-indent-box it-options-theme_layouts it-options-theme_layouts-use"> <label><?php printf(__('%1$s Keep current Layouts', 'it-l10n-Builder-Paige'), $form->add_radio('layouts_import_method', 'add')); ?> </label> <br /> <label><?php printf(__('%1$s Remove current Layouts', 'it-l10n-Builder-Paige'), $form->add_radio('layouts_import_method', 'replace')); ?> </label> </div>--> </div> <?php } else { ?> <p><?php _e('Your theme provides a set of default Layouts and Views. You can update your site to match these provided Layouts and Views.', 'it-l10n-Builder-Paige'); ?> </p> <div class="it-shrink-wrap-box"> <label><?php printf(__('%1$s Keep the site\'s current Layouts and Views', 'it-l10n-Builder-Paige'), $form->add_radio('theme_layouts', array('value' => 'ignore', 'class' => 'show-hide-toggle'))); ?> </label> <br /> <label><?php printf(__('%1$s Use the Layouts and Views included with the theme', 'it-l10n-Builder-Paige'), $form->add_radio('theme_layouts', array('value' => 'use', 'class' => 'show-hide-toggle'))); ?> </label> <div class="it-options-theme_layouts it-options-theme_layouts-use"> <p class="description"><?php _e('Important: This option will replace your current Layouts and Views with the Layouts and Views provided by the theme.', 'it-l10n-Builder-Paige'); ?> </p> </div> <!-- <div class="it-indent-box it-options-theme_layouts it-options-theme_layouts-use"> <label><?php printf(__('%1$s Keep current Layouts', 'it-l10n-Builder-Paige'), $form->add_radio('layouts_import_method', 'add')); ?> </label> <br /> <label><?php printf(__('%1$s Remove current Layouts', 'it-l10n-Builder-Paige'), $form->add_radio('layouts_import_method', 'replace')); ?> </label> </div>--> </div> <?php } ?> <div class="it-input-set"> <div class="it-options-theme_layouts it-options-theme_layouts-ignore"> <?php $form->add_submit('update_layouts_and_views', array('value' => 'Keep current Layouts and Views')); ?> </div> <div class="it-options-theme_layouts it-options-theme_layouts-use"> <?php $form->add_submit('update_layouts_and_views', array('value' => 'Update Layouts and Views')); ?> </div> <p><a class="it-skip" href="<?php echo admin_url('admin.php?page=ithemes-builder-theme'); ?> "><?php _e('Skip'); ?> </a></p> </div> </div> <?php $form->add_hidden('theme_activation'); ?> <?php $form->add_hidden('fresh_install'); ?> <?php $form->add_hidden('step'); ?> <?php $form->add_hidden_no_save('editor_tab', $this->_parent->_active_tab); ?> <?php $form->end_form(); ?> </div> <?php }
function _add_module_fields($module, $id, $position) { if (!isset($this->_modules[$module['module']])) { return; } $defaults = $this->_modules[$module['module']]->get_defaults(); $data = array_merge($defaults, $module['data']); $form = new ITForm($data, array('prefix' => "module-{$id}")); $layout_option = $this->_modules[$module['module']]->get_layout_option(); $preview_image_url = $this->_modules[$module['module']]->get_preview_image($data); ?> <tr class="module-row" id="module-<?php echo $id; ?> "> <td class="preview-container"> <div id="module-<?php echo $id; ?> -preview" class="module-<?php echo $this->_modules[$module['module']]->_var; ?> "> <?php if (!empty($preview_image_url)) { ?> <img src="<?php echo $preview_image_url; ?> " /> <?php } ?> </div> </td> <td> <h4 class="module-name"> <span class="module-name"> <?php if (isset($module['data']['name'])) { ?> <?php echo $data['name']; ?> <?php } else { ?> <?php echo $this->_modules[$module['module']]->_name; ?> <?php } ?> </span> </h4> <div class="row-actions module-links"></div> <?php foreach ((array) $data as $var => $val) { $value_array = array('value' => $val); if ($var === $layout_option) { $value_array['class'] = 'layout-option'; } $form->add_hidden($var, $value_array); echo "\n"; } unset($form->_args['prefix']); ?> <?php $form->add_hidden("position-{$id}", array('value' => $position, 'class' => 'module-position')); ?> <?php $form->add_hidden("module-{$id}", array('value' => $module['module'], 'class' => 'module-var')); ?> <?php if (isset($module['guid'])) { $form->add_hidden("module-guid-{$id}", $module['guid']); } ?> </td> </tr> <?php return true; }
function form($instance) { $defaults = array('title' => '', 'entry_id' => '', 'style' => ''); $instance = wp_parse_args((array) $instance, $defaults); $form = new ITForm($instance, array('widget_instance' => $this)); $posts = get_posts(array('post_type' => 'widget_content', 'numberposts' => '1000')); $entries = array(); foreach ((array) $posts as $post) { $title = $post->post_title; if (strlen($title) > 80) { $title = substr($title, 0, 80) . '...'; } $entries[$post->ID] = $title; } asort($entries); $styles = builder_get_widget_styles(); if (!empty($styles)) { $styles = array_merge(array('' => 'Default'), $styles); } ?> <?php if (!empty($entries)) { ?> <p> <label for="<?php echo $this->get_field_id('title'); ?> "><?php _e('Title:', 'it-l10n-Builder-Madison'); ?> </label> <?php $form->add_text_box('title', array('class' => 'widefat')); ?> </p> <p> <label for="<?php echo $this->get_field_id('entry_id'); ?> "><?php _e('Widget Content Entry:', 'it-l10n-Builder-Madison'); ?> </label><br /> <?php $form->add_drop_down('entry_id', $entries); ?> </p> <?php if (!empty($styles)) { ?> <p> <label for="<?php echo $this->get_field_id('style'); ?> "><?php _e('Widget Style:', 'it-l10n-Builder-Madison'); ?> </label><br /> <?php $form->add_drop_down('style', $styles); ?> </p> <?php } else { ?> <?php $form->add_hidden('style'); ?> <?php } ?> <p> <em>Note: Use the <a href="<?php echo admin_url('edit.php?post_type=widget_content'); ?> ">Widget Content editor</a> to manage content for the Widget Content widgets.</em> </p> <?php } else { ?> <p> This widget allows you to easily add advanced content to a sidebar. </p> <p> Currently, your site doesn't have any Widget Content entries. Use the <a href="<?php echo admin_url('edit.php?post_type=widget_content'); ?> ">Widget Content editor</a> to create new entries. Once you have created one or more new Widget Content entries, edit this widget again to select the desired entry and customize the widget. </p> <?php $form->add_hidden('title'); ?> <?php $form->add_hidden('entry_id'); ?> <?php $form->add_hidden('style'); ?> <?php } }
function form($instance) { $defaults = array('show_site_title' => '1', 'custom_site_title' => '', 'site_title_tag' => 'div', 'home_title_tag' => 'h1', 'show_tagline' => '1', 'custom_tagline' => '', 'site_tagline_tag' => 'div', 'home_tagline_tag' => 'div'); $instance = wp_parse_args((array) $instance, $defaults); $form = new ITForm($instance, array('widget_instance' => $this)); $use_default_tag_settings_options = array('1' => __('Yes'), '' => __('No, use custom tag settings', 'it-l10n-Builder-Paige')); $generic_tag_options = array('div' => '<div> (Recommended)', 'h1' => '<h1> (Not Recommended)', 'h2' => '<h2>', 'h3' => '<h3>', 'h4' => '<h4>', 'h5' => '<h5>', 'h6' => '<h6>'); $home_title_tag_options = array('div' => '<div>', 'h1' => '<h1> (Recommended)'); $home_title_tag_options = array_merge($generic_tag_options, $home_title_tag_options); foreach ($generic_tag_options as $tag => $description) { $generic_tag_options[$tag] = htmlentities($description); } foreach ($home_title_tag_options as $tag => $description) { $home_title_tag_options[$tag] = htmlentities($description); } $styles = builder_get_widget_styles(); if (!empty($styles)) { $styles = array_merge(array('' => 'Default'), $styles); } ?> <p> <label for="<?php echo $this->get_field_id('show_site_title'); ?> "><?php printf(__('Show Site Title (configured in <a href="%s">Settings > General</a>):', 'it-l10n-Builder-Paige'), admin_url('options-general.php')); ?> </label><br /> <?php $form->add_yes_no_drop_down('show_site_title'); ?> </p> <p> <label for="<?php echo $this->get_field_id('custom_site_title'); ?> "><?php _e('Customize Site Title (leave blank for default Site Title):', 'it-l10n-Builder-Paige'); ?> </label><br /> <?php $form->add_text_box('custom_site_title'); ?> </p> <p> <label for="<?php echo $this->get_field_id('show_tagline'); ?> "><?php printf(__('Show Tagline (configured in <a href="%s">Settings > General</a>):', 'it-l10n-Builder-Paige'), admin_url('options-general.php')); ?> </label><br /> <?php $form->add_yes_no_drop_down('show_tagline'); ?> </p> <p> <label for="<?php echo $this->get_field_id('custom_tagline'); ?> "><?php _e('Customize Tagline (leave blank for default Tagline):', 'it-l10n-Builder-Paige'); ?> </label><br /> <?php $form->add_text_box('custom_tagline'); ?> </p> <p> <label for="<?php echo $this->get_field_id('home_title_tag'); ?> "><?php _e('Site Title tag (when on the home page):', 'it-l10n-Builder-Paige'); ?> </label><br /> <?php $form->add_drop_down('home_title_tag', $home_title_tag_options); ?> </p> <p> <label for="<?php echo $this->get_field_id('home_tagline_tag'); ?> "><?php _e('Tagline tag (when on the home page):', 'it-l10n-Builder-Paige'); ?> </label><br /> <?php $form->add_drop_down('home_tagline_tag', $generic_tag_options); ?> </p> <p> <label for="<?php echo $this->get_field_id('site_title_tag'); ?> "><?php _e('Site Title tag (on other site views):', 'it-l10n-Builder-Paige'); ?> </label><br /> <?php $form->add_drop_down('site_title_tag', $generic_tag_options); ?> </p> <p> <label for="<?php echo $this->get_field_id('site_tagline_tag'); ?> "><?php _e('Tagline tag (on other site views):', 'it-l10n-Builder-Paige'); ?> </label><br /> <?php $form->add_drop_down('site_tagline_tag', $generic_tag_options); ?> </p> <?php if (!empty($styles)) { ?> <p> <label for="<?php echo $this->get_field_id('style'); ?> "><?php _e('Widget Style:', 'it-l10n-Builder-Paige'); ?> </label><br /> <?php $form->add_drop_down('style', $styles); ?> </p> <?php } else { ?> <?php $form->add_hidden('style'); ?> <?php } }
function post_box_index() { global $post; $form = new ITForm($this->_parse_meta_box_data($post->ID)); $robots = array('' => '', 'index,follow' => 'index, follow', 'noindex,follow' => 'noindex, follow', 'index,nofollow' => 'index, nofollow', 'noindex,nofollow' => 'noindex, nofollow'); ?> <dl> <?php if (!empty($this->_options["enable_custom_titles_{$post->post_type}s"])) { ?> <dt><label for='<?php echo "{$this->_var}_title"; ?> '>Title</label></dt> <dd><?php $form->add_text_box("{$this->_var}_title", array('style' => 'width:350px;')); ?> </dd> <?php } ?> <?php if (!empty($this->_options["enable_custom_descriptions_{$post->post_type}s"])) { ?> <dt><label for='<?php echo "{$this->_var}_description"; ?> '>Description (max 150 characters)</label></dt> <dd><?php $form->add_text_area("{$this->_var}_description", array('style' => 'width:350px;')); ?> </dd> <?php } ?> <?php if (!empty($this->_options["enable_custom_robots_{$post->post_type}s"])) { ?> <dt><label for='<?php echo "{$this->_var}_robots"; ?> '>Robots</label></dt> <dd><?php $form->add_drop_down("{$this->_var}_robots", $robots); ?> </dd> <?php } ?> <?php if (!empty($this->_options["enable_custom_keywords_{$post->post_type}s"])) { ?> <dt><label for='<?php echo "{$this->_var}_keywords"; ?> '>Keywords (comma separated list)</label></dt> <dd><?php $form->add_text_box("{$this->_var}_keywords", array('style' => 'width:350px;')); ?> </dd> <?php } ?> </dl> <?php $form->add_hidden("{$this->_var}_save", '1'); ?> <?php $form->add_hidden("{$this->_var}_nonce", wp_create_nonce(plugin_basename(__FILE__))); }