Пример #1
0
 public static function warn($code, $message)
 {
     ITUtility::show_error_message($message);
 }
Пример #2
0
        function _show_import_methods_screen()
        {
            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>Basic Import Options</h2>
		
		<?php 
            if (is_wp_error($info)) {
                ?>
			<?php 
                ITUtility::show_error_message(__('Error: The selected input file could not be found. Please select a different file to import.', 'it-l10n-Builder-Cohen'));
                ?>
			
			<p><a href="<?php 
                echo esc_url($this->_parent->_self_link);
                ?>
"><?php 
                _e('&larr; Back to Import/Export Settings', 'it-l10n-Builder-Cohen');
                ?>
</a></p>
		<?php 
            } else {
                ?>
			<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('Use the following options to select how to import each type of data contained in the export:', 'it-l10n-Builder-Cohen');
                ?>
</p>
			
			<?php 
                $form->start_form(array(), "import_customize_guid_{$_REQUEST['guid']}");
                ?>
				<?php 
                $import->show_data_source_import_methods($form);
                ?>
				
				<p class="submit">
					<?php 
                $form->add_submit('next', __('Next Step', '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_customize');
                ?>
				<?php 
                $form->add_hidden_no_save('editor_tab', 'import-export');
                ?>
			<?php 
                $form->end_form();
                ?>
		<?php 
            }
            ?>
	</div>
<?php 
        }
Пример #3
0
        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();
        }
Пример #4
0
 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();
     }
 }
Пример #5
0
    /**
     * 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 
    }