当前位置: 首页>>代码示例>>PHP>>正文


PHP MainWP_DB::free_result方法代码示例

本文整理汇总了PHP中MainWP_DB::free_result方法的典型用法代码示例。如果您正苦于以下问题:PHP MainWP_DB::free_result方法的具体用法?PHP MainWP_DB::free_result怎么用?PHP MainWP_DB::free_result使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MainWP_DB的用法示例。


在下文中一共展示了MainWP_DB::free_result方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: sync

 public function sync($args, $assoc_args)
 {
     $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesForCurrentUser());
     WP_CLI::line('Syncing ' . MainWP_DB::num_rows($websites) . ' sites');
     $warnings = 0;
     $errors = 0;
     while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
         WP_CLI::line('  -> ' . $website->name . ' (' . $website->url . ')');
         try {
             if (MainWP_Sync::syncSite($website)) {
                 WP_CLI::success('  Sync succeeded');
             } else {
                 WP_CLI::warning('  Sync failed');
                 $warnings++;
             }
         } catch (Exception $e) {
             WP_CLI::error('  Sync failed');
             $errors++;
         }
     }
     @MainWP_DB::free_result($websites);
     if ($errors > 0) {
         WP_CLI::error('Sync completed with errors');
     } else {
         if ($warnings > 0) {
             WP_CLI::warning('Sync completed with warnings');
         } else {
             WP_CLI::success('Sync completed');
         }
     }
 }
开发者ID:jexmex,项目名称:mainwp,代码行数:31,代码来源:class-mainwp-wp-cli-command.php

示例2: render

    public static function render()
    {
        self::renderHeader('');
        ?>
        <a class="button-primary mwp-child-scan" href="#"><?php 
        _e('Scan', 'mainwp');
        ?>
</a>
        <?php 
        $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesForCurrentUser());
        if (!$websites) {
            echo __('<p>No websites to scan.</p>', 'mainwp');
        } else {
            ?>
			<table id="mwp_child_scan_childsites">
				<tr><th>Child</th><th>Status</th></tr>
			<?php 
            while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
                $imgfavi = '';
                if ($website !== null) {
                    if (get_option('mainwp_use_favicon', 1) == 1) {
                        $favi = MainWP_DB::Instance()->getWebsiteOption($website, 'favi_icon', '');
                        $favi_url = MainWP_Utility::get_favico_url($favi, $website);
                        $imgfavi = '<img src="' . $favi_url . '" width="16" height="16" style="vertical-align:middle;"/>&nbsp;';
                    }
                }
                if ($website->sync_errors == '') {
                    echo '<tr siteid="' . $website->id . '"><td title="' . $website->url . '">' . $imgfavi . ' ' . stripslashes($website->name) . ':</td><td></td></tr>';
                } else {
                    echo '<tr><td title="' . $website->url . '">' . $imgfavi . ' ' . stripslashes($website->name) . ':</td><td>Sync errors</td></tr>';
                }
            }
            @MainWP_DB::free_result($websites);
            ?>
			</table>
			<?php 
        }
        ?>
    <?php 
        self::renderFooter('');
    }
开发者ID:sacredwebsite,项目名称:mainwp,代码行数:41,代码来源:page-mainwp-child-scan.php

示例3: renderTest

    public static function renderTest()
    {
        if (!mainwp_current_user_can('dashboard', 'test_connection')) {
            mainwp_do_not_have_permissions(__('test connection', 'mainwp'));
            return;
        }
        ?>
            <div id="mainwp_managesites_test_errors" class="mainwp_error error"></div>
            <div id="mainwp_managesites_test_message" class="mainwp_updated updated"></div>
            <form method="POST" action="" enctype="multipart/form-data" id="mainwp_testconnection_form">
            <div class="mainwp_info-box-blue">
                <span><?php 
        _e('The Test Connection feature is specifically testing what your Dashboard can "see" and what your Dashboard "sees" and what my Dashboard "sees" or what your browser "sees" can be completely different things.', 'mainwp');
        ?>
</span>
            </div>
            <div class="postbox">
            <h3 class="mainwp_box_title"><span><i class="fa fa-cog"></i> <?php 
        _e('Test a Site Connection', 'mainwp');
        ?>
</span></h3>
            <div class="inside">
                <table class="form-table">
                    <tr class="form-field form-required">
                        <th scope="row"><?php 
        _e('Site URL:', 'mainwp');
        ?>
</th>
                        <td>
                            <input type="text" id="mainwp_managesites_test_wpurl"
                                   name="mainwp_managesites_add_wpurl"
                                   value="<?php 
        if (isset($_REQUEST['site'])) {
            echo $_REQUEST['site'];
        }
        ?>
" autocompletelist="mainwp-test-sites" class="mainwp_autocomplete" /><span class="mainwp-form_hint">Proper Format: <strong>http://address.com/</strong> or <strong>http://www.address.com/</strong></span>
                            <datalist id="mainwp-test-sites">
								<?php 
        $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesForCurrentUser());
        while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
            echo '<option>' . $website->url . '</option>';
        }
        @MainWP_DB::free_result($websites);
        ?>
                            </datalist>
                            <br/><em><?php 
        _e('Please only use the domain URL, do not add /wp-admin.', 'mainwp');
        ?>
