/** * Returns the parsed module template * @return string */ function displayModule() { include 'lang/' . $this->language['languagefile'] . '.managerwidgets.php'; if ($this->configIsSet()) { $theme = $this->modx->db->select('setting_value', $this->modx->getFullTableName('system_settings'), 'setting_name=\'manager_theme\'', ''); $theme = $this->modx->db->getRow($theme); $theme = $theme['setting_value'] != '' ? '/' . $theme['setting_value'] : ''; $widgets = array(); foreach ($piwikWidgets as $piwikWidget) { $this->chunkie->setPlaceholder('', $piwikWidget, 'widget'); $this->chunkie->setPlaceholder('piwikURL', 'http://' . $this->options['piwikURL'], 'widget'); $this->chunkie->setPlaceholder('piwikSiteId', $this->options['piwikSiteId'], 'widget'); $this->chunkie->setPlaceholder('piwikTokenAuth', $this->options['piwikTokenAuth'], 'widget'); $this->chunkie->setTpl($this->chunkie->getTemplateChunk('@FILE templates/widget.template.html')); $this->chunkie->prepareTemplate('', array(), 'widget'); $widgets[] = $this->chunkie->process('widget'); } $this->chunkie->setPlaceholder('widgets', implode("\n", $widgets), 'module'); $this->chunkie->setPlaceholder('language', $this->language, 'module'); $this->chunkie->setPlaceholder('piwikURL', 'http://' . $this->options['piwikURL'], 'module'); $this->chunkie->setPlaceholder('piwikSiteId', $this->options['piwikSiteId'], 'module'); $this->chunkie->setPlaceholder('piwikTokenAuth', $this->options['piwikTokenAuth'], 'module'); $this->chunkie->setPlaceholder('managertheme', $theme, 'module'); $this->chunkie->setTpl($this->chunkie->getTemplateChunk('@FILE templates/module.template.html')); $this->chunkie->prepareTemplate('', array(), 'module'); $template = $this->chunkie->process('module'); } else { $theme = $this->modx->db->select('setting_value', $this->modx->getFullTableName('system_settings'), 'setting_name=\'manager_theme\'', ''); $theme = $this->modx->db->getRow($theme); $theme = $theme['setting_value'] != '' ? '/' . $theme['setting_value'] : ''; $this->chunkie->setPlaceholder('language', $this->language, 'module'); $this->chunkie->setPlaceholder('managertheme', $theme, 'module'); $this->chunkie->setTpl($this->chunkie->getTemplateChunk('@FILE templates/noconfig.template.html')); $this->chunkie->prepareTemplate('', array(), 'module'); $template = $this->chunkie->process('module'); } return $template; }
$can_migrate_comments = $modx->addPackage('quip', '../../components/quip/model/', $modx->db->config['table_prefix']); // Now instantiate a new xpdo object and add our wordpress package. This gives // us the ability to make queries on the wordpress database as an xpdo object. $wp = new xPDO('mysql:host=' . $wp_database_host . ';dbname=' . $wp_database_name . ';charset=' . $wp_database_charset, $wp_database_username, $wp_database_password); $can_migrate_wp = $wp->addPackage('wordpress', '../', $wp_database_prefix); if (!$can_migrate_wp) { die('Wordpress Package could not be loaded.'); } /** * during migrations where you need to try, try and try again to get it right, * it's easier to truncate the tables here instead of doing it manually. * setting $empty_tables to true will delete data from the following tables. */ if ($empty_tables) { if ($can_migrate_comments) { $modx->db->query('TRUNCATE ' . $modx->getFullTableName('quip_comments')); $modx->db->query('TRUNCATE ' . $modx->getFullTableName('quip_comments_closure')); } $modx->db->query('TRUNCATE ' . $modx->getFullTableName('site_content')); $modx->db->query('TRUNCATE ' . $modx->getFullTableName('site_templates') . 'WHERE id != 1'); $modx->db->query('TRUNCATE ' . $modx->getFullTableName('site_tmplvars')); $modx->db->query('TRUNCATE ' . $modx->getFullTableName('site_tmplvar_contentvalues')); $modx->db->query('TRUNCATE ' . $modx->getFullTableName('site_tmplvar_templates')); } // first set up the document parents $post_parent = setupParent($post_document_parent, 'Post'); if ($post_parent === false) { die('There was an error setting up the post parent. Check your configuration value for $post_document_parent'); } $page_parent = setupParent($page_document_parent, 'Page');