function _show_layouts_and_views_options() { $options = array('child_theme_type' => 'parent', 'theme_layouts' => 'ignore', 'theme_activation' => !empty($_REQUEST['theme_activation']) ? 1 : '', 'fresh_install' => !empty($_REQUEST['fresh_install']) ? 1 : '', 'step' => 'finish'); $logo_url = ITUtility::get_url_from_file(dirname(__FILE__) . '/images/builder-logo.png'); $old_theme = isset($GLOBALS['builder_old_theme']) ? $GLOBALS['builder_old_theme'] : false; $current_theme = wp_get_theme(); if ($old_theme && $old_theme->get_template() != $current_theme->get_template()) { $template_switch = true; } else { $template_switch = false; } $form = new ITForm($options); $this->_form =& $form; ?> <div class="wrap"> <?php $form->start_form(array('id' => 'it-builder-setup')); ?> <?php if (empty($_REQUEST['theme_activation'])) { ?> <?php ITUtility::screen_icon(); ?> <?php $this->_print_editor_tabs(); ?> <?php } ?> <div class="it-brochure-box"> <img class="it-logo" src="<?php echo $logo_url; ?> " alt="Builder Logo" /> <h1>Builder Setup</h1> <?php if ($template_switch) { ?> <p><?php _e('You are switching from a different Builder theme. Would you like to continue to use your current Layouts and Views? Or do you want to use the Layouts and Views included with this new theme?', 'it-l10n-Builder-Paige'); ?> </p> <div class="it-shrink-wrap-box"> <label><?php printf(__('%1$s Keep the site\'s current Layouts and Views', 'it-l10n-Builder-Paige'), $form->add_radio('theme_layouts', array('value' => 'ignore', 'class' => 'show-hide-toggle'))); ?> </label> <br /> <label><?php printf(__('%1$s Use the Layouts and Views included with the new theme', 'it-l10n-Builder-Paige'), $form->add_radio('theme_layouts', array('value' => 'use', 'class' => 'show-hide-toggle'))); ?> </label> <div class="it-options-theme_layouts it-options-theme_layouts-use"> <p class="description"><?php _e('Important: This option will replace your current Layouts and Views with the Layouts and Views provided by the theme.', 'it-l10n-Builder-Paige'); ?> </p> </div> <!-- <div class="it-indent-box it-options-theme_layouts it-options-theme_layouts-use"> <label><?php printf(__('%1$s Keep current Layouts', 'it-l10n-Builder-Paige'), $form->add_radio('layouts_import_method', 'add')); ?> </label> <br /> <label><?php printf(__('%1$s Remove current Layouts', 'it-l10n-Builder-Paige'), $form->add_radio('layouts_import_method', 'replace')); ?> </label> </div>--> </div> <?php } else { ?> <p><?php _e('Your theme provides a set of default Layouts and Views. You can update your site to match these provided Layouts and Views.', 'it-l10n-Builder-Paige'); ?> </p> <div class="it-shrink-wrap-box"> <label><?php printf(__('%1$s Keep the site\'s current Layouts and Views', 'it-l10n-Builder-Paige'), $form->add_radio('theme_layouts', array('value' => 'ignore', 'class' => 'show-hide-toggle'))); ?> </label> <br /> <label><?php printf(__('%1$s Use the Layouts and Views included with the theme', 'it-l10n-Builder-Paige'), $form->add_radio('theme_layouts', array('value' => 'use', 'class' => 'show-hide-toggle'))); ?> </label> <div class="it-options-theme_layouts it-options-theme_layouts-use"> <p class="description"><?php _e('Important: This option will replace your current Layouts and Views with the Layouts and Views provided by the theme.', 'it-l10n-Builder-Paige'); ?> </p> </div> <!-- <div class="it-indent-box it-options-theme_layouts it-options-theme_layouts-use"> <label><?php printf(__('%1$s Keep current Layouts', 'it-l10n-Builder-Paige'), $form->add_radio('layouts_import_method', 'add')); ?> </label> <br /> <label><?php printf(__('%1$s Remove current Layouts', 'it-l10n-Builder-Paige'), $form->add_radio('layouts_import_method', 'replace')); ?> </label> </div>--> </div> <?php } ?> <div class="it-input-set"> <div class="it-options-theme_layouts it-options-theme_layouts-ignore"> <?php $form->add_submit('update_layouts_and_views', array('value' => 'Keep current Layouts and Views')); ?> </div> <div class="it-options-theme_layouts it-options-theme_layouts-use"> <?php $form->add_submit('update_layouts_and_views', array('value' => 'Update Layouts and Views')); ?> </div> <p><a class="it-skip" href="<?php echo admin_url('admin.php?page=ithemes-builder-theme'); ?> "><?php _e('Skip'); ?> </a></p> </div> </div> <?php $form->add_hidden('theme_activation'); ?> <?php $form->add_hidden('fresh_install'); ?> <?php $form->add_hidden('step'); ?> <?php $form->add_hidden_no_save('editor_tab', $this->_parent->_active_tab); ?> <?php $form->end_form(); ?> </div> <?php }
function _show_import_confirm_screen($import = null) { if (is_null($import)) { require_once dirname(__FILE__) . '/class.builder-import-export.php'; $import = new BuilderImportExport($_REQUEST['guid']); } $info = $import->get_info(); $details = array('name' => __('Name', 'it-l10n-Builder-Cohen'), 'timestamp' => __('Date and Time', 'it-l10n-Builder-Cohen'), 'exported_by' => __('Exported By', 'it-l10n-Builder-Cohen'), 'builder_version' => __('Builder Version', 'it-l10n-Builder-Cohen'), 'site_url' => __('Site Address', 'it-l10n-Builder-Cohen')); $form = new ITForm(array(), true); ?> <div class="wrap"> <?php ITUtility::screen_icon(); ?> <h2>Confirm Import Options</h2> <p><?php _e('Selected export file details:', 'it-l10n-Builder-Cohen'); ?> </p> <table style="text-align:left;margin-left:20px;"> <?php foreach ((array) $details as $var => $description) { ?> <?php $val = $info[$var]; if ('timestamp' === $var) { $val = gmdate('Y-m-d H:i:s', $info['timestamp'] + get_option('gmt_offset') * 3600); } if ('site_url' === $var) { $val = "<a href='" . esc_attr($val) . "'>{$val}</a>"; } ?> <tr><th scope="row" style="padding-right:20px;"><?php echo $description; ?> </th> <td><?php echo $val; ?> </td> </tr> <?php } ?> </table> <br /> <p><?php _e('The data will be imported with the following settings:', 'it-l10n-Builder-Cohen'); ?> </p> <?php $form->start_form(array(), "import_run_guid_{$_REQUEST['guid']}"); ?> <?php $import->show_data_source_import_process($form); ?> <p class="submit"> <?php $form->add_submit('run', __('Run Import', 'it-l10n-Builder-Cohen')); ?> <?php $form->add_submit('cancel', array('value' => __('Cancel', 'it-l10n-Builder-Cohen'), 'class' => 'button-secondary')); ?> </p> <?php $form->add_hidden_no_save('guid', $_REQUEST['guid']); ?> <?php $form->add_hidden_no_save('action', 'import_run'); ?> <?php $form->add_hidden_no_save('editor_tab', 'import-export'); ?> <?php $form->end_form(); ?> </div> <?php }
function _editor() { if (isset($_REQUEST['updated'])) { ITUtility::show_status_message('Theme Settings Updated'); } if (isset($_REQUEST['errors'])) { $error_codes = explode(',', $_REQUEST['errors']); foreach ((array) $error_codes as $code) { $message = get_transient("it_bt_{$code}"); if (false != $message) { ITUtility::show_error_message($message); } } } $this->_set_option_defaults(); $form = new ITForm($this->_options); $this->_form =& $form; ?> <div class="wrap"> <?php $form->start_form(); ?> <?php ITUtility::screen_icon(); ?> <?php $this->_print_editor_tabs(); ?> <p><?php _e('For information about this page, please click the "Help" button at the top right.', 'it-l10n-Builder-Cohen'); ?> </p> <?php $this->_print_meta_boxes($form); ?> <p class="submit"> <?php $form->add_submit('save', array('value' => 'Save Settings', 'class' => 'button-primary')); ?> <?php //$form->add_submit( 'reset', array( 'value' => 'Restore Default Settings', 'class' => 'button-secondary', 'onClick' => "return confirm('Restoring default settings will reset all Builder settings. The layouts and views will not be reset. Are you sure that you want to restore all of Builder\'s settings to default values?');" ) ); ?> </p> <?php $form->add_hidden_no_save('editor_tab', $this->_parent->_active_tab); ?> <?php $form->end_form(); ?> <form style="display:none" method="get" action=""> <p> <?php wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); ?> <?php wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false); ?> </p> </form> </div> <?php $this->_init_meta_boxes(); }
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 > 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 }
/** * Prints settings page * * @since 1.0 */ function print_settings_page() { $settings = it_exchange_get_option('addon_itelic', true); $this->form_values = empty($this->error_message) ? $settings : \ITForm::get_post_data(); $form_options = array('id' => 'it-exchange-add-on-itelic-settings', 'action' => 'admin.php?page=it-exchange-addons&add-on-settings=licensing'); $form = new \ITForm($this->form_values, array('prefix' => 'it-exchange-add-on-itelic')); if (!empty($this->status_message)) { \ITUtility::show_status_message($this->status_message); } if (!empty($this->error_message)) { \ITUtility::show_error_message($this->error_message); } ?> <div class="wrap"> <h2><?php _e('Licensing Settings', Plugin::SLUG); ?> </h2> <?php do_action('it_exchange_itelic_settings_page_top'); ?> <?php do_action('it_exchange_addon_settings_page_top'); ?> <?php $form->start_form($form_options, 'it-exchange-itelic-settings'); ?> <?php do_action('it_exchange_itelic_settings_form_top', $form); ?> <?php $this->get_form_table($form, $this->form_values); ?> <?php do_action('it_exchange_itelic_settings_form_bottom', $form); ?> <p class="submit"> <?php $form->add_submit('submit', array('value' => __('Save Changes', Plugin::SLUG), 'class' => 'button button-primary button-large')); ?> </p> <?php $form->end_form(); ?> <?php $this->inline_scripts(); ?> <?php do_action('it_exchange_itelic_settings_page_bottom'); ?> <?php do_action('it_exchange_addon_settings_page_bottom'); ?> </div> <?php }