function builder_show_setup_tab_notice() { ITUtility::show_status_message(sprintf(__('Go to Builder\'s <a href="%s">Setup page</a> to finish setting up the Builder theme.', 'it-l10n-Builder-Paige'), admin_url('admin.php?page=theme-settings&editor_tab=setup&theme_activation=1'))); }
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}&action=import&guid={$guid}", "import_guid_{$guid}"); $delete_link = wp_nonce_url("{$this->_parent->_self_link}&action=delete&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(); }
function _save_layout() { $layout = array(); if (isset($_POST['layout-guid'])) { if (!empty($this->_options['layouts'][$_POST['layout-guid']])) { $layout = $this->_options['layouts'][$_POST['layout-guid']]; } else { $layout['guid'] = $_POST['layout-guid']; } } $layout['description'] = $_POST['description']; $layout['hide_widgets'] = $_POST['hide_widgets']; $layout['modules'] = array(); if ('custom' == $_POST['width']) { $layout['width'] = $_POST['custom_width']; } else { $layout['width'] = $_POST['width']; } ksort($_POST); foreach ((array) $_POST as $var => $val) { if (preg_match('/^module-(\\d+)-(.+)$/', $var, $matches)) { $layout['modules'][$_POST["position-{$matches[1]}"]]['data'][$matches[2]] = $val; } else { if (preg_match('/^module-(\\d+)$/', $var, $matches)) { $layout['modules'][$_POST["position-{$matches[1]}"]]['module'] = $val; if (!isset($layout['modules'][$_POST["position-{$matches[1]}"]]['data'])) { $layout['modules'][$_POST["position-{$matches[1]}"]]['data'] = array(); } } else { if (preg_match('/^module-guid-(\\d+)$/', $var, $matches)) { $layout['modules'][$_POST["position-{$matches[1]}"]]['guid'] = $val; } } } } foreach ((array) $layout['modules'] as $id => $module) { if (!isset($module['guid']) || empty($module['guid'])) { $layout['modules'][$id]['guid'] = uniqid(''); } } ksort($layout['modules']); $layout = apply_filters('builder_filter_saved_layout_data', $layout); $error = false; if (empty($layout['description'])) { ITUtility::show_error_message(__('You must supply a Name.', 'it-l10n-Builder-Paige')); $error = true; } if (empty($layout['width'])) { ITUtility::show_error_message(__('Please supply a Width.', 'it-l10n-Builder-Paige')); $error = true; } else { if ((string) intval($layout['width']) != (string) $layout['width']) { ITUtility::show_error_message(__('The Width must be an integer number.', 'it-l10n-Builder-Paige')); $error = true; } else { if ($layout['width'] < 50) { ITUtility::show_error_message(__('The Width must be at least 50 pixels. Please increase the Width.', 'it-l10n-Builder-Paige')); $error = true; } } } if (true === $error) { $this->_cached_layout = $layout; $this->_modify_layout(); return; } if (empty($layout['version'])) { $layout['version'] = 1; } else { $layout['version']++; } if (!empty($_REQUEST['add_layout'])) { foreach ((array) $this->_options['layouts'] as $ex_layout) { if (strtolower($layout['description']) === strtolower($ex_layout['description'])) { ITUtility::show_error_message(__('A layout with that Name already exists. Please choose a unique name.', 'it-l10n-Builder-Paige')); $this->_cached_layout = $layout; $this->_modify_layout(); return; } } $id = uniqid(''); $layout['guid'] = $id; $_REQUEST['layout'] = $id; unset($_REQUEST['add_layout']); $this->_options['layouts'][$id] = $layout; ITUtility::show_status_message(sprintf(__('%s created', 'it-l10n-Builder-Paige'), $layout['description'])); } else { if (!empty($_REQUEST['layout'])) { $this->_options['layouts'][$_REQUEST['layout']] = $layout; ITUtility::show_status_message(sprintf(__('%s updated', 'it-l10n-Builder-Paige'), $layout['description'])); } } do_action('builder_editor_save_custom_settings', $layout); $this->_save(); if (empty($_REQUEST['save_and_continue'])) { $this->_list_layouts(); } else { $this->_modify_layout(); } }
function _reset_data() { $this->_storage->reset(); $this->_options = $this->_storage->load(); $GLOBALS['wp_theme_options'] = $this->_options; ITUtility::show_status_message(__('Data reset', 'it-l10n-Builder-Cohen')); }
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(); }
/** * 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 }