XpressEngine Core  1.11.2
 All Classes Namespaces Files Functions Variables Pages
member_extra_info.lib.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 
7 function memberTransImageName($matches)
8 {
9  // If member_srl < 0, then return text only in the body
10  $member_srl = $matches[3];
11  if($member_srl < 0)
12  {
13  return $matches[5];
14  }
15  // If member_srl=o(not a member), return the entire body
16  if(!$member_srl)
17  {
18  return $matches[0];
19  }
20 
21  $oMemberModel = getModel('member');
22  $nick_name = $matches[5];
23 
24  // Initialize global variable for cache
25  if(!isset($GLOBALS['_transImageNameList'][$member_srl]))
26  {
27  $GLOBALS['_transImageNameList'][$member_srl] = new stdClass();
28  }
29  $_tmp = &$GLOBALS['_transImageNameList'][$member_srl];
30 
31  // If pre-defined data in the global variables, return it
32  if(!$_tmp->cached)
33  {
34  $_tmp->cached = true;
35  $image_name_file = sprintf('files/member_extra_info/image_name/%s%d.gif', getNumberingPath($member_srl), $member_srl);
36  $image_mark_file = sprintf('files/member_extra_info/image_mark/%s%d.gif', getNumberingPath($member_srl), $member_srl);
37 
38  if(file_exists(_XE_PATH_ . $image_name_file))
39  {
40  $_tmp->image_name_file = $image_name_file . '?' . date('YmdHis', filemtime(_XE_PATH_ . $image_name_file));
41  $image_name_file = $_tmp->image_name_file;
42  }
43  else
44  {
45  $image_name_file = '';
46  }
47 
48  if(file_exists(_XE_PATH_ . $image_mark_file))
49  {
50  $_tmp->image_mark_file = $image_mark_file . '?' . date('YmdHis', filemtime(_XE_PATH_ . $image_mark_file));
51  $image_mark_file = $_tmp->image_mark_file;
52  }
53  else
54  {
55  $image_mark_file = '';
56  }
57 
58  $site_module_info = Context::get('site_module_info');
59  $group_image = $oMemberModel->getGroupImageMark($member_srl, $site_module_info->site_srl);
60  $_tmp->group_image = $group_image;
61  }
62  else
63  {
64  $group_image = $_tmp->group_image;
65  $image_name_file = $_tmp->image_name_file;
66  $image_mark_file = $_tmp->image_mark_file;
67  }
68 
69  // If image name and mark doesn't exist, set the original information
70  if(!$image_name_file && !$image_mark_file && !$group_image)
71  {
72  return $matches[0];
73  }
74 
75  // check member_config
76 
77  $config = $oMemberModel->getMemberConfig();
78 
79  if($config->image_name == 'Y' && $image_name_file)
80  {
81  $nick_name = sprintf('<img src="%s%s" alt="id: %s" title="id: %s" style="border:0;vertical-align:middle;margin-right:3px" />', Context::getRequestUri(), $image_name_file, strip_tags($nick_name), strip_tags($nick_name));
82  }
83  if($config->image_mark == 'Y' && $image_mark_file)
84  {
85  $nick_name = sprintf('<img src="%s%s" alt="id: %s" title="id : %s" style="border:0;vertical-align:middle;margin-right:3px"/>%s', Context::getRequestUri(), $image_mark_file, strip_tags($nick_name), strip_tags($nick_name), $nick_name);
86  }
87 
88  if($group_image)
89  {
90  $nick_name = sprintf('<img src="%s" style="border:0;max-height:16px;vertical-align:middle;margin-right:3px" alt="%s" title="%s" />%s', $group_image->src, $group_image->title, $group_image->description, $nick_name);
91  }
92 
93  return preg_replace('/' . preg_quote($matches[5], '/') . '<\/' . $matches[6] . '>$/', '', $matches[0]) . $nick_name . '</' . $matches[6] . '>';
94 }
95 
96 /* End of file member_extra_info.lib.php */
97 /* Location: ./addons/member_extra_info/member_extra_info.lib.php */
getNumberingPath($no, $size=3)
Definition: func.inc.php:1081
if(file_exists(_XE_PATH_. 'config/config.user.inc.php')) if(!defined('__DEBUG__')) if(!defined('__DEBUG_OUTPUT__')) if(!defined('__DEBUG_PROTECT__')) if(!defined('__DEBUG_PROTECT_IP__')) if(!defined('__DEBUG_DB_OUTPUT__')) if(!defined('__LOG_SLOW_QUERY__')) if(!defined('__LOG_SLOW_TRIGGER__')) if(!defined('__LOG_SLOW_ADDON__')) if(!defined('__LOG_SLOW_WIDGET__')) if(!defined('__DEBUG_QUERY__')) if(!defined('__OB_GZHANDLER_ENABLE__')) if(!defined('__ENABLE_PHPUNIT_TEST__')) if(!defined('__PROXY_SERVER__')) if(!defined('__ERROR_LOG__')) if(!defined('__DISABLE_DEFAULT_CSS__')) if(!defined('__AUTO_OPCACHE_INVALIDATE__')) if((__DEBUG_OUTPUT__==2)&&version_compare(PHP_VERSION, '6.0.0')===-1) if(version_compare(PHP_VERSION, '5.3.0') >=0) $GLOBALS['__xe_autoload_file_map']
Definition: config.inc.php:324
const _XE_PATH_
Definition: config.inc.php:49
getRequestUri($ssl_mode=FOLLOW_REQUEST_SSL, $domain=null)
getModel($module_name)
Definition: func.inc.php:145
memberTransImageName($matches)
If member_srl exists in the div or span, replace to image name or nick image for each member_srl...