本文整理汇总了PHP中EM_Locations::count方法的典型用法代码示例。如果您正苦于以下问题:PHP EM_Locations::count方法的具体用法?PHP EM_Locations::count怎么用?PHP EM_Locations::count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EM_Locations
的用法示例。
在下文中一共展示了EM_Locations::count方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: em_admin_options_page
function em_admin_options_page()
{
global $wpdb, $EM_Notices;
//Check for uninstall/reset request
if (!empty($_REQUEST['action']) && $_REQUEST['action'] == 'uninstall') {
em_admin_options_uninstall_page();
return;
}
if (!empty($_REQUEST['action']) && $_REQUEST['action'] == 'reset') {
em_admin_options_reset_page();
return;
}
//substitute dropdowns with input boxes for some situations to improve speed, e.g. if there 1000s of locations or users
$total_users = $wpdb->get_var("SELECT COUNT(ID) FROM {$wpdb->users};");
if ($total_users > 100 && !defined('EM_OPTIMIZE_SETTINGS_PAGE_USERS')) {
define('EM_OPTIMIZE_SETTINGS_PAGE_USERS', true);
}
$total_locations = EM_Locations::count();
if ($total_locations > 100 && !defined('EM_OPTIMIZE_SETTINGS_PAGE_LOCATIONS')) {
define('EM_OPTIMIZE_SETTINGS_PAGE_LOCATIONS', true);
}
//TODO place all options into an array
global $events_placeholder_tip, $locations_placeholder_tip, $categories_placeholder_tip, $bookings_placeholder_tip;
$events_placeholders = '<a href="' . EM_ADMIN_URL . '&page=events-manager-help#event-placeholders">' . __('Event Related Placeholders', 'dbem') . '</a>';
$locations_placeholders = '<a href="' . EM_ADMIN_URL . '&page=events-manager-help#location-placeholders">' . __('Location Related Placeholders', 'dbem') . '</a>';
$bookings_placeholders = '<a href="' . EM_ADMIN_URL . '&page=events-manager-help#booking-placeholders">' . __('Booking Related Placeholders', 'dbem') . '</a>';
$categories_placeholders = '<a href="' . EM_ADMIN_URL . '&page=events-manager-help#category-placeholders">' . __('Category Related Placeholders', 'dbem') . '</a>';
$events_placeholder_tip = " " . sprintf(__('This accepts %s and %s placeholders.', 'dbem'), $events_placeholders, $locations_placeholders);
$locations_placeholder_tip = " " . sprintf(__('This accepts %s placeholders.', 'dbem'), $locations_placeholders);
$categories_placeholder_tip = " " . sprintf(__('This accepts %s placeholders.', 'dbem'), $categories_placeholders);
$bookings_placeholder_tip = " " . sprintf(__('This accepts %s, %s and %s placeholders.', 'dbem'), $bookings_placeholders, $events_placeholders, $locations_placeholders);
global $save_button;
$save_button = '<tr><th> </th><td><p class="submit" style="margin:0px; padding:0px; text-align:right;"><input type="submit" class="button-primary" id="dbem_options_submit" name="Submit" value="' . __('Save Changes', 'dbem') . ' (' . __('All', 'dbem') . ')" /></p></ts></td></tr>';
if (defined('EM_SETTINGS_TABS') && EM_SETTINGS_TABS) {
$tabs_enabled = true;
$general_tab_link = esc_url(add_query_arg(array('em_tab' => 'general')));
$pages_tab_link = esc_url(add_query_arg(array('em_tab' => 'pages')));
$formats_tab_link = esc_url(add_query_arg(array('em_tab' => 'formats')));
$bookings_tab_link = esc_url(add_query_arg(array('em_tab' => 'bookings')));
$emails_tab_link = esc_url(add_query_arg(array('em_tab' => 'emails')));
} else {
$general_tab_link = $pages_tab_link = $formats_tab_link = $bookings_tab_link = $emails_tab_link = '';
}
?>
<script type="text/javascript" charset="utf-8"><?php
include EM_DIR . '/includes/js/admin-settings.js';
?>
</script>
<style type="text/css">.postbox h3 { cursor:pointer; }</style>
<div class="wrap <?php
if (empty($tabs_enabled)) {
echo 'tabs-active';
}
?>
">
<div id='icon-options-general' class='icon32'><br /></div>
<h2 class="nav-tab-wrapper">
<a href="<?php
echo $general_tab_link;
?>
#general" id="em-menu-general" class="nav-tab nav-tab-active"><?php
_e('General', 'dbem');
?>
</a>
<a href="<?php
echo $pages_tab_link;
?>
#pages" id="em-menu-pages" class="nav-tab"><?php
_e('Pages', 'dbem');
?>
</a>
<a href="<?php
echo $formats_tab_link;
?>
#formats" id="em-menu-formats" class="nav-tab"><?php
_e('Formatting', 'dbem');
?>
</a>
<?php
if (get_option('dbem_rsvp_enabled')) {
?>
<a href="<?php
echo $bookings_tab_link;
?>
#bookings" id="em-menu-bookings" class="nav-tab"><?php
_e('Bookings', 'dbem');
?>
</a>
<?php
}
?>
<a href="<?php
echo $emails_tab_link;
?>
#emails" id="em-menu-emails" class="nav-tab"><?php
_e('Emails', 'dbem');
?>
</a>
</h2>
<h3 id="em-options-title"><?php
//.........这里部分代码省略.........
示例2: em_locations_admin
/**
* Outputs table of locations belonging to user
* @param array $args
*/
function em_locations_admin($args = array())
{
global $EM_Location;
if (is_user_logged_in() && current_user_can('edit_locations')) {
if (!empty($_GET['action']) && $_GET['action'] == 'edit') {
if (empty($_REQUEST['redirect_to'])) {
$_REQUEST['redirect_to'] = em_add_get_params($_SERVER['REQUEST_URI'], array('action' => null, 'location_id' => null));
}
em_location_form();
} else {
if (get_option('dbem_css_editors')) {
echo '<div class="css-locations-admin">';
}
$limit = !empty($_REQUEST['limit']) ? $_REQUEST['limit'] : 20;
//Default limit
$page = !empty($_REQUEST['pno']) ? $_REQUEST['pno'] : 1;
$offset = $page > 1 ? ($page - 1) * $limit : 0;
$order = !empty($_REQUEST['order']) ? $_REQUEST['order'] : 'ASC';
if (array_key_exists('status', $_REQUEST)) {
$status = $_REQUEST['status'] ? 1 : 0;
} else {
$status = false;
}
$blog = false;
if (EM_MS_GLOBAL && !get_site_option('dbem_ms_mainblog_locations') && !is_main_site()) {
//set current blog id if not on main site and using global mode whilst not forcing all locations to be on main blog
$blog = get_current_blog_id();
}
$args = array('limit' => $limit, 'offset' => $offset, 'status' => $status, 'blog' => $blog);
//count locations
$locations_mine_count = EM_Locations::count(array('owner' => get_current_user_id(), 'blog' => $blog, 'status' => false));
$locations_all_count = current_user_can('read_others_locations') ? EM_Locations::count(array('blog' => $blog, 'status' => false, 'owner' => false)) : 0;
//get set of locations
if (!empty($_REQUEST['view']) && $_REQUEST['view'] == 'others' && current_user_can('read_others_locations')) {
$locations = EM_Locations::get($args);
$locations_count = $locations_all_count;
} else {
$locations = EM_Locations::get(array_merge($args, array('owner' => get_current_user_id())));
$locations_count = $locations_mine_count;
}
em_locate_template('tables/locations.php', true, array('args' => $args, 'locations' => $locations, 'locations_count' => $locations_count, 'locations_mine_count' => $locations_mine_count, 'locations_all_count' => $locations_all_count, 'page' => $page, 'limit' => $limit, 'offset' => $offset, 'show_add_new' => true));
if (get_option('dbem_css_editors')) {
echo '</div>';
}
}
} else {
if (get_option('dbem_css_editors')) {
echo '<div class="css-locations-admin">';
}
echo '<div class="css-locations-admin-login">' . __("You must log in to view and manage your locations.", 'dbem') . '</div>';
if (get_option('dbem_css_editors')) {
echo '</div>';
}
}
}
示例3: em_admin_options_page
function em_admin_options_page()
{
global $wpdb, $EM_Notices;
//Check for uninstall/reset request
if (!empty($_REQUEST['action']) && $_REQUEST['action'] == 'uninstall') {
em_admin_options_uninstall_page();
return;
}
if (!empty($_REQUEST['action']) && $_REQUEST['action'] == 'reset') {
em_admin_options_reset_page();
return;
}
//substitute dropdowns with input boxes for some situations to improve speed, e.g. if there 1000s of locations or users
$total_users = $wpdb->get_var("SELECT COUNT(ID) FROM {$wpdb->users};");
if ($total_users > 100 && !defined('EM_OPTIMIZE_SETTINGS_PAGE_USERS')) {
define('EM_OPTIMIZE_SETTINGS_PAGE_USERS', true);
}
$total_locations = EM_Locations::count();
if ($total_locations > 100 && !defined('EM_OPTIMIZE_SETTINGS_PAGE_LOCATIONS')) {
define('EM_OPTIMIZE_SETTINGS_PAGE_LOCATIONS', true);
}
//TODO place all options into an array
global $events_placeholder_tip, $locations_placeholder_tip, $categories_placeholder_tip, $bookings_placeholder_tip;
$events_placeholders = '<a href="' . EM_ADMIN_URL . '&page=events-manager-help#event-placeholders">' . __('Event Related Placeholders', 'dbem') . '</a>';
$locations_placeholders = '<a href="' . EM_ADMIN_URL . '&page=events-manager-help#location-placeholders">' . __('Location Related Placeholders', 'dbem') . '</a>';
$bookings_placeholders = '<a href="' . EM_ADMIN_URL . '&page=events-manager-help#booking-placeholders">' . __('Booking Related Placeholders', 'dbem') . '</a>';
$categories_placeholders = '<a href="' . EM_ADMIN_URL . '&page=events-manager-help#category-placeholders">' . __('Category Related Placeholders', 'dbem') . '</a>';
$events_placeholder_tip = " " . sprintf(__('This accepts %s and %s placeholders.', 'dbem'), $events_placeholders, $locations_placeholders);
$locations_placeholder_tip = " " . sprintf(__('This accepts %s placeholders.', 'dbem'), $locations_placeholders);
$categories_placeholder_tip = " " . sprintf(__('This accepts %s placeholders.', 'dbem'), $categories_placeholders);
$bookings_placeholder_tip = " " . sprintf(__('This accepts %s, %s and %s placeholders.', 'dbem'), $bookings_placeholders, $events_placeholders, $locations_placeholders);
global $save_button;
$save_button = '<tr><th> </th><td><p class="submit" style="margin:0px; padding:0px; text-align:right;"><input type="submit" class="button-primary" id="dbem_options_submit" name="Submit" value="' . __('Save Changes', 'dbem') . ' (' . __('All', 'dbem') . ')" /></p></ts></td></tr>';
?>
<script type="text/javascript" charset="utf-8"><?php
include EM_DIR . '/includes/js/admin-settings.js';
?>
</script>
<style type="text/css">.postbox h3 { cursor:pointer; }</style>
<div class="wrap">
<div id='icon-options-general' class='icon32'><br /></div>
<h2 class="nav-tab-wrapper">
<a href="#general" id="em-menu-general" class="nav-tab nav-tab-active"><?php
_e('General', 'dbem');
?>
</a>
<a href="#pages" id="em-menu-pages" class="nav-tab"><?php
_e('Pages', 'dbem');
?>
</a>
<a href="#formats" id="em-menu-formats" class="nav-tab"><?php
_e('Formatting', 'dbem');
?>
</a>
<?php
if (get_option('dbem_rsvp_enabled')) {
?>
<a href="#bookings" id="em-menu-bookings" class="nav-tab"><?php
_e('Bookings', 'dbem');
?>
</a>
<?php
}
?>
<a href="#emails" id="em-menu-emails" class="nav-tab"><?php
_e('Emails', 'dbem');
?>
</a>
</h2>
<h3 id="em-options-title"><?php
_e('Event Manager Options', 'dbem');
?>
</h3>
<form id="em-options-form" method="post" action="">
<div class="metabox-holder">
<!-- // TODO Move style in css -->
<div class='postbox-container' style='width: 99.5%'>
<div id="">
<div class="em-menu-general em-menu-group">
<!-- GENERAL OPTIONS -->
<div class="postbox " id="em-opt-general" >
<div class="handlediv" title="<?php
__('Click to toggle', 'dbem');
?>
"><br /></div><h3><span><?php
_e('General Options', 'dbem');
?>
</span></h3>
<div class="inside">
<table class="form-table">
<?php
em_options_radio_binary(__('Disable thumbnails?', 'dbem'), 'dbem_thumbnails_enabled', __('Select yes to disable Events Manager from enabling thumbnails (some themes may already have this enabled, which we cannot be turned off here).', 'dbem'));
?>
<tr class="em-header">
<td colspan="2">
<h4><?php
echo sprintf(__('%s Settings', 'dbem'), __('Event', 'dbem'));
//.........这里部分代码省略.........
示例4: em_locations_admin
/**
* Outputs table of locations belonging to user
* @param array $args
*/
function em_locations_admin($args = array())
{
global $EM_Location;
if (is_user_logged_in() && current_user_can('edit_locations')) {
if (!empty($_GET['action']) && $_GET['action'] == 'edit') {
if (empty($_REQUEST['redirect_to'])) {
$_REQUEST['redirect_to'] = em_add_get_params($_SERVER['REQUEST_URI'], array('action' => null, 'location_id' => null));
}
em_location_form();
} else {
$url = empty($url) ? $_SERVER['REQUEST_URI'] : $url;
//url to this page
$limit = !empty($_REQUEST['limit']) ? $_REQUEST['limit'] : 20;
//Default limit
$page = !empty($_REQUEST['pno']) ? $_REQUEST['pno'] : 1;
$offset = $page > 1 ? ($page - 1) * $limit : 0;
$args = array('limit' => $limit, 'offset' => $offset, 'status' => false, 'blog' => false);
if (!empty($_REQUEST['view']) && $_REQUEST['view'] == 'others' && current_user_can('read_others_locations')) {
$locations = EM_Locations::get($args);
$locations_count = EM_Locations::count(array('status' => false, 'blog' => false, 'owner' => false));
} else {
$locations = EM_Locations::get(array_merge($args, array('owner' => get_current_user_id())));
$locations_count = EM_Locations::count(array('status' => false, 'blog' => false, 'owner' => get_current_user_id()));
}
$locations_mine_count = EM_Locations::count(array('owner' => get_current_user_id(), 'blog' => false, 'status' => false));
$locations_all_count = current_user_can('read_others_locations') ? EM_Locations::count(array('blog' => false, 'status' => false)) : 0;
em_locate_template('tables/locations.php', true, array('args' => $args, 'locations' => $locations, 'locations_count' => $locations_count, 'locations_mine_count' => $locations_mine_count, 'locations_all_count' => $locations_all_count, 'url' => $url, 'page' => $page, 'limit' => $limit, 'offset' => $offset, 'show_add_new' => true));
}
} else {
echo __("You must log in to view and manage your locations.", 'dbem');
}
}
示例5: em_admin_locations
function em_admin_locations($message = '', $fill_fields = false)
{
global $EM_Notices;
$limit = !empty($_REQUEST['limit']) ? $_REQUEST['limit'] : 20;
//Default limit
$page = !empty($_REQUEST['pno']) ? $_REQUEST['pno'] : 1;
$offset = $page > 1 ? ($page - 1) * $limit : 0;
if (!empty($_REQUEST['owner']) && current_user_can('read_others_locations')) {
$locations = EM_Locations::get(array('owner' => false));
$locations_mine_count = EM_Locations::count(array('owner' => get_current_user_id()));
$locations_all_count = count($locations);
} else {
$locations = EM_Locations::get(array('owner' => get_current_user_id(), 'blog' => false));
$locations_mine_count = count($locations);
$locations_all_count = current_user_can('read_others_locations') ? EM_Locations::count(array('blog' => false)) : 0;
}
$locations_count = count($locations);
?>
<div class='wrap'>
<div id='icon-edit' class='icon32'>
<br/>
</div>
<h2>
<?php
_e('Locations', 'dbem');
?>
<a href="admin.php?page=events-manager-locations&action=add" class="button add-new-h2"><?php
_e('Add New', 'dbem');
?>
</a>
</h2>
<?php
echo $EM_Notices;
?>
<form id='locations-filter' method='post' action=''>
<input type='hidden' name='page' value='locations'/>
<input type='hidden' name='limit' value='<?php
echo $limit;
?>
' />
<input type='hidden' name='p' value='<?php
echo $page;
?>
' />
<div class="subsubsub">
<a href='admin.php?page=events-manager-locations' <?php
echo empty($_REQUEST['owner']) ? 'class="current"' : '';
?>
><?php
echo sprintf(__('My %s', 'dbem'), __('Locations', 'dbem'));
?>
<span class="count">(<?php
echo $locations_mine_count;
?>
)</span></a>
<?php
if (current_user_can('read_others_locations')) {
?>
|
<a href='admin.php?page=events-manager-locations&owner=all' <?php
echo !empty($_REQUEST['owner']) ? 'class="current"' : '';
?>
><?php
echo sprintf(__('All %s', 'dbem'), __('Locations', 'dbem'));
?>
<span class="count">(<?php
echo $locations_all_count;
?>
)</span></a>
<?php
}
?>
</div>
<?php
if ($locations_count > 0) {
?>
<div class='tablenav'>
<div class="alignleft actions">
<select name="action">
<option value="" selected="selected"><?php
_e('Bulk Actions');
?>
</option>
<option value="location_delete"><?php
_e('Delete selected', 'dbem');
?>
</option>
</select>
<input type="submit" value="<?php
_e('Apply');
?>
" id="doaction2" class="button-secondary action" />
</div>
<?php
if ($locations_count >= $limit) {
$locations_nav = em_admin_paginate($locations_count, $limit, $page);
echo $locations_nav;
//.........这里部分代码省略.........
示例6: get_current_user_id
global $wpdb, $bp, $EM_Location, $EM_Notices;
$url = $bp->events->link . 'my-locations/';
//url to this page
$limit = !empty($_REQUEST['limit']) ? $_REQUEST['limit'] : 20;
//Default limit
$page = !empty($_REQUEST['pno']) ? $_REQUEST['pno'] : 1;
$offset = $page > 1 ? ($page - 1) * $limit : 0;
if (!empty($bp->action_variables[0]) && $bp->action_variables[0] == 'others' && current_user_can('read_others_locations')) {
$locations = EM_Locations::get();
$locations_mine_count = EM_Locations::count(array('owner' => get_current_user_id()));
$locations_all_count = count($locations);
} else {
$locations = EM_Locations::get(array('owner' => get_current_user_id()));
$locations_mine_count = count($locations);
$locations_all_count = current_user_can('read_others_locations') ? EM_Locations::count() : 0;
}
$locations_count = count($locations);
?>
<div class='wrap'>
<?php
echo $EM_Notices;
?>
<form id='locations-filter' method='post' action=''>
<input type='hidden' name='page' value='locations'/>
<input type='hidden' name='limit' value='<?php
echo $limit;
?>
' />
<input type='hidden' name='p' value='<?php