示例#1
0
        function meta_box_export()
        {
            $options = array();
            if (!empty($_GET['export_error'])) {
                $errors = explode(',', $_GET['export_error']);
                if (in_array('name', $errors)) {
                    ITUtility::show_inline_error_message('You must supply a name for the export.');
                }
            }
            foreach ((array) $this->_data_sources as $var => $name) {
                $options['data_sources'][] = $var;
            }
            $form = new ITForm($options);
            ?>
	<?php 
            $form->start_form(array(), 'export_data');
            ?>
		<p><?php 
            _e('A Builder export file can be used to easily migrate settings, layouts, and views to another site. For example, transferring settings from a development site to a production site. Export files can also be used as very basic backups of Builder settings.', 'it-l10n-Builder-Cohen');
            ?>
</p>
		<hr />
		
		<p><?php 
            _e('Create a name for this export:', 'it-l10n-Builder-Cohen');
            ?>
</p>
		<ul class="no-bullets">
			<li><label for="name"><?php 
            $form->add_text_box('name');
            ?>
</label></li>
		</ul>
		
		<p><?php 
            _e('Select what the export file should contain:', 'it-l10n-Builder-Cohen');
            ?>
</p>
		<ul class="no-bullets">
			<?php 
            foreach ((array) $this->_data_sources as $var => $name) {
                ?>
				<li><label for="data_sources-<?php 
                echo $var;
                ?>
"><?php 
                $form->add_multi_check_box('data_sources', $var);
                ?>
 <?php 
                echo $name;
                ?>
</li>
			<?php 
            }
            ?>
		</ul>
		
		<p>
			<?php 
            $form->add_submit('export', array('value' => 'Create Export', 'class' => 'button-secondary'));
            ?>
		</p>
		
		<?php 
            $form->add_hidden_no_save('action', 'export');
            ?>
		<?php 
            $form->add_hidden_no_save('editor_tab', $this->_parent->_active_tab);
            ?>
	<?php 
            $form->end_form();
        }