</em>
                        </td>
                    </tr>
                </table>
                </div>
                </div>
                <div class="postbox">
                <h3 class="mainwp_box_title"><span><i class="fa fa-cog"></i> <?php 
        _e('Advanced Options', 'mainwp');
        ?>
</span></h3>
                <div class="inside">
                    <table class="form-table">
                    <tr class="form-field form-required">
                       <th scope="row"><?php 
        _e('Verify Certificate', 'mainwp');
        ?>
 <?php 
        MainWP_Utility::renderToolTip(__('Verify the childs SSL certificate. This should be disabled if you are using out of date or self signed certificates.', 'mainwp'));
        ?>
</th>
                        <td>
                            <select id="mainwp_managesites_test_verifycertificate" name="mainwp_managesites_test_verifycertificate">
                                 <option selected value="1"><?php 
        _e('Yes', 'mainwp');
        ?>
</option>
                                 <option value="0"><?php 
        _e('No', 'mainwp');
        ?>
</option>
                                 <option value="2"><?php 
        _e('Use Global Setting', 'mainwp');
        ?>
</option>
                             </select> <em>(<?php 
        _e('Default: Yes', 'mainwp');
        ?>
)</em>
                        </td>
                    </tr>
                    <tr class="form-field form-required">
                       <th scope="row"><?php 
        _e('SSL Version', 'mainwp');
        ?>
 <?php 
        MainWP_Utility::renderToolTip(__('Prefered SSL Version to connect to your site.', 'mainwp'));
        ?>
</th>
                        <td>
                            <select id="mainwp_managesites_test_ssl_version" name="mainwp_managesites_test_ssl_version">
//.........这里部分代码省略.........
开发者ID:senlin,项目名称:mainwp,代码行数:101,代码来源:view-mainwp-manage-sites-view.php

示例4: sync

 /**
  * Sync Data with Child Sites
  *
  * ## OPTIONS
  *
  * [<websiteid>]
  * : The id (or ids, comma separated) of the child sites that need to be synced.
  *
  * [--all]
  * : If set, all child sites will be synced.
  *
  * ## EXAMPLES
  *
  *     wp mainwp sync 2,5
  *     wp mainwp sync --all
  *
  * @synopsis [<websiteid>] [--all]
  */
 public function sync($args, $assoc_args)
 {
     $sites = array();
     if (count($args) > 0) {
         $args_exploded = explode(',', $args[0]);
         foreach ($args_exploded as $arg) {
             if (!is_numeric(trim($arg))) {
                 WP_CLI::error('Child site ids should be numeric.');
             }
             $sites[] = trim($arg);
         }
     }
     if (count($sites) == 0 && !isset($assoc_args['all'])) {
         WP_CLI::error('Please specify one or more child sites, or use --all.');
     }
     $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesForCurrentUser());
     WP_CLI::line('Sync started');
     $warnings = 0;
     $errors = 0;
     while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
         if (count($sites) > 0 && !in_array($website->id, $sites)) {
             continue;
         }
         WP_CLI::line('  -> ' . $website->name . ' (' . $website->url . ')');
         try {
             if (MainWP_Sync::syncSite($website)) {
                 WP_CLI::success('  Sync succeeded');
             } else {
                 WP_CLI::warning('  Sync failed');
                 $warnings++;
             }
         } catch (Exception $e) {
             WP_CLI::error('  Sync failed: ' . MainWP_Error_Helper::getConsoleErrorMessage($e));
             $errors++;
         }
     }
     @MainWP_DB::free_result($websites);
     if ($errors > 0) {
         WP_CLI::error('Sync completed with errors');
     } else {
         if ($warnings > 0) {
             WP_CLI::warning('Sync completed with warnings');
         } else {
             WP_CLI::success('Sync completed');
         }
     }
 }
