本文整理汇总了PHP中get_Cache函数的典型用法代码示例。如果您正苦于以下问题:PHP get_Cache函数的具体用法?PHP get_Cache怎么用?PHP get_Cache使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_Cache函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CommentList2
/**
* Constructor
*
* @param Blog This may be NULL only when must select comments from all Blog. Use NULL carefully, because it may generate very long queries!
* @param integer|NULL Limit
* @param string name of cache to be used
* @param string prefix to differentiate page/order params when multiple Results appear one same page
* @param string Name to be used when saving the filterset (leave empty to use default for collection)
*/
function CommentList2($Blog, $limit = 1000, $cache_name = 'CommentCache', $param_prefix = '', $filterset_name = '')
{
global $Settings;
// Call parent constructor:
parent::DataObjectList2(get_Cache($cache_name), $limit, $param_prefix, NULL);
// Set Blog. Note: It can be NULL on ?disp=usercomments
$this->Blog = $Blog;
// The SQL Query object:
$this->CommentQuery = new CommentQuery();
$this->CommentQuery->Blog = $this->Blog;
// The Item filter SQL Query object:
$this->ItemQuery = new ItemQuery('T_items__item', 'post_', 'post_ID');
// Blog can be NULL on ?disp=usercomments, in this case ItemQuery blog must be set to 0, which means all blog
$this->ItemQuery->blog = empty($this->Blog) ? 0 : $this->Blog->ID;
if (!empty($filterset_name)) {
// Set the filterset_name with the filterset_name param
$this->filterset_name = 'CommentList_filters_' . $filterset_name;
} else {
// Set a generic filterset_name
$this->filterset_name = 'CommentList_filters_coll' . (!is_null($this->Blog) ? $this->Blog->ID : '0');
}
$this->page_param = $param_prefix . 'paged';
// Initialize the default filter set:
$this->set_default_filters(array('filter_preset' => NULL, 'author_IDs' => NULL, 'author' => NULL, 'author_email' => NULL, 'author_url' => NULL, 'url_match' => '=', 'include_emptyurl' => NULL, 'author_IP' => NULL, 'post_ID' => NULL, 'comment_ID' => NULL, 'comment_ID_list' => NULL, 'rating_toshow' => NULL, 'rating_turn' => 'above', 'rating_limit' => 1, 'keywords' => NULL, 'phrase' => 'AND', 'exact' => 0, 'statuses' => NULL, 'expiry_statuses' => array('active'), 'types' => array('comment', 'trackback', 'pingback'), 'orderby' => 'date', 'order' => !is_null($this->Blog) ? $this->Blog->get_setting('comments_orderdir') : 'DESC', 'comments' => $this->limit, 'page' => 1, 'featured' => NULL, 'timestamp_min' => NULL, 'timestamp_max' => NULL, 'threaded_comments' => false, 'user_perm' => NULL));
}
示例2: get_available_FileRoots
/**
* Get an array of ALL available Fileroots (not just the cached ones).
*
* @todo fp> it would probably make sense to refactor this as the constructor for the file roots
* and initialize the whole cache at construction time
*
* @static
*
* @return array of FileRoots (key being the FileRoot's ID)
*/
function get_available_FileRoots()
{
global $current_User;
$r = array();
// The user's blog (if available) is the default/first one:
$user_FileRoot =& $this->get_by_type_and_ID('user', $current_User->ID, true);
if ($user_FileRoot) {
// We got a user media dir:
$r[$user_FileRoot->ID] =& $user_FileRoot;
}
// blog/collection media dirs:
$BlogCache =& get_Cache('BlogCache');
$bloglist = $BlogCache->load_user_blogs('blog_media_browse', $current_User->ID);
foreach ($bloglist as $blog_ID) {
if ($Root =& $this->get_by_type_and_ID('collection', $blog_ID, true)) {
$r[$Root->ID] =& $Root;
}
}
// skins root:
$skins_FileRoot =& $this->get_by_type_and_ID('skins', 0, false);
if ($skins_FileRoot) {
// We got a skins dir:
$r[$skins_FileRoot->ID] =& $skins_FileRoot;
}
return $r;
}
示例3: stats_format_req_URI
/**
* Helper function for "Requested URI" column
* @param integer Blog ID
* @param string Requested URI
* @return string
*/
function stats_format_req_URI($hit_blog_ID, $hit_uri, $max_len = 40)
{
if (!empty($hit_blog_ID)) {
$BlogCache =& get_Cache('BlogCache');
$tmp_Blog =& $BlogCache->get_by_ID($hit_blog_ID);
$full_url = $tmp_Blog->get('baseurlroot') . $hit_uri;
} else {
$full_url = $hit_uri;
}
if (strlen($hit_uri) > $max_len) {
$hit_uri = '...' . substr($hit_uri, -$max_len);
}
return '<a href="' . $full_url . '">' . $hit_uri . '</a>';
}
示例4: UserList
/**
* Constructor
*
* @param integer|NULL Limit
* @param string prefix to differentiate page/order params when multiple Results appear one same page
* @param string Name to be used when saving the filterset (leave empty to use default)
* @param array Query params:
* 'join_group' => true,
* 'join_session' => false,
* 'join_country' => true,
* 'join_city' => true,
* 'keywords_fields' - Fields of users table to search by keywords
* 'where_status_closed' - FALSE - to don't display closed users
* 'where_org_ID' - ID of organization
*/
function UserList($filterset_name = '', $limit = 20, $param_prefix = 'users_', $query_params = array())
{
// Call parent constructor:
parent::DataObjectList2(get_Cache('UserCache'), $limit, $param_prefix, NULL);
// Init query params, @see $this->query_init()
$this->query_params = $query_params;
if (!empty($filterset_name)) {
// Set the filterset_name with the filterset_name param
$this->filterset_name = 'UserList_filters_' . $filterset_name;
} else {
// Set a generic filterset_name
$this->filterset_name = 'UserList_filters';
}
$this->order_param = 'results_' . $param_prefix . 'order';
$this->page_param = $param_prefix . 'paged';
// Initialize the default filter set:
$this->set_default_filters(array('filter_preset' => NULL, 'country' => NULL, 'region' => NULL, 'subregion' => NULL, 'city' => NULL, 'membersonly' => false, 'keywords' => NULL, 'gender' => NULL, 'status_activated' => NULL, 'account_status' => NULL, 'reported' => NULL, 'custom_sender_email' => NULL, 'custom_sender_name' => NULL, 'group' => -1, 'age_min' => NULL, 'age_max' => NULL, 'userfields' => array(), 'order' => '-D', 'users' => array(), 'level_min' => NULL, 'level_max' => NULL, 'org' => NULL));
}
示例5: Link
/**
* Constructor
*
* @param table Database row
*/
function Link($db_row = NULL)
{
// Call parent constructor:
parent::DataObject('T_links', 'link_', 'link_ID', 'datecreated', 'datemodified', 'creator_user_ID', 'lastedit_user_ID');
if ($db_row != NULL) {
$this->ID = $db_row->link_ID;
$this->ltype_ID = $db_row->link_ltype_ID;
// source of link:
$ItemCache =& get_Cache('ItemCache');
$this->Item =& $ItemCache->get_by_ID($db_row->link_itm_ID);
$FileCache =& get_Cache('FileCache');
// fp> do not halt on error. For some reason (ahem bug) a file can disappear and if we fail here then we won't be
// able to delete the link
$this->File =& $FileCache->get_by_ID($db_row->link_file_ID, false, false);
} else {
// New object:
}
}
示例6: ItemListLight
/**
* Constructor
*
* @todo add param for saved session filter set
*
* @param Blog
* @param mixed Default filter set: Do not show posts before this timestamp, can be 'now'
* @param mixed Default filter set: Do not show posts after this timestamp, can be 'now'
* @param integer|NULL Limit
* @param string name of cache to be used (for table prefix info)
* @param string prefix to differentiate page/order params when multiple Results appear one same page
* @param array restrictions for itemlist (position, contact, firm, ...) key: restriction name, value: ID of the restriction
*/
function ItemListLight(&$Blog, $timestamp_min = NULL, $timestamp_max = NULL, $limit = 20, $cache_name = 'ItemCacheLight', $param_prefix = '', $filterset_name = '')
{
global $Settings, $posttypes_specialtypes;
// Call parent constructor:
parent::DataObjectList2(get_Cache($cache_name), $limit, $param_prefix, NULL);
// asimo> The ItemQuery init was moved into the query_init() method
// The SQL Query object:
// $this->ItemQuery = new ItemQuery( $this->Cache->dbtablename, $this->Cache->dbprefix, $this->Cache->dbIDname );
$this->Blog =& $Blog;
if (!empty($filterset_name)) {
// Set the filterset_name with the filterset_name param
$this->filterset_name = 'ItemList_filters_' . $filterset_name;
} else {
// Set a generic filterset_name
$this->filterset_name = 'ItemList_filters_coll' . (!is_null($this->Blog) ? $this->Blog->ID : '0');
}
$this->page_param = $param_prefix . 'paged';
// Initialize the default filter set:
$this->set_default_filters(array('filter_preset' => NULL, 'ts_min' => $timestamp_min, 'ts_max' => $timestamp_max, 'ts_created_max' => NULL, 'coll_IDs' => NULL, 'cat_array' => array(), 'cat_modifier' => NULL, 'cat_focus' => 'wide', 'tags' => NULL, 'authors' => NULL, 'authors_login' => NULL, 'assignees' => NULL, 'assignees_login' => NULL, 'author_assignee' => NULL, 'lc' => 'all', 'keywords' => NULL, 'keyword_scope' => 'title,content', 'phrase' => 'AND', 'exact' => 0, 'post_ID' => NULL, 'post_ID_list' => NULL, 'post_title' => NULL, 'ymdhms' => NULL, 'week' => NULL, 'ymdhms_min' => NULL, 'ymdhms_max' => NULL, 'statuses' => NULL, 'types' => '-' . implode(',', $posttypes_specialtypes), 'visibility_array' => get_inskin_statuses(is_null($this->Blog) ? NULL : $this->Blog->ID, 'post'), 'orderby' => !is_null($this->Blog) ? $this->Blog->get_setting('orderby') : 'datestart', 'order' => !is_null($this->Blog) ? $this->Blog->get_setting('orderdir') : 'DESC', 'unit' => !is_null($this->Blog) ? $this->Blog->get_setting('what_to_show') : 'posts', 'posts' => $this->limit, 'page' => 1, 'featured' => NULL));
}
示例7: unset
$login = $_POST['login'];
$pass = $_POST['pwd'];
unset($_POST['pwd']);
// password will be hashed below
} elseif (isset($_GET['login'])) {
// Trying to log in with a GET; we might only provide a user here.
$login = $_GET['login'];
$pass = isset($_GET['pwd']) ? $_GET['pwd'] : '';
unset($_GET['pwd']);
// password will be hashed below
}
$Debuglog->add('login: ' . var_export($login, true), 'login');
$Debuglog->add('pass: ' . (empty($pass) ? '' : 'not') . ' empty', 'login');
// either 'login' (normal) or 'redirect_to_backoffice' may be set here. This also helps to display the login form again, if either login or pass were empty.
$login_action = param_arrayindex('login_action');
$UserCache =& get_Cache('UserCache');
if (!empty($login_action) || !empty($login) && !empty($pass)) {
// User is trying to login right now
$Debuglog->add('User is trying to log in.', 'login');
header_nocache();
// Note: login and password cannot include '<' !
$login = strtolower(strip_tags(remove_magic_quotes($login)));
$pass = strip_tags(remove_magic_quotes($pass));
$pass_md5 = md5($pass);
/*
* Handle javascript-hashed password:
* If possible, the login form will hash the entered password with a salt that changes everytime.
*/
param('pwd_salt', 'string', '');
// just for comparison with the one from Session
$pwd_salt_sess = $Session->get('core.pwd_salt');
示例8: item_ink_by_urltitle
/**
* Template tag: Link to an item identified by its url title / slug / name
*
* Note: this will query the database. Thus, in most situations it will make more sense
* to use a hardcoded link. This tag can be useful for prototyping location independant
* sites.
*/
function item_ink_by_urltitle($params = array())
{
// Make sure we are not missing any param:
$params = array_merge(array('urltitle' => NULL, 'before' => ' ', 'after' => ' ', 'text' => '#'), $params);
/**
* @var ItemCache
*/
$ItemCache =& get_Cache('ItemCache');
/**
* @var Item
*/
$Item =& $ItemCache->get_by_urltitle($params['urltitle'], false);
if (empty($Item)) {
return false;
}
$Item->permanent_link($params);
}
示例9: trackback_response
}
if (!empty($_GET['__mode'])) {
// some MT extension (AFAIK), that we do not support
return;
}
if (empty($tb_id)) {
trackback_response(1, 'No trackback post ID given.');
// exits
}
if (empty($url)) {
trackback_response(1, 'No url to your permanent entry given.');
// exits
}
@header('Content-Type: text/xml');
$comment_post_ID = $tb_id;
$ItemCache =& get_Cache('ItemCache');
$commented_Item =& $ItemCache->get_by_ID($comment_post_ID);
if (!($Blog =& $commented_Item->get_Blog())) {
trackback_response(1, 'Sorry, could not get the post\'s weblog.');
// exits
}
if (!$Blog->get('allowtrackbacks')) {
trackback_response(1, 'Sorry, this weblog does not allow you to trackback its posts.');
// exits
}
// Commented out again, because it's comment specific: if( ! $commented_Item->can_comment( NULL ) )
// "BeforeTrackbackInsert" should be hooked instead!
if ($commented_Item->comment_status != 'open') {
trackback_response(1, 'Sorry, this item does not accept trackbacks.');
// exits
}
示例10: FileRoot
/**
* Constructor
*
* Will fail if non existent User or Blog is requested.
* But specific access permissions on (threfore existence of) this User or Blog should have been tested before anyway.
*
* @param string Root type: 'user', 'group' or 'collection'
* @param integer ID of the user, the group or the collection the file belongs to...
* @param boolean Create the directory, if it does not exist yet?
*/
function FileRoot($root_type, $root_in_type_ID, $create = true)
{
// Store type:
$this->type = $root_type;
// Store ID in type:
$this->in_type_ID = $root_in_type_ID;
// Generate unique ID:
$this->ID = FileRoot::gen_ID($root_type, $root_in_type_ID);
switch ($root_type) {
case 'user':
$UserCache =& get_Cache('UserCache');
$User =& $UserCache->get_by_ID($root_in_type_ID);
$this->name = $User->get('preferredname');
//.' ('. /* TRANS: short for "user" */ T_('u').')';
$this->ads_path = $User->get_media_dir($create);
$this->ads_url = $User->get_media_url();
return;
case 'collection':
$BlogCache =& get_Cache('BlogCache');
/**
* @var Blog
*/
$Blog =& $BlogCache->get_by_ID($root_in_type_ID);
$this->name = $Blog->get('shortname');
//.' ('. /* TRANS: short for "blog" */ T_('b').')';
$this->ads_path = $Blog->get_media_dir($create);
$this->ads_url = $Blog->get_media_url();
return;
case 'skins':
// fp> some stuff here should go out of here... but I don't know where to put it yet. I'll see after the Skin refactoring.
global $Settings, $Debuglog;
/**
* @var User
*/
global $current_User;
if (!$Settings->get('fm_enable_roots_skins')) {
// Skins root is disabled:
$Debuglog->add('Attempt to access skins dir, but this feature is globally disabled', 'files');
} elseif (!$current_User->check_perm('templates')) {
// No perm to access templates:
$Debuglog->add('Attempt to access skins dir, but no permission', 'files');
} else {
global $skins_path, $skins_url;
$this->name = T_('Skins');
$this->ads_path = $skins_path;
$this->ads_url = $skins_url;
}
return;
}
debug_die("Root_type={$root_type} not supported");
}
示例11: die
* @todo Currently if you change the name of a blog it gets not reflected in the blog list buttons!
*
* @version $Id: coll_settings.ctrl.php,v 1.11 2008/01/21 09:35:26 fplanque Exp $
*/
if (!defined('EVO_MAIN_INIT')) {
die('Please, do not access this page directly.');
}
param_action('edit');
param('tab', 'string', 'general', true);
// Check permissions on requested blog and autoselect an appropriate blog if necessary.
// This will prevent a fat error when switching tabs and you have restricted perms on blog properties.
if ($selected = autoselect_blog('blog_properties', 'edit')) {
// We have a blog to work on:
if (set_working_blog($selected)) {
// Selected a new blog:
$BlogCache =& get_Cache('BlogCache');
$Blog =& $BlogCache->get_by_ID($blog);
}
/**
* @var Blog
*/
$edited_Blog =& $Blog;
} else {
// We could not find a blog we have edit perms on...
// Note: we may still have permission to edit categories!!
// redirect to blog list:
header_redirect('?ctrl=collections');
// EXITED:
$Messages->add(T_('Sorry, you have no permission to edit blog properties.'), 'error');
$action = 'nil';
$tab = '';
示例12: autoselect_blog
/**
* Check permissions on a given blog (by ID) and autoselect an appropriate blog
* if necessary.
*
* For use in admin
*
* NOTE: we no longer try to set $Blog inside of the function because later global use cannot be safely guaranteed in PHP4.
*
* @param string Permission name that must be given to the {@link $current_User} object.
* @param string Permission level that must be given to the {@link $current_User} object.
* @return integer new selected blog
*/
function autoselect_blog($permname, $permlevel = 'any')
{
global $blog;
/**
* @var User
*/
global $current_User;
$autoselected_blog = $blog;
if ($autoselected_blog) {
// a blog is already selected
if (!$current_User->check_perm($permname, $permlevel, false, $autoselected_blog)) {
// invalid blog
// echo 'current blog was invalid';
$autoselected_blog = 0;
}
}
if (!$autoselected_blog) {
// No blog is selected so far (or selection was invalid)...
// Let's try to find another one:
/**
* @var BlogCache
*/
$BlogCache =& get_Cache('BlogCache');
// Get first suitable blog
$blog_array = $BlogCache->load_user_blogs($permname, $permlevel, $current_User->ID, 'ID', 1);
if (!empty($blog_array)) {
$autoselected_blog = $blog_array[0];
}
}
return $autoselected_blog;
}
示例13: ItemListLight
/**
* Constructor
*
* @todo add param for saved session filter set
*
* @param Blog
* @param mixed Default filter set: Do not show posts before this timestamp, can be 'now'
* @param mixed Default filter set: Do not show posts after this timestamp, can be 'now'
* @param integer|NULL Limit
* @param string name of cache to be used (for table prefix info)
* @param string prefix to differentiate page/order params when multiple Results appear one same page
* @param array restrictions for itemlist (position, contact, firm, ...) key: restriction name, value: ID of the restriction
*/
function ItemListLight(&$Blog, $timestamp_min = NULL, $timestamp_max = NULL, $limit = 20, $cache_name = 'ItemCacheLight', $param_prefix = '', $filterset_name = '', $restrict_to = array())
{
global $Settings;
// Call parent constructor:
parent::DataObjectList2(get_Cache($cache_name), $limit, $param_prefix, NULL);
// The SQL Query object:
$this->ItemQuery =& new ItemQuery($this->Cache->dbtablename, $this->Cache->dbprefix, $this->Cache->dbIDname);
$this->Blog =& $Blog;
if (!empty($filterset_name)) {
// Set the filterset_name with the filterset_name param
$this->filterset_name = 'ItemList_filters_' . $filterset_name;
} else {
// Set a generic filterset_name
$this->filterset_name = 'ItemList_filters_coll' . $this->Blog->ID;
}
$this->page_param = $param_prefix . 'paged';
$this->restrict_to = $restrict_to;
// Initialize the default filter set:
$this->set_default_filters(array('filter_preset' => NULL, 'ts_min' => $timestamp_min, 'ts_max' => $timestamp_max, 'ts_created_max' => NULL, 'cat_array' => array(), 'cat_modifier' => NULL, 'cat_focus' => 'wide', 'tags' => NULL, 'authors' => NULL, 'assignees' => NULL, 'author_assignee' => NULL, 'lc' => 'all', 'keywords' => NULL, 'phrase' => 'AND', 'exact' => 0, 'post_ID' => NULL, 'post_ID_list' => NULL, 'post_title' => NULL, 'ymdhms' => NULL, 'week' => NULL, 'ymdhms_min' => NULL, 'ymdhms_max' => NULL, 'statuses' => NULL, 'types' => '-1000', 'visibility_array' => array('published', 'protected', 'private'), 'orderby' => $this->Blog->get_setting('orderby'), 'order' => $this->Blog->get_setting('orderdir'), 'unit' => $this->Blog->get_setting('what_to_show'), 'posts' => $this->limit, 'page' => 1));
}
示例14: get_oauth_info
function get_oauth_info($params = array())
{
$params = array_merge(array('type' => '', 'ID' => '', 'blog_ID' => '', 'user_ID' => ''), $params);
if ($params['type'] == 'blog') {
// Get from CollSettings
$blog_ID = $params['ID'];
$try_user = false;
} elseif ($params['type'] == 'user') {
// Get from UserSettings
$user_ID = $params['ID'];
$try_user = true;
} else {
// Get from any
$blog_ID = $params['blog_ID'];
$user_ID = $params['user_ID'];
$try_user = true;
}
$r = array();
if (!empty($blog_ID)) {
// CollSettings
$BlogCache =& get_Cache('BlogCache');
$Blog =& $BlogCache->get_by_ID($blog_ID, false, false);
if (!empty($Blog)) {
$r['token'] = $this->get_coll_setting('twitter_token', $Blog);
if (!empty($r['token'])) {
// There is already a linked twitter user in this Blog, get token secret
$r['token_secret'] = $this->get_coll_setting('twitter_secret', $Blog);
$r['contact'] = $this->get_coll_setting('twitter_contact', $Blog);
$r['msg_format'] = $this->get_coll_setting('twitter_msg_format', $Blog);
$try_user = false;
// Do not overwrite
}
}
}
if ($try_user && !empty($user_ID)) {
// UserSettings
$r['token'] = $this->UserSettings->get('twitter_token', $user_ID);
if (!empty($r['token'])) {
// There is already a linked twitter user in this User, get token secret
$r['token_secret'] = $this->UserSettings->get('twitter_secret', $user_ID);
$r['contact'] = $this->UserSettings->get('twitter_contact', $user_ID);
$r['msg_format'] = $this->UserSettings->get('twitter_msg_format', $user_ID);
}
}
return $r;
}
示例15: init
/**
* Get an array of registered users and guests.
*
* @return array containing number of registered users and guests ('registered' and 'guests')
*/
function init()
{
if ($this->_initialized) {
return true;
}
global $DB, $localtimenow, $timeout_online_user;
$this->_count_guests = 0;
$this->_registered_Users = array();
$timeout_YMD = date('Y-m-d H:i:s', $localtimenow - $timeout_online_user);
$UserCache =& get_Cache('UserCache');
// We get all sessions that have been seen in $timeout_YMD and that have a session key.
// NOTE: we do not use DISTINCT here, because guest users are all "NULL".
foreach ($DB->get_results("\r\n\t\t\tSELECT sess_user_ID\r\n\t\t\t FROM T_sessions\r\n\t\t\t WHERE sess_lastseen > '" . $timeout_YMD . "'\r\n\t\t\t AND sess_key IS NOT NULL", OBJECT, 'Sessions: get list of relevant users.') as $row) {
if (!empty($row->sess_user_ID) && ($User =& $UserCache->get_by_ID($row->sess_user_ID))) {
// assign by ID so that each user is only counted once (he could use multiple user agents at the same time)
$this->_registered_Users[$User->ID] =& $User;
if (!$User->showonline) {
$this->_count_guests++;
}
} else {
$this->_count_guests++;
}
}
$this->_initialized = true;
}