示例#2
0
    function _show_child_theme_options()
    {
        $options = array('child_theme_type' => 'parent', 'child_theme_option' => 'activate', 'theme_activation' => !empty($_REQUEST['theme_activation']) ? 1 : '', 'fresh_install' => !empty($_REQUEST['fresh_install']) ? 1 : '', 'step' => 'layouts_and_views');
        if (get_transient('builder_fresh_install')) {
            $options['step'] = 'finish';
            delete_transient('builder_fresh_install');
        }
        $themes = wp_get_themes();
        $names = array();
        foreach ($themes as $theme) {
            $names[] = $theme->get('Name');
        }
        $options['child_theme_name'] = sprintf(__('%s - Custom', 'it-l10n-Builder-Paige'), $themes[basename(get_template_directory())]->get('Name'));
        if (in_array($options['child_theme_name'], $names)) {
            $count = 2;
            while (in_array("{$options['child_theme_name']} {$count}", $names)) {
                $count++;
            }
            $options['child_theme_name'] = "{$options['child_theme_name']} {$count}";
        }
        $logo_url = ITUtility::get_url_from_file(dirname(__FILE__) . '/images/builder-logo.png');
        $child = wp_get_theme(get_stylesheet());
        if (get_template() == get_stylesheet()) {
            $child_theme_objects = builder_get_child_themes();
            $child_themes = array();
            foreach ($child_theme_objects as $theme) {
                $child_themes[$theme->get_stylesheet()] = $theme->get('Name');
            }
            if (empty($child_themes)) {
                $type = 'create_child';
            } else {
                $type = 'select_or_create_child';
            }
            $parent = $child;
        } else {
            $type = 'child_info';
            $parent = wp_get_theme(get_template());
        }
        $form = new ITForm($options);
        $this->_form =& $form;
        ?>
	<div class="wrap">
		<?php 
        $form->start_form();
        ?>
			<?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 ('child_info' == $type) {
            ?>
					<div class="it-notice"><?php 
            printf(__('You are currently running a custom Builder child theme called <strong>%1$s</strong> created for the <strong>%2$s</strong> theme. All customizations should be made to this custom theme.', 'it-l10n-Builder-Paige'), $child->get('Name'), $parent->get('Name'));
            ?>
</div>
					<br />
					
					<div class="it-input-set">
						<?php 
            if ('finish' == $options['step']) {
                ?>
							<?php 
                $form->add_submit('ignore', array('value' => __('Continue', 'it-l10n-Builder-Paige')));
                ?>
						<?php 
            } else {
                ?>
							<?php 
                $form->add_submit('ignore', array('value' => __('Continue to Layouts and Views Setup', 'it-l10n-Builder-Paige')));
                ?>
						<?php 
            }
            ?>
					</div>
				<?php 
        } elseif ('create_child' == $type) {
            ?>
					<p><?php 
            printf(__('To create a <a href="%1$s">child theme</a> that you can customize, choose a name below and click the <em>Create My Child Theme</em> button.', 'it-l10n-Builder-Paige'), 'http://codex.wordpress.org/Child_Themes');
            ?>
</p>
					
					<div class="it-input-set">
						<label for="child_theme_name"><?php 
            _e('Your child theme name', 'it-l10n-Builder-Paige');
            ?>
</label>
						<?php 
            ITUtility::add_tooltip(__('Use a descriptive name that will help you identify your theme\'s name.', 'it-l10n-Builder-Paige'));
            ?>
						<br />
						
						<?php 
            $form->add_text_box('child_theme_name', array('class' => 'regular-text'));
            ?>
					</div>
					
					<div class="it-input-set">
						<?php 
            $form->add_submit('create_child_theme', array('value' => __('Create My Child Theme', 'it-l10n-Builder-Paige')));
            ?>
						
						<?php 
            if (empty($GLOBALS['builder_fresh_install'])) {
                ?>
							<p><a class="it-skip" href="<?php 
                echo admin_url('admin.php?page=theme-settings&editor_tab=setup&step=layouts_and_views');
                ?>
"><?php 
                _e('Skip to next step', 'it-l10n-Builder-Paige');
                ?>
</a></p>
						<?php 
            } else {
                ?>
							<p><a class="it-skip" href="<?php 
                echo admin_url('admin.php?page=ithemes-builder-theme');
                ?>
"><?php 
                _e('Skip', 'it-l10n-Builder-Paige');
                ?>
</a></p>
						<?php 
            }
            ?>
					</div>
				<?php 
        } else {
            ?>
					<p><?php 
            printf(_n('Your site has a <a href="%1$s">child theme</a> for the %2$s theme available. As it is recommended to always run a child theme rather than the parent theme, please either activate the existing child theme or create a new one using the options below.', 'Your site has <a href="%1$s">child themes</a> for the %2$s theme available. As it is recommended to always run a child theme rather than the parent theme, please either activate an existing child theme or create a new one using the options below.', count($child_themes), 'it-l10n-Builder-Paige'), 'http://codex.wordpress.org/Child_Themes', $parent->get('Name'));
            ?>
</p>
					
					<div class="it-shrink-wrap-box">
						<label><?php 
            printf(__('%1$s Activate an existing child theme', 'it-l10n-Builder-Paige'), $form->add_radio('child_theme_option', array('value' => 'activate', 'class' => 'show-hide-toggle')));
            ?>
</label>
						<br />
						
						<label><?php 
            printf(__('%1$s Create a new child theme', 'it-l10n-Builder-Paige'), $form->add_radio('child_theme_option', array('value' => 'create', 'class' => 'show-hide-toggle')));
            ?>
</label>
						<br />
						<br />
						
						<div class="it-options-child_theme_option it-options-child_theme_option-activate">
							<p><label for="child_theme"><?php 
            _e('Select the theme to activate:', 'it-l10n-Builder-Paige');
            ?>
</label></p>
							<?php 
            $form->add_drop_down('child_theme', $child_themes);
            ?>
							<br />
							<br />
							<br />
							<?php 
            $form->add_submit('create_child_theme', array('value' => __('Activate My Child Theme', 'it-l10n-Builder-Paige')));
            ?>
						</div>
						
						<div class="it-options-child_theme_option it-options-child_theme_option-create">
							<p>
								<label for="child_theme_name"><?php 
            _e('Your child theme name', 'it-l10n-Builder-Paige');
            ?>
</label>
								<?php 
            ITUtility::add_tooltip(__('Use a descriptive name that will help you identify your theme.', 'it-l10n-Builder-Paige'));
            ?>
							</p>
							
							<?php 
            $form->add_text_box('child_theme_name', array('class' => 'regular-text'));
            ?>
							<br />
							<br />
							<br />
							
							<?php 
            $form->add_submit('create_child_theme', array('value' => __('Create My Child Theme', 'it-l10n-Builder-Paige')));
            ?>
						</div>
						
						<?php 
            if (empty($GLOBALS['builder_fresh_install'])) {
                ?>
							<p><a class="it-skip" href="<?php 
                echo admin_url('admin.php?page=theme-settings&editor_tab=setup&step=layouts_and_views');
                ?>
"><?php 
                _e('Skip to next step', 'it-l10n-Builder-Paige');
                ?>
</a></p>
						<?php 
            } else {
                ?>
							<p><a class="it-skip" href="<?php 
                echo admin_url('admin.php?page=ithemes-builder-theme');
                ?>
"><?php 
                _e('Skip', 'it-l10n-Builder-Paige');
                ?>
</a></p>
						<?php 
            }
            ?>
					</div>
				<?php 
        }
        ?>
			</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 
    }