开发者ID:reeslo,项目名称:mainwp,代码行数:65,代码来源:class-mainwp-wp-cli-command.php

示例5: syncSite

 public static function syncSite(&$pWebsite = null, $pForceFetch = false, $pAllowDisconnect = true)
 {
     if ($pWebsite == null) {
         return false;
     }
     $userExtension = MainWP_DB::Instance()->getUserExtensionByUserId($pWebsite->userid);
     if ($userExtension == null) {
         return false;
     }
     MainWP_Utility::endSession();
     try {
         $pluginDir = $pWebsite->pluginDir;
         if ($pluginDir == '') {
             $pluginDir = $userExtension->pluginDir;
         }
         $cloneEnabled = apply_filters('mainwp_clone_enabled', false);
         $cloneSites = array();
         if ($cloneEnabled) {
             $disallowedCloneSites = get_option('mainwp_clone_disallowedsites');
             if ($disallowedCloneSites === false) {
                 $disallowedCloneSites = array();
             }
             $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesForCurrentUser());
             if ($websites) {
                 while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
                     if (in_array($website->id, $disallowedCloneSites)) {
                         continue;
                     }
                     if ($website->id == $pWebsite->id) {
                         continue;
                     }
                     $cloneSites[$website->id] = array('name' => $website->name, 'url' => $website->url, 'extauth' => $website->extauth, 'size' => $website->totalsize);
                 }
                 @MainWP_DB::free_result($websites);
             }
         }
         $pluginConflicts = get_option('mainwp_pluginConflicts');
         if ($pluginConflicts !== false) {
             $pluginConflicts = array_keys($pluginConflicts);
         }
         $themeConflicts = get_option('mainwp_themeConflicts');
         if ($themeConflicts !== false) {
             $themeConflicts = array_keys($themeConflicts);
         }
         $othersData = apply_filters('mainwp-sync-others-data', array(), $pWebsite);
         $information = MainWP_Utility::fetchUrlAuthed($pWebsite, 'stats', array('optimize' => get_option('mainwp_optimize') == 1 ? 1 : 0, 'heatMap' => MainWP_Extensions::isExtensionAvailable('mainwp-heatmap-extension') ? $userExtension->heatMap : 0, 'pluginDir' => $pluginDir, 'cloneSites' => !$cloneEnabled ? 0 : urlencode(json_encode($cloneSites)), 'pluginConflicts' => json_encode($pluginConflicts), 'themeConflicts' => json_encode($themeConflicts), 'othersData' => json_encode($othersData), 'server' => get_admin_url(), 'numberdaysOutdatePluginTheme' => get_option('mainwp_numberdays_Outdate_Plugin_Theme', 365)), true, $pForceFetch);
         $return = self::syncInformationArray($pWebsite, $information, '', 1, false, $pAllowDisconnect);
         return $return;
     } catch (MainWP_Exception $e) {
         $sync_errors = '';
         $offline_check_result = 1;
         if ($e->getMessage() == 'HTTPERROR') {
             $sync_errors = __('HTTP error', 'mainwp') . ($e->getMessageExtra() != null ? ' - ' . $e->getMessageExtra() : '');
             $offline_check_result = -1;
         } else {
             if ($e->getMessage() == 'NOMAINWP') {
                 $sync_errors = __('MainWP not detected', 'mainwp');
                 $offline_check_result = 1;
             }
         }
         return self::syncInformationArray($pWebsite, $information, $sync_errors, $offline_check_result, true, $pAllowDisconnect);
     }
 }
开发者ID:reeslo,项目名称:mainwp,代码行数:63,代码来源:class-mainwp-sync.php

