Example #1
0
<?php

require_once dirname(__FILE__) . '/admin/includes/HtmlImportSettings.php';
/**
 * Fired when the plugin is uninstalled.
 *
 * @package   HTMLImportPlugin
 * @author    Your Name <*****@*****.**>
 * @license   GPL-2.0+
 * @link      http://example.com
 * @copyright 2014 Your Name or Company Name
 */
// If uninstall not called from WordPress, then exit
if (!defined('WP_UNINSTALL_PLUGIN')) {
    exit;
}
$settings = new \html_import\admin\HtmlImportSettings();
$settings->deleteFromDB();
Example #2
0
 /**
  * Ensures the provided WebPage is imported into WordPress.  $stubs_only will force the import to create a stub (only creates the page with a title, no content) or do a full import.  A record of the page being imported is stored in $html_post_lookup which is returned updated.  $media_lookup maintains a list of all local media files that have been imported, and it is updated during the course of this import and returned.  The HtmlImportSettings defines various settings to apply to the imported page.
  *
  * @param \html_import\indices\WebPage          $webPage
  * @param bool                                  $stubs_only
  * @param                                       $html_post_lookup
  * @param                                       $media_lookup
  * @param \html_import\admin\HtmlImportSettings $settings
  *
  * @return \html_import\WPMetaConfigs
  */
 private function importAndRecordWebPage(\html_import\indices\WebPage $webPage, $stubs_only = true, &$html_post_lookup, &$media_lookup, html_import\admin\HtmlImportSettings $settings)
 {
     $category = $settings->getCategories()->getValuesArray();
     $tag = array();
     // build up the categories from the settings;
     if (!is_null($category) && is_array($category)) {
         foreach ($category as $index => $cat) {
             $cat_id = get_cat_ID(trim($cat));
             $categoryIDs[$index] = intval($cat_id);
         }
     }
     // placeholder, in the future build up the tags
     if (!is_null($tag) && is_array($tag)) {
         foreach ($tag as $t) {
             //TODO: support tags
         }
     }
     $parent_page = new \html_import\WPMetaConfigs();
     // get the id of the parent selected in the settings page
     $hasParent = $parent_page->loadFromPostID($settings->getParentPage()->getValue());
     $parent_page_id = null;
     if ($hasParent) {
         $parent_page_id = $settings->getParentPage()->getValue();
     }
     // determine if the page itself was loaded from the index with a parent page, then override the id if so
     $parentWebPage = $webPage->getParent();
     if (!is_null($parentWebPage)) {
         if (!is_null($wp_id = $parentWebPage->getWPID())) {
             $parent_page_id = $wp_id;
         }
     }
     // create the appropriate importer and perform the import
     // TODO: this creation is a candidate to be replaced with a factory
     $stages = new \html_import\HTMLImportStages();
     $postMeta = $this->importAnHTML($webPage, $settings, $parent_page_id, $html_post_lookup);
     if (!$webPage->isFolder()) {
         if ($stubs_only) {
             $stubImport = new html_import\HTMLStubImporter($settings, $stages);
             $stubImport->import($webPage, $postMeta, $html_post_lookup, $media_lookup);
         } else {
             $fullImport = new html_import\HTMLFullImporter($settings, $stages);
             $fullImport->import($webPage, $postMeta, $html_post_lookup, $media_lookup);
         }
     } else {
         $folderImport = new html_import\FolderImporter($settings, $stages);
         $folderImport->import($webPage, $postMeta, $html_post_lookup, $media_lookup);
     }
     return $postMeta;
 }
Example #3
0
					$('#logMessages').hide('fast');
				});
			});
		</script>

		<?php 
        echo '<div id="noLogMessages" style="display:none;">';
        echo "<b>show log messages</b>";
        echo '</div>';
        echo '<div id="logMessages" style="display:inline;">';
        echo "<b>hide log messages</b>";
        HTMLImportPlugin::get_instance()->importHTMLFiles($settingsToProcess);
        echo '</div>';
    }
}
$settings = new html_import\admin\HtmlImportSettings();
$settings->loadFromDB();
?>

<div class="wrap">

	<h2><?php 
echo esc_html(get_admin_page_title());
?>
</h2>

	<form enctype="multipart/form-data" method="post" action="">

		<p id="index-type">

		<h3>Select the type of import index</h3>