示例#3
0
        function _modify_layout()
        {
            $defaults = array('guid' => '', 'description' => '', 'width' => '960', 'hide_widths' => 'no');
            $defaults = apply_filters('builder_filter_layout_editor_default_values', $defaults);
            $layout_widths = array('600' => __('Narrow (600 pixels)', 'it-l10n-Builder-Paige'), '780' => __('Medium (780 pixels)', 'it-l10n-Builder-Paige'), '960' => __('Wide (960 pixels)', 'it-l10n-Builder-Paige'));
            $layout_widths = apply_filters('builder_filter_layout_editor_width_options', $layout_widths);
            foreach ((array) $layout_widths as $width => $description) {
                if ((string) intval($width) != (string) $width) {
                    unset($layout_widths[$width]);
                }
            }
            $layout_widths['custom'] = __('Custom...', 'it-l10n-Builder-Paige');
            if (builder_theme_supports('builder-extensions')) {
                $extensions_data = apply_filters('builder_get_extensions_data', array());
                $extensions = array('' => __('-- No Extension --', 'it-l10n-Builder-Paige'));
                $extension_descriptions = array();
                foreach ((array) $extensions_data as $extension => $extension_data) {
                    $extensions[$extension] = $extension_data['name'];
                    $description = $extension_data['description'];
                    if (!empty($description)) {
                        $description = "<p>{$description}</p>";
                    }
                    if ($extension_data['disable_theme_style']) {
                        $description .= __('<p><strong>Notice:</strong> This Extension replaces theme styling with its own.</p>', 'it-l10n-Builder-Paige');
                    }
                    $extension_descriptions[] = '"' . str_replace('"', '\\"', $extension) . '": "' . str_replace('"', '\\"', $description) . '"';
                }
            }
            /*			$layouts = array();
            			foreach ( (array) $this->_options['layouts'] as $layout_id => $layout_data ) {
            				if ( isset( $_REQUEST['layout'] ) && ( $layout_id == $_REQUEST['layout'] ) )
            					continue;
            				$layouts[$layout_id] = $layout_data['description'];
            			}
            			sort( $layouts );*/
            $layout = array();
            if (isset($this->_cached_layout) && is_array($this->_cached_layout)) {
                $layout = $this->_cached_layout;
            } else {
                if (isset($_REQUEST['layout']) && isset($this->_options['layouts'][$_REQUEST['layout']])) {
                    $layout = $this->_options['layouts'][$_REQUEST['layout']];
                }
            }
            $layout = ITUtility::merge_defaults($layout, $defaults);
            if (isset($layout['width']) && (string) intval($layout['width']) == (string) $layout['width'] && !isset($layout_widths[$layout['width']])) {
                $layout['custom_width'] = $layout['width'];
                $layout['width'] = 'custom';
            }
            if (!empty($layout['extension']) && false !== strpos($layout['extension'], '%WP_CONTENT_DIR%')) {
                $layout['extension'] = basename($layout['extension']);
            }
            $form = new ITForm($layout);
            ?>
	<div class="wrap">
		<?php 
            ITUtility::screen_icon();
            ?>
		
		<?php 
            if (!empty($_REQUEST['layout'])) {
                ?>
			<h2><?php 
                _e('Edit Layout', $this->_var);
                ?>
</h2>
		<?php 
            } else {
                ?>
			<h2><?php 
                _e('Add New Layout', $this->_var);
                ?>
</h2>
		<?php 
            }
            ?>
		
		<?php 
            $form->start_form();
            ?>
			<h3 class="title"><?php 
            _e('Settings', 'it-l10n-Builder-Paige');
            ?>
</h3>
			<table class="form-table">
				<tr><th scope="row"><label for="description"><?php 
            _e('Name', 'it-l10n-Builder-Paige');
            ?>
</label></th>
					<td>
						<?php 
            $form->add_text_box('description', array('size' => '15', 'maxlength' => '15'));
            ?>
						<?php 
            ITUtility::add_tooltip(__('The name helps identify this Layout\'s widget areas. Choose a descriptive, short name.', 'it-l10n-Builder-Paige'));
            ?>
					</td>
				</tr>
				<tr><th scope="row"><label for="width"><?php 
            _e('Width', 'it-l10n-Builder-Paige');
            ?>
</label></th>
					<td>
						<?php 
            $form->add_drop_down('width', $layout_widths);
            ?>
						<?php 
            ITUtility::add_tooltip(__('The width determines how wide the Layout is. Typically, a wider width is better for more complex Layouts that have multiple sidebars while a more narrow width is better for minimalistic Layouts such as one that does not use any sidebars.'));
            ?>
						<div id="layout-width-custom" style="display:none;">
							<label>
								<?php 
            _e('Custom Width', 'it-l10n-Builder-Paige');
            ?>
								<?php 
            $form->add_text_box('custom_width', array('size' => '4', 'maxlength' => '5'));
            ?>
								<?php 
            _e('pixels', 'it-l10n-Builder-Paige');
            ?>
							</label>
						</div>
					</td>
				</tr>
				<?php 
            if (builder_theme_supports('builder-extensions')) {
                ?>
					<tr><th scope="row"><label for="extension"><?php 
                _e('Extension', 'it-l10n-Builder-Paige');
                ?>
</label></th>
						<td>
							<?php 
                $form->add_drop_down('extension', $extensions);
                ?>
							<?php 
                ITUtility::add_tooltip(__('Extensions can provide additional code that changes the content, provides additional features, or modifies the styling of the Layout.<br /><br />You can find Extensions in your theme\'s directory inside a directory named "extensions".', 'it-l10n-Builder-Paige'));
                ?>
							
							<div id="extension-details"></div>
						</td>
					</tr>
				<?php 
            }
            ?>
				<tr><th scope="row"><label for="hide_widgets"><?php 
            _e('Hide Widget Areas', 'it-l10n-Builder-Paige');
            ?>
</label></th>
					<td>
						<?php 
            $form->add_drop_down('hide_widgets', array('no' => __('No', 'it-l10n-Builder-Paige'), 'yes' => __('Yes', 'it-l10n-Builder-Paige')));
            ?>
						<?php 
            ITUtility::add_tooltip(__('Use this option to hide this Layout\'s widget areas from the <strong>Appearance &gt; Widgets</strong> editor. This makes it easier to work with other Layout\'s widget areas.', 'it-l10n-Builder-Paige'));
            ?>
					</td>
				</tr>
				<?php 
            do_action('builder_editor_add_custom_settings', $layout);
            ?>
			</table>
			
			<h3 class="title">Design</h3>
			<table class="form-table layout-modules">
				<tr class="add-module-help"><td colspan="2"><?php 
            _e('In order to start building your layout, please click the Add Module link below.', 'it-l10n-Builder-Paige');
            ?>
</td></tr>
				<?php 
            $position = 1;
            $max_id = 0;
            if (isset($layout['modules'])) {
                foreach ((array) $layout['modules'] as $id => $module) {
                    if (false !== $this->_add_module_fields($module, $id, $position)) {
                        $position++;
                    }
                    if ($id > $max_id) {
                        $max_id = $id;
                    }
                }
            }
            ?>
			</table>
			
			<p class="submit">
				<?php 
            $form->add_submit('save', array('value' => __('Save Layout', 'it-l10n-Builder-Paige'), 'class' => 'button-primary'));
            ?>
				<?php 
            $form->add_submit('save_and_continue', array('value' => __('Save Layout and Continue Editing', 'it-l10n-Builder-Paige'), 'class' => 'button-secondary'));
            ?>
				<?php 
            $form->add_submit('cancel', array('value' => __('Cancel', 'it-l10n-Builder-Paige'), 'class' => 'button-secondary cancel'));
            ?>
			</p>
			
			<input type="hidden" name="next-position" value="<?php 
            echo $position;
            ?>
" />
			<input type="hidden" name="current-position" value="0" />
			<input type="hidden" name="next-id" value="<?php 
            echo $max_id + 1;
            ?>
" />
			<?php 
            $form->add_hidden('self-link', $this->_self_link);
            ?>
			<?php 
            if (isset($_REQUEST['layout'])) {
                $form->add_hidden('layout', $_REQUEST['layout']);
            }
            ?>
			<?php 
            if (isset($_REQUEST['layout'])) {
                $form->add_hidden('layout-guid', $layout['guid']);
            }
            ?>
			<?php 
            if (isset($_REQUEST['add_layout'])) {
                $form->add_hidden('add_layout', $_REQUEST['add_layout']);
            }
            ?>
			<?php 
            $form->add_hidden('base_url', "{$this->_plugin_url}");
            ?>
		<?php 
            $form->end_form();
            ?>
	</div>
<?php 
            foreach ((array) $this->_modules as $var => $module) {
                echo "<table id=\"module-editor-{$var}\" style=\"display:none;\">";
                $this->_add_module_fields(array('module' => $var, 'data' => array()), '%id%', '%position%');
                echo '</table>';
                $form->add_hidden("module-name-{$var}", $module->_name);
                $form->add_hidden("module-editable-{$var}", method_exists($module, 'edit') ? '1' : '0');
                $form->add_hidden("module-max-{$var}", $module->_max);
            }
            $module_image_paths = array();
            if (is_dir("{$this->_plugin_path}/modules") && ($readdir = opendir("{$this->_plugin_path}/modules"))) {
                while (($module = readdir($readdir)) !== false) {
                    if (preg_match('/^\\.{1,2}$/', $module)) {
                        continue;
                    }
                    if (is_dir("{$this->_plugin_path}/modules/{$module}") && is_dir("{$this->_plugin_path}/modules/{$module}/images")) {
                        $module_image_paths[] = "modules/{$module}/images";
                    }
                }
            }
            echo "<div class=\"preload-images\">\n";
            foreach ((array) $module_image_paths as $path) {
                if ($readdir = opendir("{$this->_plugin_path}/{$path}")) {
                    while (($image = readdir($readdir)) !== false) {
                        if (is_file("{$this->_plugin_path}/{$path}/{$image}") && preg_match('/\\.(png|jpg|jpeg|gif)$/i', $image)) {
                            echo "<img src=\"{$this->_plugin_url}/{$path}/{$image}\" alt=\"preload image\" />\n";
                        }
                    }
                }
            }
            echo "</div>\n";
            ?>
	<script type="text/javascript">
		<?php 
            if (isset($extension_descriptions)) {
                ?>
			var builder_extension_details = {<?php 
                echo implode(",\n", $extension_descriptions);
                ?>
};
		<?php 
            }
            ?>
		
		init_layout_editor();
	</script>
<?php 
        }
