Exemple #1
0
    public static function posting()
    {
        ?>
    <div class="wrap">
      <?php 
        //  Use this to add a new page. To bulk change pages click on the "Manage" tab.
        do_action("mainwp_bulkpage_before_post", $_GET['id']);
        $skip_post = false;
        if (isset($_GET['id'])) {
            if ('yes' == get_post_meta($_GET['id'], '_mainwp_skip_posting', true)) {
                $skip_post = true;
                wp_delete_post($_GET['id'], true);
            }
        }
        if (!$skip_post) {
            //Posts the saved sites
            if (isset($_GET['id'])) {
                $id = $_GET['id'];
                $post = get_post($id);
                if ($post) {
                    $selected_by = get_post_meta($id, '_selected_by', true);
                    $selected_sites = unserialize(base64_decode(get_post_meta($id, '_selected_sites', true)));
                    $selected_groups = unserialize(base64_decode(get_post_meta($id, '_selected_groups', true)));
                    $post_slug = base64_decode(get_post_meta($id, '_slug', true));
                    $post_custom = get_post_custom($id);
                    include_once ABSPATH . 'wp-includes' . DIRECTORY_SEPARATOR . 'post-thumbnail-template.php';
                    $post_featured_image = get_post_thumbnail_id($id);
                    $mainwp_upload_dir = wp_upload_dir();
                    $new_post = array('post_title' => $post->post_title, 'post_content' => $post->post_content, 'post_status' => $post->post_status, 'post_date' => $post->post_date, 'post_date_gmt' => $post->post_date_gmt, 'post_type' => 'page', 'post_name' => $post_slug, 'post_excerpt' => $post->post_excerpt, 'comment_status' => $post->comment_status, 'ping_status' => $post->ping_status, 'id_spin' => $post->ID);
                    if ($post_featured_image != null) {
                        //Featured image is set, retrieve URL
                        $img = wp_get_attachment_image_src($post_featured_image, 'full');
                        $post_featured_image = $img[0];
                    }
                    $dbwebsites = array();
                    if ($selected_by == 'site') {
                        //Get all selected websites
                        foreach ($selected_sites as $k) {
                            if (MainWPUtility::ctype_digit($k)) {
                                $website = MainWPDB::Instance()->getWebsiteById($k);
                                $dbwebsites[$website->id] = MainWPUtility::mapSite($website, array('id', 'url', 'name', 'adminname', 'nossl', 'privkey', 'nosslkey'));
                            }
                        }
                    } else {
                        //Get all websites from the selected groups
                        foreach ($selected_groups as $k) {
                            if (MainWPUtility::ctype_digit($k)) {
                                $websites = MainWPDB::Instance()->query(MainWPDB::Instance()->getSQLWebsitesByGroupId($k));
                                while ($websites && ($website = @MainWPDB::fetch_object($websites))) {
                                    if ($website->sync_errors != '') {
                                        continue;
                                    }
                                    $dbwebsites[$website->id] = MainWPUtility::mapSite($website, array('id', 'url', 'name', 'adminname', 'nossl', 'privkey', 'nosslkey'));
                                }
                                @MainWPDB::free_result($websites);
                            }
                        }
                    }
                    $output = new stdClass();
                    $output->ok = array();
                    $output->errors = array();
                    $startTime = time();
                    if (count($dbwebsites) > 0) {
                        $post_data = array('new_post' => base64_encode(serialize($new_post)), 'post_custom' => base64_encode(serialize($post_custom)), 'post_featured_image' => base64_encode($post_featured_image), 'mainwp_upload_dir' => base64_encode(serialize($mainwp_upload_dir)));
                        $post_data = apply_filters("mainwp_bulkpage_posting", $post_data, $id);
                        MainWPUtility::fetchUrlsAuthed($dbwebsites, 'newpost', $post_data, array(MainWPBulkAdd::getClassName(), 'PostingBulk_handler'), $output);
                    }
                    $failed_posts = array();
                    foreach ($dbwebsites as $website) {
                        if ($output->ok[$website->id] == 1 && isset($output->added_id[$website->id])) {
                            do_action('mainwp-post-posting-page', $website, $output->added_id[$website->id], isset($output->link[$website->id]) ? $output->link[$website->id] : null);
                            do_action('mainwp-bulkposting-done', $post, $website, $output);
                        } else {
                            $failed_posts[] = $website->id;
                        }
                    }
                    $del_post = true;
                    $saved_draft = get_post_meta($id, "_saved_as_draft", true);
                    if ($saved_draft == "yes") {
                        if (count($failed_posts) > 0) {
                            $del_post = false;
                            update_post_meta($post->ID, "_selected_sites", base64_encode(serialize($failed_posts)));
                            update_post_meta($post->ID, "_selected_groups", "");
                            wp_update_post(array("ID" => $id, 'post_status' => 'draft'));
                        }
                    }
                    if ($del_post) {
                        wp_delete_post($id, true);
                    }
                    $countSites = 0;
                    foreach ($dbwebsites as $website) {
                        if (isset($output->ok[$website->id]) && $output->ok[$website->id] == 1) {
                            $countSites++;
                        }
                    }
                    if (!empty($countSites)) {
                        $seconds = time() - $startTime;
                        MainWPTwitter::updateTwitterInfo('new_page', $countSites, $seconds, 1, $startTime, 1);
                    }
                    if (MainWPTwitter::enabledTwitterMessages()) {
                        $twitters = MainWPTwitter::getTwitterNotice('new_page');
                        if (is_array($twitters)) {
                            foreach ($twitters as $timeid => $twit_mess) {
                                if (!empty($twit_mess)) {
                                    $sendText = MainWPTwitter::getTwitToSend('new_page', $timeid);
                                    ?>
                                    <div class="mainwp-tips mainwp_info-box-blue twitter"><span class="mainwp-tip" twit-what="new_page" twit-id="<?php 
                                    echo $timeid;
                                    ?>
"><?php 
                                    echo $twit_mess;
                                    ?>
</span>&nbsp;<?php 
                                    MainWPTwitter::genTwitterButton($sendText);
                                    ?>
<span><a href="#" class="mainwp-dismiss-twit" ><i class="fa fa-times-circle"></i> <?php 
                                    _e('Dismiss', 'mainwp');
                                    ?>
</a></span></div>
                                <?php 
                                }
                            }
                        }
                    }
                }
                ?>
                <div id="message" class="updated">
                    <?php 
                foreach ($dbwebsites as $website) {
                    ?>
                    <p><a href="<?php 
                    echo admin_url('admin.php?page=managesites&dashboard=' . $website->id);
                    ?>
"><?php 
                    echo stripslashes($website->name);
                    ?>
</a>
                        : <?php 
                    echo isset($output->ok[$website->id]) && $output->ok[$website->id] == 1 ? 'New page created. ' . "<a href=\"" . $output->link[$website->id] . "\"  target=\"_blank\">View Page</a>" : 'ERROR: ' . $output->errors[$website->id];
                    ?>
</p>
                    <?php 
                }
                ?>
                </div>
               
                <?php 
            } else {
                ?>
                <div class="error below-h2">
                    <p><strong>ERROR</strong>: <?php 
                _e('An undefined error occured.', 'mainwp');
                ?>
</p>
                </div>               
                <?php 
            }
        }
        // no skip posting
        ?>
        <br/>
        <a href="<?php 
        echo get_admin_url();
        ?>
admin.php?page=PageBulkAdd" class="add-new-h2" target="_top"><?php 
        _e('Add New', 'mainwp');
        ?>
</a>
        <a href="<?php 
        echo get_admin_url();
        ?>
admin.php?page=mainwp_tab" class="add-new-h2" target="_top"><?php 
        _e('Return
            to Dashboard', 'mainwp');
        ?>
</a>
                
    </div>
    <?php 
    }
    public static function render()
    {
        $show_form = true;
        if (isset($_POST['updateadminpassword'])) {
            check_admin_referer('mainwp_updateadminpassword', 'security');
            $errors = array();
            if (isset($_POST['select_by'])) {
                $selected_sites = array();
                if (isset($_POST['selected_sites']) && is_array($_POST['selected_sites'])) {
                    foreach ($_POST['selected_sites'] as $selected) {
                        $selected_sites[] = $selected;
                    }
                }
                $selected_groups = array();
                if (isset($_POST['selected_groups']) && is_array($_POST['selected_groups'])) {
                    foreach ($_POST['selected_groups'] as $selected) {
                        $selected_groups[] = $selected;
                    }
                }
                if ($_POST['select_by'] == 'group' && count($selected_groups) == 0 || $_POST['select_by'] == 'site' && count($selected_sites) == 0) {
                    $errors[] = __('Please select the sites or groups where you want to change the admin password.', 'mainwp');
                }
            } else {
                $errors[] = __('Please select whether you want to change the admin password for specific sites or groups.', 'mainwp');
            }
            if (!isset($_POST['pass1']) || $_POST['pass1'] == '' || !isset($_POST['pass2']) || $_POST['pass2'] == '') {
                $errors[] = __('Please enter the password twice.', 'mainwp');
            } else {
                if ($_POST['pass1'] != $_POST['pass2']) {
                    $errors[] = __('Please enter the same password in the two password fields.', 'mainwp');
                }
            }
            if (count($errors) == 0) {
                $show_form = false;
                $new_password = array('user_pass' => $_POST['pass1']);
                $dbwebsites = array();
                if ($_POST['select_by'] == 'site') {
                    //Get all selected websites
                    foreach ($selected_sites as $k) {
                        if (MainWPUtility::ctype_digit($k)) {
                            $website = MainWPDB::Instance()->getWebsiteById($k);
                            $dbwebsites[$website->id] = MainWPUtility::mapSite($website, array('id', 'url', 'name', 'adminname', 'nossl', 'privkey', 'nosslkey'));
                        }
                    }
                } else {
                    //Get all websites from the selected groups
                    foreach ($selected_groups as $k) {
                        if (MainWPUtility::ctype_digit($k)) {
                            $websites = MainWPDB::Instance()->query(MainWPDB::Instance()->getSQLWebsitesByGroupId($k));
                            while ($websites && ($website = @MainWPDB::fetch_object($websites))) {
                                if ($website->sync_errors != '') {
                                    continue;
                                }
                                $dbwebsites[$website->id] = MainWPUtility::mapSite($website, array('id', 'url', 'name', 'adminname', 'nossl', 'privkey', 'nosslkey'));
                            }
                            @MainWPDB::free_result($websites);
                        }
                    }
                }
                if (count($dbwebsites) > 0) {
                    $post_data = array('new_password' => base64_encode(serialize($new_password)));
                    $output = new stdClass();
                    $output->ok = array();
                    $output->errors = array();
                    MainWPUtility::fetchUrlsAuthed($dbwebsites, 'newadminpassword', $post_data, array(MainWPBulkAdd::getClassName(), 'PostingBulk_handler'), $output);
                }
            }
        }
        if (!$show_form) {
            //Added to..
            ?>
            <div class="wrap">
                <img src="<?php 
            echo plugins_url('images/icons/mainwp-passwords.png', dirname(__FILE__));
            ?>
" style="float: left; margin-right: 8px; margin-top: 7px ;" alt="MainWP Passwords" height="32"/><h2 id="add-new-user"> Update Admin Passwords</h2>
                <div id="message" class="updated">
                    <?php 
            foreach ($dbwebsites as $website) {
                ?>
                        <p><a href="<?php 
                echo admin_url('admin.php?page=managesites&dashboard=' . $website->id);
                ?>
"><?php 
                echo stripslashes($website->name);
                ?>
</a>: <?php 
                echo isset($output->ok[$website->id]) && $output->ok[$website->id] == 1 ? __('Admin password updated.', 'mainwp') : __('ERROR: ', 'mainwp') . $output->errors[$website->id];
                ?>
</p>
            <?php 
            }
            ?>
                </div>
                <br />
                <a href="<?php 
            echo get_admin_url();
            ?>
admin.php?page=UpdateAdminPasswords" class="add-new-h2" target="_top"><?php 
            _e('Update admin passwords', 'mainwp');
            ?>
</a>
                <a href="<?php 
            echo get_admin_url();
            ?>
admin.php?page=mainwp_tab" class="add-new-h2" target="_top"><?php 
            _e('Return to Dashboard', 'mainwp');
            ?>
</a>
            </div>
            <?php 
        } else {
            // header in User page
            MainWPUser::renderHeader('UpdateAdminPasswords');
            ?>
            <form action="" method="post" name="createuser" id="createuser" class="add:users: validate">

                <input type="hidden" name="security" value="<?php 
            echo wp_create_nonce('mainwp_updateadminpassword');
            ?>
" />

                <div class="mainwp_config_box_right">
                    <?php 
            MainWPUI::select_sites_box(__("Select Sites to Update", 'mainwp'));
            ?>
                </div>

                <div class="mainwp_config_box_left postbox mainwp-postbox">
                <h3 class="mainwp_box_title"><i class="fa fa-key"></i> <?php 
            _e('Bulk Update Administrator Passwords', 'mainwp');
            ?>
</h3>
                <div class="inside">
                <table class="form-table">
                    <tr class="form-field form-required">
                        <th scope="row"><label for="pass1"><?php 
            _e('Enter New Password ', 'mainwp');
            ?>
<br /><span class="description"><?php 
            _e('(twice, required)', 'mainwp');
            ?>
</span></label></th>
                        <td><input name="user_login" type="hidden" id="user_login" value="admin">
                            <input class="mainwp-field mainwp-password" name="pass1" type="password" id="pass1" autocomplete="off" />
                            <br />
                            <input class="mainwp-field mainwp-password" name="pass2" type="password" id="pass2" autocomplete="off" />
                            <br />
                            <div id="pass-strength-result" style="display: block;"><?php 
            _e('Strength indicator', 'mainwp');
            ?>
</div>
                            <p class="description indicator-hint" style="clear:both;"><?php 
            _e('Hint: The password should be at least seven characters long. To make it stronger, use upper and lower case letters, numbers and symbols like ! " ? $ % ^ &amp; ).', 'mainwp');
            ?>
</p>
                        </td>
                    </tr>
                    <tr><td></td><td colspan="2"><input type="submit" name="updateadminpassword" id="bulk_updateadminpassword" class="button-primary" value="<?php 
            _e('Update Now', 'mainwp');
            ?>
"  /></td></tr>
                </table>
                </div>
                </div>

            </form>
            <?php 
            MainWPUser::renderFooter('UpdateAdminPasswords');
        }
    }
Exemple #3
0
 public static function doImport()
 {
     if (isset($_POST['select_by'])) {
         $selected_sites = array();
         if (isset($_POST['selected_sites']) && is_array($_POST['selected_sites'])) {
             foreach ($_POST['selected_sites'] as $selected) {
                 $selected_sites[] = $selected;
             }
         }
         $selected_groups = array();
         if (isset($_POST['selected_groups']) && is_array($_POST['selected_groups'])) {
             foreach ($_POST['selected_groups'] as $selected) {
                 $selected_groups[] = $selected;
             }
         }
     }
     $user_to_add = array('user_pass' => $_POST['pass1'], 'user_login' => $_POST['user_login'], 'user_url' => $_POST['url'], 'user_email' => $_POST['email'], 'first_name' => $_POST['first_name'], 'last_name' => $_POST['last_name'], 'role' => $_POST['role']);
     $ret = array();
     $dbwebsites = array();
     $not_valid = array();
     $error_sites = "";
     if ($_POST['select_by'] == 'site') {
         //Get all selected websites
         foreach ($selected_sites as $url) {
             if (!empty($url)) {
                 $website = MainWPDB::Instance()->getWebsitesByUrl($url);
                 if ($website) {
                     $dbwebsites[$website[0]->id] = MainWPUtility::mapSite($website[0], array('id', 'url', 'name', 'adminname', 'nossl', 'privkey', 'nosslkey'));
                 } else {
                     $not_valid[] = "Error - The website doesn't exist in the Network. " . $url;
                     $error_sites .= $url . ";";
                 }
             }
         }
     } else {
         //Get all websites from the selected groups
         foreach ($selected_groups as $group) {
             if (MainWPDB::Instance()->getGroupsByName($group)) {
                 $websites = MainWPDB::Instance()->query(MainWPDB::Instance()->getSQLWebsitesByGroupName($group));
                 if ($websites) {
                     while ($websites && ($website = @MainWPDB::fetch_object($websites))) {
                         $dbwebsites[$website->id] = MainWPUtility::mapSite($website, array('id', 'url', 'name', 'adminname', 'nossl', 'privkey', 'nosslkey'));
                     }
                     @MainWPDB::free_result($websites);
                 } else {
                     $not_valid[] = __("Error - These are not websites in the group. ", 'mainwp') . $group;
                     $error_sites .= $group . ";";
                 }
             } else {
                 $not_valid[] = __("Error - The group doesn't exist in the Network. ", 'mainwp') . $group;
                 $error_sites .= $group . ";";
             }
         }
     }
     if (count($dbwebsites) > 0) {
         $post_data = array('new_user' => base64_encode(serialize($user_to_add)), 'send_password' => isset($_POST['send_password']) ? $_POST['send_password'] : '');
         $output = new stdClass();
         $output->ok = array();
         $output->errors = array();
         MainWPUtility::fetchUrlsAuthed($dbwebsites, 'newuser', $post_data, array(MainWPBulkAdd::getClassName(), 'PostingBulk_handler'), $output);
     }
     $ret['ok_list'] = $ret['error_list'] = array();
     foreach ($dbwebsites as $website) {
         if (isset($output->ok[$website->id]) && $output->ok[$website->id] == 1) {
             $ret['ok_list'][] = 'New user(s) created: ' . stripslashes($website->name);
         } else {
             $ret['error_list'][] = $output->errors[$website->id] . " " . stripslashes($website->name);
             $error_sites .= $website->url . ";";
         }
     }
     foreach ($not_valid as $val) {
         $ret['error_list'][] = $val;
     }
     $ret['failed_logging'] = "";
     if (!empty($error_sites)) {
         $error_sites = rtrim($error_sites, ';');
         $ret['failed_logging'] = $_POST['user_login'] . "," . $_POST['email'] . "," . $_POST['first_name'] . "," . $_POST['last_name'] . "," . $_POST['url'] . "," . $_POST['pass1'] . "," . intval($_POST['send_password']) . "," . $_POST['role'] . "," . $error_sites . ",";
     }
     $ret['line_number'] = $_POST['line_number'];
     die(json_encode($ret));
 }
Exemple #4
0
    public static function posting()
    {
        //Posts the saved sites
        ?>
    <div class="wrap">
<!--        <img src="--><?php 
        //echo plugins_url('images/icons/mainwp-post.png', dirname(__FILE__));
        ?>
<!--" style="float: left; margin-right: 8px; margin-top: 7px ;" alt="MainWP Post" height="32"/>-->
        <h2>New Post</h2>
        <?php 
        do_action("mainwp_bulkpost_before_post", $_GET['id']);
        $skip_post = false;
        if (isset($_GET['id'])) {
            if ('yes' == get_post_meta($_GET['id'], '_mainwp_skip_posting', true)) {
                $skip_post = true;
                wp_delete_post($_GET['id'], true);
            }
        }
        if (!$skip_post) {
            if (isset($_GET['id'])) {
                $id = $_GET['id'];
                $post = get_post($id);
                if ($post) {
                    //                die('<pre>'.print_r($post, 1).'</pre>');
                    $selected_by = get_post_meta($id, '_selected_by', true);
                    $selected_sites = unserialize(base64_decode(get_post_meta($id, '_selected_sites', true)));
                    $selected_groups = unserialize(base64_decode(get_post_meta($id, '_selected_groups', true)));
                    /** @deprecated */
                    $post_category = base64_decode(get_post_meta($id, '_categories', true));
                    $post_tags = base64_decode(get_post_meta($id, '_tags', true));
                    $post_slug = base64_decode(get_post_meta($id, '_slug', true));
                    $post_custom = get_post_custom($id);
                    //                if (isset($post_custom['_tags'])) $post_custom['_tags'] = base64_decode(trim($post_custom['_tags']));
                    include_once ABSPATH . 'wp-includes' . DIRECTORY_SEPARATOR . 'post-thumbnail-template.php';
                    $post_featured_image = get_post_thumbnail_id($id);
                    $mainwp_upload_dir = wp_upload_dir();
                    //                $results = apply_filters('mainwp-pre-posting-posts', array($post), true);
                    //                $post = $results[0];
                    $new_post = array('post_title' => $post->post_title, 'post_content' => $post->post_content, 'post_status' => $post->post_status, 'post_date' => $post->post_date, 'post_date_gmt' => $post->post_date_gmt, 'post_tags' => $post_tags, 'post_name' => $post_slug, 'post_excerpt' => $post->post_excerpt, 'comment_status' => $post->comment_status, 'ping_status' => $post->ping_status, 'id_spin' => $post->ID);
                    if ($post_featured_image != null) {
                        //Featured image is set, retrieve URL
                        $img = wp_get_attachment_image_src($post_featured_image, 'full');
                        $post_featured_image = $img[0];
                    }
                    $dbwebsites = array();
                    if ($selected_by == 'site') {
                        //Get all selected websites
                        foreach ($selected_sites as $k) {
                            if (MainWPUtility::ctype_digit($k)) {
                                $website = MainWPDB::Instance()->getWebsiteById($k);
                                $dbwebsites[$website->id] = MainWPUtility::mapSite($website, array('id', 'url', 'name', 'adminname', 'nossl', 'privkey', 'nosslkey'));
                            }
                        }
                    } else {
                        //Get all websites from the selected groups
                        foreach ($selected_groups as $k) {
                            if (MainWPUtility::ctype_digit($k)) {
                                $websites = MainWPDB::Instance()->query(MainWPDB::Instance()->getSQLWebsitesByGroupId($k));
                                while ($websites && ($website = @MainWPDB::fetch_object($websites))) {
                                    if ($website->sync_errors != '') {
                                        continue;
                                    }
                                    $dbwebsites[$website->id] = MainWPUtility::mapSite($website, array('id', 'url', 'name', 'adminname', 'nossl', 'privkey', 'nosslkey'));
                                }
                                @MainWPDB::free_result($websites);
                            }
                        }
                    }
                    $output = new stdClass();
                    $output->ok = array();
                    $output->errors = array();
                    if (count($dbwebsites) > 0) {
                        $post_data = array('new_post' => base64_encode(serialize($new_post)), 'post_custom' => base64_encode(serialize($post_custom)), 'post_category' => base64_encode($post_category), 'post_featured_image' => base64_encode($post_featured_image), 'mainwp_upload_dir' => base64_encode(serialize($mainwp_upload_dir)));
                        MainWPUtility::fetchUrlsAuthed($dbwebsites, 'newpost', $post_data, array(MainWPBulkAdd::getClassName(), 'PostingBulk_handler'), $output);
                    }
                    $failed_posts = array();
                    foreach ($dbwebsites as $website) {
                        if ($output->ok[$website->id] == 1 && isset($output->added_id[$website->id])) {
                            do_action('mainwp-post-posting-post', $website, $output->added_id[$website->id], isset($output->link[$website->id]) ? $output->link[$website->id] : null);
                            do_action('mainwp-bulkposting-done', $post, $website, $output);
                        } else {
                            $failed_posts[] = $website->id;
                        }
                    }
                    $del_post = true;
                    $saved_draft = get_post_meta($id, "_saved_as_draft", true);
                    if ($saved_draft == "yes") {
                        if (count($failed_posts) > 0) {
                            $del_post = false;
                            update_post_meta($post->ID, "_selected_sites", base64_encode(serialize($failed_posts)));
                            update_post_meta($post->ID, "_selected_groups", "");
                            wp_update_post(array("ID" => $id, 'post_status' => 'draft'));
                        }
                    }
                    if ($del_post) {
                        wp_delete_post($id, true);
                    }
                    ?>
                    <div id="message" class="updated">
                        <?php 
                    foreach ($dbwebsites as $website) {
                        ?>
                        <p><a href="<?php 
                        echo admin_url('admin.php?page=managesites&dashboard=' . $website->id);
                        ?>
"><?php 
                        echo $website->name;
                        ?>
</a>
                            : <?php 
                        echo isset($output->ok[$website->id]) && $output->ok[$website->id] == 1 ? 'New post created. ' . "<a href=\"" . $output->link[$website->id] . "\" target=\"_blank\">View Post</a>" : 'ERROR: ' . $output->errors[$website->id];
                        ?>
</p>
                        <?php 
                    }
                    ?>
                    </div>               
                    <?php 
                }
                // if ($post)
            } else {
                ?>
                <div class="error below-h2">
                    <p><strong><?php 
                _e('ERROR', 'mainwp');
                ?>
</strong>: <?php 
                _e('An undefined error occured.', 'mainwp');
                ?>
</p>
                </div>                
                <?php 
            }
        }
        // no skip posting
        ?>
            
        <br/>
        <a href="<?php 
        echo get_admin_url();
        ?>
admin.php?page=PostBulkAdd" class="add-new-h2" target="_top"><?php 
        _e('Add New', 'mainwp');
        ?>
</a>
        <a href="<?php 
        echo get_admin_url();
        ?>
admin.php?page=mainwp_tab" class="add-new-h2" target="_top"><?php 
        _e('Return
            to Dashboard', 'mainwp');
        ?>
</a>
                
    </div>
    <?php 
    }