Exemple #1
0
        function form($instance)
        {
            $instance = wp_parse_args((array) $instance, array('sidebar' => ''));
            $form = new ITForm($instance, array('widget_instance' => $this));
            if (empty($this->_registered_sidebars)) {
                $this->_registered_sidebars = get_transient('it-cached-registered-sidebars');
            }
            if (!is_array($this->_registered_sidebars)) {
                $this->_registered_sidebars = array();
            }
            unset($this->_registered_sidebars['wp_inactive_widgets']);
            ?>
	<p>
		<label for="<?php 
            echo $this->get_field_id('sidebar');
            ?>
"><?php 
            _e('Sidebar to Duplicate:', 'it-l10n-Builder-Madison');
            ?>
</label><br />
		<?php 
            $form->add_drop_down('sidebar', $this->_registered_sidebars);
            ?>
	</p>
<?php 
        }
Exemple #2
0
        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));
        }
Exemple #3
0
        function add_widget_style_dropdown($args)
        {
            $styles = builder_get_widget_styles();
            echo "<pre>Args: " . print_r($args, true) . "</pre>\n";
            it_classes_load('it-form.php');
            $form = new ITForm();
            $description = apply_filters('builder_filter_widget_style_input_description', __('Your Builder child theme offers different widget styles. Select one from the drop down for a different look for this widget.', 'it-l10n-Builder-Madison') . '<br />');
            ?>
	<p>
		<label><?php 
            echo $description;
            ?>
 <?php 
            $form->add_drop_down('it-style', $styles);
            ?>
<br /></label>
	</p>
<?php 
        }
Exemple #4
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 
    }
