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


PHP nxt_cache_get函数代码示例

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


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


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