示例6: hookGetSites

 /**
  * @param string $pluginFile Extension plugin file to verify
  * @param string $key The child-key
  * @param int $websiteid The id of the child-site you wish to retrieve
  * @param bool $for_manager
  *
  * @return array|bool An array of arrays, the inner-array contains the id/url/name/totalsize of the website. False when something goes wrong.
  */
 public static function hookGetSites($pluginFile, $key, $websiteid = null, $for_manager = false)
 {
     if (!self::hookVerify($pluginFile, $key)) {
         return false;
     }
     if ($for_manager && (!defined('MWP_TEAMCONTROL_PLUGIN_SLUG') || !mainwp_current_user_can('extension', dirname(MWP_TEAMCONTROL_PLUGIN_SLUG)))) {
         return false;
     }
     if (isset($websiteid) && $websiteid != null) {
         $website = MainWP_DB::Instance()->getWebsiteById($websiteid);
         if (!MainWP_Utility::can_edit_website($website)) {
             return false;
         }
         if (!mainwp_current_user_can('site', $websiteid)) {
             return false;
         }
         return array(array('id' => $websiteid, 'url' => MainWP_Utility::getNiceURL($website->url, true), 'name' => $website->name, 'totalsize' => $website->totalsize));
     }
     $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesForCurrentUser(false, null, 'wp.url', false, false, null, $for_manager));
     $output = array();
     while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
         $output[] = array('id' => $website->id, 'url' => MainWP_Utility::getNiceURL($website->url, true), 'name' => $website->name, 'totalsize' => $website->totalsize);
     }
     @MainWP_DB::free_result($websites);
     return $output;
 }
开发者ID:jexmex,项目名称:mainwp,代码行数:34,代码来源:page-mainwp-extensions.php

示例7: checkWebsite

 public static function checkWebsite()
 {
     if (!isset($_POST['websiteid'])) {
         //Check all websites
         $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesForCurrentUser());
     } else {
         $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsiteById($_POST['websiteid']));
         if (!$websites) {
             return 0;
         }
     }
     $output = array();
     if (!$websites) {
         $emailOutput = '';
     } else {
         $emailOutput = null;
     }
     $errors = false;
     while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
         if (self::performCheck($website, true, $emailOutput)) {
             $output[$website->id] = 1;
         } else {
             $output[$website->id] = -1;
             $errors = true;
         }
     }
     @MainWP_DB::free_result($websites);
     if ($emailOutput != null) {
         if ($errors) {
             $emailOutput .= '<br /><br />Please take a look at the issues and make sure everything is ok.';
         }
         $email = MainWP_DB::Instance()->getUserNotificationEmail($website->userid);
         wp_mail($email, $errors ? 'Down Time Alert - MainWP' : 'Up Time Alert - MainWP', MainWP_Utility::formatEmail($email, $emailOutput), array('From: "' . get_option('admin_email') . '" <' . get_option('admin_email') . '>', 'content-type: text/html'));
     }
     return array('result' => $output);
 }
开发者ID:jexmex,项目名称:mainwp,代码行数:36,代码来源:page-mainwp-offline-checks.php

