From: Steve Sutton Date: Wed, 8 Jul 2015 21:58:54 +0000 (-0400) Subject: Looking at the import part X-Git-Tag: v0.0.2^2~52 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/index.cgi?a=commitdiff_plain;h=a05488e0cec3d251a5c9f5663707a2a8f402c188;p=WP-Plugins%2Fglm-wp-importer.git Looking at the import part --- diff --git a/NOTES.md b/NOTES.md index a3e1c6b..06ca5a9 100644 --- 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/ diff --git a/controllers/Admin.php b/controllers/Admin.php index 4071142..5fa27f2 100644 --- a/controllers/Admin.php +++ b/controllers/Admin.php @@ -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 '
'; + echo '
'.print_r($_REQUEST, true).'
'; + echo '
'; + } } diff --git a/index.php b/index.php index 690c9d3..db6b44d 100644 --- 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__)); } diff --git a/views/optionsPage.php b/views/optionsPage.php index f3bfda6..92cd437 100644 --- a/views/optionsPage.php +++ b/views/optionsPage.php @@ -7,7 +7,7 @@ submit_button(); ?> -
+