Пример #1
0
        function meta_box_import()
        {
            $form = new ITForm();
            ?>
	<?php 
            $form->start_form(array(), 'import_data');
            ?>
		<p><?php 
            _e('Importing a Builder export file allows you to apply/add some or all of the export data to the site. Importing the data also also adds the uploaded export file to the list of Site Exports for use later.', 'it-l10n-Builder-Cohen');
            ?>
</p>
		<hr />
		
		<p><?php 
            printf(__('Select export file to import:', 'it-l10n-Builder-Cohen'));
            ?>
</p>
		<ul class="no-bullets">
			<li><?php 
            $form->add_file_upload('import_file');
            ?>
</li>
		</ul>
		<br />
		
		<p>
			<?php 
            $form->add_submit('import', array('value' => 'Import', 'class' => 'button-secondary'));
            ?>
		</p>
		
		<?php 
            $form->add_hidden_no_save('action', 'import');
            ?>
		<?php 
            $form->add_hidden_no_save('editor_tab', $this->_parent->_active_tab);
            ?>
	<?php 
            $form->end_form();
        }
Пример #2
0
    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 
    }
Пример #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 
        }