示例8: posting

    public static function posting()
    {
        //Posts the saved sites
        ?>
		<div class="wrap">
			<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();
                    $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 (MainWP_Utility::ctype_digit($k)) {
                                $website = MainWP_DB::Instance()->getWebsiteById($k);
                                $dbwebsites[$website->id] = MainWP_Utility::mapSite($website, array('id', 'url', 'name', 'adminname', 'nossl', 'privkey', 'nosslkey'));
                            }
                        }
                    } else {
                        //Get all websites from the selected groups
                        foreach ($selected_groups as $k) {
                            if (MainWP_Utility::ctype_digit($k)) {
                                $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesByGroupId($k));
                                while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
                                    if ($website->sync_errors != '') {
                                        continue;
                                    }
                                    $dbwebsites[$website->id] = MainWP_Utility::mapSite($website, array('id', 'url', 'name', 'adminname', 'nossl', 'privkey', 'nosslkey'));
                                }
                                @MainWP_DB::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_category' => base64_encode($post_category), 'post_featured_image' => base64_encode($post_featured_image), 'mainwp_upload_dir' => base64_encode(serialize($mainwp_upload_dir)));
                        MainWP_Utility::fetchUrlsAuthed($dbwebsites, 'newpost', $post_data, array(MainWP_Bulk_Add::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);
                    }
                    $countSites = 0;
                    $countRealItems = 0;
                    foreach ($dbwebsites as $website) {
                        if (isset($output->ok[$website->id]) && $output->ok[$website->id] == 1) {
                            $countSites++;
                            $countRealItems++;
                        }
//.........这里部分代码省略.........
开发者ID:senlin,项目名称:mainwp,代码行数:101,代码来源:page-mainwp-post.php

示例9: doImport

 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 = MainWP_DB::Instance()->getWebsitesByUrl($url);
                 if ($website) {
                     $dbwebsites[$website[0]->id] = MainWP_Utility::mapSite($website[0], array('id', 'url', 'name', 'adminname', 'nossl', 'privkey', 'nosslkey'));
                 } else {
                     $not_valid[] = __("Error - The website doesn't exist in the Network.", 'mainwp') . " " . $url;
                     $error_sites .= $url . ';';
                 }
             }
         }
     } else {
         //Get all websites from the selected groups
         foreach ($selected_groups as $group) {
             if (MainWP_DB::Instance()->getGroupsByName($group)) {
                 $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesByGroupName($group));
                 if ($websites) {
                     while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
                         $dbwebsites[$website->id] = MainWP_Utility::mapSite($website, array('id', 'url', 'name', 'adminname', 'nossl', 'privkey', 'nosslkey'));
                     }
                     @MainWP_DB::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();
         MainWP_Utility::fetchUrlsAuthed($dbwebsites, 'newuser', $post_data, array(MainWP_Bulk_Add::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));
 }
开发者ID:senlin,项目名称:mainwp,代码行数:81,代码来源:page-mainwp-user.php

示例10: prepareUpload

 public static function prepareUpload()
 {
     include_once ABSPATH . '/wp-admin/includes/plugin-install.php';
     $output = array();
     $output['sites'] = array();
     if ($_POST['selected_by'] == 'site') {
         //Get sites
         foreach ($_POST['selected_sites'] as $enc_id) {
             $websiteid = $enc_id;
             if (MainWP_Utility::ctype_digit($websiteid)) {
                 $website = MainWP_DB::Instance()->getWebsiteById($websiteid);
                 $output['sites'][$website->id] = MainWP_Utility::mapSite($website, array('id', 'url', 'name'));
             }
         }
     } else {
         //Get sites from group
         foreach ($_POST['selected_groups'] as $enc_id) {
             $groupid = $enc_id;
             if (MainWP_Utility::ctype_digit($groupid)) {
                 $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesByGroupId($groupid));
                 while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
                     if ($website->sync_errors != '') {
                         continue;
                     }
                     $output['sites'][$website->id] = MainWP_Utility::mapSite($website, array('id', 'url', 'name'));
                 }
                 @MainWP_DB::free_result($websites);
             }
         }
     }
     $output['urls'] = array();
     foreach ($_POST['files'] as $file) {
         $output['urls'][] = MainWP_Utility::getDownloadUrl('bulk', $file);
     }
     $output['urls'] = implode('||', $output['urls']);
     $output['urls'] = apply_filters('mainwp_installbulk_prepareupload', $output['urls']);
     die(json_encode($output));
 }
开发者ID:reeslo,项目名称:mainwp,代码行数:38,代码来源:page-mainwp-install-bulk.php

示例11: getWebsiteListContent

    public static function getWebsiteListContent()
    {
        $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesForCurrentUser());
        while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
            ?>
			<li class="managegroups_site-listitem">
				<input type="checkbox" name="sites" value="<?php 
            echo $website->id;
            ?>
" id="<?php 
            echo MainWP_Utility::getNiceURL($website->url);
            ?>
" class="mainwp-checkbox2"><label for="<?php 
            echo MainWP_Utility::getNiceURL($website->url);
            ?>
" class="mainwp-label2"><span class="website_url" style="display: none;"><?php 
            echo MainWP_Utility::getNiceURL($website->url);
            ?>
</span><span class="website_name"><?php 
            echo stripslashes($website->name);
            ?>
</span></label>
			</li>
			<?php 
        }
        @MainWP_DB::free_result($websites);
    }
开发者ID:senlin,项目名称:mainwp,代码行数:27,代码来源:page-mainwp-manage-groups.php

示例12: select_categories_box


