RCCWP_CustomWritePanelPage::Import PHP Method

Import() public method

public Import ( )
    function Import()
    {
        global $mf_domain;
        include_once 'RCCWP_CustomWritePanel.php';
        if (isset($_FILES['import-write-panel-file']) && !empty($_FILES['import-write-panel-file']['tmp_name'])) {
            $filePath = $_FILES['import-write-panel-file']['tmp_name'];
        } else {
            die(__('Error uploading file!', $mf_domain));
        }
        if (isset($_REQUEST['overwrite-existing'])) {
            $overwrite = true;
        }
        $writePanelName = basename($_FILES['import-write-panel-file']['name'], ".pnl");
        $panelID = RCCWP_CustomWritePanel::Import($filePath, $writePanelName, $overwrite);
        unlink($filePath);
        echo "<div class='wrap'><h3>" . __("The Write Panel was imported successfuly.", $mf_domain) . "</h3>";
        echo '<p><a href="' . RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('view-custom-write-panel', $panelID) . '">' . __('Click here', $mf_domain) . ' </a> ' . __('to edit the write panel.', $mf_domain) . '</p>';
        echo "</div>";
    }