本文整理汇总了PHP中membership_db_prefix函数的典型用法代码示例。如果您正苦于以下问题:PHP membership_db_prefix函数的具体用法?PHP membership_db_prefix怎么用?PHP membership_db_prefix使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了membership_db_prefix函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct()
{
global $wpdb;
$this->db =& $wpdb;
foreach ($this->tables as $table) {
$this->{$table} = membership_db_prefix($this->db, $table);
}
add_action('plugins_loaded', array(&$this, 'load_textdomain'));
// Set up Actions
add_action('init', array(&$this, 'initialise_plugin'), 1);
add_filter('query_vars', array(&$this, 'add_queryvars'));
add_action('generate_rewrite_rules', array(&$this, 'add_rewrites'));
// Add protection
add_action('parse_request', array(&$this, 'initialise_membership_protection'), 2);
// Download protection
add_action('pre_get_posts', array(&$this, 'handle_download_protection'), 3);
// Payment return
add_action('pre_get_posts', array(&$this, 'handle_paymentgateways'), 1);
// add feed protection
add_filter('feed_link', array(&$this, 'add_feed_key'), 99, 2);
// Register
add_filter('register', array(&$this, 'override_register'));
// Ultimate Facebook Compatibility
add_filter('wdfb_registration_redirect_url', array(&$this, 'wdfb_registration_redirect_url'));
// Level shortcodes filters
add_filter('membership_level_shortcodes', array(&$this, 'build_level_shortcode_list'));
add_filter('membership_not_level_shortcodes', array(&$this, 'build_not_level_shortcode_list'));
}
示例2: __construct
function __construct($id = false, &$tips = false)
{
global $wpdb, $site_id;
$this->db = $wpdb;
foreach ($this->tables as $table) {
$this->{$table} = membership_db_prefix($this->db, $table);
}
// If we're constructing before the tables exist, just exit.
$table = membership_db_prefix($this->db, 'coupons');
if ($this->db->get_var("SHOW TABLES LIKE '{$table}'") != $table) {
return;
}
// If we are passing a non numeric ID we should try to find the ID by searching for the coupon name instead.
if (!is_numeric($id)) {
$search = $this->db->get_var($this->db->prepare("SELECT id FROM {$this->coupons} WHERE couponcode = %s", strtoupper($id)));
if (!empty($search)) {
$this->id = $search;
}
} else {
$this->id = $id;
}
if ($tips !== false) {
$this->_tips = $tips;
}
// Get the coupon for further usage
$this->_coupon = $this->get_coupon();
}
示例3: __construct
function __construct($id = false)
{
global $wpdb;
$this->db =& $wpdb;
foreach ($this->tables as $table) {
$this->{$table} = membership_db_prefix($this->db, $table);
}
$this->id = $id;
}
示例4: __construct
function __construct()
{
global $wpdb;
$this->db =& $wpdb;
foreach ($this->tables as $table) {
$this->{$table} = membership_db_prefix($this->db, $table);
}
add_action('add_admin_bar_menus', array(&$this, 'add_admin_bar_items'));
add_action('membership_dashboard_membershipuselevel', array(&$this, 'switch_membership_level'));
}
示例5: __construct
function __construct($id = false, $fullload = false, $loadtype = array('public', 'core'))
{
global $wpdb;
$this->db =& $wpdb;
foreach ($this->tables as $table) {
$this->{$table} = membership_db_prefix($this->db, $table);
}
$this->id = $id;
if ($fullload) {
$this->load_rules($loadtype);
}
}
示例6: M_Gateway
function M_Gateway()
{
global $wpdb;
$this->db =& $wpdb;
foreach ($this->tables as $table) {
$this->{$table} = membership_db_prefix($this->db, $table);
}
// Actions and Filters
add_filter('M_gateways_list', array(&$this, 'gateways_list'));
add_action('membership_process_payment_return', array(&$this, 'process_payment_return'));
add_action('membership_record_user_gateway', array(&$this, 'record_user_gateway'));
}
示例7: __construct
function __construct()
{
global $wpdb;
$this->db =& $wpdb;
foreach ($this->tables as $table) {
$this->{$table} = membership_db_prefix($this->db, $table);
}
// Set up Actions
add_action('init', array(&$this, 'set_up_schedule'));
add_filter('cron_schedules', array(&$this, 'add_time_period'));
if (!$this->get_expiring_relationships_count() >= 50) {
// Schedule for quarter hourly to get number of processing down a bit
add_action('membership_process_quarterhourly_cron', array(&$this, 'transition_user_through_subscriptions'));
} else {
// We don't have that many, so let's process hourly instead
add_action('membership_process_hourly_cron', array(&$this, 'transition_user_through_subscriptions'));
}
}
示例8: __construct
function __construct($id = false, &$tips = false)
{
global $wpdb;
$this->db =& $wpdb;
foreach ($this->tables as $table) {
$this->{$table} = membership_db_prefix($this->db, $table);
}
// If we are passing a non numeric ID we should try to find the ID by searching for the coupon name instead.
if (!is_numeric($id)) {
$search = $this->db->get_var($this->db->prepare("SELECT * FROM {$this->coupons} WHERE `couponcode` = %s", $id));
if (!empty($search)) {
$this->id = $search;
}
} else {
$this->id = $id;
}
if ($tips !== false) {
$this->_tips = $tips;
}
}
示例9: __construct
public function __construct($id = false, $fullload = false, $loadtype = array('public', 'core'))
{
global $wpdb, $M_options;
$this->id = $id;
$this->db = $wpdb;
foreach ($this->tables as $table) {
$this->{$table} = membership_db_prefix($this->db, $table);
}
if (is_null($this->active)) {
//only run if hasn't been run before
//check if this level is active - if it isn't we don't want to load it's rules
$this->active = (bool) $wpdb->get_var($wpdb->prepare("\n\t\t\t\tSELECT level_active\n\t\t\t\tFROM {$this->membership_levels}\n\t\t\t\tWHERE level_active = 1\n\t\t\t\t\tAND id = %d", $this->id));
}
$allow_page_cascade = isset($M_options['allow_page_rule_cascade']) ? $M_options['allow_page_rule_cascade'] : 'yes';
$this->allow_page_cascade = 'yes' == $allow_page_cascade ? true : false;
if ($fullload && $this->active) {
$this->load_rules($loadtype);
}
add_action('remove_this_level_members', 'remove_level_members', 10, 1);
}
示例10: __construct
function __construct()
{
global $nxtdb;
$this->db =& $nxtdb;
foreach ($this->tables as $table) {
$this->{$table} = membership_db_prefix($this->db, $table);
}
// Add administration actions
add_action('init', array(&$this, 'initialise_plugin'), 1);
// Add in admin area membership levels
add_action('init', array(&$this, 'initialise_membership_protection'), 999);
add_action('admin_menu', array(&$this, 'add_admin_menu'));
add_action('plugins_loaded', array(&$this, 'load_textdomain'));
// Header actions
add_action('load-toplevel_page_membership', array(&$this, 'add_admin_header_membership'));
add_action('load-membership_page_members', array(&$this, 'add_admin_header_members'));
add_action('load-membership_page_membershiplevels', array(&$this, 'add_admin_header_membershiplevels'));
add_action('load-membership_page_membershipsubs', array(&$this, 'add_admin_header_membershipsubs'));
add_action('load-membership_page_membershipgateways', array(&$this, 'add_admin_header_membershipgateways'));
add_action('load-membership_page_membershipoptions', array(&$this, 'add_admin_header_membershipoptions'));
add_action('load-membership_page_membershipurlgroups', array(&$this, 'add_admin_header_membershipurlgroups'));
add_action('load-membership_page_membershippings', array(&$this, 'add_admin_header_membershippings'));
add_action('load-users_page_membershipuser', array(&$this, 'add_admin_header_membershipuser'));
add_filter('membership_level_sections', array(&$this, 'default_membership_sections'));
// Media management additional fields
add_filter('attachment_fields_to_edit', array(&$this, 'add_media_protection_settings'), 99, 2);
add_filter('attachment_fields_to_save', array(&$this, 'save_media_protection_settings'), 99, 2);
// rewrites
add_action('generate_rewrite_rules', array(&$this, 'add_rewrites'));
add_filter('query_vars', array(&$this, 'add_queryvars'));
// profile field for feeds
add_action('show_user_profile', array(&$this, 'add_profile_feed_key'));
// Pings
add_action('membership_subscription_form_after_levels', array(&$this, 'show_subscription_ping_information'));
add_action('membership_subscription_add', array(&$this, 'update_subscription_ping_information'));
add_action('membership_subscription_update', array(&$this, 'update_subscription_ping_information'));
add_action('membership_level_form_after_rules', array(&$this, 'show_level_ping_information'));
add_action('membership_level_add', array(&$this, 'update_level_ping_information'));
add_action('membership_level_update', array(&$this, 'update_level_ping_information'));
}
示例11: __construct
function __construct()
{
global $nxtdb;
$this->db =& $nxtdb;
foreach ($this->tables as $table) {
$this->{$table} = membership_db_prefix($this->db, $table);
}
add_action('plugins_loaded', array(&$this, 'load_textdomain'));
// Set up Actions
add_action('init', array(&$this, 'initialise_plugin'), 1);
add_filter('query_vars', array(&$this, 'add_queryvars'));
add_action('generate_rewrite_rules', array(&$this, 'add_rewrites'));
// Add protection
add_action('parse_request', array(&$this, 'initialise_membership_protection'), 2);
// Download protection
add_action('pre_get_posts', array(&$this, 'handle_download_protection'), 3);
// Payment return
add_action('pre_get_posts', array(&$this, 'handle_paymentgateways'), 1);
// add feed protection
add_filter('feed_link', array(&$this, 'add_feed_key'), 99, 2);
// Register
add_filter('register', array(&$this, 'override_register'));
}
示例12: membership_news_stream
function membership_news_stream()
{
global $wpdb;
$table = membership_db_prefix($wpdb, 'membership_news');
// Superfluous prepare, but do it anyway
$news = $wpdb->get_results($wpdb->prepare("SELECT * FROM {$table} ORDER BY newsdate DESC LIMIT %d, %d", 0, 50));
?>
<div class="postbox " id="dashboard_news">
<h3 class="hndle"><span><?php
_e('News', 'membership');
?>
</span></h3>
<div class="inside">
<?php
if (!empty($news)) {
foreach ($news as $key => $newsitem) {
echo "<p id='newsitem-" . $newsitem->id . "'>";
echo "[ ";
echo date("Y-m-d : H:i", strtotime($newsitem->newsdate));
echo " ] ";
echo $newsitem->newsitem;
echo "</p>";
}
} else {
echo "<p>" . __('There will be some interesting news here when your site gets going.', 'membership') . "</p>";
}
?>
<br class="clear">
</div>
</div>
<?php
}
示例13: M_build_database_structure
function M_build_database_structure()
{
global $wpdb;
$bi = 'bigint(20)';
$biu = 'bigint(20) unsigned';
$bi11 = 'bigint(11)';
$bi35 = 'bigint(35)';
$i = 'int(11)';
$v1 = 'varchar(1)';
$v5 = 'varchar(5)';
$v10 = 'varchar(10)';
$v30 = 'varchar(30)';
$v35 = 'varchar(35)';
$v50 = 'varchar(50)';
$v20 = 'varchar(20)';
$v200 = 'varchar(200)';
$v250 = 'varchar(250)';
$t = 'text';
$jd = 'date';
$d = 'datetime';
$ts = 'timestamp';
$dc = 'decimal(11,2)';
$structure = array(membership_db_prefix($wpdb, 'membership_levels') => array('id' => $bi, 'level_title' => $v250, 'level_slug' => $v250, 'level_active' => $i, 'level_count' => $bi), membership_db_prefix($wpdb, 'membership_relationships') => array('rel_id' => $bi, 'user_id' => $bi, 'sub_id' => $bi, 'level_id' => $bi, 'startdate' => $d, 'updateddate' => $d, 'expirydate' => $d, 'order_instance' => $bi, 'usinggateway' => $v50), membership_db_prefix($wpdb, 'membership_rules') => array('level_id' => $bi, 'rule_ive' => $v20, 'rule_area' => $v20, 'rule_value' => $t, 'rule_order' => $i), membership_db_prefix($wpdb, 'subscriptions') => array('id' => $bi, 'sub_name' => $v200, 'sub_active' => $i, 'sub_public' => $i, 'sub_count' => $bi, 'sub_description' => $t, 'sub_pricetext' => $v200), membership_db_prefix($wpdb, 'subscriptions_levels') => array('sub_id' => $bi, 'level_id' => $bi, 'level_period' => $i, 'sub_type' => $v20, 'level_price' => $dc, 'level_currency' => $v5, 'level_order' => $bi, 'level_period_unit' => $v1), membership_db_prefix($wpdb, 'subscription_transaction') => array('transaction_ID' => $biu, 'transaction_subscription_ID' => $bi, 'transaction_user_ID' => $bi, 'transaction_sub_ID' => $bi, 'transaction_paypal_ID' => $v30, 'transaction_payment_type' => $v20, 'transaction_stamp' => $bi35, 'transaction_total_amount' => $bi, 'transaction_currency' => $v35, 'transaction_duedate' => $jd, 'transaction_gateway' => $v50, 'transaction_note' => $t, 'transaction_expires' => $d), membership_db_prefix($wpdb, 'urlgroups') => array('id' => $bi, 'groupname' => $v250, 'groupurls' => $t, 'isregexp' => $i, 'stripquerystring' => $i), membership_db_prefix($wpdb, 'communications') => array('id' => $bi11, 'subject' => $v250, 'message' => $t, 'periodunit' => $i, 'periodtype' => $v5, 'periodprepost' => $v5, 'lastupdated' => $ts, 'active' => $i, 'periodstamp' => $bi), membership_db_prefix($wpdb, 'pings') => array('id' => $bi, 'pingname' => $v250, 'pingurl' => $v250, 'pinginfo' => $t, 'pingtype' => $v10), membership_db_prefix($wpdb, 'ping_history') => array('id' => $bi, 'ping_id' => $bi, 'ping_sent' => $ts, 'ping_info' => $t, 'ping_return' => $t), membership_db_prefix($wpdb, 'levelmeta') => array('id' => $bi, 'level_id' => $bi, 'meta_key' => $v250, 'meta_value' => $t, 'meta_stamp' => $ts), membership_db_prefix($wpdb, 'subscriptionmeta') => array('id' => $bi, 'sub_id' => $bi, 'meta_key' => $v250, 'meta_value' => $t, 'meta_stamp' => $ts), membership_db_prefix($wpdb, 'member_payments') => array('id' => $bi11, 'member_id' => $bi, 'sub_id' => $bi, 'level_id' => $bi, 'level_order' => $i, 'paymentmade' => $d, 'paymentexpires' => $d), membership_db_prefix($wpdb, 'coupons') => array('id' => $biu, 'site_id' => $bi, 'couponcode' => $v250, 'discount' => $dc, 'discount_type' => $v5, 'discount_currency' => $v5, 'coupon_startdate' => $d, 'coupon_enddate' => $d, 'coupon_sub_id' => $bi, 'coupon_uses' => $i, 'coupon_used' => $i, 'coupon_apply_to' => $v20));
return $structure;
}
示例14: prepare_query
function prepare_query()
{
global $wpdb, $wp_version;
$this->first_user = ($this->page - 1) * $this->users_per_page;
$this->query_limit = $wpdb->prepare(" LIMIT %d, %d", $this->first_user, $this->users_per_page);
$this->query_orderby = ' ORDER BY user_login';
$search_sql = '';
if ($this->search_term) {
$searches = array();
$search_sql = 'AND (';
foreach (array('user_login', 'user_nicename', 'user_email', 'user_url', 'display_name') as $col) {
$searches[] = $col . " LIKE '%{$this->search_term}%'";
}
$search_sql .= implode(' OR ', $searches);
$search_sql .= ')';
}
// The following code changes in WP3 and above
// We are on version 3.0 or above
$this->query_from = " FROM {$wpdb->users}";
$this->query_where = " WHERE 1=1 {$search_sql}";
if ($this->role) {
$this->query_from .= " INNER JOIN {$wpdb->usermeta} ON {$wpdb->users}.ID = {$wpdb->usermeta}.user_id";
$this->query_where .= $wpdb->prepare(" AND {$wpdb->usermeta}.meta_key = '{$wpdb->prefix}capabilities' AND {$wpdb->usermeta}.meta_value LIKE %s", '%' . $this->role . '%');
} elseif (is_multisite()) {
$level_key = $wpdb->prefix . 'capabilities';
// wpmu site admins don't have user_levels
$this->query_from .= ", {$wpdb->usermeta}";
$this->query_where .= " AND {$wpdb->users}.ID = {$wpdb->usermeta}.user_id AND meta_key = '{$level_key}'";
}
if ($this->sub_id) {
$sql = $wpdb->prepare("SELECT user_id FROM " . membership_db_prefix($wpdb, "membership_relationships") . " WHERE sub_id = %d", $this->sub_id);
$subs = $wpdb->get_col($sql);
if (!empty($subs)) {
$this->query_where .= " AND {$wpdb->users}.ID IN (" . implode(',', $subs) . ")";
// wp 2.9.2 and lower
$this->query_from_where .= " AND {$wpdb->users}.ID IN (" . implode(',', $subs) . ")";
} else {
$this->query_where .= " AND {$wpdb->users}.ID IN (0)";
// wp 2.9.2 and lower
$this->query_from_where .= " AND {$wpdb->users}.ID IN (0)";
}
}
if ($this->level_id) {
$sql = $wpdb->prepare("SELECT user_id FROM " . membership_db_prefix($wpdb, "membership_relationships") . " WHERE level_id = %d", $this->level_id);
$levels = $wpdb->get_col($sql);
if (!empty($levels)) {
$this->query_where .= " AND {$wpdb->users}.ID IN (" . implode(',', $levels) . ")";
// wp 2.9.2 and lower
$this->query_from_where .= " AND {$wpdb->users}.ID IN (" . implode(',', $levels) . ")";
} else {
$this->query_where .= " AND {$wpdb->users}.ID IN (0)";
// wp 2.9.2 and lower
$this->query_from_where .= " AND {$wpdb->users}.ID IN (0)";
}
}
if ($this->active) {
$sql = $wpdb->prepare("SELECT user_id FROM " . $wpdb->usermeta . " WHERE meta_key = '" . membership_db_prefix($wpdb, 'membership_active', false) . "' AND meta_value = 'no'");
$actives = $wpdb->get_col($sql);
if (!empty($actives)) {
if ($this->active == 'yes') {
$this->query_where .= " AND {$wpdb->users}.ID NOT IN (" . implode(',', $actives) . ")";
// wp 2.9.2 and lower
$this->query_from_where .= " AND {$wpdb->users}.ID NOT IN (" . implode(',', $actives) . ")";
} else {
// no
$this->query_where .= " AND {$wpdb->users}.ID IN (" . implode(',', $actives) . ")";
// wp 2.9.2 and lower
$this->query_from_where .= " AND {$wpdb->users}.ID IN (" . implode(',', $actives) . ")";
}
} else {
if ($this->active == 'yes') {
$this->query_where .= " AND {$wpdb->users}.ID NOT IN (0)";
// wp 2.9.2 and lower
$this->query_from_where .= " AND {$wpdb->users}.ID NOT IN (0)";
} else {
// no
$this->query_where .= " AND {$wpdb->users}.ID IN (0)";
// wp 2.9.2 and lower
$this->query_from_where .= " AND {$wpdb->users}.ID IN (0)";
}
}
}
do_action_ref_array('pre_user_search', array(&$this));
}
示例15: get_subscriptions
function get_subscriptions()
{
global $wpdb;
return $wpdb->get_results("SELECT * FROM " . membership_db_prefix($wpdb, 'subscriptions') . " WHERE sub_active = 1");
}