//.........这里部分代码省略.........
                    echo wp_kses_post(sprintf('<p>%s</p>', __('No selected categories.', 'mainwp')));
                } else {
                    foreach ($cats as $cat) {
                        echo wp_kses_post('<div class="mainwp_selected_sites_item  selected_sites_item_checked">
												<input type="' . $type . '" name="sites_selected_cats_' . $prefix . $cbox_prefix . '" value="' . $website->id . ',' . $cat['term_id'] . ',' . $cat['name'] . '" id="sites_selected_cats_' . $prefix . $cat['term_id'] . '" checked="true" />
												<label>' . $cat['name'] . '</label>
										    </div>');
                    }
                }
                ?>
								</div>
								<div class="mainwp_categories_list_bottom">
									<div style="float:right">
										<a href="#" rel="<?php 
                echo esc_attr($prefix);
                ?>
" class="load_more_cats" onClick="return mainwp_ss_cats_more(this, <?php 
                echo esc_attr($website->id);
                ?>
, 'site')">
											<?php 
                esc_html_e('Reload', 'mainwp');
                ?>
										</a>
										<span class="mainwp_more_loading">
											<i class="fa fa-spinner fa-pulse"></i>
										</span>
									</div>
									<div class="clearfix"></div>
								</div>
							</div>
							<?php 
            }
            @MainWP_DB::free_result($websites);
        }
        ?>
					</div>
					<div class="selected_groups" <?php 
        echo esc_attr($selected_by == 'group' ? 'style = "display: block"' : '');
        ?>
