echo '</div>';
}
+ private function _checkRequiredOptions()
+ {
+ $errors = array();
+ if (!$this->_options['site_url']) {
+ $errors[] = 'Site URL';
+ }
+ if (!$this->_options['db_host']) {
+ $errors[] = 'Database Host';
+ }
+ if (!$this->_options['db_name']) {
+ $errors[] = 'Database Name';
+ }
+ if (!$this->_options['db_user']) {
+ $errors[] = 'Database Usecr';
+ }
+ if (!$this->_options['toolbox_schema']) {
+ $errors[] = 'Toolbox Schema';
+ }
+ if (!$this->_options['toolbox_page_table']) {
+ $errors[] = 'Toolbox Page Table';
+ }
+ if (!$this->_options['toolbox_paragraphs_table']) {
+ $errors[] = 'Toolbox Paragraph Table';
+ }
+ if (!$this->_options['toolbox_files_table']) {
+ $errors[] = 'Toolbox Files Table';
+ }
+ return $errors;
+ }
+
private function _greet()
{
- echo '<h2>Hello there person!</h2>';
- $this->_connect();
- $sql = "SELECT * FROM toolbox.pages";
- $data = $this->_dbh->query($sql)->fetchAll();
- printf('<p>Found %d Pages</p>', count($data));
- echo '<a href="admin.php?import=toolbox&step=1">Start the Import Now</a>';
+ // Verify that everything is setup
+ $checkErrors = $this->_checkRequiredOptions();
+ echo '<p>Confirming Settings...</p>';
+ if (isset($checkErrors) && is_array($checkErrors) && !empty($checkErrors)) {
+ printf("<pre>Please update empty GLM Import <a href=\"%s\">Settings</a>:\n%s</pre>",
+ 'options-general.php?page=glmwpimporter',
+ implode("\n", $checkErrors)
+ );
+ } else {
+ echo '<p>All Set!</p>';
+ $this->_connect();
+ $sql = "SELECT * FROM toolbox.pages";
+ $data = $this->_dbh->query($sql)->fetchAll();
+ printf('<p>Found %d Pages</p>', count($data));
+ echo '<a href="admin.php?import=toolbox&step=1">Start the Import Now</a>';
+ }
}
private function _displayImage($data, $alignment)
switch($step) {
case 0:
$this->_greet();
- $this->_readOptions();
+ //$this->_readOptions();
break;
case 1:
$this->_import();