• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP nxt_cache_get函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中nxt_cache_get函数的典型用法代码示例。如果您正苦于以下问题:PHP nxt_cache_get函数的具体用法?PHP nxt_cache_get怎么用?PHP nxt_cache_get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: get_topic

function get_topic($id, $cache = true)
{
    global $bbdb;
    if (!is_numeric($id)) {
        list($slug, $sql) = bb_get_sql_from_slug('topic', $id);
        $id = nxt_cache_get($slug, 'bb_topic_slug');
    }
    // not else
    if (is_numeric($id)) {
        $id = (int) $id;
        $sql = "topic_id = {$id}";
    }
    if (0 === $id || !$sql) {
        return false;
    }
    // &= not =&
    $cache &= 'AND topic_status = 0' == ($where = apply_filters('get_topic_where', 'AND topic_status = 0'));
    if (($cache || !$where) && is_numeric($id) && false !== ($topic = nxt_cache_get($id, 'bb_topic'))) {
        return $topic;
    }
    // $where is NOT bbdb:prepared
    $topic = $bbdb->get_row("SELECT * FROM {$bbdb->topics} WHERE {$sql} {$where}");
    $topic = bb_append_meta($topic, 'topic');
    if ($cache) {
        nxt_cache_set($topic->topic_id, $topic, 'bb_topic');
        nxt_cache_add($topic->topic_slug, $topic->topic_id, 'bb_topic_slug');
    }
    return $topic;
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:29,代码来源:functions.bb-topics.php


示例2: get_all_category_ids

/**
 * Retrieves all category IDs.
 *
 * @since 2.0.0
 * @link http://codex.nxtclass.org/Function_Reference/get_all_category_ids
 *
 * @return object List of all of the category IDs.
 */
function get_all_category_ids()
{
    if (!($cat_ids = nxt_cache_get('all_category_ids', 'category'))) {
        $cat_ids = get_terms('category', array('fields' => 'ids', 'get' => 'all'));
        nxt_cache_add('all_category_ids', $cat_ids, 'category');
    }
    return $cat_ids;
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:16,代码来源:category.php


示例3: _get_cron_lock

function _get_cron_lock()
{
    global $_nxt_using_ext_object_cache, $nxtdb;
    $value = 0;
    if ($_nxt_using_ext_object_cache) {
        // Skip local cache and force refetch of doing_cron transient in case
        // another processs updated the cache
        $value = nxt_cache_get('doing_cron', 'transient', true);
    } else {
        $row = $nxtdb->get_row($nxtdb->prepare("SELECT option_value FROM {$nxtdb->options} WHERE option_name = %s LIMIT 1", '_transient_doing_cron'));
        if (is_object($row)) {
            $value = $row->option_value;
        }
    }
    return $value;
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:16,代码来源:nxt-cron.php


示例4: bp_adminbar_blogs_menu

function bp_adminbar_blogs_menu()
{
    global $bp;
    if (!is_user_logged_in() || !bp_is_active('blogs')) {
        return false;
    }
    if (!is_multisite()) {
        return false;
    }
    if (!($blogs = nxt_cache_get('bp_blogs_of_user_' . $bp->loggedin_user->id . '_inc_hidden', 'bp'))) {
        $blogs = bp_blogs_get_blogs_for_user($bp->loggedin_user->id, true);
        nxt_cache_set('bp_blogs_of_user_' . $bp->loggedin_user->id . '_inc_hidden', $blogs, 'bp');
    }
    $counter = 0;
    if (is_array($blogs['blogs']) && (int) $blogs['count']) {
        echo '<li id="bp-adminbar-blogs-menu"><a href="' . trailingslashit($bp->loggedin_user->domain . bp_get_blogs_slug()) . '">';
        _e('My Sites', 'buddypress');
        echo '</a>';
        echo '<ul>';
        foreach ((array) $blogs['blogs'] as $blog) {
            $alt = 0 == $counter % 2 ? ' class="alt"' : '';
            $site_url = esc_attr($blog->siteurl);
            echo '<li' . $alt . '>';
            echo '<a href="' . $site_url . '">' . esc_html($blog->name) . '</a>';
            echo '<ul>';
            echo '<li class="alt"><a href="' . $site_url . 'nxt-admin/">' . __('Dashboard', 'buddypress') . '</a></li>';
            echo '<li><a href="' . $site_url . 'nxt-admin/post-new.php">' . __('New Post', 'buddypress') . '</a></li>';
            echo '<li class="alt"><a href="' . $site_url . 'nxt-admin/edit.php">' . __('Manage Posts', 'buddypress') . '</a></li>';
            echo '<li><a href="' . $site_url . 'nxt-admin/edit-comments.php">' . __('Manage Comments', 'buddypress') . '</a></li>';
            echo '</ul>';
            do_action('bp_adminbar_blog_items', $blog);
            echo '</li>';
            $counter++;
        }
        $alt = 0 == $counter % 2 ? ' class="alt"' : '';
        if (bp_blog_signup_enabled()) {
            echo '<li' . $alt . '>';
            echo '<a href="' . bp_get_root_domain() . '/' . bp_get_blogs_root_slug() . '/create/">' . __('Create a Site!', 'buddypress') . '</a>';
            echo '</li>';
        }
        echo '</ul>';
        echo '</li>';
    }
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:44,代码来源:bp-blogs-buddybar.php


示例5: update_object_term_cache

 /**
  * Updates the cache for Term ID(s).
  *
  * Will only update the cache for terms not already cached.
  *
  * The $object_ids expects that the ids be separated by commas, if it is a
  * string.
  *
  * It should be noted that update_object_term_cache() is very time extensive. It
  * is advised that the function is not called very often or at least not for a
  * lot of terms that exist in a lot of taxonomies. The amount of time increases
  * for each term and it also increases for each taxonomy the term belongs to.
  *
  * @package NXTClass
  * @subpackage Taxonomy
  * @since 2.3.0
  * @uses $this->get_object_terms() Used to get terms from the database to update
  *
  * @param string|array $object_ids Single or list of term object ID(s)
  * @param string $object_type The taxonomy object type
  * @return null|bool Null value is given with empty $object_ids. False if 
  */
 function update_object_term_cache($object_ids, $object_type)
 {
     if (empty($object_ids)) {
         return;
     }
     if (!is_array($object_ids)) {
         $object_ids = explode(',', $object_ids);
     }
     $object_ids = array_map('intval', $object_ids);
     $taxonomies = $this->get_object_taxonomies($object_type);
     $ids = array();
     foreach ((array) $object_ids as $id) {
         foreach ($taxonomies as $taxonomy) {
             if (false === nxt_cache_get($id, "{$taxonomy}_relationships")) {
                 $ids[] = $id;
                 break;
             }
         }
     }
     if (empty($ids)) {
         return false;
     }
     $terms = $this->get_object_terms($ids, $taxonomies, 'fields=all_with_object_id');
     $object_terms = array();
     foreach ((array) $terms as $term) {
         $object_terms[$term->object_id][$term->taxonomy][$term->term_id] = $term;
     }
     foreach ($ids as $id) {
         foreach ($taxonomies as $taxonomy) {
             if (!isset($object_terms[$id][$taxonomy])) {
                 if (!isset($object_terms[$id])) {
                     $object_terms[$id] = array();
                 }
                 $object_terms[$id][$taxonomy] = array();
             }
         }
     }
     foreach ($object_terms as $id => $value) {
         foreach ($value as $taxonomy => $terms) {
             nxt_cache_set($id, $terms, "{$taxonomy}_relationships");
         }
     }
 }
开发者ID:nxtclass,项目名称:NXTClass,代码行数:65,代码来源:class.nxt-taxonomy.php


示例6: bp_xprofile_get_meta

function bp_xprofile_get_meta($object_id, $object_type, $meta_key = '')
{
    global $nxtdb, $bp;
    $object_id = (int) $object_id;
    if (!$object_id) {
        return false;
    }
    if (!isset($object_type)) {
        return false;
    }
    if (!in_array($object_type, array('group', 'field', 'data'))) {
        return false;
    }
    if (!empty($meta_key)) {
        $meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key);
        if (!($metas = nxt_cache_get('bp_xprofile_meta_' . $object_type . '_' . $object_id . '_' . $meta_key, 'bp'))) {
            $metas = $nxtdb->get_col($nxtdb->prepare("SELECT meta_value FROM " . $bp->profile->table_name_meta . " WHERE object_id = %d AND object_type = %s AND meta_key = %s", $object_id, $object_type, $meta_key));
            nxt_cache_set('bp_xprofile_meta_' . $object_type . '_' . $object_id . '_' . $meta_key, $metas, 'bp');
        }
    } else {
        $metas = $nxtdb->get_col($nxtdb->prepare("SELECT meta_value FROM " . $bp->profile->table_name_meta . " WHERE object_id = %d AND object_type = %s", $object_id, $object_type));
    }
    if (empty($metas)) {
        if (empty($meta_key)) {
            return array();
        } else {
            return '';
        }
    }
    $metas = array_map('maybe_unserialize', (array) $metas);
    if (1 == count($metas)) {
        return $metas[0];
    } else {
        return $metas;
    }
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:36,代码来源:bp-xprofile-functions.php


示例7: bb_get_transient

/**
 * Get the value of a transient
 *
 * If the transient does not exist or does not have a value, then the return value
 * will be false.
 * 
 * @since 1.0
 * @package bbPress
 * @subpackage Transient
 *
 * @param string $transient Transient name. Expected to not be SQL-escaped
 * @return mixed Value of transient
 */
function bb_get_transient($transient)
{
    global $_bb_using_ext_object_cache, $bbdb;
    if ($_bb_using_ext_object_cache) {
        $value = nxt_cache_get($transient, 'transient');
    } else {
        $transient_option = '_transient_' . $bbdb->escape($transient);
        $transient_timeout = '_transient_timeout_' . $bbdb->escape($transient);
        $timeout = bb_get_option($transient_timeout);
        if ($timeout && $timeout < time()) {
            bb_delete_option($transient_option);
            bb_delete_option($transient_timeout);
            return false;
        }
        $value = bb_get_option($transient_option);
    }
    return apply_filters('transient_' . $transient, $value);
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:31,代码来源:functions.bb-meta.php


示例8: dpa_get_total_achievements_count_for_user

/**
 * Get count of how many (active) Achievements the specified user has.
 * Only users with edit permission can see hidden Achievements.
 *
 * @global object $bp BuddyPress global settings
 * @global nxtdb $nxtdb NXTClass database object
 * @param int $user_id
 * @since 2.0
 */
function dpa_get_total_achievements_count_for_user($user_id = false)
{
    global $bp, $nxtdb;
    if (!$user_id) {
        $user_id = $bp->displayed_user->id ? $bp->displayed_user->id : $bp->loggedin_user->id;
    }
    if (!($count = nxt_cache_get('dpa_get_total_achievements_count_for_user_' . $user_id, 'bp'))) {
        $admin_sql = $nxtdb->prepare("AND (is_active = 1 OR is_active = 2)");
        $count = $nxtdb->get_var($nxtdb->prepare("SELECT COUNT(a.id) FROM {$bp->achievements->table_achievements} as a, {$bp->achievements->table_unlocked} as u WHERE a.id = u.achievement_id AND u.user_id = %d {$admin_sql}", $user_id));
        nxt_cache_set('dpa_get_total_achievements_count_for_user_' . $user_id, $count, 'bp');
    }
    return $count;
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:22,代码来源:achievements-classes.php


示例9: cache_users

 /**
  * Retrieve info for user lists to prevent multiple queries by get_userdata()
  *
  * @since 3.0.0
  *
  * @param array $user_ids User ID numbers list
  */
 function cache_users($user_ids)
 {
     global $nxtdb;
     $clean = array();
     foreach ($user_ids as $id) {
         $id = (int) $id;
         if (!nxt_cache_get($id, 'users')) {
             $clean[] = $id;
         }
     }
     if (empty($clean)) {
         return;
     }
     $list = implode(',', $clean);
     $users = $nxtdb->get_results("SELECT * FROM {$nxtdb->users} WHERE ID IN ({$list})");
     $ids = array();
     foreach ($users as $user) {
         update_user_caches($user);
         $ids[] = $user->ID;
     }
     update_meta_cache('user', $ids);
 }
开发者ID:nxtclass,项目名称:NXTClass,代码行数:29,代码来源:pluggable.php


示例10: dpa_get_actions

/**
 * Loads the actions from the database.
 *
 * @global object $bp BuddyPress global settings
 * @global nxtdb $nxtdb NXTClass database object
 * @return string
 * @since 2.0
 */
function dpa_get_actions()
{
    global $bp, $nxtdb;
    if (!($actions = nxt_cache_get('dpa_actions', 'dpa'))) {
        $actions = $nxtdb->get_results($nxtdb->prepare("SELECT * FROM {$bp->achievements->table_actions} ORDER BY category, description"));
        nxt_cache_set('dpa_actions', $actions, 'dpa');
    }
    return apply_filters('dpa_get_actions', (array) $actions);
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:17,代码来源:achievements-core.php


示例11: substr

     } else {
         $blogname = substr($domain, 0, strpos($domain, '.'));
     }
 } else {
     $blogname = htmlspecialchars(substr($_SERVER['REQUEST_URI'], strlen($path)));
     if (false !== strpos($blogname, '/')) {
         $blogname = substr($blogname, 0, strpos($blogname, '/'));
     }
     if (false !== strpos($blogname, '?')) {
         $blogname = substr($blogname, 0, strpos($blogname, '?'));
     }
     $reserved_blognames = array('page', 'comments', 'blog', 'nxt-admin', 'nxt-includes', 'nxt-content', 'files', 'feed');
     if ($blogname != '' && !in_array($blogname, $reserved_blognames) && !is_file($blogname)) {
         $path .= $blogname . '/';
     }
     $current_blog = nxt_cache_get('current_blog_' . $domain . $path, 'site-options');
     if (!$current_blog) {
         $current_blog = get_blog_details(array('domain' => $domain, 'path' => $path), false);
         if ($current_blog) {
             nxt_cache_set('current_blog_' . $domain . $path, $current_blog, 'site-options');
         }
     }
     unset($reserved_blognames);
 }
 if (!defined('nxt_INSTALLING') && is_subdomain_install() && !is_object($current_blog)) {
     if (defined('NOBLOGREDIRECT')) {
         $destination = NOBLOGREDIRECT;
         if ('%siteurl%' == $destination) {
             $destination = "http://" . $current_site->domain . $current_site->path;
         }
     } else {
开发者ID:nxtclass,项目名称:NXTClass,代码行数:31,代码来源:ms-settings.php


示例12: get_usermeta

/**
 * Retrieve user metadata.
 *
 * If $user_id is not a number, then the function will fail over with a 'false'
 * boolean return value. Other returned values depend on whether there is only
 * one item to be returned, which be that single item type. If there is more
 * than one metadata value, then it will be list of metadata values.
 *
 * @since 2.0.0
 * @deprecated 3.0.0
 * @deprecated Use get_user_meta()
 * @see get_user_meta()
 *
 * @param int $user_id User ID
 * @param string $meta_key Optional. Metadata key.
 * @return mixed
 */
function get_usermeta($user_id, $meta_key = '')
{
    _deprecated_function(__FUNCTION__, '3.0', 'get_user_meta()');
    global $nxtdb;
    $user_id = (int) $user_id;
    if (!$user_id) {
        return false;
    }
    if (!empty($meta_key)) {
        $meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key);
        $user = nxt_cache_get($user_id, 'users');
        // Check the cached user object
        if (false !== $user && isset($user->{$meta_key})) {
            $metas = array($user->{$meta_key});
        } else {
            $metas = $nxtdb->get_col($nxtdb->prepare("SELECT meta_value FROM {$nxtdb->usermeta} WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key));
        }
    } else {
        $metas = $nxtdb->get_col($nxtdb->prepare("SELECT meta_value FROM {$nxtdb->usermeta} WHERE user_id = %d", $user_id));
    }
    if (empty($metas)) {
        if (empty($meta_key)) {
            return array();
        } else {
            return '';
        }
    }
    $metas = array_map('maybe_unserialize', $metas);
    if (count($metas) == 1) {
        return $metas[0];
    } else {
        return $metas;
    }
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:51,代码来源:deprecated.php


示例13: get_blog_id_from_url

/**
 * Get a blog's numeric ID from its URL.
 *
 * On a subdirectory installation like example.com/blog1/,
 * $domain will be the root 'example.com' and $path the
 * subdirectory '/blog1/'. With subdomains like blog1.example.com,
 * $domain is 'blog1.example.com' and $path is '/'.
 *
 * @since MU 2.6.5
 *
 * @param string $domain
 * @param string $path Optional. Not required for subdomain installations.
 * @return int
 */
function get_blog_id_from_url($domain, $path = '/')
{
    global $nxtdb;
    $domain = strtolower($nxtdb->escape($domain));
    $path = strtolower($nxtdb->escape($path));
    $id = nxt_cache_get(md5($domain . $path), 'blog-id-cache');
    if ($id == -1) {
        // blog does not exist
        return 0;
    } elseif ($id) {
        return (int) $id;
    }
    $id = $nxtdb->get_var("SELECT blog_id FROM {$nxtdb->blogs} WHERE domain = '{$domain}' and path = '{$path}' /* get_blog_id_from_url */");
    if (!$id) {
        nxt_cache_set(md5($domain . $path), -1, 'blog-id-cache');
        return false;
    }
    nxt_cache_set(md5($domain . $path), $id, 'blog-id-cache');
    return $id;
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:34,代码来源:ms-functions.php


示例14: get_blog_option

/**
 * Retrieve option value based on setting name and blog_id.
 *
 * If the option does not exist or does not have a value, then the return value
 * will be false. This is useful to check whether you need to install an option
 * and is commonly used during installation of plugin options and to test
 * whether upgrading is required.
 *
 * There is a filter called 'blog_option_$option' with the $option being
 * replaced with the option name. The filter takes two parameters. $value and
 * $blog_id. It returns $value.
 * The 'option_$option' filter in get_option() is not called.
 *
 * @since MU
 * @uses apply_filters() Calls 'blog_option_$optionname' with the option name value.
 *
 * @param int $blog_id Optional. Blog ID, can be null to refer to the current blog.
 * @param string $setting Name of option to retrieve. Should already be SQL-escaped.
 * @param string $default (optional) Default value returned if option not found.
 * @return mixed Value set for the option.
 */
function get_blog_option($blog_id, $setting, $default = false)
{
    global $nxtdb;
    if (null === $blog_id) {
        $blog_id = $nxtdb->blogid;
    }
    $key = $blog_id . '-' . $setting . '-blog_option';
    $value = nxt_cache_get($key, 'site-options');
    if ($value == null) {
        if ($blog_id == $nxtdb->blogid) {
            $value = get_option($setting, $default);
            $notoptions = nxt_cache_get('notoptions', 'options');
            if (isset($notoptions[$setting])) {
                nxt_cache_set($key, 'noop', 'site-options');
                $value = $default;
            } elseif ($value == false) {
                nxt_cache_set($key, 'falsevalue', 'site-options');
            } else {
                nxt_cache_set($key, $value, 'site-options');
            }
            return apply_filters('blog_option_' . $setting, $value, $blog_id);
        } else {
            $blog_prefix = $nxtdb->get_blog_prefix($blog_id);
            $row = $nxtdb->get_row($nxtdb->prepare("SELECT * FROM {$blog_prefix}options WHERE option_name = %s", $setting));
            if (is_object($row)) {
                // Has to be get_row instead of get_var because of funkiness with 0, false, null values
                $value = $row->option_value;
                if ($value == false) {
                    nxt_cache_set($key, 'falsevalue', 'site-options');
                } else {
                    nxt_cache_set($key, $value, 'site-options');
                }
            } else {
                // option does not exist, so we must cache its non-existence
                nxt_cache_set($key, 'noop', 'site-options');
                $value = $default;
            }
        }
    } elseif ($value == 'noop') {
        $value = $default;
    } elseif ($value == 'falsevalue') {
        $value = false;
    }
    // If home is not set use siteurl.
    if ('home' == $setting && '' == $value) {
        return get_blog_option($blog_id, 'siteurl');
    }
    if ('siteurl' == $setting || 'home' == $setting || 'category_base' == $setting) {
        $value = untrailingslashit($value);
    }
    return apply_filters('blog_option_' . $setting, maybe_unserialize($value), $blog_id);
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:73,代码来源:ms-blogs.php


示例15: get_calendar

/**
 * Display calendar with days that have posts as links.
 *
 * The calendar is cached, which will be retrieved, if it exists. If there are
 * no posts for the month, then it will not be displayed.
 *
 * @since 1.0.0
 *
 * @param bool $initial Optional, default is true. Use initial calendar names.
 * @param bool $echo Optional, default is true. Set to false for return.
 */
function get_calendar($initial = true, $echo = true)
{
    global $nxtdb, $m, $monthnum, $year, $nxt_locale, $posts;
    $cache = array();
    $key = md5($m . $monthnum . $year);
    if ($cache = nxt_cache_get('get_calendar', 'calendar')) {
        if (is_array($cache) && isset($cache[$key])) {
            if ($echo) {
                echo apply_filters('get_calendar', $cache[$key]);
                return;
            } else {
                return apply_filters('get_calendar', $cache[$key]);
            }
        }
    }
    if (!is_array($cache)) {
        $cache = array();
    }
    // Quick check. If we have no posts at all, abort!
    if (!$posts) {
        $gotsome = $nxtdb->get_var("SELECT 1 as test FROM {$nxtdb->posts} WHERE post_type = 'post' AND post_status = 'publish' LIMIT 1");
        if (!$gotsome) {
            $cache[$key] = '';
            nxt_cache_set('get_calendar', $cache, 'calendar');
            return;
        }
    }
    if (isset($_GET['w'])) {
        $w = '' . intval($_GET['w']);
    }
    // week_begins = 0 stands for Sunday
    $week_begins = intval(get_option('start_of_week'));
    // Let's figure out when we are
    if (!empty($monthnum) && !empty($year)) {
        $thismonth = '' . zeroise(intval($monthnum), 2);
        $thisyear = '' . intval($year);
    } elseif (!empty($w)) {
        // We need to get the month from MySQL
        $thisyear = '' . intval(substr($m, 0, 4));
        $d = ($w - 1) * 7 + 6;
        //it seems MySQL's weeks disagree with PHP's
        $thismonth = $nxtdb->get_var("SELECT DATE_FORMAT((DATE_ADD('{$thisyear}0101', INTERVAL {$d} DAY) ), '%m')");
    } elseif (!empty($m)) {
        $thisyear = '' . intval(substr($m, 0, 4));
        if (strlen($m) < 6) {
            $thismonth = '01';
        } else {
            $thismonth = '' . zeroise(intval(substr($m, 4, 2)), 2);
        }
    } else {
        $thisyear = gmdate('Y', current_time('timestamp'));
        $thismonth = gmdate('m', current_time('timestamp'));
    }
    $unixmonth = mktime(0, 0, 0, $thismonth, 1, $thisyear);
    $last_day = date('t', $unixmonth);
    // Get the next and previous month and year with at least one post
    $previous = $nxtdb->get_row("SELECT MONTH(post_date) AS month, YEAR(post_date) AS year\n\t\tFROM {$nxtdb->posts}\n\t\tWHERE post_date < '{$thisyear}-{$thismonth}-01'\n\t\tAND post_type = 'post' AND post_status = 'publish'\n\t\t\tORDER BY post_date DESC\n\t\t\tLIMIT 1");
    $next = $nxtdb->get_row("SELECT MONTH(post_date) AS month, YEAR(post_date) AS year\n\t\tFROM {$nxtdb->posts}\n\t\tWHERE post_date > '{$thisyear}-{$thismonth}-{$last_day} 23:59:59'\n\t\tAND post_type = 'post' AND post_status = 'publish'\n\t\t\tORDER BY post_date ASC\n\t\t\tLIMIT 1");
    /* translators: Calendar caption: 1: month name, 2: 4-digit year */
    $calendar_caption = _x('%1$s %2$s', 'calendar caption');
    $calendar_output = '<table id="nxt-calendar">
	<caption>' . sprintf($calendar_caption, $nxt_locale->get_month($thismonth), date('Y', $unixmonth)) . '</caption>
	<thead>
	<tr>';
    $myweek = array();
    for ($wdcount = 0; $wdcount <= 6; $wdcount++) {
        $myweek[] = $nxt_locale->get_weekday(($wdcount + $week_begins) % 7);
    }
    foreach ($myweek as $wd) {
        $day_name = true == $initial ? $nxt_locale->get_weekday_initial($wd) : $nxt_locale->get_weekday_abbrev($wd);
        $wd = esc_attr($wd);
        $calendar_output .= "\n\t\t<th scope=\"col\" title=\"{$wd}\">{$day_name}</th>";
    }
    $calendar_output .= '
	</tr>
	</thead>

	<tfoot>
	<tr>';
    if ($previous) {
        $calendar_output .= "\n\t\t" . '<td colspan="3" id="prev"><a href="' . get_month_link($previous->year, $previous->month) . '" title="' . esc_attr(sprintf(__('View posts for %1$s %2$s'), $nxt_locale->get_month($previous->month), date('Y', mktime(0, 0, 0, $previous->month, 1, $previous->year)))) . '">&laquo; ' . $nxt_locale->get_month_abbrev($nxt_locale->get_month($previous->month)) . '</a></td>';
    } else {
        $calendar_output .= "\n\t\t" . '<td colspan="3" id="prev" class="pad">&nbsp;</td>';
    }
    $calendar_output .= "\n\t\t" . '<td class="pad">&nbsp;</td>';
    if ($next) {
        $calendar_output .= "\n\t\t" . '<td colspan="3" id="next"><a href="' . get_month_link($next->year, $next->month) . '" title="' . esc_attr(sprintf(__('View posts for %1$s %2$s'), $nxt_locale->get_month($next->month), date('Y', mktime(0, 0, 0, $next->month, 1, $next->year)))) . '">' . $nxt_locale->get_month_abbrev($nxt_locale->get_month($next->month)) . ' &raquo;</a></td>';
    } else {
        $calendar_output .= "\n\t\t" . '<td colspan="3" id="next" class="pad">&nbsp;</td>';
//.........这里部分代码省略.........
开发者ID:nxtclass,项目名称:NXTClass,代码行数:101,代码来源:general-template.php


示例16: dpa_get_achievement_picture

/**
 * Returns Achievement's picture; takes into account size of image required
 *
 * @since 2.0
 * @global DPA_Achievement_Template $achievements_template Achievements template tag object
 * @global int $blog_id Site ID
 * @global object $bp BuddyPress global settings
 * @param string $size Optional; set to "thumb" to fetch thumbnail-sized picture, and "activitystream" for a thumbnail-sized picture with width/height style tags.
 * @return string HTML image tag
 */
function dpa_get_achievement_picture($size = '')
{
    global $achievements_template, $blog_id, $bp;
    $achievement_slug = dpa_get_achievement_slug();
    $achievement_id = dpa_get_achievement_id();
    if ('thumb' == $size || 'activitystream' == $size) {
        $is_thumbnail = true;
    } else {
        $is_thumbnail = dpa_get_achievement_picture_is_thumbnail();
    }
    if (($picture_id = dpa_get_achievement_picture_id()) < 1) {
        if (empty($bp->grav_default->user)) {
            $default_grav = 'wavatar';
        } elseif ('mystery' == $bp->grav_default->user) {
            $default_grav = apply_filters('bp_core_mysteryman_src', BP_PLUGIN_URL . '/bp-core/images/mystery-man.jpg');
        } else {
            $default_grav = $bp->grav_default->user;
        }
        if ('thumb' == $size) {
            $grav_size = apply_filters('dpa_get_achievement_picture_gravatar_width', BP_AVATAR_THUMB_WIDTH, 'thumb');
        } elseif ('activitystream' == $size) {
            $grav_size = apply_filters('dpa_get_achievement_picture_gravatar_width', 20, 'activitystream');
        } else {
            $grav_size = apply_filters('dpa_get_achievement_picture_gravatar_width', BP_AVATAR_FULL_WIDTH, 'full');
        }
        $email = apply_filters('bp_core_gravatar_email', $achievement_slug . '@' . $bp->root_domain, $achievement_id, 'achievements');
        if (is_ssl()) {
            $host = 'https://secure.gravatar.com/avatar/';
        } else {
            $host = 'http://www.gravatar.com/avatar/';
        }
        $avatar_url = apply_filters('bp_gravatar_url', $host) . md5($email) . '?d=' . $default_grav . '&amp;s=' . $grav_size;
    } else {
        if ($cached_urls = nxt_cache_get('dpa_achievement_picture_urls', 'dpa') && isset($cached_urls) && is_array($cached_urls) && isset($cached_urls[$picture_id]) && $cached_urls[$picture_id]) {
            $avatar_url = $cached_urls[$picture_id];
        } else {
            if ($is_nonroot_multisite = is_multisite() && BP_ROOT_BLOG != $blog_id) {
                switch_to_blog(BP_ROOT_BLOG);
            }
            // Necessary evil
            list($avatar_url, $avatar_width, $avatar_height, $is_intermediate) = image_downsize($picture_id, 'large');
            if ($is_nonroot_multisite) {
                restore_current_blog();
            }
            if (!is_array($cached_urls)) {
                $cached_urls = array($picture_id => $avatar_url);
            } else {
                $cached_urls[$picture_id] = $avatar_url;
            }
            $grav_size = 0;
            nxt_cache_set('dpa_achievement_picture_urls', $cached_urls, 'dpa');
        }
    }
    $style = '';
    if ('activitystream' == $size && ('mystery' == $bp->grav_default->user || $picture_id > 0)) {
        $style = 'width="20" height="20"';
    }
    if ($is_thumbnail) {
        $picture_type = "avatar-thumbnail";
    } else {
        $picture_type = "avatar-full";
    }
    $url = '<img src="' . esc_url($avatar_url) . '" alt="' . esc_attr(dpa_get_achievement_name()) . '" title="' . esc_attr(dpa_get_achievement_name()) . '" ' . $style . ' class="avatar' . esc_attr(' achievement-' . $achievement_slug . '-avatar ') . $picture_type . '" />';
    return apply_filters('dpa_get_achievement_picture', $url, $achievement_id, $picture_id, $grav_size, $style);
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:75,代码来源:achievements-templatetags.php


示例17: bp_core_get_total_member_count

/**
 * Returns the total number of members for the installation.
 *
 * @package BuddyPress Core
 * @return int The total number of members.
 */
function bp_core_get_total_member_count()
{
    global $nxtdb, $bp;
    if (!($count = nxt_cache_get('bp_total_member_count', 'bp'))) {
        $status_sql = bp_core_get_status_sql();
        $count = $nxtdb->get_var($nxtdb->prepare("SELECT COUNT(ID) FROM {$nxtdb->users} WHERE {$status_sql}"));
        nxt_cache_set('bp_total_member_count', $count, 'bp');
    }
    return apply_filters('bp_core_get_total_member_count', $count);
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:16,代码来源:bp-members-functions.php


示例18: bp_get_friend_reject_request_link

function bp_get_friend_reject_request_link()
{
    global $members_template, $bp;
    if (!($friendship_id = nxt_cache_get('friendship_id_' . $members_template->member->id . '_' . $bp->loggedin_user->id))) {
        $friendship_id = friends_get_friendship_id($members_template->member->id, $bp->loggedin_user->id);
        nxt_cache_set('friendship_id_' . $members_template->member->id . '_' . $bp->loggedin_user->id, $friendship_id, 'bp');
    }
    return apply_filters('bp_get_friend_reject_request_link', nxt_nonce_url($bp->loggedin_user->domain . bp_get_friends_slug() . '/requests/reject/' . $friendship_id, 'friends_reject_friendship'));
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:9,代码来源:bp-friends-template.php


示例19: friends_get_total_friend_count

function friends_get_total_friend_count($user_id = 0)
{
    global $bp;
    if (!$user_id) {
        $user_id = $bp->displayed_user->id ? $bp->displayed_user->id : $bp->loggedin_user->id;
    }
    if (!($count = nxt_cache_get('bp_total_friend_count_' . $user_id, 'bp'))) {
        $count = bp_get_user_meta($user_id, 'total_friend_count', true);
        if (empty($count)) {
            $count = 0;
        }
        nxt_cache_set('bp_total_friend_count_' . $user_id, $count, 'bp');
    }
    return apply_filters('friends_get_total_friend_count', $count);
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:15,代码来源:bp-friends-functions.php


示例20: get_site_transient

/**
 * Get the value of a site transient.
 *
 * If the transient does not exist or does not have a value, then the return value
 * will be false.
 *
 * @see get_transient()
 * @since 2.9.0
 * @package NXTClass
 * @subpackage Transient
 *
 * @uses apply_filters() Calls 'pre_site_transient_$transient' hook before checking the transient.
 * 	Any value other than false will "short-circuit" the retrieval of the transient
 *	and return the returned value.
 * @uses apply_filters() Calls 'site_transient_$option' hook, after checking the transient, with
 * 	the transient value.
 *
 * @param string $transient Transient name. Expected to not be SQL-escaped.
 * @return mixed Value of transient
 */
function get_site_transient($transient)
{
    global $_nxt_using_ext_object_cache;
    $pre = apply_filters('pre_site_transient_' . $transient, false);
    if (false !== $pre) {
        return $pre;
    }
    if ($_nxt_using_ext_object_cache) {
        $value = nxt_cache_get($transient, 'site-transient');
    } else {
        // Core transients that do not have a timeout. Listed here so querying timeouts can be avoided.
        $no_timeout = array('update_core', 'update_plugins', 'update_themes');
        $transient_option = '_site_transient_' . $transient;
        if (!in_array($transient, $no_timeout)) {
            $transient_timeout = '_site_transient_timeout_' . $transient;
            $timeout = get_site_option($transient_timeout);
            if (false !== $timeout && $timeout < time()) {
                delete_site_option($transient_option);
                delete_site_option($transient_timeout);
                return false;
            }
        }
        $value = get_site_option($transient_option);
    }
    return apply_filters('site_transient_' . $transient, $value);
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:46,代码来源:functions.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP nxt_cache_set函数代码示例发布时间:2022-05-15
下一篇:
PHP nxt_cache_delete函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap