Looking at the import part
authorSteve Sutton <steve@gaslightmedia.com>
Wed, 8 Jul 2015 21:58:54 +0000 (17:58 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Wed, 8 Jul 2015 21:58:54 +0000 (17:58 -0400)
NOTES.md
controllers/Admin.php
index.php
views/optionsPage.php

index a3e1c6b..06ca5a9 100644 (file)
--- a/NOTES.md
+++ b/NOTES.md
@@ -10,3 +10,7 @@ I'm planning on using the same thing here.
 2. Fetch all pages from the database and add pages.
 3. Fetch list of all images, files and import them into Media Library
 4. Update all pages with new references of the images.
+
+REFERENCES:
+For Wordpress Plugin Development
+https://developer.wordpress.org/plugins/the-basics/header-requirements/
index 4071142..5fa27f2 100644 (file)
@@ -35,7 +35,12 @@ class GlmWPImporter_Admin_Controller
     {
         $this->path = $path;
         add_action('admin_menu', array($this, 'glmwpimporter_add_admin_menu'));
-        add_action('admin_init', array($this, 'glmwpimporter_settings_init'));
+
+        if (isset($action) && $action = filter_var($_REQUEST['glm_action'], FILTER_SANITIZE_STRING)) {
+            add_action('admin_init', array($this, 'glmimporter_import_pages'));
+        } else {
+            add_action('admin_init', array($this, 'glmwpimporter_settings_init'));
+        }
 
     }
 
@@ -47,7 +52,6 @@ class GlmWPImporter_Admin_Controller
     {
     }
 
-
     static public function glmwpimporter_uninstall()
     {
         delete_option(GLM_WP_IMPORT_SETTINGS);
@@ -197,4 +201,10 @@ class GlmWPImporter_Admin_Controller
         }
     }
 
+    public function glmimporter_import_pages()
+    {
+        echo '<div class="wrap">';
+        echo '<pre>'.print_r($_REQUEST, true).'</pre>';
+        echo '</div>';
+    }
 }
index 690c9d3..db6b44d 100644 (file)
--- a/index.php
+++ b/index.php
@@ -18,10 +18,5 @@ if (is_admin()) {
     register_deactivation_hook(__FILE__, array('GlmWPImporter_Admin_Controller', 'deactivate_plugin'));
     register_uninstall_hook(__FILE__, array('GlmWPImporter_Admin_Controller', 'uninstall'));
 
-
-    if ($action = filter_var($_REQUEST['glm_action'], FILTER_SANITIZE_STRING)) {
-        $importController = new GlmWPImporter_Import_Controller(plugin_dir_path(__FILE__));
-    } else {
-        $adminController = new GlmWPImporter_Admin_Controller(plugin_dir_path(__FILE__));
-    }
+    $adminController = new GlmWPImporter_Admin_Controller(plugin_dir_path(__FILE__));
 }
index f3bfda6..92cd437 100644 (file)
@@ -7,7 +7,7 @@
             submit_button();
         ?>
     </form>
-    <form action="admin.php?page=glmwpimporter">
+    <form action="edit.php?page=glmwpimporter">
         <input type="hidden" name="glm_action" value="Import">
         <input class="button" type="submit" value="Import Pages">
     </form>