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


PHP MainWP_Utility::get_current_wpid方法代码示例

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


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

示例1: render

    public static function render()
    {
        $current_wpid = MainWP_Utility::get_current_wpid();
        if (!MainWP_Utility::ctype_digit($current_wpid)) {
            return;
        }
        $website = MainWP_DB::Instance()->getWebsiteById($current_wpid, true);
        ?>
		<div id="mainwp-notes-area">
			<div id="mainwp-notes-note" style="padding-bottom: 1em;">
				<?php 
        if ($website->note == '') {
            echo 'No Saved Notes';
        } else {
            echo $website->note;
        }
        ?>
			</div>
			<div style="text-align: center; border-top: 1px Solid #f4f4f4; padding-top: 1em;">
				<a href="#" class="mainwp_notes_show_all button button-primary" id="mainwp_notes_<?php 
        echo $website->id;
        ?>
"><?php 
        _e('Edit Notes', 'mainwp');
        ?>
</a>
			</div>
		</div>
		<?php 
    }
开发者ID:senlin,项目名称:mainwp,代码行数:30,代码来源:widget-mainwp-notes.php

示例2: renderWidget

    public static function renderWidget($renew, $pExit = true)
    {
        $current_wpid = MainWP_Utility::get_current_wpid();
        if (empty($current_wpid)) {
            return;
        }
        $sql = MainWP_DB::Instance()->getSQLWebsiteById($current_wpid);
        $websites = MainWP_DB::Instance()->query($sql);
        $allPlugins = array();
        if ($websites) {
            $website = @MainWP_DB::fetch_object($websites);
            if ($website && $website->plugins != '') {
                $plugins = json_decode($website->plugins, 1);
                if (is_array($plugins) && count($plugins) != 0) {
                    foreach ($plugins as $plugin) {
                        if (isset($plugin['mainwp']) && $plugin['mainwp'] == 'T') {
                            continue;
                        }
                        $allPlugins[] = $plugin;
                    }
                }
            }
            @MainWP_DB::free_result($websites);
        }
        $actived_plugins = MainWP_Utility::getSubArrayHaving($allPlugins, 'active', 1);
        $actived_plugins = MainWP_Utility::sortmulti($actived_plugins, 'name', 'desc');
        $inactive_plugins = MainWP_Utility::getSubArrayHaving($allPlugins, 'active', 0);
        $inactive_plugins = MainWP_Utility::sortmulti($inactive_plugins, 'name', 'desc');
        $plugins_outdate = array();
        if (count($allPlugins) > 0 && $website) {
            $plugins_outdate = json_decode(MainWP_DB::Instance()->getWebsiteOption($website, 'plugins_outdate_info'), true);
            if (!is_array($plugins_outdate)) {
                $plugins_outdate = array();
            }
            $pluginsOutdateDismissed = json_decode(MainWP_DB::Instance()->getWebsiteOption($website, 'plugins_outdate_dismissed'), true);
            if (is_array($pluginsOutdateDismissed)) {
                $plugins_outdate = array_diff_key($plugins_outdate, $pluginsOutdateDismissed);
            }
            $userExtension = MainWP_DB::Instance()->getUserExtension();
            $decodedDismissedPlugins = json_decode($userExtension->dismissed_plugins, true);
            if (is_array($decodedDismissedPlugins)) {
                $plugins_outdate = array_diff_key($plugins_outdate, $decodedDismissedPlugins);
            }
        }
        ?>
		<div class="clear mwp_plugintheme_widget">
			<a class="mainwp_action left mainwp_action_down plugins_actived_lnk" href="#"><?php 
        _e('Active', 'mainwp');
        ?>
 (<?php 
        echo count($actived_plugins);
        ?>
)</a><a class="mainwp_action mid plugins_inactive_lnk right" href="#"><?php 
        _e('Inactive', 'mainwp');
        ?>
 (<?php 
        echo count($inactive_plugins);
        ?>
)</a><br/><br/>

			<div class="mainwp_plugins_active">
				<?php 
        $str_format = __(' | Last Updated %s Days Ago', 'mainwp');
        for ($i = 0; $i < count($actived_plugins); $i++) {
            $outdate_notice = '';
            $slug = $actived_plugins[$i]['slug'];
            if (isset($plugins_outdate[$slug])) {
                $plugin_outdate = $plugins_outdate[$slug];
                $now = new \DateTime();
                $last_updated = $plugin_outdate['last_updated'];
                $plugin_last_updated_date = new \DateTime('@' . $last_updated);
                $diff_in_days = $now->diff($plugin_last_updated_date)->format('%a');
                $outdate_notice = sprintf($str_format, $diff_in_days);
            }
            ?>
					<div class="mainwp-row mainwp-active">
						<input class="pluginSlug" type="hidden" name="slug" value="<?php 
            echo $actived_plugins[$i]['slug'];
            ?>
"/>
						<input class="websiteId" type="hidden" name="id" value="<?php 
            echo $website->id;
            ?>
"/>
						<span class="mainwp-left-col">
							<a href="<?php 
            echo admin_url() . 'plugin-install.php?tab=plugin-information&plugin=' . dirname($actived_plugins[$i]['slug']) . '&TB_iframe=true&width=640&height=477';
            ?>
" target="_blank" class="thickbox" title="More information about <?php 
            echo $actived_plugins[$i]['name'];
            ?>
">
								<?php 
            echo $actived_plugins[$i]['name'];
            ?>
							</a>
							<?php 
            echo ' ' . $actived_plugins[$i]['version'];
            ?>
 <?php 
//.........这里部分代码省略.........
开发者ID:senlin,项目名称:mainwp,代码行数:101,代码来源:widget-mainwp-widget-plugins.php

示例3: hookGetDashboardSites

 public static function hookGetDashboardSites($pluginFile, $key)
 {
     if (!self::hookVerify($pluginFile, $key)) {
         return null;
     }
     $current_wpid = MainWP_Utility::get_current_wpid();
     if ($current_wpid) {
         $sql = MainWP_DB::Instance()->getSQLWebsiteById($current_wpid);
     } else {
         $sql = MainWP_DB::Instance()->getSQLWebsitesForCurrentUser();
     }
     return MainWP_DB::Instance()->query($sql);
 }
开发者ID:jexmex,项目名称:mainwp,代码行数:13,代码来源:page-mainwp-extensions.php

示例4: renderDashboardBody

    public static function renderDashboardBody($websites, $pDashboard, $pScreenLayout)
    {
        $opts = get_option('mainwp_opts_showhide_sections', false);
        $hide_shortcuts = is_array($opts) && isset($opts['welcome_shortcuts']) && $opts['welcome_shortcuts'] == 'hide' ? true : false;
        ?>
		<form action="admin-post.php" method="post">
			<?php 
        wp_nonce_field('mainwp_tab-general');
        ?>
			<?php 
        wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false);
        ?>
			<?php 
        wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false);
        ?>
			<input type="hidden" name="action" value="save_howto_testPages_general"/>

			<div id="mainwp-welocme-bar" class="welcome-panel" style="padding-left: 2em;">
				<table id="mainwp-refresh-bar" width="100%">
					<tbody>
					<tr>
						<td>
							<div id="mainwp-welocme-bar-top">
                    <span style="float:right;">
                    <a style="font-size: 18px;" class="button-hero button mainwp-upgrade-button" id="dashboard_refresh" title="<?php 
        echo MainWP_Right_Now::renderLastUpdate();
        ?>
"><i class="fa fa-refresh"></i> <?php 
        _e('Sync Data with Child Sites', 'mainwp');
        ?>
</a>
                    <a style="font-size: 18px;" class="button-hero button-primary button" target="_blank" href="https://extensions.mainwp.com"><i class="fa fa-cart-plus"></i> <?php 
        _e('Get New Extensions', 'mainwp');
        ?>
</a>
                    </span>
								<?php 
        $current_wp_id = MainWP_Utility::get_current_wpid();
        $website = null;
        if (!empty($current_wp_id)) {
            $website = $websites[0];
        }
        $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 !== null) {
            if (time() - $website->dtsSync > 60 * 60 * 24) {
                ?>
<h3>
										<i class="fa fa-flag"></i> <?php 
                _e('Your MainWP Dashboard has not been synced for 24 hours!', 'mainwp');
                ?>
										</h3>
										<p class="about-description"><?php 
                _e('Click the Sync Data button to get the latest data from child sites.', 'mainwp');
                ?>
</p>
										<?php 
            } else {
                ?>
										<h3><?php 
                echo sprintf(__('Welcome to %s Dashboard!', 'mainwp'), stripslashes($website->name));
                ?>
</h3>
										<p class="about-description"><?php 
                echo sprintf(__('This information is only for %s%s', 'mainwp'), $imgfavi, MainWP_Utility::getNiceURL($website->url, true));
                ?>
</p>
										<?php 
            }
        } else {
            $sync_status = MainWP_DB::Instance()->getLastSyncStatus();
            if ($sync_status === 'not_synced') {
                ?>
<h3>
										<i class="fa fa-flag"></i> <?php 
                _e('Your MainWP Dashboard has not been synced for 24 hours!', 'mainwp');
                ?>
										</h3>
										<p class="about-description"><?php 
                _e('Click the Sync Data button to get the latest data from child sites.', 'mainwp');
                ?>
</p>
										<?php 
            } else {
                if ($sync_status === 'all_synced') {
                    ?>
										<h3><?php 
                    echo __('All sites have been synced within the last 24 hours!', 'mainwp');
                    ?>
</h3>
										<p class="about-description"><?php 
                    echo __('Manage your WordPress sites with ease.', 'mainwp');
                    ?>
</p>
//.........这里部分代码省略.........
开发者ID:senlin,项目名称:mainwp,代码行数:101,代码来源:page-mainwp-main.php

示例5: update_footer

    function update_footer()
    {
        if (!self::isMainWP_Pages()) {
            return;
        }
        $current_wpid = MainWP_Utility::get_current_wpid();
        if ($current_wpid) {
            $website = MainWP_DB::Instance()->getWebsiteById($current_wpid);
            $websites = array($website);
        } else {
            $websites = MainWP_DB::Instance()->query(MainWP_DB::Instance()->getSQLWebsitesForCurrentUser(false, null, 'wp_sync.dtsSync DESC, wp.url ASC'));
        }
        ob_start();
        $cntr = 0;
        if (is_array($websites)) {
            for ($i = 0; $i < count($websites); $i++) {
                $website = $websites[$i];
                if ($website->sync_errors == '') {
                    $cntr++;
                    echo '<input type="hidden" name="dashboard_wp_ids[]" class="dashboard_wp_id" value="' . $website->id . '" />';
                }
            }
        } else {
            if ($websites !== false) {
                while ($website = @MainWP_DB::fetch_object($websites)) {
                    if ($website->sync_errors == '') {
                        $cntr++;
                        echo '<input type="hidden" name="dashboard_wp_ids[]" class="dashboard_wp_id" value="' . $website->id . '" />';
                    }
                }
            }
        }
        ?>
		<div id="refresh-status-box" title="Syncing Websites" style="display: none; text-align: center">
			<div id="refresh-status-progress"></div>
			<span id="refresh-status-current">0</span> / <span id="refresh-status-total"><?php 
        echo esc_html($cntr);
        ?>
</span>
			<span id="refresh-status-text"><?php 
        esc_html_e('synced', 'mainwp');
        ?>
</span>

			<div style="height: 160px; overflow: auto; margin-top: 20px; margin-bottom: 10px; text-align: left" id="refresh-status-content">
				<table style="width: 100%">
					<?php 
        if (is_array($websites)) {
            for ($i = 0; $i < count($websites); $i++) {
                $website = $websites[$i];
                if ($website->sync_errors == '') {
                    echo '<tr><td>' . MainWP_Utility::getNiceURL($website->url) . '</td><td style="width: 80px"><span class="refresh-status-wp" niceurl="' . MainWP_Utility::getNiceURL($website->url) . '" siteid="' . $website->id . '">PENDING</span></td></tr>';
                } else {
                    echo '<tr class="mainwp_wp_offline"><td>' . MainWP_Utility::getNiceURL($website->url) . '</td><td style="width: 80px"><span class="refresh-status-wp" niceurl="' . MainWP_Utility::getNiceURL($website->url) . '" siteid="' . $website->id . '">DISCONNECTED</span></td></tr>';
                }
            }
        } else {
            @MainWP_DB::data_seek($websites, 0);
            while ($website = @MainWP_DB::fetch_object($websites)) {
                if ($website->sync_errors == '') {
                    echo '<tr><td>' . MainWP_Utility::getNiceURL($website->url) . '</td><td style="width: 80px"><span class="refresh-status-wp" niceurl="' . MainWP_Utility::getNiceURL($website->url) . '" siteid="' . $website->id . '">PENDING</span></td></tr>';
                } else {
                    echo '<tr class="mainwp_wp_offline"><td>' . MainWP_Utility::getNiceURL($website->url) . '</td><td style="width: 80px"><span class="refresh-status-wp" niceurl="' . MainWP_Utility::getNiceURL($website->url) . '" siteid="' . $website->id . '">DISCONNECTED</span></td></tr>';
                }
            }
        }
        ?>
				</table>
			</div>
			<input id="refresh-status-close" type="button" name="Close" value="Close" class="button"/>
		</div>
		<?php 
        if (!self::isHideFooter()) {
            self::sites_fly_menu();
            self::add_new_links();
        }
        $newOutput = ob_get_clean();
        $output = '';
        if (!self::isHideFooter()) {
            $output .= '<a href="javascript:void(0)" id="dashboard_refresh" title="Sync Data" class="mainwp-left-margin-2 mainwp-green"><i class="fa fa-refresh fa-2x"></i></a> <a id="mainwp-add-new-button" class="mainwp-blue mainwp-left-margin-2" title="Add New" href="javascript:void(0)"><i class="fa fa-plus fa-2x"></i></a> <a class="mainwp-red mainwp-left-margin-2" title="Get MainWP Extensions" href="https://mainwp.com/extensions/" target="_blank"><i class="fa fa-shopping-cart fa-2x"></i></a> <a class="mainwp-white mainwp-left-margin-2" title="Get Support" href="http://support.mainwp.com" target="_blank"><i class="fa fa-life-ring fa-2x"></i></a>' . '<a href="https://www.facebook.com/mainwp" class="mainwp-link-clean mainwp-left-margin-2" style="color: #3B5998;" target="_blank"><i class="fa fa-facebook-square fa-2x"></i></a> ' . ' <a href="https://twitter.com/mymainwp" class="mainwp-link-clean" target="_blank" style="color: #4099FF;"><i class="fa fa-twitter-square fa-2x"></i></a>.';
        }
        return $output . $newOutput;
    }
开发者ID:reeslo,项目名称:mainwp,代码行数:83,代码来源:class-mainwp-system.php

示例6: renderSites

    public static function renderSites()
    {
        $globalView = true;
        $current_wpid = MainWP_Utility::get_current_wpid();
        if ($current_wpid) {
            $sql = MainWP_DB::Instance()->getSQLWebsiteById($current_wpid);
            $globalView = false;
        } else {
            $sql = MainWP_DB::Instance()->getSQLWebsitesForCurrentUser();
        }
        $websites = MainWP_DB::Instance()->query($sql);
        if (!$websites) {
            return;
        }
        $userExtension = MainWP_DB::Instance()->getUserExtension();
        $total_themesIgnored = $total_pluginsIgnored = 0;
        $total_themesIgnoredAbandoned = $total_pluginsIgnoredAbandoned = 0;
        if ($globalView) {
            $decodedIgnoredPlugins = json_decode($userExtension->ignored_plugins, true);
            $decodedIgnoredThemes = json_decode($userExtension->ignored_themes, true);
            $total_pluginsIgnored = is_array($decodedIgnoredPlugins) ? count($decodedIgnoredPlugins) : 0;
            $total_themesIgnored = is_array($decodedIgnoredThemes) ? count($decodedIgnoredThemes) : 0;
            $decodedIgnoredPluginsAbandoned = json_decode($userExtension->dismissed_plugins, true);
            $decodedIgnoredThemesAbandoned = json_decode($userExtension->dismissed_themes, true);
            $total_pluginsIgnoredAbandoned = is_array($decodedIgnoredPluginsAbandoned) ? count($decodedIgnoredPluginsAbandoned) : 0;
            $total_themesIgnoredAbandoned = is_array($decodedIgnoredThemesAbandoned) ? count($decodedIgnoredThemesAbandoned) : 0;
        }
        $decodedDismissedPlugins = json_decode($userExtension->dismissed_plugins, true);
        $decodedDismissedThemes = json_decode($userExtension->dismissed_themes, true);
        $globalIgnoredPluginConflicts = json_decode($userExtension->ignored_pluginConflicts, true);
        if (!is_array($globalIgnoredPluginConflicts)) {
            $globalIgnoredPluginConflicts = array();
        }
        $globalIgnoredThemeConflicts = json_decode($userExtension->ignored_themeConflicts, true);
        if (!is_array($globalIgnoredThemeConflicts)) {
            $globalIgnoredThemeConflicts = array();
        }
        $total_wp_upgrades = 0;
        $total_plugin_upgrades = 0;
        $total_theme_upgrades = 0;
        $total_sync_errors = 0;
        $total_uptodate = 0;
        $total_offline = 0;
        $total_conflict = 0;
        $total_plugins_outdate = 0;
        $total_themes_outdate = 0;
        $allPlugins = array();
        $pluginsInfo = array();
        $allThemes = array();
        $themesInfo = array();
        $allPluginsOutdate = array();
        $pluginsOutdateInfo = array();
        $allThemesOutdate = array();
        $themesOutdateInfo = array();
        @MainWP_DB::data_seek($websites, 0);
        $currentSite = null;
        $pluginsIgnored_perSites = $themesIgnored_perSites = array();
        $pluginsIgnoredAbandoned_perSites = $themesIgnoredAbandoned_perSites = array();
        while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
            if (!$globalView) {
                $currentSite = $website;
            }
            $wp_upgrades = json_decode(MainWP_DB::Instance()->getWebsiteOption($website, 'wp_upgrades'), true);
            if ($website->is_ignoreCoreUpdates) {
                $wp_upgrades = array();
            }
            if (is_array($wp_upgrades) && count($wp_upgrades) > 0) {
                $total_wp_upgrades++;
            }
            $plugin_upgrades = json_decode($website->plugin_upgrades, true);
            if ($website->is_ignorePluginUpdates) {
                $plugin_upgrades = array();
            }
            $theme_upgrades = json_decode($website->theme_upgrades, true);
            if ($website->is_ignoreThemeUpdates) {
                $theme_upgrades = array();
            }
            $decodedPremiumUpgrades = json_decode(MainWP_DB::Instance()->getWebsiteOption($website, 'premium_upgrades'), true);
            if (is_array($decodedPremiumUpgrades)) {
                foreach ($decodedPremiumUpgrades as $crrSlug => $premiumUpgrade) {
                    $premiumUpgrade['premium'] = true;
                    if ($premiumUpgrade['type'] == 'plugin') {
                        if (!is_array($plugin_upgrades)) {
                            $plugin_upgrades = array();
                        }
                        if (!$website->is_ignorePluginUpdates) {
                            $plugin_upgrades[$crrSlug] = $premiumUpgrade;
                        }
                    } else {
                        if ($premiumUpgrade['type'] == 'theme') {
                            if (!is_array($theme_upgrades)) {
                                $theme_upgrades = array();
                            }
                            if (!$website->is_ignoreThemeUpdates) {
                                $theme_upgrades[$crrSlug] = $premiumUpgrade;
                            }
                        }
                    }
                }
            }
//.........这里部分代码省略.........
开发者ID:senlin,项目名称:mainwp,代码行数:101,代码来源:widget-mainwp-right-now.php

示例7: render

    public static function render()
    {
        $current_wpid = MainWP_Utility::get_current_wpid();
        if (!MainWP_Utility::ctype_digit($current_wpid)) {
            return;
        }
        $website = MainWP_DB::Instance()->getWebsiteById($current_wpid, true);
        ?>
		<div class="mainwp-row-top">
			<div style="display: inline-block; width: 100px;"><?php 
        _e('Groups:', 'mainwp');
        ?>
</div>
			<?php 
        echo $website->groups == '' ? 'None' : $website->groups;
        ?>
		</div>
		<div class="mainwp-row">
			<div style="display: inline-block; width: 100px;"><?php 
        _e('Notes:', 'mainwp');
        ?>
</div>
			<a href="#" class="mainwp_notes_show_all" id="mainwp_notes_<?php 
        echo $website->id;
        ?>
"><i class="fa fa-pencil"></i> <?php 
        _e('Open Notes', 'mainwp');
        ?>
			</a><img src="<?php 
        echo plugins_url('images/notes.png', dirname(__FILE__));
        ?>
" class="mainwp_notes_img" id="mainwp_notes_img_<?php 
        echo $website->id;
        ?>
" <?php 
        if ($website->note == '') {
            echo 'style="display: none;"';
        }
        ?>
 />
		</div>
		<span style="display: none"
			id="mainwp_notes_<?php 
        echo $website->id;
        ?>
_note"><?php 
        echo $website->note;
        ?>
</span>
		<div class="mainwp-row">
			<div style="display: inline-block; width: 100px;"><?php 
        _e('Go to:', 'mainwp');
        ?>
</div>
			<a href="admin.php?page=SiteOpen&newWindow=yes&websiteid=<?php 
        echo $website->id;
        ?>
" target="_blank"><i class="fa fa-external-link"></i> <?php 
        _e('WP Admin', 'mainwp');
        ?>
			</a> |
			<a target="_blank" href="<?php 
        echo $website->url;
        ?>
"><i class="fa fa-external-link"></i> <?php 
        _e('Front Page', 'mainwp');
        ?>
			</a>
		</div>
		<div class="mainwp-row">
			<div style="display: inline-block; width: 100px;"><?php 
        _e('Child Site:', 'mainwp');
        ?>
</div>
			<a href="admin.php?page=managesites&id=<?php 
        echo $website->id;
        ?>
"><i class="fa fa-pencil-square-o"></i> <?php 
        _e('Edit', 'mainwp');
        ?>
			</a> |
			<a target="_blank" href="admin.php?page=managesites&scanid=<?php 
        echo $website->id;
        ?>
"><i class="fa fa-shield"></i> <?php 
        _e('Security Scan', 'mainwp');
        ?>
			</a>
		</div>

		<?php 
        do_action('mainwp_shortcuts_widget', $website);
        ?>
		<div id="mainwp_notes_overlay" class="mainwp_overlay"></div>
		<div id="mainwp_notes" class="mainwp_popup">
			<a id="mainwp_notes_closeX" class="mainwp_closeX" style="display: inline; "></a>

			<div id="mainwp_notes_title" class="mainwp_popup_title">
				<a href="<?php 
        echo admin_url('admin.php?page=managesites&dashboard=' . $website->id);
//.........这里部分代码省略.........
开发者ID:sacredwebsite,项目名称:mainwp,代码行数:101,代码来源:widget-mainwp-shortcuts.php

示例8: 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

示例9: renderMetabox

    public static function renderMetabox()
    {
        $website = MainWP_Utility::get_current_wpid();
        if (!$website) {
            return;
        }
        $website = MainWP_DB::Instance()->getWebsiteById($website);
        MainWP_Manage_Sites::showBackups($website);
        ?>
		<?php 
        if (mainwp_current_user_can('dashboard', 'execute_backups')) {
            ?>
			<hr/>
			<div style="text-align: center;">
				<a href="<?php 
            echo admin_url('admin.php?page=managesites&backupid=' . $website->id);
            ?>
" class="button-primary"><?php 
            _e('Backup Now', 'mainwp');
            ?>
</a>
			</div>
		<?php 
        }
        ?>
		<?php 
    }
开发者ID:sacredwebsite,项目名称:mainwp,代码行数:27,代码来源:page-mainwp-manage-backups.php

示例10: renderSites

    public static function renderSites()
    {
        $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);
        if (!$websites) {
            return;
        }
        $total_securityIssues = 0;
        @MainWP_DB::data_seek($websites, 0);
        while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
            if (MainWP_Utility::ctype_digit($website->securityIssues)) {
                $total_securityIssues += $website->securityIssues;
            }
        }
        //We found some with security issues!
        if ($total_securityIssues > 0) {
            ?>
			<div class="clear">
				<div class="mainwp-row-top darkred">
					<span class="mainwp-left-col"><span class="mainwp-rightnow-number"><?php 
            echo $total_securityIssues;
            ?>
</span> <?php 
            _e('Security issue', 'mainwp');
            echo $total_securityIssues > 1 ? 's' : '';
            ?>
</span>
					<span class="mainwp-mid-col">&nbsp;</span>
					<span class="mainwp-right-col"><a href="#" id="mainwp_securityissues_show" onClick="return rightnow_show('securityissues');"><?php 
            _e('Show All', 'mainwp');
            ?>
</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" class="securityIssues_dashboard_allFixAll button-primary" value="<?php 
            _e('Fix All', 'mainwp');
            ?>
"/></span>
				</div>
				<div id="wp_securityissues" style="display: none">
					<?php 
            @MainWP_DB::data_seek($websites, 0);
            while ($websites && ($website = @MainWP_DB::fetch_object($websites))) {
                if (!MainWP_Utility::ctype_digit($website->securityIssues) || $website->securityIssues == 0) {
                    continue;
                }
                ?>
						<div class="mainwp-row" siteid="<?php 
                echo $website->id;
                ?>
">
							<span class="mainwp-left-col"><a href="admin.php?page=managesites&scanid=<?php 
                echo $website->id;
                ?>
"><?php 
                echo stripslashes($website->name);
                ?>
</a></span>
							<span class="mainwp-mid-col"><span class="<?php 
                echo $website->securityIssues > 0 ? 'darkred' : 'mainwp_ga_plus';
                ?>
"><span class="mainwp-rightnow-number"><?php 
                echo $website->securityIssues;
                ?>
</span> Issue<?php 
                echo $website->securityIssues > 1 ? 's' : '';
                ?>
</span></span>
							<span class="mainwp-right-col">
								<?php 
                if ($website->securityIssues == 0) {
                    ?>
									<input type="button" class="securityIssues_dashboard_unfixAll button" value="<?php 
                    _e('Unfix All', 'mainwp');
                    ?>
"/>
								<?php 
                } else {
                    ?>
									<input type="button" class="securityIssues_dashboard_fixAll button-primary" value="<?php 
                    _e('Fix All', 'mainwp');
                    ?>
"/>
								<?php 
                }
                ?>
								<i class="fa fa-spinner fa-pulse img-loader" style="display: none;"></i>
							</span>
						</div>
					<?php 
            }
            ?>
				</div>
			</div>
			<?php 
        } else {
            esc_html_e('No security issues detected.', 'mainwp');
        }
//.........这里部分代码省略.........
开发者ID:sacredwebsite,项目名称:mainwp,代码行数:101,代码来源:page-mainwp-security-issues.php

示例11: renderMetabox

 public static function renderMetabox()
 {
     $website = MainWP_Utility::get_current_wpid();
     if (!$website) {
         return;
     }
     $website = MainWP_DB::Instance()->getWebsiteById($website);
     MainWP_Manage_Sites_View::showSEOWidget($website);
 }
开发者ID:reeslo,项目名称:mainwp,代码行数:9,代码来源:page-mainwp-manage-sites.php

示例12: renderWidget

    public static function renderWidget($renew, $pExit = true)
    {
        $current_wpid = MainWP_Utility::get_current_wpid();
        if (empty($current_wpid)) {
            return;
        }
        $sql = MainWP_DB::Instance()->getSQLWebsiteById($current_wpid);
        $websites = MainWP_DB::Instance()->query($sql);
        $allThemes = array();
        if ($websites) {
            $website = @MainWP_DB::fetch_object($websites);
            if ($website && $website->themes != '') {
                $themes = json_decode($website->themes, 1);
                if (is_array($themes) && count($themes) != 0) {
                    foreach ($themes as $theme) {
                        $allThemes[] = $theme;
                    }
                }
            }
            @MainWP_DB::free_result($websites);
        }
        $actived_themes = MainWP_Utility::getSubArrayHaving($allThemes, 'active', 1);
        $actived_themes = MainWP_Utility::sortmulti($actived_themes, 'name', 'desc');
        $inactive_themes = MainWP_Utility::getSubArrayHaving($allThemes, 'active', 0);
        $inactive_themes = MainWP_Utility::sortmulti($inactive_themes, 'name', 'desc');
        if (count($allThemes) > 0 && $website) {
            $themes_outdate = json_decode(MainWP_DB::Instance()->getWebsiteOption($website, 'themes_outdate_info'), true);
            if (!is_array($themes_outdate)) {
                $themes_outdate = array();
            }
            $themesOutdateDismissed = json_decode(MainWP_DB::Instance()->getWebsiteOption($website, 'themes_outdate_dismissed'), true);
            if (is_array($themesOutdateDismissed)) {
                $themes_outdate = array_diff_key($themes_outdate, $themesOutdateDismissed);
            }
            $userExtension = MainWP_DB::Instance()->getUserExtension();
            $decodedDismissedThemes = json_decode($userExtension->dismissed_themes, true);
            if (is_array($decodedDismissedThemes)) {
                $themes_outdate = array_diff_key($themes_outdate, $decodedDismissedThemes);
            }
        }
        ?>
		<div class="clear">
			<a class="mainwp_action left mainwp_action_down themes_actived_lnk" href="#"><?php 
        _e('Active', 'mainwp');
        ?>
 (<?php 
        echo count($actived_themes);
        ?>
)</a><a class="mainwp_action mid themes_inactive_lnk right" href="#"><?php 
        _e('Inactive', 'mainwp');
        ?>
 (<?php 
        echo count($inactive_themes);
        ?>
)</a><br/><br/>

			<div class="mainwp_themes_active">
				<?php 
        $str_format = __(' | Last Updated %s Days Ago', 'mainwp');
        for ($i = 0; $i < count($actived_themes); $i++) {
            $outdate_notice = '';
            $slug = $actived_themes[$i]['slug'];
            if (isset($themes_outdate[$slug])) {
                $theme_outdate = $themes_outdate[$slug];
                $now = new \DateTime();
                $last_updated = $theme_outdate['last_updated'];
                $theme_last_updated_date = new \DateTime('@' . $last_updated);
                $diff_in_days = $now->diff($theme_last_updated_date)->format('%a');
                $outdate_notice = sprintf($str_format, $diff_in_days);
            }
            ?>
					<div class="mainwp-row mainwp-active">
						<input class="themeName" type="hidden" name="name" value="<?php 
            echo $actived_themes[$i]['name'];
            ?>
"/>
						<input class="websiteId" type="hidden" name="id" value="<?php 
            echo $website->id;
            ?>
"/>
						<span class="mainwp-left-col">
							<?php 
            echo $actived_themes[$i]['name'] . ' ' . $actived_themes[$i]['version'];
            echo $outdate_notice;
            ?>
						</span>
					</div>
				<?php 
        }
        ?>
			</div>

			<div class="mainwp_themes_inactive" style="display: none">
				<?php 
        for ($i = 0; $i < count($inactive_themes); $i++) {
            $outdate_notice = '';
            $slug = $inactive_themes[$i]['slug'];
            if (isset($themes_outdate[$slug])) {
                $theme_outdate = $themes_outdate[$slug];
                $now = new \DateTime();
//.........这里部分代码省略.........
开发者ID:senlin,项目名称:mainwp,代码行数:101,代码来源:widget-mainwp-widget-themes.php


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