Exemple #5
0
        function meta_box_site_exports()
        {
            $form = new ITForm();
            if (!empty($_GET['exported']) && isset($this->_exports['exports'][$_GET['exported']]['name'])) {
                ITUtility::show_status_message(sprintf(__('Created export: %s', 'it-l10n-Builder-Cohen'), $this->_exports['exports'][$_GET['exported']]['name']));
            }
            if (!empty($_GET['deleted'])) {
                if ($_GET['deleted'] > 1) {
                    ITUtility::show_status_message(sprintf(__('%d exports deleted.', 'it-l10n-Builder-Cohen'), $_GET['deleted']));
                } else {
                    if ($_GET['deleted'] > 0) {
                        ITUtility::show_status_message(__('Export deleted.', 'it-l10n-Builder-Cohen'));
                    }
                }
            }
            ?>
	<?php 
            $form->start_form(array(), 'site_exports');
            ?>
		<p><?php 
            _e('The following listing shows export files created on this site or imported from another site. These exports can be imported into this site (in order to revert changes made to the site\'s settings) or can be downloaded for importing into another site.', 'it-l10n-Builder-Cohen');
            ?>
</p>
		<hr />
		
		<?php 
            if (empty($this->_exports['exports'])) {
                ?>
			<p><?php 
                printf(__('No exports have been created on or imported. Please use either the <a href="%1$s">Export Data</a> or <a href="%2$s">Import Data</a> options to load data.', 'it-l10n-Builder-Cohen'), '#import-export-export', '#import-export-import');
                ?>
</p>
		<?php 
            } else {
                ?>
			<?php 
                ob_start();
                ?>
				<tr class="thead">
					<th scope="col" class="check-column"><input type="checkbox" id="check-all-groups" /></th>
					<th><?php 
                _e('Name', 'it-l10n-Builder-Cohen');
                ?>
</th>
					<th><?php 
                _e('Export Date and Time', 'it-l10n-Builder-Cohen');
                ?>
</th>
					<th title="<?php 
                _e('The types of data contained inside the export.', 'it-l10n-Builder-Cohen');
                ?>
"><?php 
                _e('Contents', 'it-l10n-Builder-Cohen');
                ?>
</th>
					<th title="<?php 
                _e('This is the version of Builder that created the export.', 'it-l10n-Builder-Cohen');
                ?>
"><?php 
                _e('Builder Version', 'it-l10n-Builder-Cohen');
                ?>
</th>
					<th title="<?php 
                _e('This is the site that created the export.', 'it-l10n-Builder-Cohen');
                ?>
"><?php 
                _e('Source Site', 'it-l10n-Builder-Cohen');
                ?>
</th>
					<th title="<?php 
                _e('This is the user who created the export.', 'it-l10n-Builder-Cohen');
                ?>
"><?php 
                _e('Exported By', 'it-l10n-Builder-Cohen');
                ?>
</th>
					<th><?php 
                _e('Download', 'it-l10n-Builder-Cohen');
                ?>
</th>
				</tr>
			<?php 
                $header = ob_get_contents();
                ob_end_clean();
                ?>
			
			<div class="tablenav top">
				<div class="alignleft actions">
					<?php 
                $form->add_drop_down('action', array('' => __('Bulk Actions'), 'delete' => __('Delete')));
                ?>
					<?php 
                $form->add_submit('bulk_action', array('class' => 'button-secondary action', 'value' => __('Apply')));
                ?>
				</div>
			</div>
			
			<table cellspacing="0" class="widefat fixed" id="site-exports">
				<thead>
					<?php 
                echo $header;
                ?>
				</thead>
				<tfoot>
					<?php 
                echo $header;
                ?>
				</tfoot>
				<tbody>
					<?php 
                $count = 0;
                ?>
					<?php 
                foreach ((array) $this->_exports['exports'] as $guid => $info) {
                    ?>
						<?php 
                    $timestamp = gmdate('Y-m-d H:i:s', $info['timestamp'] + get_option('gmt_offset') * 3600);
                    $import_link = wp_nonce_url("{$this->_parent->_self_link}&amp;action=import&amp;guid={$guid}", "import_guid_{$guid}");
                    $delete_link = wp_nonce_url("{$this->_parent->_self_link}&amp;action=delete&amp;guid={$guid}", "delete_guid_{$guid}");
                    $data_sources = array();
                    foreach ((array) $info['data_sources'] as $source) {
                        $data_sources[] = $source['name'];
                    }
                    natcasesort($data_sources);
                    $contents = implode(', ', $data_sources);
                    $class = $count++ % 2 ? '' : 'alternate';
                    ?>
						<tr class="<?php 
                    echo $class;
                    ?>
" id="entry-<?php 
                    echo $guid;
                    ?>
">
							<th scope="row" class="check-column"><input type="checkbox" name="guid[]" class="administrator exports" value="<?php 
                    echo $guid;
                    ?>
" /></th>
							<td>
								<strong><a title="<?php 
                    echo esc_attr(sprintf(__('Import data from %s', 'it-l10n-Builder-Cohen'), $info['name']));
                    ?>
" href="<?php 
                    echo esc_html($import_link);
                    ?>
"><?php 
                    echo $info['name'];
                    ?>
</a></strong>
								<br/>
								<div class="row-actions">
									<span class="import"><a title="<?php 
                    echo esc_attr(sprintf(__('Import data from %s', 'it-l10n-Builder-Cohen'), $info['name']));
                    ?>
" href="<?php 
                    echo esc_html($import_link);
                    ?>
"><?php 
                    _e('Import', 'it-l10n-Builder-Cohen');
                    ?>
</a> | </span>
									<span class="delete"><a href="<?php 
                    echo esc_attr($delete_link);
                    ?>
" onclick='return showNotice.warn();'><?php 
                    _e('Delete', 'it-l10n-Builder-Cohen');
                    ?>
</a></span>
								</div>
							</td>
							<td><?php 
                    echo $timestamp;
                    ?>
</td>
							<td><?php 
                    echo $contents;
                    ?>
</td>
							<td><?php 
                    echo $info['builder_version'];
                    ?>
</td>
							<td><a href="<?php 
                    echo esc_attr($info['site_url']);
                    ?>
"><?php 
                    echo $info['site_url'];
                    ?>
</a></td>
							<td><?php 
                    echo $info['exported_by'];
                    ?>
</td>
							<td><a href="<?php 
                    echo esc_attr($info['url']);
                    ?>
"><?php 
                    echo basename($info['file']);
                    ?>
</a></td>
						</tr>
					<?php 
                }
                ?>
				</tbody>
			</table>
			
			<div class="tablenav bottom">
				<div class="alignleft actions">
					<?php 
                $form->add_drop_down('action2', array('' => __('Bulk Actions'), 'delete' => __('Delete')));
                ?>
					<?php 
                $form->add_submit('bulk_action', array('class' => 'button-secondary action', 'value' => __('Apply')));
                ?>
				</div>
			</div>
		<?php 
            }
            ?>
		
		<?php 
            $form->add_hidden_no_save('editor_tab', $this->_parent->_active_tab);
            ?>
	<?php 
            $form->end_form();
        }
Exemple #6
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 
        }
Exemple #7
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 
            }
        }
Exemple #8
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 
            }
        }
Exemple #9
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 
    }