>
						<?php 
        if (count($groups) == 0) {
            echo wp_kses_post(sprintf('<p>%s</p>', __('No groups with entries have been found.', 'mainwp')));
        }
        foreach ($groups as $gid => $group) {
            ?>
							<div class="categories_group_<?php 
            echo esc_attr($gid);
            ?>
">
								<div class="mainwp_groups_list_header">
									<div><?php 
            echo stripslashes($group->name);
            ?>
</div>
								</div>
								<?php 
            $websites = MainWP_DB::Instance()->getWebsitesByGroupIds(array($gid));
            foreach ($websites as $website) {
                $id = $website->id;
                $cats = isset($selected_cats[$id]) && is_array($selected_cats[$id]) ? $selected_cats[$id] : array();
                ?>
								<div class="categories_site_<?php 
                echo esc_attr($id);
                ?>
开发者ID:senlin,项目名称:mainwp,代码行数:67,代码来源:class-mainwp-ui.php

示例13: render

    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 (MainWP_Utility::ctype_digit($k)) {
                            $website = MainWP_DB::Instance()->getWebsiteById($k);
                            $dbwebsites[$website->id] = MainWP_Utility::mapSite($website, array('id', 'url', 'name', 'adminname', 'nossl', 'privkey', 'nosslkey'));
                        }
                    }
                } else {
                    //Get all websites from the selected groups
                    foreach ($selected_groups as $k) {
                        if (MainWP_Utility::ctype_digit($k)) {
                            $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesByGroupId($k));
                            while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
                                if ($website->sync_errors != '') {
                                    continue;
                                }
                                $dbwebsites[$website->id] = MainWP_Utility::mapSite($website, array('id', 'url', 'name', 'adminname', 'nossl', 'privkey', 'nosslkey'));
                            }
                            @MainWP_DB::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();
                    MainWP_Utility::fetchUrlsAuthed($dbwebsites, 'newadminpassword', $post_data, array(MainWP_Bulk_Add::getClassName(), 'PostingBulk_handler'), $output);
                }
            }
        }
        if (!$show_form) {
            //Added to..
            ?>
			<div class="wrap">
                <h2 id="add-new-user"><i class="fa fa-key"></i> 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');
            ?>
//.........这里部分代码省略.........
开发者ID:sacredwebsite,项目名称:mainwp,代码行数:101,代码来源:page-mainwp-bulk-update-admin-passwords.php

示例14: clear_items

 function clear_items()
 {
     if (MainWP_DB::is_result($this->items)) {
         @MainWP_DB::free_result($this->items);
     }
 }
开发者ID:sacredwebsite,项目名称:mainwp,代码行数:6,代码来源:table-mainwp-manage-sites-list-table.php

示例15: renderSites

    public static function renderSites($renew, $pExit = true)
    {
        $current_wpid = MainWP_Utility::get_current_wpid();
        if ($current_wpid) {
            $sql = MainWP_DB::Instance()->getSQLWebsiteById($current_wpid);
        } else {
            $sql = MainWP_DB::Instance()->getSQLWebsitesForCurrentUser();
        }
        $websites = MainWP_DB::Instance()->query($sql);
        $allPages = array();
        if ($websites) {
            while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
                if ($website->recent_pages == '') {
                    continue;
                }
                $pages = json_decode($website->recent_pages, 1);
                if (count($pages) == 0) {
                    continue;
                }
                foreach ($pages as $page) {
                    $page['website'] = (object) array('id' => $website->id, 'url' => $website->url);
                    $allPages[] = $page;
                }
            }
            @MainWP_DB::free_result($websites);
        }
        $recent_pages_published = MainWP_Utility::getSubArrayHaving($allPages, 'status', 'publish');
        $recent_pages_published = MainWP_Utility::sortmulti($recent_pages_published, 'dts', 'desc');
        $recent_pages_draft = MainWP_Utility::getSubArrayHaving($allPages, 'status', 'draft');
        $recent_pages_draft = MainWP_Utility::sortmulti($recent_pages_draft, 'dts', 'desc');
        $recent_pages_pending = MainWP_Utility::getSubArrayHaving($allPages, 'status', 'pending');
        $recent_pages_pending = MainWP_Utility::sortmulti($recent_pages_pending, 'dts', 'desc');
        $recent_pages_trash = MainWP_Utility::getSubArrayHaving($allPages, 'status', 'trash');
        $recent_pages_trash = MainWP_Utility::sortmulti($recent_pages_trash, 'dts', 'desc');
        ?>
		<div class="clear">
			<a href="<?php 
        echo admin_url('admin.php?page=PageBulkAdd&select=' . ($current_wpid ? $current_wpid : 'all'));
        ?>
" class="button-primary" style="float: right"><?php 
        _e('Add New', 'mainwp');
        ?>
</a>
			<a class="mainwp_action left mainwp_action_down recent_posts_published_lnk" href="#"><?php 
        _e('Published', 'mainwp');
        ?>
 (<?php 
        echo count($recent_pages_published);
        ?>
)</a><a class="mainwp_action mid recent_posts_draft_lnk" href="#"><?php 
        _e('Draft', 'mainwp');
        ?>
 (<?php 
        echo count($recent_pages_draft);
        ?>
)</a><a class="mainwp_action mid recent_posts_pending_lnk" href="#"><?php 
        _e('Pending', 'mainwp');
        ?>
 (<?php 
        echo count($recent_pages_pending);
        ?>
)</a><a class="mainwp_action right recent_posts_trash_lnk" href="#"><?php 
        _e('Trash', 'mainwp');
        ?>
 (<?php 
        echo count($recent_pages_trash);
        ?>
)</a><br/><br/>

			<div class="recent_posts_published">
				<?php 
        for ($i = 0; $i < count($recent_pages_published) && $i < 5; $i++) {
            if (!isset($recent_pages_published[$i]['title']) || $recent_pages_published[$i]['title'] == '') {
                $recent_pages_published[$i]['title'] = '(No Title)';
            }
            if (isset($recent_pages_published[$i]['dts'])) {
                if (!stristr($recent_pages_published[$i]['dts'], '-')) {
                    $recent_pages_published[$i]['dts'] = MainWP_Utility::formatTimestamp(MainWP_Utility::getTimestamp($recent_pages_published[$i]['dts']));
                }
            }
            ?>
					<div class="mainwp-row mainwp-recent">
						<input class="postId" type="hidden" name="id" value="<?php 
            echo $recent_pages_published[$i]['id'];
            ?>
"/>
						<input class="websiteId" type="hidden" name="id" value="<?php 
            echo $recent_pages_published[$i]['website']->id;
            ?>
"/>
						<span class="mainwp-left-col" style="width: 60% !important; margin-right: 1em;"><a href="<?php 
            echo $recent_pages_published[$i]['website']->url;
            ?>
?p=<?php 
            echo $recent_pages_published[$i]['id'];
            ?>
" target="_blank"><?php 
            echo htmlentities($recent_pages_published[$i]['title'], ENT_COMPAT | ENT_HTML401, 'UTF-8');
            ?>
</a></span>
//.........这里部分代码省略.........
开发者ID:senlin,项目名称:mainwp,代码行数:101,代码来源:widget-mainwp-recent-pages.php


注:本文中的MainWP_DB::free_result方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。