root/trunk/common/mvblog_import.php
| Revision 776, 2.0 KB (checked in by michiel, 9 months ago) |
|---|
| Line | |
|---|---|
| 1 | <?php |
| 2 | /** |
| 3 | * MvBlog -- An open source no-nosense blogtool |
| 4 | * |
| 5 | * Copyright (C) 2005-2008, Michiel van Baak |
| 6 | * Michiel van Baak <mvanbaak@users.sourceforge.net> |
| 7 | * |
| 8 | * See http://dev.mvblog.org for more information on MvBlog. |
| 9 | * That page also provides Bugtrackers, Filereleases etc. |
| 10 | * |
| 11 | * This program is free software, distributed under the terms of |
| 12 | * the GNU General Public License Version 2. See the LICENSE file |
| 13 | * at the top of the source tree. |
| 14 | * |
| 15 | * @package MvBlog |
| 16 | * @author Michiel van Baak |
| 17 | * @version %%VERSION%% |
| 18 | * @copyright 2005-2008 Michiel van Baak |
| 19 | */ |
| 20 | |
| 21 | /** |
| 22 | * Class that holds methods that can be used to import other blogs |
| 23 | * @package MvBlog |
| 24 | */ |
| 25 | Class MvBlog_import extends MvBlog_common { |
| 26 | /* constants */ |
| 27 | |
| 28 | /* variables */ |
| 29 | /** |
| 30 | * The supported blogtools |
| 31 | * @var array |
| 32 | */ |
| 33 | public $supported_blogs; |
| 34 | |
| 35 | /* methods */ |
| 36 | /* __construct {{{ */ |
| 37 | /** |
| 38 | * Class constructor that populates the supported_blogs variable. |
| 39 | * @todo read the supported blogtools from classes available |
| 40 | */ |
| 41 | public function __construct() { |
| 42 | $this->supported_blogs = array( |
| 43 | "wordpress", |
| 44 | ); |
| 45 | } |
| 46 | /* }}} */ |
| 47 | /* show_options {{{ */ |
| 48 | /** |
| 49 | * Show a list with all supported blogtools with a link to the module main info page |
| 50 | */ |
| 51 | public function show_options() { |
| 52 | echo "Here are the supported import scripts. Please click on one.<br />"; |
| 53 | foreach ($this->supported_blogs as $v) { |
| 54 | echo "<a href=\"index.php?action=import&type=".$v."\">".$v."</a><br />"; |
| 55 | } |
| 56 | } |
| 57 | /* }}} */ |
| 58 | /* run_module {{{ */ |
| 59 | /** |
| 60 | * Create an object for the selected blogtool import |
| 61 | * |
| 62 | * @param string $type The blogtool to import from. Can be 'wordpress' only for now |
| 63 | * @param array $options Additional options to pass to the import module |
| 64 | * @return bool true on success, false on failure |
| 65 | */ |
| 66 | public function run_module($type, $options = array()) { |
| 67 | if (!in_array($type, $this->supported_blogs)) { |
| 68 | echo gettext("Unsupported import type"); |
| 69 | return false; |
| 70 | } |
| 71 | $class = "MvBlog_import_".$type; |
| 72 | $importtype = new $class($options); |
| 73 | } |
| 74 | /* }}} */ |
| 75 | } |
| 76 | ?> |
Note: See TracBrowser
for help on using the browser.
