本文整理汇总了PHP中ipsRegistry::setClass方法的典型用法代码示例。如果您正苦于以下问题:PHP ipsRegistry::setClass方法的具体用法?PHP ipsRegistry::setClass怎么用?PHP ipsRegistry::setClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ipsRegistry
的用法示例。
在下文中一共展示了ipsRegistry::setClass方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor
*
* @return @e void
*/
public function __construct(ipsRegistry $registry)
{
/* Hard limit - not used in Sphinx but may need to revisit if we bust IN()s */
//IPSSearchRegistry::set('set.hardLimit', ( ipsRegistry::$settings['search_hardlimit'] ) ? ipsRegistry::$settings['search_hardlimit'] : 200 );
/* Get class forums, used for displaying forum names on results */
if (ipsRegistry::isClassLoaded('class_forums') !== TRUE) {
$classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('forums') . "/sources/classes/forums/class_forums.php", 'class_forums', 'forums');
ipsRegistry::setClass('class_forums', new $classToLoad(ipsRegistry::instance()));
ipsRegistry::getClass('class_forums')->strip_invisible = 1;
ipsRegistry::getClass('class_forums')->forumsInit();
}
/* Get live or archive */
$this->searchArchives = ipsRegistry::$request['search_app_filters']['forums']['liveOrArchive'] == 'archive' ? true : false;
if ($this->searchArchives) {
/* Load up archive class */
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/archive/reader.php', 'classes_archive_reader');
$this->archiveReader = new $classToLoad();
$this->archiveReader->setApp('forums');
$this->table = $this->archiveReader->getFields();
$this->table['_table_'] = 'forums_archive_posts';
$this->table['_prefix_'] = 'p.archive_';
$this->table['forums_search_posts_main'] = 'forums_search_archive_main';
$this->table['forums_search_posts_delta'] = 'forums_search_archive_delta';
/* disable max days search */
$this->settings['search_ucontent_days'] = 0;
} else {
$this->table = array('_table_' => 'posts', '_prefix_' => 'p.', 'pid' => 'pid', 'author_id' => 'author_id', 'author_name' => 'author_name', 'ip_address' => 'ip_address', 'post_date' => 'post_date', 'post' => 'post', 'queued' => 'queued', 'topic_id' => 'topic_id', 'new_topic' => 'new_topic', 'post_bwoptions' => 'post_bwoptions', 'post_key' => 'post_key', 'post_htmlstate' => 'post_htmlstate', 'use_sig' => 'use_sig', 'use_emo' => 'use_emo', 'append_edit' => 'append_edit', 'edit_time' => 'edit_time', 'edit_name' => 'edit_name', 'post_edit_reason' => 'post_edit_reason', 'forums_search_posts_main' => 'forums_search_posts_main', 'forums_search_posts_delta' => 'forums_search_posts_delta');
}
parent::__construct($registry);
}
示例2: __construct
/**
* Constructor
*
* @return @e void
*/
public function __construct(ipsRegistry $registry)
{
/* Get class forums, used for displaying forum names on results */
if (ipsRegistry::isClassLoaded('class_forums') !== TRUE) {
$classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('forums') . "/sources/classes/forums/class_forums.php", 'class_forums', 'forums');
ipsRegistry::setClass('class_forums', new $classToLoad(ipsRegistry::instance()));
ipsRegistry::getClass('class_forums')->strip_invisible = 1;
ipsRegistry::getClass('class_forums')->forumsInit();
}
/* Load tagging stuff */
if (!$registry->isClassLoaded('tags')) {
require_once IPS_ROOT_PATH . 'sources/classes/tags/bootstrap.php';
/*noLibHook*/
$registry->setClass('tags', classes_tags_bootstrap::run('forums', 'topics'));
}
/* Get live or archive */
$this->searchArchives = ipsRegistry::$request['search_app_filters']['forums']['liveOrArchive'] == 'archive' ? true : false;
if ($this->searchArchives) {
/* Load up archive class */
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/archive/reader.php', 'classes_archive_reader');
$this->archiveReader = new $classToLoad();
$this->archiveReader->setApp('forums');
$this->table = $this->archiveReader->getFields();
$this->table['_table_'] = 'forums_archive_posts';
$this->table['_prefix_'] = 'p.archive_';
} else {
$this->table = array('_table_' => 'posts', '_prefix_' => 'p.', 'pid' => 'pid', 'author_id' => 'author_id', 'author_name' => 'author_name', 'ip_address' => 'ip_address', 'post_date' => 'post_date', 'post' => 'post', 'queued' => 'queued', 'topic_id' => 'topic_id', 'new_topic' => 'new_topic', 'post_bwoptions' => 'post_bwoptions', 'post_key' => 'post_key', 'post_htmlstate' => 'post_htmlstate', 'use_sig' => 'use_sig', 'use_emo' => 'use_emo', 'append_edit' => 'append_edit', 'edit_time' => 'edit_time', 'edit_name' => 'edit_name', 'post_edit_reason' => 'post_edit_reason');
}
parent::__construct($registry);
/* Set up wrapper */
$this->templates = array('group' => 'search', 'template' => 'searchResultsAsForum');
}
示例3: __construct
/**
* Constructor
*
* @access public
* @param object ipsRegistry
* @return void
*/
public function __construct(ipsRegistry $registry)
{
//-----------------------------------------
// Could potentially be setup from sessions
//-----------------------------------------
if (!$registry->isClassLoaded('ccsFunctions')) {
require_once IPSLib::getAppDir('ccs') . '/sources/functions.php';
$registry->setClass('ccsFunctions', new ccsFunctions($registry));
}
}
示例4: __construct
/**
* Constructor
*/
public function __construct()
{
/* Init attachments */
$classname = IPSLib::loadLibrary(IPSLib::getAppDir('core') . '/sources/classes/attach/class_attach.php', 'class_attach');
$this->class_attach = new $classname(ipsRegistry::instance());
ipsRegistry::getClass('class_localization')->loadLanguageFile(array('public_topic'), 'forums');
$this->class_attach->type = 'post';
$this->class_attach->init();
$this->class_attach->getUploadFormSettings();
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/class_reputation_cache.php', 'classReputationCache');
ipsRegistry::setClass('repCache', new $classToLoad());
}
示例5: __construct
/**
* CONSTRUCTOR
*
* @access public
* @param object ipsRegistry reference
* @return void
*/
public function __construct(ipsRegistry $registry)
{
//-----------------------------------------
// Set IPS CLASS
//-----------------------------------------
$this->registry = $registry;
$this->request = $this->registry->fetchRequest();
/* Load the Blog functions library */
require_once IPS_ROOT_PATH . 'applications_addon/ips/blog/sources/lib/lib_blogfunctions.php';
$registry->setClass('blog_std', new blogFunctions($registry));
//-----------------------------------------
// Load allowed methods and build dispatch
// list
//-----------------------------------------
require_once DOC_IPS_ROOT_PATH . 'interface/blog/apis/methods_metaweblog.php';
if (is_array($_METAWEBLOG_ALLOWED_METHODS) and count($_METAWEBLOG_ALLOWED_METHODS)) {
foreach ($_METAWEBLOG_ALLOWED_METHODS as $_method => $_data) {
$this->__dispatch_map[$_method] = $_data;
}
}
}
示例6: getHtml
/**
* Retuns the html for displaying the forum category filter on the advanced search page
*
* @return string Filter HTML
*/
public function getHtml()
{
/* Make sure class_forums is setup */
if (ipsRegistry::isClassLoaded('class_forums') !== TRUE) {
$classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('forums') . "/sources/classes/forums/class_forums.php", 'class_forums', 'forums');
ipsRegistry::setClass('class_forums', new $classToLoad(ipsRegistry::instance()));
}
ipsRegistry::getClass('class_forums')->strip_invisible = 1;
ipsRegistry::getClass('class_forums')->forumsInit();
/* Got any archived content? */
$canSearchArchives = false;
if ($this->settings['archive_on']) {
$canSearchArchives = true;
if (($this->settings['search_method'] == 'traditional' || $this->settings['search_method'] == 'sql') && $this->settings['archive_remote_sql_database']) {
$canSearchArchives = false;
}
}
$topic = NULL;
if ($this->request['cType'] == 'topic') {
$this->request['cId'] = intval($this->request['cId']);
$topic = ipsRegistry::DB()->buildAndFetch(array('select' => '*', 'from' => 'topics', 'where' => "tid={$this->request['cId']}"));
}
return array('title' => IPSLib::getAppTitle('forums'), 'html' => ipsRegistry::getClass('output')->getTemplate('search')->forumAdvancedSearchFilters(ipsRegistry::getClass('class_forums')->buildForumJump(0, 1, 0, (isset($this->request['cId']) and $this->request['cType'] == 'forum') ? array($this->request['cId']) : array()), $canSearchArchives, $topic));
}
示例7: doExecute
//.........这里部分代码省略.........
foreach ($this->request['field_' . $id] as $k => $v) {
$query[] = "p.field_{$id} LIKE '%|{$k}|%'";
}
}
} else {
$query[] = $this->custom_fields->cache_data[$id]['pf_search_type'] == 'loose' ? "p.field_{$id} LIKE '%" . $this->request['field_' . $id] . "%'" : "p.field_{$id} = '" . $this->request['field_' . $id] . "'";
}
}
}
}
}
//-----------------------------------------
// Rating..
//-----------------------------------------
if ($pp_rating_real) {
$_queryPP = true;
$query[] = "pp.pp_rating_real > " . $pp_rating_real;
$url['pp_rating_real'] = "pp_rating_real=" . $pp_rating_real;
}
//-----------------------------------------
// Finish query
//-----------------------------------------
//$query[] = "m.members_l_display_name != ''";
$joins = array();
if ($_queryPP) {
$joins[] = array('from' => array('pfields_content' => 'p'), 'where' => 'p.member_id=m.member_id', 'type' => 'left');
$joins[] = array('from' => array('profile_portal' => 'pp'), 'where' => 'pp.pp_member_id=m.member_id', 'type' => 'left');
}
//-----------------------------------------
// Reputation
//-----------------------------------------
if (!ipsRegistry::isClassLoaded('repCache')) {
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/class_reputation_cache.php', 'classReputationCache');
ipsRegistry::setClass('repCache', new $classToLoad());
}
//-----------------------------------------
// START THE LISTING
//-----------------------------------------
$notInMembers = 0;
foreach ($query as $q) {
if (!strstr($q, 'm.')) {
$notInMembers++;
}
}
/* Get the count */
if ($notInMembers > 0 or $this->sort_key != 'members_l_display_name' or $this->request['request_method'] == 'post') {
$_max = $this->DB->buildAndFetch(array('select' => 'COUNT( * ) as cnt', 'from' => array('members' => 'm'), 'where' => implode(" AND ", $query), 'add_join' => $joins));
$this->DB->build(array('select' => ' m.member_id', 'from' => array('members' => 'm'), 'where' => implode(" AND ", $query), 'order' => 'm.' . $this->sort_key . ' ' . $this->sort_order, 'limit' => array($this->first, $this->max_results), 'add_join' => $joins));
} else {
$_max = $this->DB->buildAndFetch(array('select' => 'COUNT( * ) as cnt', 'from' => 'members m', 'where' => implode(" AND ", $query)));
$this->DB->build(array('select' => 'm.member_id', 'from' => array('members' => 'm'), 'where' => implode(" AND ", $query), 'order' => 'm.' . $this->sort_key . ' ' . $this->sort_order, 'limit' => array($this->first, $this->max_results)));
}
/* Fetch IDs */
$mids = array();
$this->DB->execute();
while ($m = $this->DB->fetch()) {
if ($m['member_id']) {
$mids[] = $m['member_id'];
}
}
if (count($mids)) {
$members = array();
$_members = IPSMember::load($mids, 'all');
/* Make sure that we keep the ordering from the query */
foreach ($mids as $id) {
$members[$id] = $_members[$id];
示例8: init
//.........这里部分代码省略.........
// Do we have one yet?
//-----------------------------------------
foreach ($addrs as $ip) {
//-----------------------------------------
// IP v4
//-----------------------------------------
if (IPSLib::validateIPv4($ip)) {
self::instance()->ip_address = $ip;
break;
} else {
if (IPSLib::validateIPv6($ip)) {
self::instance()->ip_address = $ip;
break;
}
}
}
//-----------------------------------------
// Make sure we take a valid IP address
//-----------------------------------------
if (!self::instance()->ip_address and !isset($_SERVER['SHELL']) and $_SERVER['SESSIONNAME'] != 'Console') {
if (!defined('IPS_IS_SHELL') or !IPS_IS_SHELL) {
print "Could not determine your IP address";
exit;
}
}
//-----------------------------------------
// Get user-agent, browser and OS
//-----------------------------------------
self::instance()->user_agent = IPSText::parseCleanValue(my_getenv('HTTP_USER_AGENT'));
self::instance()->operating_system = self::_fetch_os();
if (IPS_AREA == 'admin') {
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/session/adminSessions.php', 'adminSessions');
/**
* Support for extending the session class
*/
if (is_file(IPS_ROOT_PATH . "sources/classes/session/ssoAdminSessions.php")) {
$classToLoadA = IPSLib::loadLibrary(IPS_ROOT_PATH . "sources/classes/session/ssoAdminSessions.php", 'ssoAdminSessions');
/**
* Does the ssoAdminSessions class exist?
*/
if (class_exists($classToLoadA)) {
$parent = get_parent_class($classToLoadA);
/**
* Is it a child of adminSessions
*/
if ($parent == $classToLoad) {
self::$session_class = new $classToLoadA();
} else {
self::$session_class = new $classToLoad();
}
}
} else {
self::$session_class = new $classToLoad();
}
} else {
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/session/publicSessions.php', 'publicSessions');
/**
* Support for extending the session class
*/
if (is_file(IPS_ROOT_PATH . "sources/classes/session/ssoPublicSessions.php")) {
$classToLoadA = IPSLib::loadLibrary(IPS_ROOT_PATH . "sources/classes/session/ssoPublicSessions.php", 'ssoPublicSessions');
/**
* Does the ssoPublicSessions class exist?
*/
if (class_exists($classToLoadA)) {
$parent = get_parent_class($classToLoadA);
/**
* Is it a child of publicSessions
*/
if ($parent == $classToLoad) {
self::$session_class = new $classToLoadA();
} else {
self::$session_class = new $classToLoad();
}
}
} else {
self::$session_class = new $classToLoad();
}
//-----------------------------------------
// Set other
//-----------------------------------------
self::$data_store['publicSessionID'] = self::$session_class->session_data['id'];
}
//-----------------------------------------
// Set user agent
//-----------------------------------------
$_cookie = IPSCookie::get("uagent_bypass");
self::$data_store['userAgentKey'] = isset(self::$session_class->session_data['uagent_key']) ? self::$session_class->session_data['uagent_key'] : '';
self::$data_store['userAgentType'] = isset(self::$data_store['uagent_type']) ? self::$data_store['uagent_type'] : self::$session_class->session_data['uagent_type'];
self::$data_store['userAgentVersion'] = isset(self::$session_class->session_data['uagent_version']) ? self::$session_class->session_data['uagent_version'] : '';
self::$data_store['userAgentBypass'] = $_cookie ? true : (isset(self::$session_class->session_data['uagent_bypass']) ? self::$session_class->session_data['uagent_bypass'] : '');
self::$data_store['forumsModeratorData'] = array();
/* Some mobile app set up */
if (self::$data_store['userAgentType'] == 'mobileApp') {
/* This converts non UTF-8 POST/GET data in __construct */
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . '/sources/base/ipsMobileApp.php', 'ipsMobileApp');
ipsRegistry::setClass('isMobileApp', new $classToLoad());
}
}
}
示例9: buildDisplayData
//.........这里部分代码省略.........
}
if (stripos($member['pp_bio_content'], '[i]') !== false) {
if (stripos($member['pp_bio_content'], '[/i]') > stripos($member['pp_bio_content'], '[i]')) {
$member['pp_bio_content'] = str_ireplace('[i]', '<em>', $member['pp_bio_content']);
$member['pp_bio_content'] = str_ireplace('[/i]', '</em>', $member['pp_bio_content']);
}
}
if (stripos($member['pp_bio_content'], '[u]') !== false) {
if (stripos($member['pp_bio_content'], '[/u]') > stripos($member['pp_bio_content'], '[u]')) {
$member['pp_bio_content'] = str_ireplace('[u]', '<span class="underscore">', $member['pp_bio_content']);
$member['pp_bio_content'] = str_ireplace('[/u]', '</span>', $member['pp_bio_content']);
}
}
//-----------------------------------------
// Signature bbcode
//-----------------------------------------
if (isset($member['signature']) and $member['signature'] and $parseFlags['signature']) {
if (isset(self::$_parsedSignatures[$member['member_id']])) {
$member['signature'] = self::$_parsedSignatures[$member['member_id']];
} else {
if ($member['cache_content']) {
$member['signature'] = '<!--cached-' . gmdate('r', $member['cache_updated']) . '-->' . $member['cache_content'];
} else {
IPSText::getTextClass('bbcode')->parse_bbcode = ipsRegistry::$settings['sig_allow_ibc'];
IPSText::getTextClass('bbcode')->parse_smilies = 1;
IPSText::getTextClass('bbcode')->parse_html = ipsRegistry::$settings['sig_allow_html'];
IPSText::getTextClass('bbcode')->parse_nl2br = 1;
IPSText::getTextClass('bbcode')->parsing_section = 'signatures';
IPSText::getTextClass('bbcode')->parsing_mgroup = $member['member_group_id'];
IPSText::getTextClass('bbcode')->parsing_mgroup_others = $member['mgroup_others'];
$member['signature'] = IPSText::getTextClass('bbcode')->preDisplayParse($member['signature']);
IPSContentCache::update($member['member_id'], 'sig', $member['signature']);
}
self::$_parsedSignatures[$member['member_id']] = $member['signature'];
}
}
//-----------------------------------------
// If current session, reset last_activity
//-----------------------------------------
if (!empty($member['running_time'])) {
$member['last_activity'] = $member['running_time'] > $member['last_activity'] ? $member['running_time'] : $member['last_activity'];
}
//-----------------------------------------
// Online?
//-----------------------------------------
$time_limit = time() - ipsRegistry::$settings['au_cutoff'] * 60;
$member['_online'] = 0;
if (!ipsRegistry::$settings['disable_anonymous'] and isset($member['login_anonymous'])) {
list($be_anon, $loggedin) = explode('&', $member['login_anonymous']);
} else {
$be_anon = 0;
$loggedin = $member['last_activity'] > $time_limit ? 1 : 0;
}
$bypass_anon = 0;
$our_mgroups = array();
if (ipsRegistry::member()->getProperty('mgroup_others')) {
$our_mgroups = explode(",", IPSText::cleanPermString(ipsRegistry::member()->getProperty('mgroup_others')));
}
$our_mgroups[] = ipsRegistry::member()->getProperty('member_group_id');
if (ipsRegistry::member()->getProperty('g_access_cp') and !ipsRegistry::$settings['disable_admin_anon']) {
$bypass_anon = 1;
}
if (($member['last_visit'] > $time_limit or $member['last_activity'] > $time_limit) and ($be_anon != 1 or $bypass_anon == 1) and $loggedin == 1) {
$member['_online'] = 1;
}
//-----------------------------------------
// Last Active
//-----------------------------------------
$member['_last_active'] = ipsRegistry::getClass('class_localization')->getDate($member['last_activity'], 'SHORT');
if ($be_anon == 1) {
// Member last logged in anonymous
if (!ipsRegistry::member()->getProperty('g_access_cp') or ipsRegistry::$settings['disable_admin_anon']) {
$member['_last_active'] = ipsRegistry::getClass('class_localization')->words['private'];
}
}
//-----------------------------------------
// Rating
//-----------------------------------------
$member['_pp_rating_real'] = intval($member['pp_rating_real']);
//-----------------------------------------
// Long display names
//-----------------------------------------
$member['members_display_name_short'] = IPSText::truncate($member['members_display_name'], 16);
//-----------------------------------------
// Reputation
//-----------------------------------------
if (!ipsRegistry::isClassLoaded('repCache')) {
require_once IPS_ROOT_PATH . 'sources/classes/class_reputation_cache.php';
ipsRegistry::setClass('repCache', new classReputationCache());
}
$member['pp_reputation_points'] = $member['pp_reputation_points'] ? $member['pp_reputation_points'] : 0;
$member['author_reputation'] = ipsRegistry::getClass('repCache')->getReputation($member['pp_reputation_points']);
//-----------------------------------------
// Other stuff not worthy of individual comments
//-----------------------------------------
$member['members_profile_views'] = isset($member['members_profile_views']) ? $member['members_profile_views'] : 0;
$member['_pp_profile_views'] = ipsRegistry::getClass('class_localization')->formatNumber($member['members_profile_views']);
IPSDebug::setMemoryDebugFlag("IPSMember::buildDisplayData: " . $member['member_id'] . " - Completed", $_NOW);
return $member;
}
示例10: buildDisplayData
//.........这里部分代码省略.........
if (isset(self::$_parsedSignatures[$member['member_id']])) {
$member['signature'] = self::$_parsedSignatures[$member['member_id']];
} else {
if ($member['cache_content']) {
$member['signature'] = '<!--signature-cached-' . gmdate('r', $member['cache_updated']) . '-->' . $member['cache_content'];
} else {
/* Grab the parser file */
if (self::$_sigParser === null) {
/* Load parser */
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/text/parser.php', 'classes_text_parser');
self::$_sigParser = new $classToLoad();
}
/* set up parser */
self::$_sigParser->set(array('memberData' => $member, 'parseBBCode' => 1, 'parseHtml' => $group_cache[$member['member_group_id']]['g_dohtml'] && $member['bw_html_sig'], 'parseEmoticons' => 1, 'parseArea' => 'signatures'));
$member['signature'] = self::$_sigParser->display($member['signature']);
IPSContentCache::update($member['member_id'], 'sig', $member['signature']);
}
self::$_parsedSignatures[$member['member_id']] = $member['signature'];
}
}
//-----------------------------------------
// If current session, reset last_activity
//-----------------------------------------
if (!empty($member['running_time'])) {
$member['last_activity'] = $member['running_time'] > $member['last_activity'] ? $member['running_time'] : $member['last_activity'];
}
//-----------------------------------------
// Online?
//-----------------------------------------
$time_limit = time() - ipsRegistry::$settings['au_cutoff'] * 60;
$member['_online'] = 0;
$bypass_anon = ipsRegistry::member()->getProperty('g_access_cp') ? 1 : 0;
list($be_anon, $loggedin) = explode('&', empty($member['login_anonymous']) ? '0&0' : $member['login_anonymous']);
/* Is not anon but the group might be forced to? */
if (empty($be_anon) && self::isLoggedInAnon($member)) {
$be_anon = 1;
}
/* Finally set the online flag */
if (($member['last_visit'] > $time_limit or $member['last_activity'] > $time_limit) and ($be_anon != 1 or $bypass_anon == 1) and $loggedin == 1) {
$member['_online'] = 1;
}
//-----------------------------------------
// Last Active
//-----------------------------------------
$member['_last_active'] = ipsRegistry::getClass('class_localization')->getDate($member['last_activity'], 'SHORT');
// Member last logged in anonymous ?
if ($be_anon == 1 && !ipsRegistry::member()->getProperty('g_access_cp')) {
$member['_last_active'] = ipsRegistry::getClass('class_localization')->words['private'];
}
//-----------------------------------------
// Rating
//-----------------------------------------
$member['_pp_rating_real'] = intval($member['pp_rating_real']);
//-----------------------------------------
// Display name formatted
//-----------------------------------------
$member['members_display_name_formatted'] = self::makeNameFormatted($member['members_display_name'], $member['member_id'] ? $member['member_group_id'] : ipsRegistry::$settings['guest_group']);
//-----------------------------------------
// Long display names
//-----------------------------------------
$member['members_display_name_short'] = IPSText::truncate($member['members_display_name'], 16);
//-----------------------------------------
// Reputation
//-----------------------------------------
$member['pp_reputation_points'] = $member['pp_reputation_points'] ? $member['pp_reputation_points'] : 0;
if ($parseFlags['reputation'] and $member['member_id']) {
if (!ipsRegistry::isClassLoaded('repCache')) {
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/class_reputation_cache.php', 'classReputationCache');
ipsRegistry::setClass('repCache', new $classToLoad());
}
$member['author_reputation'] = ipsRegistry::getClass('repCache')->getReputation($member['pp_reputation_points']);
}
//-----------------------------------------
// Other stuff not worthy of individual comments
//-----------------------------------------
$member['members_profile_views'] = isset($member['members_profile_views']) ? $member['members_profile_views'] : 0;
/* BG customization */
if ($member['pp_customization'] and !empty($member['gbw_allow_customization']) and !$member['bw_disable_customization']) {
$member['customization'] = IPSLib::safeUnserialize($member['pp_customization']);
if (is_array($member['customization'])) {
/* Figure out BG URL */
if ($member['customization']['type'] == 'url' and $member['customization']['bg_url'] and $member['gbw_allow_url_bgimage']) {
$member['customization']['_bgUrl'] = $member['customization']['bg_url'];
} else {
if ($member['customization']['type'] == 'upload' and $member['customization']['bg_url'] and $member['gbw_allow_upload_bgimage']) {
$member['customization']['_bgUrl'] = ipsRegistry::$settings['upload_url'] . '/' . $member['customization']['bg_url'];
} else {
if ($member['customization']['bg_color']) {
$member['customization']['type'] = 'bgColor';
}
}
}
}
}
/* Title is ambigious */
$member['member_title'] = $member['title'];
IPSDebug::setMemoryDebugFlag("IPSMember::buildDisplayData: " . $member['member_id'] . " - Completed", $_NOW);
$buildMembers[$_key] = $member;
return $member;
}
示例11: modifySearchQuery
/**
* Modify the search query
*
* @access public
* @param array $query The current unmodified query
* @param bool [$count_only] Set to true if this is a count(*) query
* @return array Search query, modified by the plugin
**/
public function modifySearchQuery($query, $count_only = false)
{
if (ipsRegistry::$settings['search_method'] == 'sphinx') {
$query->SetFilter('approved', array(1));
$query->SetFilter('queued', array(0));
$query->SetFilter('password', array(0));
if (isset(ipsRegistry::$request['search_app_filters']['forums']['forums']) && is_array(ipsRegistry::$request['search_app_filters']['forums']['forums']) && count(ipsRegistry::$request['search_app_filters']['forums']['forums'])) {
/* Load class_forums so that we can search sub forums automatically */
if (ipsRegistry::isClassLoaded('class_forums') !== TRUE) {
require_once IPSLib::getAppDir('forums') . '/sources/classes/forums/class_forums.php';
ipsRegistry::setClass('class_forums', new class_forums(ipsRegistry::instance()));
ipsRegistry::getClass('class_forums')->forumsInit();
}
$forum_ids = array();
/* Get a list of child ids */
foreach (ipsRegistry::$request['search_app_filters']['forums']['forums'] as $forum_id) {
if ($forum_id) {
$forum_ids[] = $forum_id;
//$children = ipsRegistry::getClass( 'class_forums' )->forumsGetChildren( $forum_id );
//foreach( $children as $kid )
//{
// if( ! in_array( $kid, ipsRegistry::$request['search_app_filters']['forums'] ) )
// {
// $forum_ids[] = $kid;
// }
//}
}
}
if (is_array($forum_ids) and count($forum_ids)) {
$query->SetFilter('forum_id', $forum_ids);
}
}
/* Limit by forum */
$type = ipsRegistry::$request['type'];
$type_id = intval(ipsRegistry::$request['type_id']);
if ($type && $type_id) {
$query->SetFilter('forum_id', array($type_id));
}
/* Limit by topic */
$type_2 = ipsRegistry::$request['type_2'];
$type_id_2 = intval(ipsRegistry::$request['type_id_2']);
if ($type_2 && $type_id_2) {
$query->SetFilter('tid', array($type_id_2));
}
} else {
return $query;
}
}
示例12: executePlugin
/**
* Execute the plugin and return the HTML to show on the page.
* Can be called from ACP or front end, so the plugin needs to setup any appropriate lang files, skin files, etc.
*
* @access public
* @param array Block data
* @return string Block HTML to display or cache
*/
public function executePlugin($block)
{
$data = array();
//-----------------------------------------
// Reset login form lang if needed
//-----------------------------------------
if (!$this->memberData['member_id']) {
$uses_name = $uses_email = false;
foreach ($this->cache->getCache('login_methods') as $method) {
if ($method['login_user_id'] == 'username') {
$uses_name = true;
}
if ($method['login_user_id'] == 'email') {
$uses_email = true;
}
}
if ($uses_name and $uses_email) {
$this->lang->words['enter_name'] = $this->lang->words['welcome_name_and_email'];
} else {
if ($uses_email) {
$this->lang->words['enter_name'] = $this->lang->words['welcome_useremail'];
}
}
} else {
$topics = $this->DB->buildAndFetch(array('select' => 'COUNT(*) as total', 'from' => 'topics', 'where' => 'starter_id=' . $this->memberData['member_id']));
$posts = $this->DB->buildAndFetch(array('select' => 'COUNT(*) as total', 'from' => 'posts', 'where' => 'author_id=' . $this->memberData['member_id']));
$newTopics = $this->DB->buildAndFetch(array('select' => 'COUNT(*) as total', 'from' => 'topics', 'where' => 'start_date > ' . $this->memberData['last_visit']));
$newPosts = $this->DB->buildAndFetch(array('select' => 'COUNT(*) as total', 'from' => 'posts', 'where' => 'post_date > ' . $this->memberData['last_visit']));
$newFriends = $this->DB->buildAndFetch(array('select' => 'COUNT(*) as total', 'from' => 'profile_friends', 'where' => 'friends_approved=0 AND friends_friend_id=' . $this->memberData['member_id']));
$newComments = $this->DB->buildAndFetch(array('select' => 'COUNT(*) as total', 'from' => 'profile_comments', 'where' => 'comment_approved=0 AND comment_for_member_id=' . $this->memberData['member_id']));
$board_posts = $this->caches['stats']['total_topics'] + $this->caches['stats']['total_replies'];
$_posts_day = 0;
if ($posts['total'] and $board_posts) {
$_posts_day = round($posts['total'] / ((time() - $this->memberData['joined']) / 86400), 2);
# Fix the issue when there is less than one day
$_posts_day = $_posts_day > $posts['total'] ? $posts['total'] : $_posts_day;
}
$_posts_day = floatval($_posts_day);
//-----------------------------------------
// Get the data not already available...
//-----------------------------------------
$data = array('topics' => $topics['total'], 'posts' => $posts['total'], 'avg_posts' => $_posts_day, 'new_topics' => $newTopics['total'], 'new_posts' => $newPosts['total'], 'new_friends' => $newFriends['total'], 'new_comments' => $newComments['total']);
}
$group_cache = $this->cache->getCache('group_cache');
$data['group'] = IPSLib::makeNameFormatted($group_cache[$this->memberData['member_group_id']]['g_title'], $this->memberData['member_group_id']);
//-----------------------------------------
// Reputation
//-----------------------------------------
if (!ipsRegistry::isClassLoaded('repCache')) {
require_once IPS_ROOT_PATH . 'sources/classes/class_reputation_cache.php';
ipsRegistry::setClass('repCache', new classReputationCache());
}
$this->memberData['pp_reputation_points'] = $this->memberData['pp_reputation_points'] ? $this->memberData['pp_reputation_points'] : 0;
$this->memberData['author_reputation'] = ipsRegistry::getClass('repCache')->getReputation($this->memberData['pp_reputation_points']);
$pluginConfig = $this->returnPluginInfo();
$templateBit = $pluginConfig['templateBit'] . '_' . $block['block_id'];
return $this->registry->output->getTemplate('ccs')->{$templateBit}($block['block_name'], $data);
}