本文整理汇总了PHP中MainWP_Utility::getSubArrayHaving方法的典型用法代码示例。如果您正苦于以下问题:PHP MainWP_Utility::getSubArrayHaving方法的具体用法?PHP MainWP_Utility::getSubArrayHaving怎么用?PHP MainWP_Utility::getSubArrayHaving使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MainWP_Utility
的用法示例。
在下文中一共展示了MainWP_Utility::getSubArrayHaving方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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>
//.........这里部分代码省略.........
示例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
//.........这里部分代码省略.........
示例3: 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();
//.........这里部分代码省略.........