示例#4
0
        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 
            }
        }
示例#5
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 
            }
        }
示例#6
0
        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__)));
        }
    /**
     * Render the settings table
     *
     * @since 1.0
     *
     * @param \ITForm $form
     * @param array   $settings
     */
    function get_form_table($form, $settings = array())
    {
        if (!empty($settings)) {
            foreach ($settings as $key => $var) {
                $form->set_option($key, $var);
            }
        }
        $erd_class = $form->get_option('enable-renewal-discounts') ? '' : 'hide-if-js';
        $era_disabled = $form->get_option('sell-online-software') ? array() : array('disabled' => 'disabled');
        $info = $this->get_key_info();
        $activation = $form->get_option('activation');
        if ($info) {
            if (!isset($info->activations->list->{$activation}) || $info->activations->list->{$activation}->status == 'deactivated') {
                $still_active = false;
            } else {
                $still_active = true;
            }
        } else {
            $still_active = true;
        }
        ?>

		<style type="text/css">
			.description.active {
				color: #8cc53e;
			}

			.description.expired {
				color: #ffba00;
			}

			.description.disabled {
				color: #dd3d36;
			}
		</style>

		<div class="it-exchange-addon-settings it-exchange-itelic-addon-settings">

			<label for="license"><?php 
        _e("License Key", Plugin::SLUG);
        ?>
</label>
			<?php 
        $form->add_text_box('license');
        ?>

			<?php 
        if (empty($activation) || !$still_active) {
            ?>
				<?php 
            submit_button(__("Activate", Plugin::SLUG), 'secondary large', 'activate', false, 'style="height:46px;padding:0 20px;"');
            ?>
			<?php 
        } else {
            ?>
				<?php 
            submit_button(__("Deactivate", Plugin::SLUG), 'secondary large', 'deactivate', false, 'style="height:46px;padding:0 20px;"');
            ?>
			<?php 
        }
        ?>

			<?php 
        if ($info && $still_active) {
            ?>
				<p class="description <?php 
            echo $info->status;
            ?>
">
					<?php 
            if ($info->status == 'active') {
                ?>
						<?php 
                if ($info->expires) {
                    ?>
							<?php 
                    printf(__("License is active and expires %s", Plugin::SLUG), date(get_option('date_format'), strtotime($info->expires)));
                    ?>
						<?php 
                } else {
                    ?>
							<?php 
                    printf(__("License is active.", Plugin::SLUG));
                    ?>
						<?php 
                }
                ?>
					<?php 
            } elseif ($info->status == 'expired') {
                ?>
						<?php 
                _e("License has expired.", Plugin::SLUG);
                ?>
					<?php 
            } elseif ($info->status == 'disabled') {
                ?>
						<?php 
                _e("License is disabled.", Plugin::SLUG);
                ?>
					<?php 
            }
            ?>
				</p>
			<?php 
        } elseif (!$still_active && $form->get_option('activation')) {
            ?>
				<p class="description expired"><?php 
            _e("License deactivated remotely.", Plugin::SLUG);
            ?>
</p>
			<?php 
        }
        ?>

		<div class="it-exchange-addon-settings it-exchange-itelic-addon-settings">

			<h3><?php 
        _e("General", Plugin::SLUG);
        ?>
</h3>

			<div class="sell-online-software-container">
				<?php 
        $form->add_check_box('sell-online-software');
        ?>
				<label for="sell-online-software"><?php 
        _e("Enable Online Software Tools?", Plugin::SLUG);
        ?>
</label>

				<p class="description">
					<?php 
        _e("Check this if you sell at least one software product that is tied to URLs, such as WordPress plugins or themes.", Plugin::SLUG);
        ?>
				</p>
			</div>

			<div class="enable-remote-activation-container">
				<?php 
        $form->add_check_box('enable-remote-activation', $era_disabled);
        ?>
				<label for="enable-remote-activation"><?php 
        _e("Enable Remote License Activation?", Plugin::SLUG);
        ?>
</label>

				<p class="description">
					<?php 
        _e("Allow your customer's to activate a license key from your website. Requires Online Software Tools to be enabled.", Plugin::SLUG);
        ?>
				</p>
			</div>

			<div class="enable-remote-deactivation-container">
				<?php 
        $form->add_check_box('enable-remote-deactivation');
        ?>
				<label for="enable-remote-deactivation"><?php 
        _e("Enable Remote License Deactivation", Plugin::SLUG);
        ?>
</label>

				<p class="description"><?php 
        _e("Allow your customer's to remotely deactivate a license key.", Plugin::SLUG);
        ?>
</p>
			</div>

			<h3><?php 
        _e("Renewal Discounts", Plugin::SLUG);
        ?>
</h3>

			<div class="enable-renewal-discounts-container">

				<?php 
        $form->add_check_box('enable-renewal-discounts');
        ?>
				<label for="enable-renewal-discounts"><?php 
        _e("Enable a Global Renewal Discount?", Plugin::SLUG);
        ?>
</label>

				<p class="description"><?php 
        _e("Don't worry, this can be overridden on a per-product basis.", Plugin::SLUG);
        ?>
</p>
			</div>

			<div class="renewal-discount-type-container <?php 
        echo esc_attr($erd_class);
        ?>
">
				<label for="renewal-discount-type"><?php 
        _e("Discount Type", Plugin::SLUG);
        ?>
</label>

				<?php 
        $form->add_drop_down('renewal-discount-type', array(Renewal\Discount::TYPE_FLAT => __('Flat', Plugin::SLUG), Renewal\Discount::TYPE_PERCENT => __("Percent", Plugin::SLUG)));
        ?>
			</div>

			<div class="renewal-discount-amount-container <?php 
        echo esc_attr($erd_class);
        ?>
">
				<label for="renewal-discount-amount"><?php 
        _e("Discount Amount", Plugin::SLUG);
        ?>
</label>

				<?php 
        $form->add_text_box('renewal-discount-amount');
        ?>
			</div>

			<div class="renewal-discount-expiry-container <?php 
        echo esc_attr($erd_class);
        ?>
">
				<label for="renewal-discount-expiry"><?php 
        _e("Valid Until", Plugin::SLUG);
        ?>
</label>

				<?php 
        $form->add_text_box('renewal-discount-expiry');
        ?>

				<p class="description"><?php 
        _e("For how many days after the license key expires should the renewal discount be applied.", Plugin::SLUG);
        ?>
</p>
			</div>

		</div>
		<?php 
    }