Example #1
0
        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 
            }
        }